Skip to content

Commit d6cf3a8

Browse files
committed
Merge tag 'mac80211-next-for-davem-2016-06-09' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
Johannes Berg says: ==================== For the next cycle, we have the following: * the biggest change is Michał's work on integrating FQ/codel with the mac80211 internal software queues * cfg80211 connect result gets clarified for the "no connection at all" case * advertisement of per-interface type capabilities, in case they differ (which makes a lot of sense for some capabilities) * most of the nl80211 & hwsim unprivileged namespace operation changes * human-readable VHT capabilities in debugfs * some other cleanups, like spelling ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 52a3d79 + 5caa328 commit d6cf3a8

File tree

21 files changed

+955
-263
lines changed

21 files changed

+955
-263
lines changed

Documentation/DocBook/80211.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
!Finclude/net/cfg80211.h cfg80211_ibss_joined
137137
!Finclude/net/cfg80211.h cfg80211_connect_result
138138
!Finclude/net/cfg80211.h cfg80211_connect_bss
139+
!Finclude/net/cfg80211.h cfg80211_connect_timeout
139140
!Finclude/net/cfg80211.h cfg80211_roamed
140141
!Finclude/net/cfg80211.h cfg80211_disconnected
141142
!Finclude/net/cfg80211.h cfg80211_ready_on_channel

drivers/net/wireless/mac80211_hwsim.c

Lines changed: 94 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include <linux/module.h>
3131
#include <linux/ktime.h>
3232
#include <net/genetlink.h>
33+
#include <net/net_namespace.h>
34+
#include <net/netns/generic.h>
3335
#include "mac80211_hwsim.h"
3436

3537
#define WARN_QUEUE 100
@@ -250,6 +252,28 @@ static inline void hwsim_clear_chanctx_magic(struct ieee80211_chanctx_conf *c)
250252
cp->magic = 0;
251253
}
252254

255+
static unsigned int hwsim_net_id;
256+
257+
static int hwsim_netgroup;
258+
259+
struct hwsim_net {
260+
int netgroup;
261+
};
262+
263+
static inline int hwsim_net_get_netgroup(struct net *net)
264+
{
265+
struct hwsim_net *hwsim_net = net_generic(net, hwsim_net_id);
266+
267+
return hwsim_net->netgroup;
268+
}
269+
270+
static inline void hwsim_net_set_netgroup(struct net *net)
271+
{
272+
struct hwsim_net *hwsim_net = net_generic(net, hwsim_net_id);
273+
274+
hwsim_net->netgroup = hwsim_netgroup++;
275+
}
276+
253277
static struct class *hwsim_class;
254278

