Skip to content

Commit 60772e4

Browse files
committed
Merge tag 'mac80211-next-for-davem-2018-02-22' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
Johannes Berg says: ==================== Various updates across wireless. One thing to note: I've included a new ethertype that wireless uses (ETH_P_PREAUTH) in if_ether.h. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 82e3be3 + 94ba927 commit 60772e4

File tree

25 files changed

+584
-87
lines changed

25 files changed

+584
-87
lines changed

drivers/net/wireless/ath/wil6210/cfg80211.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,8 @@ static void wil_probe_client_handle(struct wil6210_priv *wil,
15991599
*/
16001600
bool alive = (sta->status == wil_sta_connected);
16011601

1602-
cfg80211_probe_status(ndev, sta->addr, req->cookie, alive, GFP_KERNEL);
1602+
cfg80211_probe_status(ndev, sta->addr, req->cookie, alive,
1603+
0, false, GFP_KERNEL);
16031604
}
16041605

16051606
static struct list_head *next_probe_client(struct wil6210_priv *wil)

drivers/net/wireless/mac80211_hwsim.c

Lines changed: 63 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ static LIST_HEAD(hwsim_radios);
493493
static struct workqueue_struct *hwsim_wq;
494494
static struct rhashtable hwsim_radios_rht;
495495
static int hwsim_radio_idx;
496+
static int hwsim_radios_generation = 1;
496497

