On 2012-01-29 00:25, Simon Wunderlich wrote:
Allow to set mcs masks through nl80211. We also allow to set MCS
rates but no legacy rates (and vice versa).

Signed-off-by: Simon Wunderlich <[email protected]>
Signed-off-by: Mathias Kretschmer <[email protected]>
---
 include/linux/nl80211.h |    4 +++
 include/net/cfg80211.h  |    3 +-
net/wireless/nl80211.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 65 insertions(+), 3 deletions(-)

...
@@ -5421,12 +5451,20 @@ static int nl80211_set_tx_bitrate_mask(struct
sk_buff *skb,
                sband = rdev->wiphy.bands[i];
                mask.control[i].legacy =
                        sband ? (1 << sband->n_bitrates) - 1 : 0;
+               if (sband)
+                       memcpy(mask.control[i].mcs,
+                              sband->ht_cap.mcs.rx_mask,
+                              sizeof(mask.control[i].mcs));
when use command: "iw wlan0 set bitrates legacy-5 6", I want to set it fixed in 6M rate. this copy mcs rate will add the mcs rate here and condition "if (tb[NL80211_TXRATE_MCS])"
is false, then mcs rate will not clear and lead a mistake result.
+               else
+                       memset(mask.control[i].mcs, 0,
+                              sizeof(mask.control[i].mcs));
        }

        /*
* The nested attribute uses enum nl80211_band as the index. This maps
         * directly to the enum ieee80211_band values used in cfg80211.
         */
+ BUILD_BUG_ON(NL80211_MAX_SUPP_HT_RATES > IEEE80211_HT_MCS_MASK_LEN * 8); nla_for_each_nested(tx_rates, info->attrs[NL80211_ATTR_TX_RATES], rem)
        {
                enum ieee80211_band band = nla_type(tx_rates);
@@ -5442,7 +5480,28 @@ static int nl80211_set_tx_bitrate_mask(struct
sk_buff *skb,
                                sband,
                                nla_data(tb[NL80211_TXRATE_LEGACY]),
                                nla_len(tb[NL80211_TXRATE_LEGACY]));
-                       if (mask.control[band].legacy == 0)
+               }
+               if (tb[NL80211_TXRATE_MCS]) {

false for "iw wlan0 set bitrates legacy-5 6", so ht_rateset_to_mask will not enter and mcs rate will not clear.

+                       if (!ht_rateset_to_mask(
+                                       sband,
+                                       nla_data(tb[NL80211_TXRATE_MCS]),
+                                       nla_len(tb[NL80211_TXRATE_MCS]),
+                                       mask.control[band].mcs))
+                               return -EINVAL;
+               }
+
+               if (mask.control[band].legacy == 0) {
+                       /* don't allow empty legacy rates if HT
+                        * is not even supported. */
+                       if (!rdev->wiphy.bands[band]->ht_cap.ht_supported)
+                               return -EINVAL;
+
+                       for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++)
+                               if (mask.control[band].mcs[i])
+                                       break;
+
+                       /* legacy and mcs rates may not be both empty */
+                       if (i == IEEE80211_HT_MCS_MASK_LEN)
                                return -EINVAL;
                }
        }

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

Reply via email to