diff options
author | Andrei Otcheretianski <andrei.otcheretianski@intel.com> | 2014-05-09 07:11:45 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-05-15 08:54:32 -0400 |
commit | 387910cc79da2e529f2fb4ca9428e861b9402975 (patch) | |
tree | 430ff1ed030166453f5cf645bcfabd7c93e7b584 /net/mac80211 | |
parent | 34d22ce22b0b249804816990a3b62b08b1a62546 (diff) |
mac80211: Update CSA counters in mgmt frames
Track current csa counter value and use it
to update mgmt frames at the provided offsets.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/cfg.c | 17 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 1 | ||||
-rw-r--r-- | net/mac80211/tx.c | 5 |
3 files changed, 20 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 7c5644572253..8e4754ebc2d8 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -3338,6 +3338,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, | |||
3338 | sdata->csa_radar_required = params->radar_required; | 3338 | sdata->csa_radar_required = params->radar_required; |
3339 | sdata->csa_chandef = params->chandef; | 3339 | sdata->csa_chandef = params->chandef; |
3340 | sdata->csa_block_tx = params->block_tx; | 3340 | sdata->csa_block_tx = params->block_tx; |
3341 | sdata->csa_current_counter = params->count; | ||
3341 | sdata->vif.csa_active = true; | 3342 | sdata->vif.csa_active = true; |
3342 | 3343 | ||
3343 | if (sdata->csa_block_tx) | 3344 | if (sdata->csa_block_tx) |
@@ -3382,6 +3383,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
3382 | bool need_offchan = false; | 3383 | bool need_offchan = false; |
3383 | u32 flags; | 3384 | u32 flags; |
3384 | int ret; | 3385 | int ret; |
3386 | u8 *data; | ||
3385 | 3387 | ||
3386 | if (params->dont_wait_for_ack) | 3388 | if (params->dont_wait_for_ack) |
3387 | flags = IEEE80211_TX_CTL_NO_ACK; | 3389 | flags = IEEE80211_TX_CTL_NO_ACK; |
@@ -3475,7 +3477,20 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
3475 | } | 3477 | } |
3476 | skb_reserve(skb, local->hw.extra_tx_headroom); | 3478 | skb_reserve(skb, local->hw.extra_tx_headroom); |
3477 | 3479 | ||
3478 | memcpy(skb_put(skb, params->len), params->buf, params->len); | 3480 | data = skb_put(skb, params->len); |
3481 | memcpy(data, params->buf, params->len); | ||
3482 | |||
3483 | /* Update CSA counters */ | ||
3484 | if (sdata->vif.csa_active && | ||
3485 | (sdata->vif.type == NL80211_IFTYPE_AP || | ||
3486 | sdata->vif.type == NL80211_IFTYPE_ADHOC) && | ||
3487 | params->n_csa_offsets) { | ||
3488 | int i; | ||
3489 | |||
3490 | for (i = 0; i < params->n_csa_offsets; i++) | ||
3491 | data[params->csa_offsets[i]] = | ||
3492 | sdata->csa_current_counter; | ||
3493 | } | ||
3479 | 3494 | ||
3480 | IEEE80211_SKB_CB(skb)->flags = flags; | 3495 | IEEE80211_SKB_CB(skb)->flags = flags; |
3481 | 3496 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 4668ce9a1d3f..fb2d9e755158 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -766,6 +766,7 @@ struct ieee80211_sub_if_data { | |||
766 | struct ieee80211_chanctx *reserved_chanctx; | 766 | struct ieee80211_chanctx *reserved_chanctx; |
767 | struct cfg80211_chan_def reserved_chandef; | 767 | struct cfg80211_chan_def reserved_chandef; |
768 | bool reserved_radar_required; | 768 | bool reserved_radar_required; |
769 | u8 csa_current_counter; | ||
769 | 770 | ||
770 | /* used to reconfigure hardware SM PS */ | 771 | /* used to reconfigure hardware SM PS */ |
771 | struct work_struct recalc_smps; | 772 | struct work_struct recalc_smps; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 19d36d4117e0..263dea5a5cbb 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -2449,7 +2449,8 @@ static void ieee80211_update_csa(struct ieee80211_sub_if_data *sdata, | |||
2449 | if (WARN_ON(beacon_data[counter_offset_beacon] == 1)) | 2449 | if (WARN_ON(beacon_data[counter_offset_beacon] == 1)) |
2450 | return; | 2450 | return; |
2451 | 2451 | ||
2452 | beacon_data[counter_offset_beacon]--; | 2452 | sdata->csa_current_counter--; |
2453 | beacon_data[counter_offset_beacon] = sdata->csa_current_counter; | ||
2453 | 2454 | ||
2454 | if (sdata->vif.type == NL80211_IFTYPE_AP && counter_offset_presp) { | 2455 | if (sdata->vif.type == NL80211_IFTYPE_AP && counter_offset_presp) { |
2455 | rcu_read_lock(); | 2456 | rcu_read_lock(); |
@@ -2460,7 +2461,7 @@ static void ieee80211_update_csa(struct ieee80211_sub_if_data *sdata, | |||
2460 | rcu_read_unlock(); | 2461 | rcu_read_unlock(); |
2461 | return; | 2462 | return; |
2462 | } | 2463 | } |
2463 | resp->data[counter_offset_presp]--; | 2464 | resp->data[counter_offset_presp] = sdata->csa_current_counter; |
2464 | rcu_read_unlock(); | 2465 | rcu_read_unlock(); |
2465 | } | 2466 | } |
2466 | } | 2467 | } |