497498
static struct platform_driver mac80211_hwsim_driver = {
498499
.driver = {
@@ -637,6 +638,7 @@ static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = {
637638
[HWSIM_ATTR_RADIO_NAME] = { .type = NLA_STRING },
638639
[HWSIM_ATTR_NO_VIF] = { .type = NLA_FLAG },
639640
[HWSIM_ATTR_FREQ] = { .type = NLA_U32 },
641+
[HWSIM_ATTR_PERM_ADDR] = { .type = NLA_UNSPEC, .len = ETH_ALEN },
640642
};
641643

642644
static void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
@@ -2408,6 +2410,7 @@ struct hwsim_new_radio_params {
24082410
bool destroy_on_close;
24092411
const char *hwname;
24102412
bool no_vif;
2413+
const u8 *perm_addr;
24112414
};
24122415

24132416
static void hwsim_mcast_config_msg(struct sk_buff *mcast_skb,
@@ -2572,15 +2575,25 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
25722575
skb_queue_head_init(&data->pending);
25732576

25742577
SET_IEEE80211_DEV(hw, data->dev);
2575-
eth_zero_addr(addr);
2576-
addr[0] = 0x02;
2577-
addr[3] = idx >> 8;
2578-
addr[4] = idx;
2579-
memcpy(data->addresses[0].addr, addr, ETH_ALEN);
2580-
memcpy(data->addresses[1].addr, addr, ETH_ALEN);
2581-
data->addresses[1].addr[0] |= 0x40;
2582-
hw->wiphy->n_addresses = 2;
2583-
hw->wiphy->addresses = data->addresses;
2578+
if (!param->perm_addr) {
2579+
eth_zero_addr(addr);
2580+
addr[0] = 0x02;
2581+
addr[3] = idx >> 8;
2582+
addr[4] = idx;
2583+
memcpy(data->addresses[0].addr, addr, ETH_ALEN);
2584+
/* Why need here second address ? */
2585+
data->addresses[1].addr[0] |= 0x40;
2586+
memcpy(data->addresses[1].addr, addr, ETH_ALEN);
2587+
hw->wiphy->n_addresses = 2;
2588+
hw->wiphy->addresses = data->addresses;
2589+
/* possible address clash is checked at hash table insertion */
2590+
} else {
2591+
memcpy(data->addresses[0].addr, param->perm_addr, ETH_ALEN);
2592+
/* compatibility with automatically generated mac addr */
2593+
memcpy(data->addresses[1].addr, param->perm_addr, ETH_ALEN);
2594+
hw->wiphy->n_addresses = 2;
2595+
hw->wiphy->addresses = data->addresses;
2596+
}
25842597

25852598
data->channels = param->channels;
25862599
data->use_chanctx = param->use_chanctx;
@@ -2785,13 +2798,17 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
27852798
err = rhashtable_insert_fast(&hwsim_radios_rht, &data->rht,
27862799
hwsim_rht_params);
27872800
if (err < 0) {
2788-
pr_debug("mac80211_hwsim: radio index %d already present\n",
2789-
idx);
2801+
if (info) {
2802+
GENL_SET_ERR_MSG(info, "perm addr already present");
2803+
NL_SET_BAD_ATTR(info->extack,
2804+
info->attrs[HWSIM_ATTR_PERM_ADDR]);
2805+
}
27902806
spin_unlock_bh(&hwsim_radio_lock);
27912807
goto failed_final_insert;
27922808
}
27932809

27942810
list_add_tail(&data->list, &hwsim_radios);
2811+
hwsim_radios_generation++;
27952812
spin_unlock_bh(&hwsim_radio_lock);
27962813

27972814
if (idx > 0)
@@ -3210,6 +3227,19 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
32103227
param.regd = hwsim_world_regdom_custom[idx];
32113228
}
32123229

3230+
if (info->attrs[HWSIM_ATTR_PERM_ADDR]) {
3231+
if (!is_valid_ether_addr(
3232+
nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
3233+
GENL_SET_ERR_MSG(info,"MAC is no valid source addr");
3234+
NL_SET_BAD_ATTR(info->extack,
3235+
info->attrs[HWSIM_ATTR_PERM_ADDR]);
3236+
return -EINVAL;
3237+
}
3238+
3239+
3240+
param.perm_addr = nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]);
3241+
}
3242+
32133243
ret = mac80211_hwsim_new_radio(info, &param);
32143244
kfree(hwname);
32153245
return ret;
@@ -3249,6 +3279,7 @@ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
32493279
list_del(&data->list);
32503280
rhashtable_remove_fast(&hwsim_radios_rht, &data->rht,
32513281
hwsim_rht_params);
3282+
hwsim_radios_generation++;
32523283
spin_unlock_bh(&hwsim_radio_lock);
32533284
mac80211_hwsim_del_radio(data, wiphy_name(data->hw->wiphy),
32543285
info);
@@ -3305,17 +3336,19 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info)
33053336
static int hwsim_dump_radio_nl(struct sk_buff *skb,
33063337
struct netlink_callback *cb)
33073338
{
3308-
int idx = cb->args[0];
3339+
int last_idx = cb->args[0];
33093340
struct mac80211_hwsim_data *data = NULL;
3310-
int res;
3341+
int res = 0;
3342+
void *hdr;
33113343

33123344
spin_lock_bh(&hwsim_radio_lock);
3345+
cb->seq = hwsim_radios_generation;
33133346

3314-
if (idx == hwsim_radio_idx)
3347+
if (last_idx >= hwsim_radio_idx-1)
33153348
goto done;
33163349

33173350
list_for_each_entry(data, &hwsim_radios, list) {
3318-
if (data->idx < idx)
3351+
if (data->idx <= last_idx)
33193352
continue;
33203353

33213354
if (!net_eq(wiphy_net(data->hw->wiphy), sock_net(skb->sk)))
@@ -3328,14 +3361,25 @@ static int hwsim_dump_radio_nl(struct sk_buff *skb,
33283361
if (res < 0)
33293362
break;
33303363

3331-
idx = data->idx + 1;
3364+
last_idx = data->idx;
33323365
}
33333366

3334-
cb->args[0] = idx;
3367+
cb->args[0] = last_idx;
3368+
3369+
/* list changed, but no new element sent, set interrupted flag */
3370+
if (skb->len == 0 && cb->prev_seq && cb->seq != cb->prev_seq) {
3371+
hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid,
3372+
cb->nlh->nlmsg_seq, &hwsim_genl_family,
3373+
NLM_F_MULTI, HWSIM_CMD_GET_RADIO);
3374+
if (!hdr)
3375+
res = -EMSGSIZE;
3376+
genl_dump_check_consistent(cb, hdr);
3377+
genlmsg_end(skb, hdr);
3378+
}
33353379

33363380
done:
33373381
spin_unlock_bh(&hwsim_radio_lock);
3338-
return skb->len;
3382+
return res ?: skb->len;
33393383
}
33403384

