Skip to content

Commit aad14ce

Browse files
Rajkumar Manoharanlinvjw
authored andcommitted
mac80211: Send the management frame at requested rate
Whenever the scan request or tx_mgmt is requesting not to use CCK rate for managemet frames through NL80211_ATTR_TX_NO_CCK_RATE attribute, then mac80211 should select appropriate least non-CCK rate. This could help to send P2P probes and P2P action frames at non 11b rates without diabling 11b rates globally. Cc: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent e9f935e commit aad14ce

8 files changed

Lines changed: 46 additions & 7 deletions

File tree

‎include/net/mac80211.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ struct ieee80211_bss_conf {
363363
* @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP
364364
* testing. It will be sent out with incorrect Michael MIC key to allow
365365
* TKIP countermeasures to be tested.
366+
* @IEEE80211_TX_CTL_NO_CCK_RATE: This frame will be sent at non CCK rate.
367+
* This flag is actually used for management frame especially for P2P
368+
* frames not being sent at CCK rate in 2GHz band.
366369
*
367370
* Note: If you have to add new flags to the enumeration, then don't
368371
* forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
@@ -393,6 +396,7 @@ enum mac80211_tx_control_flags {
393396
IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
394397
IEEE80211_TX_CTL_TX_OFFCHAN = BIT(25),
395398
IEEE80211_TX_INTFL_TKIP_MIC_FAILURE = BIT(26),
399+
IEEE80211_TX_CTL_NO_CCK_RATE = BIT(27),
396400
};
397401

398402
#define IEEE80211_TX_CTL_STBC_SHIFT 23

‎net/mac80211/cfg.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,6 +1897,9 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
18971897
flags |= IEEE80211_TX_CTL_TX_OFFCHAN;
18981898
}
18991899

1900+
if (no_cck)
1901+
flags |= IEEE80211_TX_CTL_NO_CCK_RATE;
1902+
19001903
if (is_offchan && !offchan)
19011904
return -EBUSY;
19021905

‎net/mac80211/ieee80211_i.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
13241324
void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
13251325
const u8 *ssid, size_t ssid_len,
13261326
const u8 *ie, size_t ie_len,
1327-
u32 ratemask, bool directed);
1327+
u32 ratemask, bool directed, bool no_cck);
13281328

13291329
void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
13301330
const size_t supp_rates_len,

‎net/mac80211/mlme.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
12391239
} else {
12401240
ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID);
12411241
ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0,
1242-
(u32) -1, true);
1242+
(u32) -1, true, false);
12431243
}
12441244

12451245
ifmgd->probe_send_count++;

‎net/mac80211/rate.c‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,27 @@ static void rc_send_low_broadcast(s8 *idx, u32 basic_rates,
233233
/* could not find a basic rate; use original selection */
234234
}
235235

236+
static inline s8
237+
rate_lowest_non_cck_index(struct ieee80211_supported_band *sband,
238+
struct ieee80211_sta *sta)
239+
{
240+
int i;
241+
242+
for (i = 0; i < sband->n_bitrates; i++) {
243+
struct ieee80211_rate *srate = &sband->bitrates[i];
244+
if ((srate->bitrate == 10) || (srate->bitrate == 20) ||
245+
(srate->bitrate == 55) || (srate->bitrate == 110))
246+
continue;
247+
248+
if (rate_supported(sta, sband->band, i))
249+
return i;
250+
}
251+
252+
/* No matching rate found */
253+
return 0;
254+
}
255+
256+
236257
bool rate_control_send_low(struct ieee80211_sta *sta,
237258
void *priv_sta,
238259
struct ieee80211_tx_rate_control *txrc)
@@ -242,7 +263,13 @@ bool rate_control_send_low(struct ieee80211_sta *sta,
242263
int mcast_rate;
243264

244265
if (!sta || !priv_sta || rc_no_data_or_no_ack(txrc)) {
245-
info->control.rates[0].idx = rate_lowest_index(txrc->sband, sta);
266+
if ((sband->band != IEEE80211_BAND_2GHZ) ||
267+
!(info->flags & IEEE80211_TX_CTL_NO_CCK_RATE))
268+
info->control.rates[0].idx =
269+
rate_lowest_index(txrc->sband, sta);
270+
else
271+
info->control.rates[0].idx =
272+
rate_lowest_non_cck_index(txrc->sband, sta);
246273
info->control.rates[0].count =
247274
(info->flags & IEEE80211_TX_CTL_NO_ACK) ?
248275
1 : txrc->hw->max_rate_tries;

‎net/mac80211/scan.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,8 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
660660
local->scan_req->ssids[i].ssid,
661661
local->scan_req->ssids[i].ssid_len,
662662
local->scan_req->ie, local->scan_req->ie_len,
663-
local->scan_req->rates[band], false);
663+
local->scan_req->rates[band], false,
664+
local->scan_req->no_cck);
664665

665666
/*
666667
* After sending probe requests, wait for probe responses

‎net/mac80211/util.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,14 +899,18 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
899899
void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
900900
const u8 *ssid, size_t ssid_len,
901901
const u8 *ie, size_t ie_len,
902-
u32 ratemask, bool directed)
902+
u32 ratemask, bool directed, bool no_cck)
903903
{
904904
struct sk_buff *skb;
905905

906906
skb = ieee80211_build_probe_req(sdata, dst, ratemask, ssid, ssid_len,
907907
ie, ie_len, directed);
908-
if (skb)
908+
if (skb) {
909+
if (no_cck)
910+
IEEE80211_SKB_CB(skb)->flags |=
911+
IEEE80211_TX_CTL_NO_CCK_RATE;
909912
ieee80211_tx_skb(sdata, skb);
913+
}
910914
}
911915

912916
u32 ieee80211_sta_get_rates(struct ieee80211_local *local,

‎net/mac80211/work.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ ieee80211_direct_probe(struct ieee80211_work *wk)
458458
*/
459459
ieee80211_send_probe_req(sdata, NULL, wk->probe_auth.ssid,
460460
wk->probe_auth.ssid_len, NULL, 0,
461-
(u32) -1, true);
461+
(u32) -1, true, false);
462462

463463
wk->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
464464
run_again(local, wk->timeout);

0 commit comments

Comments
 (0)