255279
static struct net_device *hwsim_mon; /* global monitor netdev */
@@ -526,6 +550,9 @@ struct mac80211_hwsim_data {
526550
*/
527551
u64 group;
528552

553+
/* group shared by radios created in the same netns */
554+
int netgroup;
555+
529556
int power_level;
530557

531558
/* difference between this hw's clock and the real clock, in usecs */
@@ -568,6 +595,7 @@ static struct genl_family hwsim_genl_family = {
568595
.name = "MAC80211_HWSIM",
569596
.version = 1,
570597
.maxattr = HWSIM_ATTR_MAX,
598+
.netnsok = true,
571599
};
572600

573601
enum hwsim_multicast_groups {
@@ -1202,6 +1230,9 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
12021230
if (!(data->group & data2->group))
12031231
continue;
12041232

1233+
if (data->netgroup != data2->netgroup)
1234+
continue;
1235+
12051236
if (!hwsim_chans_compat(chan, data2->tmp_chan) &&
12061237
!hwsim_chans_compat(chan, data2->channel)) {
12071238
ieee80211_iterate_active_interfaces_atomic(
@@ -2349,6 +2380,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
23492380
struct ieee80211_hw *hw;
23502381
enum nl80211_band band;
23512382
const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
2383+
struct net *net;
23522384
int idx;
23532385

23542386
if (WARN_ON(param->channels > 1 && !param->use_chanctx))
@@ -2366,6 +2398,13 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
23662398
err = -ENOMEM;
23672399
goto failed;
23682400
}
2401+
2402+
if (info)
2403+
net = genl_info_net(info);
2404+
else
2405+
net = &init_net;
2406+
wiphy_net_set(hw->wiphy, net);
2407+
23692408
data = hw->priv;
23702409
data->hw = hw;
23712410

@@ -2541,6 +2580,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
25412580
data->group = 1;
25422581
mutex_init(&data->mutex);
25432582

2583+
data->netgroup = hwsim_net_get_netgroup(net);
2584+
25442585
/* Enable frame retransmissions for lossy channels */
25452586
hw->max_rates = 4;
25462587
hw->max_rate_tries = 11;
@@ -3014,6 +3055,9 @@ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
30143055
continue;
30153056
}
30163057

3058+
if (!net_eq(wiphy_net(data->hw->wiphy), genl_info_net(info)))
3059+
continue;
3060+
30173061
list_del(&data->list);
30183062
spin_unlock_bh(&hwsim_radio_lock);
30193063
mac80211_hwsim_del_radio(data, wiphy_name(data->hw->wiphy),
@@ -3040,6 +3084,9 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info)
30403084
if (data->idx != idx)
30413085
continue;
30423086

3087+
if (!net_eq(wiphy_net(data->hw->wiphy), genl_info_net(info)))
3088+
continue;
3089+
30433090
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
30443091
if (!skb) {
30453092
res = -ENOMEM;
@@ -3079,6 +3126,9 @@ static int hwsim_dump_radio_nl(struct sk_buff *skb,
30793126
if (data->idx < idx)
30803127
continue;
30813128

3129+
if (!net_eq(wiphy_net(data->hw->wiphy), sock_net(skb->sk)))
3130+
continue;
3131+
30823132
res = mac80211_hwsim_get_radio(skb, data,
30833133
NETLINK_CB(cb->skb).portid,
30843134
cb->nlh->nlmsg_seq, cb,
@@ -3118,13 +3168,13 @@ static const struct genl_ops hwsim_ops[] = {
31183168
.cmd = HWSIM_CMD_NEW_RADIO,
31193169
.policy = hwsim_genl_policy,
31203170
.doit = hwsim_new_radio_nl,
3121-
.flags = GENL_ADMIN_PERM,
3171+
.flags = GENL_UNS_ADMIN_PERM,
31223172
},
31233173
{
31243174
.cmd = HWSIM_CMD_DEL_RADIO,
31253175
.policy = hwsim_genl_policy,
31263176
.doit = hwsim_del_radio_nl,
3127-
.flags = GENL_ADMIN_PERM,
3177+
.flags = GENL_UNS_ADMIN_PERM,
31283178
},
31293179
{
31303180
.cmd = HWSIM_CMD_GET_RADIO,
@@ -3206,6 +3256,40 @@ static int hwsim_init_netlink(void)
32063256
return -EINVAL;
32073257
}
32083258

3259+
static __net_init int hwsim_init_net(struct net *net)
3260+
{
3261+
hwsim_net_set_netgroup(net);
3262+
3263+
return 0;
3264+
}
3265+
3266+
static void __net_exit hwsim_exit_net(struct net *net)
3267+
{
3268+
struct mac80211_hwsim_data *data, *tmp;
3269+
3270+
spin_lock_bh(&hwsim_radio_lock);
3271+
list_for_each_entry_safe(data, tmp, &hwsim_radios, list) {
3272+
if (!net_eq(wiphy_net(data->hw->wiphy), net))
3273+
continue;
3274+
3275+
/* Radios created in init_net are returned to init_net. */
3276+
if (data->netgroup == hwsim_net_get_netgroup(&init_net))
3277+
continue;
3278+
3279+
list_del(&data->list);
3280+
INIT_WORK(&data->destroy_work, destroy_radio);
3281+
schedule_work(&data->destroy_work);
3282+
}
3283+
spin_unlock_bh(&hwsim_radio_lock);
3284+
}
3285+
3286+
static struct pernet_operations hwsim_net_ops = {
3287+
.init = hwsim_init_net,
3288+
.exit = hwsim_exit_net,
3289+
.id = &hwsim_net_id,
3290+
.size = sizeof(struct hwsim_net),
3291+
};
3292+
32093293
static void hwsim_exit_netlink(void)
32103294
{
32113295
/* unregister the notifier */
@@ -3242,10 +3326,14 @@ static int __init init_mac80211_hwsim(void)
32423326
spin_lock_init(&hwsim_radio_lock);
32433327
INIT_LIST_HEAD(&hwsim_radios);
32443328

3245-
err = platform_driver_register(&mac80211_hwsim_driver);
3329+
err = register_pernet_device(&hwsim_net_ops);
32463330
if (err)
32473331
return err;
32483332

3333+
err = platform_driver_register(&mac80211_hwsim_driver);
3334+
if (err)
3335+
goto out_unregister_pernet;
3336+
32493337
hwsim_class = class_create(THIS_MODULE, "mac80211_hwsim");
32503338
if (IS_ERR(hwsim_class)) {
32513339
err = PTR_ERR(hwsim_class);
@@ -3363,6 +3451,8 @@ static int __init init_mac80211_hwsim(void)
33633451
mac80211_hwsim_free();
33643452
out_unregister_driver:
33653453
platform_driver_unregister(&mac80211_hwsim_driver);
3454+
out_unregister_pernet:
3455+
unregister_pernet_device(&hwsim_net_ops);
33663456
return err;
33673457
}
33683458
module_init(init_mac80211_hwsim);
@@ -3376,5 +3466,6 @@ static void __exit exit_mac80211_hwsim(void)
33763466
mac80211_hwsim_free();
33773467
unregister_netdev(hwsim_mon);
33783468
platform_driver_unregister(&mac80211_hwsim_driver);
3469+
unregister_pernet_device(&hwsim_net_ops);
33793470
}
33803471
module_exit(exit_mac80211_hwsim);

include/net/cfg80211.h

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,19 +2367,23 @@ struct cfg80211_qos_map {
23672367
* (invoked with the wireless_dev mutex held)
23682368
*
23692369
* @connect: Connect to the ESS with the specified parameters. When connected,
2370-
* call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
2371-
* If the connection fails for some reason, call cfg80211_connect_result()
2372-
* with the status from the AP. The driver is allowed to roam to other
2373-
* BSSes within the ESS when the other BSS matches the connect parameters.
2374-
* When such roaming is initiated by the driver, the driver is expected to
2375-
* verify that the target matches the configured security parameters and
2376-
* to use Reassociation Request frame instead of Association Request frame.
2377-
* The connect function can also be used to request the driver to perform
2378-
* a specific roam when connected to an ESS. In that case, the prev_bssid
2370+
* call cfg80211_connect_result()/cfg80211_connect_bss() with status code
2371+
* %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
2372+
* cfg80211_connect_result()/cfg80211_connect_bss() with the status code
2373+
* from the AP or cfg80211_connect_timeout() if no frame with status code
2374+
* was received.
2375+
* The driver is allowed to roam to other BSSes within the ESS when the
2376+
* other BSS matches the connect parameters. When such roaming is initiated
2377+
* by the driver, the driver is expected to verify that the target matches
2378+
* the configured security parameters and to use Reassociation Request
2379+
* frame instead of Association Request frame.
2380+
* The connect function can also be used to request the driver to perform a
2381+
* specific roam when connected to an ESS. In that case, the prev_bssid
23792382
* parameter is set to the BSSID of the currently associated BSS as an
2380-
* indication of requesting reassociation. In both the driver-initiated and
2381-
* new connect() call initiated roaming cases, the result of roaming is
2382-
* indicated with a call to cfg80211_roamed() or cfg80211_roamed_bss().
2383+
* indication of requesting reassociation.
2384+
* In both the driver-initiated and new connect() call initiated roaming
2385+
* cases, the result of roaming is indicated with a call to
2386+
* cfg80211_roamed() or cfg80211_roamed_bss().
23832387
* (invoked with the wireless_dev mutex held)
23842388
* @disconnect: Disconnect from the BSS/ESS.
23852389
* (invoked with the wireless_dev mutex held)
@@ -3079,6 +3083,24 @@ struct wiphy_vendor_command {
30793083
unsigned long *storage);
30803084
};
30813085

3086+
/**
3087+
* struct wiphy_iftype_ext_capab - extended capabilities per interface type
3088+
* @iftype: interface type
3089+
* @extended_capabilities: extended capabilities supported by the driver,
3090+
* additional capabilities might be supported by userspace; these are the
3091+
* 802.11 extended capabilities ("Extended Capabilities element") and are
3092+
* in the same format as in the information element. See IEEE Std
3093+
* 802.11-2012 8.4.2.29 for the defined fields.
3094+
* @extended_capabilities_mask: mask of the valid values
3095+
* @extended_capabilities_len: length of the extended capabilities
3096+
*/
3097+
struct wiphy_iftype_ext_capab {
3098+
enum nl80211_iftype iftype;
3099+
const u8 *extended_capabilities;
3100+
const u8 *extended_capabilities_mask;
3101+
u8 extended_capabilities_len;
3102+
};
3103+
30823104
/**
30833105
* struct wiphy - wireless hardware description
30843106
* @reg_notifier: the driver's regulatory notification callback,
@@ -3199,9 +3221,14 @@ struct wiphy_vendor_command {
31993221
* additional capabilities might be supported by userspace; these are
32003222
* the 802.11 extended capabilities ("Extended Capabilities element")
32013223
* and are in the same format as in the information element. See
3202-
* 802.11-2012 8.4.2.29 for the defined fields.
3224+
* 802.11-2012 8.4.2.29 for the defined fields. These are the default
3225+
* extended capabilities to be used if the capabilities are not specified
3226+
* for a specific interface type in iftype_ext_capab.
32033227
* @extended_capabilities_mask: mask of the valid values
32043228
* @extended_capabilities_len: length of the extended capabilities
3229+
* @iftype_ext_capab: array of extended capabilities per interface type
3230+
* @num_iftype_ext_capab: number of interface types for which extended
3231+
* capabilities are specified separately.
32053232
* @coalesce: packet coalescing support information
32063233
*
32073234
* @vendor_commands: array of vendor commands supported by the hardware
@@ -3301,6 +3328,9 @@ struct wiphy {
33013328
const u8 *extended_capabilities, *extended_capabilities_mask;
33023329
u8 extended_capabilities_len;
33033330

3331+
const struct wiphy_iftype_ext_capab *iftype_ext_capab;
3332+
unsigned int num_iftype_ext_capab;
3333+
33043334
/* If multiple wiphys are registered and you're handed e.g.
33053335
* a regular netdev with assigned ieee80211_ptr, you won't
33063336
* know whether it points to a wiphy your driver has registered
@@ -4680,7 +4710,7 @@ static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
46804710
void cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
46814711
struct cfg80211_bss *bss, const u8 *req_ie,
46824712
size_t req_ie_len, const u8 *resp_ie,
4683-
size_t resp_ie_len, u16 status, gfp_t gfp);
4713+
size_t resp_ie_len, int status, gfp_t gfp);
46844714

46854715
/**
46864716
* cfg80211_connect_result - notify cfg80211 of connection result
@@ -4709,6 +4739,29 @@ cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
47094739
resp_ie_len, status, gfp);
47104740
}
47114741

4742+
/**
4743+
* cfg80211_connect_timeout - notify cfg80211 of connection timeout
4744+
*
4745+
* @dev: network device
4746+
* @bssid: the BSSID of the AP
4747+
* @req_ie: association request IEs (maybe be %NULL)
4748+
* @req_ie_len: association request IEs length
4749+
* @gfp: allocation flags
4750+
*
4751+
* It should be called by the underlying driver whenever connect() has failed
4752+
* in a sequence where no explicit authentication/association rejection was
4753+
* received from the AP. This could happen, e.g., due to not being able to send
4754+
* out the Authentication or Association Request frame or timing out while
4755+
* waiting for the response.
4756+
*/
4757+
static inline void
4758+
cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
4759+
const u8 *req_ie, size_t req_ie_len, gfp_t gfp)
4760+
{
4761+
cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
4762+
gfp);
4763+
}
4764+
47124765
/**
47134766
* cfg80211_roamed - notify cfg80211 of roaming
47144767
*

include/net/mac80211.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/skbuff.h>
2222
#include <linux/ieee80211.h>
2323
#include <net/cfg80211.h>
24+
#include <net/codel.h>
2425
#include <asm/unaligned.h>
2526

2627
/**
@@ -895,7 +896,18 @@ struct ieee80211_tx_info {
895896
unsigned long jiffies;
896897
};
897898
/* NB: vif can be NULL for injected frames */
898-
struct ieee80211_vif *vif;
899+
union {
900+
/* NB: vif can be NULL for injected frames */
901+
struct ieee80211_vif *vif;
902+
903+
/* When packets are enqueued on txq it's easy
904+
* to re-construct the vif pointer. There's no
905+
* more space in tx_info so it can be used to
906+
* store the necessary enqueue time for packet
907+
* sojourn time computation.
908+
*/
909+
codel_time_t enqueue_time;
910+
};
899911
struct ieee80211_key_conf *hw_key;
900912
u32 flags;
901913
/* 4 bytes free */
@@ -2147,9 +2159,6 @@ enum ieee80211_hw_flags {
21472159
* @n_cipher_schemes: a size of an array of cipher schemes definitions.
21482160
* @cipher_schemes: a pointer to an array of cipher scheme definitions
21492161
* supported by HW.
2150-
*
2151-
* @txq_ac_max_pending: maximum number of frames per AC pending in all txq
2152-
* entries for a vif.
21532162
*/
21542163
struct ieee80211_hw {
21552164
struct ieee80211_conf conf;
@@ -2180,7 +2189,6 @@ struct ieee80211_hw {
21802189
u8 uapsd_max_sp_len;
21812190
u8 n_cipher_schemes;
21822191
const struct ieee80211_cipher_scheme *cipher_schemes;
2183-
int txq_ac_max_pending;
21842192
};
21852193

21862194
static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,

0 commit comments

Comments
 (0)