aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-01-15 10:14:02 -0500
committerJohannes Berg <johannes.berg@intel.com>2015-01-15 16:41:32 -0500
commitb51f3beecfbbfc946749a91fb444cb8917cf444f (patch)
tree68ecd024ca26b392b48599dc3725e4416d053d1f
parent97d910d0aaa619ca530d08e2b1125b8014ccb030 (diff)
cfg80211: change bandwidth reporting to explicit field
For some reason, we made the bandwidth separate flags, which is rather confusing - a single rate cannot have different bandwidths at the same time. Change this to no longer be flags but use a separate field for the bandwidth ('bw') instead. While at it, add support for 5 and 10 MHz rates - these are reported as regular legacy rates with their real bitrate, but tagged as 5/10 now to make it easier to distinguish them. In the nl80211 API, the flags are preserved, but the code now can also clearly only set a single one of the flags. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c3
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c11
-rw-r--r--include/net/cfg80211.h33
-rw-r--r--include/uapi/linux/nl80211.h8
-rw-r--r--net/mac80211/cfg.c31
-rw-r--r--net/mac80211/util.c25
-rw-r--r--net/wireless/nl80211.c40
-rw-r--r--net/wireless/util.c24
8 files changed, 125 insertions, 50 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 44dd6ef923cd..85da63a67faf 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1827,6 +1827,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
1827 } 1827 }
1828 1828
1829 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; 1829 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
1830 sinfo->txrate.bw = RATE_INFO_BW_20;
1830 } else if (is_rate_ht40(rate, &mcs, &sgi)) { 1831 } else if (is_rate_ht40(rate, &mcs, &sgi)) {
1831 if (sgi) { 1832 if (sgi) {
1832 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 1833 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
@@ -1835,7 +1836,7 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev,
1835 sinfo->txrate.mcs = mcs; 1836 sinfo->txrate.mcs = mcs;
1836 } 1837 }
1837 1838
1838 sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 1839 sinfo->txrate.bw = RATE_INFO_BW_40;
1839 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; 1840 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
1840 } else { 1841 } else {
1841 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, 1842 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG,
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 71312ff52703..1996a8b612d2 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -856,16 +856,16 @@ mwifiex_parse_htinfo(struct mwifiex_private *priv, u8 tx_htinfo,
856 /* HT or VHT */ 856 /* HT or VHT */
857 switch (tx_htinfo & (BIT(3) | BIT(2))) { 857 switch (tx_htinfo & (BIT(3) | BIT(2))) {
858 case 0: 858 case 0:
859 /* This will be 20MHz */ 859 rate->bw = RATE_INFO_BW_20;
860 break; 860 break;
861 case (BIT(2)): 861 case (BIT(2)):
862 rate->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 862 rate->bw = RATE_INFO_BW_40;
863 break; 863 break;
864 case (BIT(3)): 864 case (BIT(3)):
865 rate->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 865 rate->bw = RATE_INFO_BW_80;
866 break; 866 break;
867 case (BIT(3) | BIT(2)): 867 case (BIT(3) | BIT(2)):
868 rate->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 868 rate->bw = RATE_INFO_BW_160;
869 break; 869 break;
870 } 870 }
871 871
@@ -885,8 +885,9 @@ mwifiex_parse_htinfo(struct mwifiex_private *priv, u8 tx_htinfo,
885 if ((tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) { 885 if ((tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) {
886 rate->mcs = priv->tx_rate; 886 rate->mcs = priv->tx_rate;
887 rate->flags |= RATE_INFO_FLAGS_MCS; 887 rate->flags |= RATE_INFO_FLAGS_MCS;
888 rate->bw = RATE_INFO_BW_20;
888 if (tx_htinfo & BIT(1)) 889 if (tx_htinfo & BIT(1))
889 rate->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 890 rate->bw = RATE_INFO_BW_40;
890 if (tx_htinfo & BIT(2)) 891 if (tx_htinfo & BIT(2))
891 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; 892 rate->flags |= RATE_INFO_FLAGS_SHORT_GI;
892 } 893 }
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0322048fddab..7b44ba0a7632 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -873,20 +873,35 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
873 * 873 *
874 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS 874 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
875 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS 875 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
876 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 MHz width transmission
877 * @RATE_INFO_FLAGS_80_MHZ_WIDTH: 80 MHz width transmission
878 * @RATE_INFO_FLAGS_160_MHZ_WIDTH: 160 MHz width transmission
879 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 876 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
880 * @RATE_INFO_FLAGS_60G: 60GHz MCS 877 * @RATE_INFO_FLAGS_60G: 60GHz MCS
881 */ 878 */
882enum rate_info_flags { 879enum rate_info_flags {
883 RATE_INFO_FLAGS_MCS = BIT(0), 880 RATE_INFO_FLAGS_MCS = BIT(0),
884 RATE_INFO_FLAGS_VHT_MCS = BIT(1), 881 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
885 RATE_INFO_FLAGS_40_MHZ_WIDTH = BIT(2), 882 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
886 RATE_INFO_FLAGS_80_MHZ_WIDTH = BIT(3), 883 RATE_INFO_FLAGS_60G = BIT(3),
887 RATE_INFO_FLAGS_160_MHZ_WIDTH = BIT(4), 884};
888 RATE_INFO_FLAGS_SHORT_GI = BIT(5), 885
889 RATE_INFO_FLAGS_60G = BIT(6), 886/**
887 * enum rate_info_bw - rate bandwidth information
888 *
889 * Used by the driver to indicate the rate bandwidth.
890 *
891 * @RATE_INFO_BW_5: 5 MHz bandwidth
892 * @RATE_INFO_BW_10: 10 MHz bandwidth
893 * @RATE_INFO_BW_20: 20 MHz bandwidth
894 * @RATE_INFO_BW_40: 40 MHz bandwidth
895 * @RATE_INFO_BW_80: 80 MHz bandwidth
896 * @RATE_INFO_BW_160: 160 MHz bandwidth
897 */
898enum rate_info_bw {
899 RATE_INFO_BW_5,
900 RATE_INFO_BW_10,
901 RATE_INFO_BW_20,
902 RATE_INFO_BW_40,
903 RATE_INFO_BW_80,
904 RATE_INFO_BW_160,
890}; 905};
891 906
892/** 907/**
@@ -898,12 +913,14 @@ enum rate_info_flags {
898 * @mcs: mcs index if struct describes a 802.11n bitrate 913 * @mcs: mcs index if struct describes a 802.11n bitrate
899 * @legacy: bitrate in 100kbit/s for 802.11abg 914 * @legacy: bitrate in 100kbit/s for 802.11abg
900 * @nss: number of streams (VHT only) 915 * @nss: number of streams (VHT only)
916 * @bw: bandwidth (from &enum rate_info_bw)
901 */ 917 */
902struct rate_info { 918struct rate_info {
903 u8 flags; 919 u8 flags;
904 u8 mcs; 920 u8 mcs;
905 u16 legacy; 921 u16 legacy;
906 u8 nss; 922 u8 nss;
923 u8 bw;
907}; 924};
908 925
909/** 926/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 11cdb85ac646..f52797a90816 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2281,6 +2281,12 @@ struct nl80211_sta_flag_update {
2281 * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: unused - 80+80 is treated the 2281 * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: unused - 80+80 is treated the
2282 * same as 160 for purposes of the bitrates 2282 * same as 160 for purposes of the bitrates
2283 * @NL80211_RATE_INFO_160_MHZ_WIDTH: 160 MHz VHT rate 2283 * @NL80211_RATE_INFO_160_MHZ_WIDTH: 160 MHz VHT rate
2284 * @NL80211_RATE_INFO_10_MHZ_WIDTH: 10 MHz width - note that this is
2285 * a legacy rate and will be reported as the actual bitrate, i.e.
2286 * half the base (20 MHz) rate
2287 * @NL80211_RATE_INFO_5_MHZ_WIDTH: 5 MHz width - note that this is
2288 * a legacy rate and will be reported as the actual bitrate, i.e.
2289 * a quarter of the base (20 MHz) rate
2284 * @__NL80211_RATE_INFO_AFTER_LAST: internal use 2290 * @__NL80211_RATE_INFO_AFTER_LAST: internal use
2285 */ 2291 */
2286enum nl80211_rate_info { 2292enum nl80211_rate_info {
@@ -2295,6 +2301,8 @@ enum nl80211_rate_info {
2295 NL80211_RATE_INFO_80_MHZ_WIDTH, 2301 NL80211_RATE_INFO_80_MHZ_WIDTH,
2296 NL80211_RATE_INFO_80P80_MHZ_WIDTH, 2302 NL80211_RATE_INFO_80P80_MHZ_WIDTH,
2297 NL80211_RATE_INFO_160_MHZ_WIDTH, 2303 NL80211_RATE_INFO_160_MHZ_WIDTH,
2304 NL80211_RATE_INFO_10_MHZ_WIDTH,
2305 NL80211_RATE_INFO_5_MHZ_WIDTH,
2298 2306
2299 /* keep last */ 2307 /* keep last */
2300 __NL80211_RATE_INFO_AFTER_LAST, 2308 __NL80211_RATE_INFO_AFTER_LAST,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6d5076fbf87a..ff090ef1ea2c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -428,11 +428,13 @@ void sta_set_rate_info_tx(struct sta_info *sta,
428 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); 428 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift);
429 } 429 }
430 if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)