Skip to content

Commit 7eb2450

Browse files
committed
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
2 parents 474a41e + 73fb08e commit 7eb2450

27 files changed

Lines changed: 339 additions & 195 deletions

‎include/linux/ieee80211.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
154154
802.11e clarifies the figure in section 7.1.2. The frame body is
155155
up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
156156
#define IEEE80211_MAX_DATA_LEN 2304
157+
/* 802.11ad extends maximum MSDU size for DMG (freq > 40Ghz) networks
158+
* to 7920 bytes, see 8.2.3 General frame format
159+
*/
160+
#define IEEE80211_MAX_DATA_LEN_DMG 7920
157161
/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
158162
#define IEEE80211_MAX_FRAME_LEN 2352
159163

‎include/net/cfg80211.h‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ enum ieee80211_channel_flags {
151151
* @dfs_state: current state of this channel. Only relevant if radar is required
152152
* on this channel.
153153
* @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
154+
* @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
154155
*/
155156
struct ieee80211_channel {
156157
enum ieee80211_band band;
@@ -165,6 +166,7 @@ struct ieee80211_channel {
165166
int orig_mag, orig_mpwr;
166167
enum nl80211_dfs_state dfs_state;
167168
unsigned long dfs_state_entered;
169+
unsigned int dfs_cac_ms;
168170
};
169171

170172
/**
@@ -2503,7 +2505,8 @@ struct cfg80211_ops {
25032505

25042506
int (*start_radar_detection)(struct wiphy *wiphy,
25052507
struct net_device *dev,
2506-
struct cfg80211_chan_def *chandef);
2508+
struct cfg80211_chan_def *chandef,
2509+
u32 cac_time_ms);
25072510
int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
25082511
struct cfg80211_update_ft_ies_params *ftie);
25092512
int (*crit_proto_start)(struct wiphy *wiphy,
@@ -3180,6 +3183,7 @@ struct cfg80211_cached_keys;
31803183
* @p2p_started: true if this is a P2P Device that has been started
31813184
* @cac_started: true if DFS channel availability check has been started
31823185
* @cac_start_time: timestamp (jiffies) when the dfs state was entered.
3186+
* @cac_time_ms: CAC time in ms
31833187
* @ps: powersave mode is enabled
31843188
* @ps_timeout: dynamic powersave timeout
31853189
* @ap_unexpected_nlportid: (private) netlink port ID of application
@@ -3235,6 +3239,7 @@ struct wireless_dev {
32353239

32363240
bool cac_started;
32373241
unsigned long cac_start_time;
3242+
unsigned int cac_time_ms;
32383243

32393244
#ifdef CONFIG_CFG80211_WEXT
32403245
/* wext data */
@@ -3667,7 +3672,7 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
36673672
* cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
36683673
*
36693674
* @wiphy: the wiphy reporting the BSS
3670-
* @channel: The channel the frame was received on
3675+
* @rx_channel: The channel the frame was received on
36713676
* @scan_width: width of the control channel
36723677
* @mgmt: the management frame (probe response or beacon)
36733678
* @len: length of the management frame
@@ -3682,18 +3687,18 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
36823687
*/
36833688
struct cfg80211_bss * __must_check
36843689
cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
3685-
struct ieee80211_channel *channel,
3690+
struct ieee80211_channel *rx_channel,
36863691
enum nl80211_bss_scan_width scan_width,
36873692
struct ieee80211_mgmt *mgmt, size_t len,
36883693
s32 signal, gfp_t gfp);
36893694

36903695
static inline struct cfg80211_bss * __must_check
36913696
cfg80211_inform_bss_frame(struct wiphy *wiphy,
3692-
struct ieee80211_channel *channel,
3697+
struct ieee80211_channel *rx_channel,
36933698
struct ieee80211_mgmt *mgmt, size_t len,
36943699
s32 signal, gfp_t gfp)
36953700
{
3696-
return cfg80211_inform_bss_width_frame(wiphy, channel,
3701+
return cfg80211_inform_bss_width_frame(wiphy, rx_channel,
36973702
NL80211_BSS_CHAN_WIDTH_20,
36983703
mgmt, len, signal, gfp);
36993704
}
@@ -3702,7 +3707,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
37023707
* cfg80211_inform_bss - inform cfg80211 of a new BSS
37033708
*
37043709
* @wiphy: the wiphy reporting the BSS
3705-
* @channel: The channel the frame was received on
3710+
* @rx_channel: The channel the frame was received on
37063711
* @scan_width: width of the control channel
37073712
* @bssid: the BSSID of the BSS
37083713
* @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
@@ -3721,20 +3726,20 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
37213726
*/
37223727
struct cfg80211_bss * __must_check
37233728
cfg80211_inform_bss_width(struct wiphy *wiphy,
3724-
struct ieee80211_channel *channel,
3729+
struct ieee80211_channel *rx_channel,
37253730
enum nl80211_bss_scan_width scan_width,
37263731
const u8 *bssid, u64 tsf, u16 capability,
37273732
u16 beacon_interval, const u8 *ie, size_t ielen,
37283733
s32 signal, gfp_t gfp);
37293734

37303735
static inline struct cfg80211_bss * __must_check
37313736
cfg80211_inform_bss(struct wiphy *wiphy,
3732-
struct ieee80211_channel *channel,
3737+
struct ieee80211_channel *rx_channel,
37333738
const u8 *bssid, u64 tsf, u16 capability,
37343739
u16 beacon_interval, const u8 *ie, size_t ielen,
37353740
s32 signal, gfp_t gfp)
37363741
{
3737-
return cfg80211_inform_bss_width(wiphy, channel,
3742+
return cfg80211_inform_bss_width(wiphy, rx_channel,
37383743
NL80211_BSS_CHAN_WIDTH_20,
37393744
bssid, tsf, capability,
37403745
beacon_interval, ie, ielen, signal,

‎include/net/mac80211.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,11 +697,11 @@ struct ieee80211_tx_info {
697697
} control;
698698
struct {
699699
struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
700-
int ack_signal;
700+
s32 ack_signal;
701701
u8 ampdu_ack_len;
702702
u8 ampdu_len;
703703
u8 antenna;
704-
/* 21 bytes free */
704+
void *status_driver_data[21 / sizeof(void *)];
705705
} status;
706706
struct {
707707
struct ieee80211_tx_rate driver_rates[
@@ -877,11 +877,13 @@ enum mac80211_rx_flags {
877877
* @RX_VHT_FLAG_80MHZ: 80 MHz was used
878878
* @RX_VHT_FLAG_80P80MHZ: 80+80 MHz was used
879879
* @RX_VHT_FLAG_160MHZ: 160 MHz was used
880+
* @RX_VHT_FLAG_BF: packet was beamformed
880881
*/
881882
enum mac80211_rx_vht_flags {
882883
RX_VHT_FLAG_80MHZ = BIT(0),
883884
RX_VHT_FLAG_80P80MHZ = BIT(1),
884885
RX_VHT_FLAG_160MHZ = BIT(2),
886+
RX_VHT_FLAG_BF = BIT(3),
885887
};
886888

887889
/**

‎include/net/regulatory.h‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ struct ieee80211_reg_rule {
155155
struct ieee80211_freq_range freq_range;
156156
struct ieee80211_power_rule power_rule;
157157
u32 flags;
158+
u32 dfs_cac_ms;
158159
};
159160

160161
struct ieee80211_regdomain {
@@ -172,14 +173,18 @@ struct ieee80211_regdomain {
172173
#define DBM_TO_MBM(gain) ((gain) * 100)
173174
#define MBM_TO_DBM(gain) ((gain) / 100)
174175

175-
#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
176-
{ \
177-
.freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
178-
.freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
179-
.freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
180-
.power_rule.max_antenna_gain = DBI_TO_MBI(gain),\
181-
.power_rule.max_eirp = DBM_TO_MBM(eirp), \
182-
.flags = reg_flags, \
176+
#define REG_RULE_EXT(start, end, bw, gain, eirp, dfs_cac, reg_flags) \
177+
{ \
178+
.freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
179+
.freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
180+
.freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
181+
.power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
182+
.power_rule.max_eirp = DBM_TO_MBM(eirp), \
183+
.flags = reg_flags, \
184+
.dfs_cac_ms = dfs_cac, \
183185
}
184186

187+
#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
188+
REG_RULE_EXT(start, end, bw, gain, eirp, 0, reg_flags)
189+
185190
#endif

‎include/uapi/linux/nl80211.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,7 @@ enum nl80211_band_attr {
23352335
* @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel
23362336
* using this channel as the primary or any of the secondary channels
23372337
* isn't possible
2338+
* @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
23382339
* @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
23392340
* currently defined
23402341
* @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -2353,6 +2354,7 @@ enum nl80211_frequency_attr {
23532354
NL80211_FREQUENCY_ATTR_NO_HT40_PLUS,
23542355
NL80211_FREQUENCY_ATTR_NO_80MHZ,
23552356
NL80211_FREQUENCY_ATTR_NO_160MHZ,
2357+
NL80211_FREQUENCY_ATTR_DFS_CAC_TIME,
23562358

23572359
/* keep last */
23582360
__NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -2449,6 +2451,8 @@ enum nl80211_reg_type {
24492451
* If you don't have one then don't send this.
24502452
* @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for
24512453
* a given frequency range. The value is in mBm (100 * dBm).
2454+
* @NL80211_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
2455+
* If not present or 0 default CAC time will be used.
24522456
* @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number
24532457
* currently defined
24542458
* @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use
@@ -2464,6 +2468,8 @@ enum nl80211_reg_rule_attr {
24642468
NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN,
24652469
NL80211_ATTR_POWER_RULE_MAX_EIRP,
24662470

2471+
NL80211_ATTR_DFS_CAC_TIME,
2472+
24672473
/* keep last */
24682474
__NL80211_REG_RULE_ATTR_AFTER_LAST,
24692475
NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1

‎net/mac80211/cfg.c‎

Lines changed: 67 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,11 +2914,11 @@ static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
29142914

29152915
static int ieee80211_start_radar_detection(struct wiphy *wiphy,
29162916
struct net_device *dev,
2917-
struct cfg80211_chan_def *chandef)
2917+
struct cfg80211_chan_def *chandef,
2918+
u32 cac_time_ms)
29182919
{
29192920
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
29202921
struct ieee80211_local *local = sdata->local;
2921-
unsigned long timeout;
29222922
int err;
29232923

29242924
mutex_lock(&local->mtx);
@@ -2937,9 +2937,9 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
29372937
if (err)
29382938
goto out_unlock;
29392939

2940-
timeout = msecs_to_jiffies(IEEE80211_DFS_MIN_CAC_TIME_MS);
29412940
ieee80211_queue_delayed_work(&sdata->local->hw,
2942-
&sdata->dfs_cac_timer_work, timeout);
2941+
&sdata->dfs_cac_timer_work,
2942+
msecs_to_jiffies(cac_time_ms));
29432943

29442944
out_unlock:
29452945
mutex_unlock(&local->mtx);
@@ -3089,52 +3089,11 @@ void ieee80211_csa_finalize_work(struct work_struct *work)
30893089
sdata_unlock(sdata);
30903090
}
30913091

3092-
int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
3093-
struct cfg80211_csa_settings *params)
3092+
static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata,
3093+
struct cfg80211_csa_settings *params,
3094+
u32 *changed)
30943095
{
3095-
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
3096-
struct ieee80211_local *local = sdata->local;
3097-
struct ieee80211_chanctx_conf *chanctx_conf;
3098-
struct ieee80211_chanctx *chanctx;
3099-
struct ieee80211_if_mesh __maybe_unused *ifmsh;
3100-
int err, num_chanctx, changed = 0;
3101-
3102-
sdata_assert_lock(sdata);
3103-
3104-
if (!list_empty(&local->roc_list) || local->scanning)
3105-
return -EBUSY;
3106-
3107-
if (sdata->wdev.cac_started)
3108-
return -EBUSY;
3109-
3110-
if (cfg80211_chandef_identical(&params->chandef,
3111-
&sdata->vif.bss_conf.chandef))
3112-
return -EINVAL;
3113-
3114-
rcu_read_lock();
3115-
chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
3116-
if (!chanctx_conf) {
3117-
rcu_read_unlock();
3118-
return -EBUSY;
3119-
}
3120-
3121-
/* don't handle for multi-VIF cases */
3122-
chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, conf);
3123-
if (chanctx->refcount > 1) {
3124-
rcu_read_unlock();
3125-
return -EBUSY;
3126-
}
3127-
num_chanctx = 0;
3128-
list_for_each_entry_rcu(chanctx, &local->chanctx_list, list)
3129-
num_chanctx++;
3130-
rcu_read_unlock();
3131-
3132-
if (num_chanctx > 1)
3133-
return -EBUSY;
3134-
3135-
/* don't allow another channel switch if one is already active. */
3136-
if (sdata->vif.csa_active)
3137-
return -EBUSY;
3096+
int err;
31383097

31393098
switch (sdata->vif.type) {
31403099
case NL80211_IFTYPE_AP:
@@ -3170,7 +3129,7 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
31703129
kfree(sdata->u.ap.next_beacon);
31713130
return err;
31723131
}
3173-
changed |= err;
3132+
*changed |= err;
31743133

31753134
break;
31763135
case NL80211_IFTYPE_ADHOC:
@@ -3204,15 +3163,15 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
32043163
err = ieee80211_ibss_csa_beacon(sdata, params);
32053164
if (err < 0)
32063165
return err;
3207-
changed |= err;
3166+
*changed |= err;
32083167
}
32093168

32103169
ieee80211_send_action_csa(sdata, params);
32113170

32123171
break;
32133172
#ifdef CONFIG_MAC80211_MESH
3214-
case NL80211_IFTYPE_MESH_POINT:
3215-
ifmsh = &sdata->u.mesh;
3173+
case NL80211_IFTYPE_MESH_POINT: {
3174+
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
32163175

32173176
if (params->chandef.width != sdata->vif.bss_conf.chandef.width)
32183177
return -EINVAL;
@@ -3237,18 +3196,72 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
32373196
ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE;
32383197
return err;
32393198
}
3240-
changed |= err;
3199+
*changed |= err;
32413200
}
32423201

32433202
if (ifmsh->csa_role == IEEE80211_MESH_CSA_ROLE_INIT)
32443203
ieee80211_send_action_csa(sdata, params);
32453204

32463205
break;
3206+
}
32473207
#endif
32483208
default:
32493209
return -EOPNOTSUPP;
32503210
}
32513211

3212+
return 0;
3213+
}
3214+
3215+
int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
3216+
struct cfg80211_csa_settings *params)
3217+
{
3218+
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
3219+
struct ieee80211_local *local = sdata->local;
3220+
struct ieee80211_chanctx_conf *chanctx_conf;
3221+
struct ieee80211_chanctx *chanctx;
3222+
int err, num_chanctx, changed = 0;
3223+
3224+
sdata_assert_lock(sdata);
3225+
3226+
if (!list_empty(&local->roc_list) || local->scanning)
3227+
return -EBUSY;
3228+
3229+
if (sdata->wdev.cac_started)
3230+
return -EBUSY;
3231+
3232+
if (cfg80211_chandef_identical(&params->chandef,
3233+
&sdata->vif.bss_conf.chandef))
3234+
return -EINVAL;
3235+
3236+
rcu_read_lock();
3237+
chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
3238+
if (!chanctx_conf) {
3239+
rcu_read_unlock();
3240+
return -EBUSY;
3241+
}
3242+
3243+
/* don't handle for multi-VIF cases */
3244+
chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, conf);
3245+
if (chanctx->refcount > 1) {
3246+
rcu_read_unlock();
3247+
return -EBUSY;
3248+
}
3249+
num_chanctx = 0;
3250+
list_for_each_entry_rcu(chanctx, &local->chanctx_list, list)
3251+
num_chanctx++;
3252+
rcu_read_unlock();
3253+
3254+
if (num_chanctx > 1)
3255+
return -EBUSY;
3256+
3257+
/* don't allow another channel switch if one is already active. */
3258+
if (sdata->vif.csa_active)
3259+
return -EBUSY;
3260+
3261+
err = ieee80211_set_csa_beacon(sdata, params, &changed);
3262+
if (err)
3263+
return err;
3264+
32523265
sdata->csa_radar_required = params->radar_required;
32533266

32543267
if (params->block_tx)

0 commit comments

Comments
 (0)