33413385
/* Generic Netlink operations array */
@@ -3393,6 +3437,7 @@ static void destroy_radio(struct work_struct *work)
33933437
struct mac80211_hwsim_data *data =
33943438
container_of(work, struct mac80211_hwsim_data, destroy_work);
33953439

3440+
hwsim_radios_generation++;
33963441
mac80211_hwsim_del_radio(data, wiphy_name(data->hw->wiphy), NULL);
33973442
}
33983443

drivers/net/wireless/mac80211_hwsim.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ enum hwsim_tx_control_flags {
6868
* %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
6969
* @HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters,
7070
* returns the radio ID (>= 0) or negative on errors, if successful
71-
* then multicast the result
71+
* then multicast the result, uses optional parameter:
72+
* %HWSIM_ATTR_REG_STRICT_REG, %HWSIM_ATTR_SUPPORT_P2P_DEVICE,
73+
* %HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE, %HWSIM_ATTR_CHANNELS,
74+
* %HWSIM_ATTR_NO_VIF, %HWSIM_ATTR_RADIO_NAME, %HWSIM_ATTR_USE_CHANCTX,
75+
* %HWSIM_ATTR_REG_HINT_ALPHA2, %HWSIM_ATTR_REG_CUSTOM_REG,
76+
* %HWSIM_ATTR_PERM_ADDR
7277
* @HWSIM_CMD_DEL_RADIO: destroy a radio, reply is multicasted
7378
* @HWSIM_CMD_GET_RADIO: fetch information about existing radios, uses:
7479
* %HWSIM_ATTR_RADIO_ID
@@ -126,6 +131,7 @@ enum {
126131
* @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
127132
* @HWSIM_ATTR_TX_INFO_FLAGS: additional flags for corresponding
128133
* rates of %HWSIM_ATTR_TX_INFO
134+
* @HWSIM_ATTR_PERM_ADDR: permanent mac address of new radio
129135
* @__HWSIM_ATTR_MAX: enum limit
130136
*/
131137

@@ -153,6 +159,7 @@ enum {
153159
HWSIM_ATTR_FREQ,
154160
HWSIM_ATTR_PAD,
155161
HWSIM_ATTR_TX_INFO_FLAGS,
162+
HWSIM_ATTR_PERM_ADDR,
156163
__HWSIM_ATTR_MAX,
157164
};
158165
#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)

include/linux/ieee80211.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Copyright (c) 2006, Michael Wu <[email protected]>
99
* Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
1010
* Copyright (c) 2016 - 2017 Intel Deutschland GmbH
11+
* Copyright (c) 2018 Intel Corporation
1112
*
1213
* This program is free software; you can redistribute it and/or modify
1314
* it under the terms of the GNU General Public License version 2 as
@@ -2111,7 +2112,7 @@ enum ieee80211_key_len {
21112112
#define FILS_ERP_MAX_REALM_LEN 253
21122113
#define FILS_ERP_MAX_RRK_LEN 64
21132114

2114-
#define PMK_MAX_LEN 48
2115+
#define PMK_MAX_LEN 64
21152116

21162117
/* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */
21172118
enum ieee80211_pub_actioncode {
@@ -2501,6 +2502,17 @@ static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
25012502
return (u8 *)hdr + 24;
25022503
}
25032504

2505+
/**
2506+
* ieee80211_get_tid - get qos TID
2507+
* @hdr: the frame
2508+
*/
2509+
static inline u8 ieee80211_get_tid(struct ieee80211_hdr *hdr)
2510+
{
2511+
u8 *qc = ieee80211_get_qos_ctl(hdr);
2512+
2513+
return qc[0] & IEEE80211_QOS_CTL_TID_MASK;
2514+
}
2515+
25042516
/**
25052517
* ieee80211_get_SA - get pointer to SA
25062518
* @hdr: the frame

0 commit comments

Comments
 (0)