mac80211/ath9k: some more performance improvements
[openwrt.git] / package / mac80211 / patches / 563-mac80211_optimize_mcs_rate_mask.patch
1 --- a/net/mac80211/ieee80211_i.h
2 +++ b/net/mac80211/ieee80211_i.h
3 @@ -656,6 +656,8 @@ struct ieee80211_sub_if_data {
4
5 /* bitmap of allowed (non-MCS) rate indexes for rate control */
6 u32 rc_rateidx_mask[IEEE80211_NUM_BANDS];
7 +
8 + bool rc_has_mcs_mask[IEEE80211_NUM_BANDS];
9 u8 rc_rateidx_mcs_mask[IEEE80211_NUM_BANDS][IEEE80211_HT_MCS_MASK_LEN];
10
11 union {
12 --- a/net/mac80211/cfg.c
13 +++ b/net/mac80211/cfg.c
14 @@ -1887,9 +1887,20 @@ static int ieee80211_set_bitrate_mask(st
15 }
16
17 for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
18 + struct ieee80211_supported_band *sband = wiphy->bands[i];
19 +
20 sdata->rc_rateidx_mask[i] = mask->control[i].legacy;
21 memcpy(sdata->rc_rateidx_mcs_mask[i], mask->control[i].mcs,
22 sizeof(mask->control[i].mcs));
23 +
24 + sdata->rc_has_mcs_mask[i] = false;
25 + if (!sband)
26 + continue;
27 +
28 + if (memcmp(sdata->rc_rateidx_mcs_mask[i],
29 + sband->ht_cap.mcs.rx_mask,
30 + sizeof(sband->ht_cap.mcs.rx_mask)) != 0)
31 + sdata->rc_has_mcs_mask[i] = true;
32 }
33
34 return 0;
35 --- a/include/net/mac80211.h
36 +++ b/include/net/mac80211.h
37 @@ -3590,6 +3590,7 @@ enum rate_control_changed {
38 * (deprecated; this will be removed once drivers get updated to use
39 * rate_idx_mask)
40 * @rate_idx_mask: user-requested rate mask (not MCS for now)
41 + * @rate_idx_mcs_mask: user-requested MCS rate mask (NULL if not in use)
42 * @skb: the skb that will be transmitted, the control information in it needs
43 * to be filled in
44 * @bss: whether this frame is sent out in AP or IBSS mode
45 @@ -3603,7 +3604,7 @@ struct ieee80211_tx_rate_control {
46 bool rts, short_preamble;
47 u8 max_rate_idx;
48 u32 rate_idx_mask;
49 - u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN];
50 + u8 *rate_idx_mcs_mask;
51 bool bss;
52 };
53
54 --- a/net/mac80211/tx.c
55 +++ b/net/mac80211/tx.c
56 @@ -640,9 +640,11 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
57 txrc.max_rate_idx = -1;
58 else
59 txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1;
60 - memcpy(txrc.rate_idx_mcs_mask,
61 - tx->sdata->rc_rateidx_mcs_mask[tx->channel->band],
62 - sizeof(txrc.rate_idx_mcs_mask));
63 +
64 + if (tx->sdata->rc_has_mcs_mask[tx->channel->band])
65 + txrc.rate_idx_mcs_mask =
66 + tx->sdata->rc_rateidx_mcs_mask[tx->channel->band];
67 +
68 txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP ||
69 tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
70 tx->sdata->vif.type == NL80211_IFTYPE_ADHOC);
71 @@ -2455,8 +2457,6 @@ struct sk_buff *ieee80211_beacon_get_tim
72 txrc.max_rate_idx = -1;
73 else
74 txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1;
75 - memcpy(txrc.rate_idx_mcs_mask, sdata->rc_rateidx_mcs_mask[band],
76 - sizeof(txrc.rate_idx_mcs_mask));
77 txrc.bss = true;
78 rate_control_get_rate(sdata, NULL, &txrc);
79
80 --- a/net/mac80211/rate.c
81 +++ b/net/mac80211/rate.c
82 @@ -461,9 +461,12 @@ void rate_control_get_rate(struct ieee80
83 * the common case.
84 */
85 mask = sdata->rc_rateidx_mask[info->band];
86 - memcpy(mcs_mask, sdata->rc_rateidx_mcs_mask[info->band],
87 - sizeof(mcs_mask));
88 - if (mask != (1 << txrc->sband->n_bitrates) - 1) {
89 + if (mask != (1 << txrc->sband->n_bitrates) - 1 || txrc->rate_idx_mcs_mask) {
90 + if (txrc->rate_idx_mcs_mask)
91 + memcpy(mcs_mask, txrc->rate_idx_mcs_mask, sizeof(mcs_mask));
92 + else
93 + memset(mcs_mask, 0xff, sizeof(mcs_mask));
94 +
95 if (sta) {
96 /* Filter out rates that the STA does not support */
97 mask &= sta->sta.supp_rates[info->band];
This page took 0.044647 seconds and 5 git commands to generate.