diff options
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/cfg80211.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 11 | ||||
-rw-r--r-- | include/net/cfg80211.h | 33 | ||||
-rw-r--r-- | include/uapi/linux/nl80211.h | 8 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 31 | ||||
-rw-r--r-- | net/mac80211/util.c | 25 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 40 | ||||
-rw-r--r-- | net/wireless/util.c | 24 |
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 | */ |
882 | enum rate_info_flags { | 879 | enum 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 | */ | ||
898 | enum 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 | */ |
902 | struct rate_info { | 918 | struct 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 | */ |
2286 | enum nl80211_rate_info { | 2292 | enum 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) | 430 | if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) |
431 | rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; | 431 | rinfo->bw = RATE_INFO_BW_40; |
432 | if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) | 432 | else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) |
433 | rinfo->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; | 433 | rinfo->bw = RATE_INFO_BW_80; |
434 | if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) | 434 | else if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) |
435 | rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; | 435 | rinfo->bw = RATE_INFO_BW_160; |
436 | else | ||
437 | rinfo->bw = RATE_INFO_BW_20; | ||
436 | if (rate->flags & IEEE80211_TX_RC_SHORT_GI) | 438 | if (rate->flags & IEEE80211_TX_RC_SHORT_GI) |
437 | rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; | 439 | rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; |
438 | } | 440 | } |
@@ -459,14 +461,21 @@ void sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) | |||
459 | rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); | 461 | rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); |
460 | } | 462 | } |
461 | 463 | ||
462 | if (sta->last_rx_rate_flag & RX_FLAG_40MHZ) | ||
463 | rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; | ||
464 | if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI) | 464 | if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI) |
465 | rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; | 465 | rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; |
466 | if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80MHZ) | 466 | |
467 | rinfo->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; | 467 | if (sta->last_rx_rate_flag & RX_FLAG_5MHZ) |
468 | if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_160MHZ) | 468 | rinfo->bw = RATE_INFO_BW_5; |
469 | rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; | 469 | else if (sta->last_rx_rate_flag & RX_FLAG_10MHZ) |
470 | rinfo->bw = RATE_INFO_BW_10; | ||
471 | else if (sta->last_rx_rate_flag & RX_FLAG_40MHZ) | ||
472 | rinfo->bw = RATE_INFO_BW_40; | ||
473 | else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80MHZ) | ||
474 | rinfo->bw = RATE_INFO_BW_80; | ||
475 | else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_160MHZ) | ||
476 | rinfo->bw = RATE_INFO_BW_160; | ||
477 | else | ||
478 | rinfo->bw = RATE_INFO_BW_20; | ||
470 | } | 479 | } |
471 | 480 | ||
472 | static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, | 481 | static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index db7216124736..fbd37d43dfce 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -2541,7 +2541,9 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, | |||
2541 | ri.mcs = status->rate_idx; | 2541 | ri.mcs = status->rate_idx; |
2542 | ri.flags |= RATE_INFO_FLAGS_MCS; | 2542 | ri.flags |= RATE_INFO_FLAGS_MCS; |
2543 | if (status->flag & RX_FLAG_40MHZ) | 2543 | if (status->flag & RX_FLAG_40MHZ) |
2544 | ri.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; | 2544 | ri.bw = RATE_INFO_BW_40; |
2545 | else | ||
2546 | ri.bw = RATE_INFO_BW_20; | ||
2545 | if (status->flag & RX_FLAG_SHORT_GI) | 2547 | if (status->flag & RX_FLAG_SHORT_GI) |
2546 | ri.flags |= RATE_INFO_FLAGS_SHORT_GI; | 2548 | ri.flags |= RATE_INFO_FLAGS_SHORT_GI; |
2547 | } else if (status->flag & RX_FLAG_VHT) { | 2549 | } else if (status->flag & RX_FLAG_VHT) { |
@@ -2549,11 +2551,13 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, | |||
2549 | ri.mcs = status->rate_idx; | 2551 | ri.mcs = status->rate_idx; |
2550 | ri.nss = status->vht_nss; | 2552 | ri.nss = status->vht_nss; |
2551 | if (status->flag & RX_FLAG_40MHZ) | 2553 | if (status->flag & RX_FLAG_40MHZ) |
2552 | ri.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; | 2554 | ri.bw = RATE_INFO_BW_40; |
2553 | if (status->vht_flag & RX_VHT_FLAG_80MHZ) | 2555 | else if (status->vht_flag & RX_VHT_FLAG_80MHZ) |
2554 | ri.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; | 2556 | ri.bw = RATE_INFO_BW_80; |
2555 | if (status->vht_flag & RX_VHT_FLAG_160MHZ) | 2557 | else if (status->vht_flag & RX_VHT_FLAG_160MHZ) |
2556 | ri.flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; | 2558 | ri.bw = RATE_INFO_BW_160; |
2559 | else | ||
2560 | ri.bw = RATE_INFO_BW_20; | ||
2557 | if (status->flag & RX_FLAG_SHORT_GI) | 2561 | if (status->flag & RX_FLAG_SHORT_GI) |
2558 | ri.flags |= RATE_INFO_FLAGS_SHORT_GI; | 2562 | ri.flags |= RATE_INFO_FLAGS_SHORT_GI; |
2559 | } else { | 2563 | } else { |
@@ -2561,10 +2565,15 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, | |||
2561 | int shift = 0; | 2565 | int shift = 0; |
2562 | int bitrate; | 2566 | int bitrate; |
2563 | 2567 | ||
2564 | if (status->flag & RX_FLAG_10MHZ) | 2568 | if (status->flag & RX_FLAG_10MHZ) { |
2565 | shift = 1; | 2569 | shift = 1; |
2566 | if (status->flag & RX_FLAG_5MHZ) | 2570 | ri.bw = RATE_INFO_BW_10; |
2571 | } else if (status->flag & RX_FLAG_5MHZ) { | ||
2567 | shift = 2; | 2572 | shift = 2; |
2573 | ri.bw = RATE_INFO_BW_5; | ||
2574 | } else { | ||
2575 | ri.bw = RATE_INFO_BW_20; | ||
2576 | } | ||
2568 | 2577 | ||
2569 | sband = local->hw.wiphy->bands[status->band]; | 2578 | sband = local->hw.wiphy->bands[status->band]; |
2570 | bitrate = sband->bitrates[status->rate_idx].bitrate; | 2579 | bitrate = sband->bitrates[status->rate_idx].bitrate; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8998484ea970..8e56eeb583aa 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -3578,6 +3578,7 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, | |||
3578 | struct nlattr *rate; | 3578 | struct nlattr *rate; |
3579 | u32 bitrate; | 3579 | u32 bitrate; |
3580 | u16 bitrate_compat; | 3580 | u16 bitrate_compat; |
3581 | enum nl80211_attrs rate_flg; | ||
3581 | 3582 | ||
3582 | rate = nla_nest_start(msg, attr); | 3583 | rate = nla_nest_start(msg, attr); |
3583 | if (!rate) | 3584 | if (!rate) |
@@ -3594,12 +3595,36 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, | |||
3594 | nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate_compat)) | 3595 | nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate_compat)) |
3595 | return false; | 3596 | return false; |
3596 | 3597 | ||
3598 | switch (info->bw) { | ||
3599 | case RATE_INFO_BW_5: | ||
3600 | rate_flg = NL80211_RATE_INFO_5_MHZ_WIDTH; | ||
3601 | break; | ||
3602 | case RATE_INFO_BW_10: | ||
3603 | rate_flg = NL80211_RATE_INFO_10_MHZ_WIDTH; | ||
3604 | break; | ||
3605 | default: | ||
3606 | WARN_ON(1); | ||
3607 | /* fall through */ | ||
3608 | case RATE_INFO_BW_20: | ||
3609 | rate_flg = 0; | ||
3610 | break; | ||
3611 | case RATE_INFO_BW_40: | ||
3612 | rate_flg = NL80211_RATE_INFO_40_MHZ_WIDTH; | ||
3613 | break; | ||
3614 | case RATE_INFO_BW_80: | ||
3615 | rate_flg = NL80211_RATE_INFO_80_MHZ_WIDTH; | ||
3616 | break; | ||
3617 | case RATE_INFO_BW_160: | ||
3618 | rate_flg = NL80211_RATE_INFO_160_MHZ_WIDTH; | ||
3619 | break; | ||
3620 | } | ||
3621 | |||
3622 | if (rate_flg && nla_put_flag(msg, rate_flg)) | ||
3623 | return false; | ||
3624 | |||
3597 | if (info->flags & RATE_INFO_FLAGS_MCS) { | 3625 | if (info->flags & RATE_INFO_FLAGS_MCS) { |
3598 | if (nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs)) | 3626 | if (nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs)) |
3599 | return false; | 3627 | return false; |
3600 | if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH && | ||
3601 | nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH)) | ||
3602 | return false; | ||
3603 | if (info->flags & RATE_INFO_FLAGS_SHORT_GI && | 3628 | if (info->flags & RATE_INFO_FLAGS_SHORT_GI && |
3604 | nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) | 3629 | nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) |
3605 | return false; | 3630 | return false; |
@@ -3608,15 +3633,6 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, | |||
3608 | return false; | 3633 | return false; |
3609 | if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_NSS, info->nss)) | 3634 | if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_NSS, info->nss)) |
3610 | return false; | 3635 | return false; |
3611 | if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH && | ||
3612 | nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH)) | ||
3613 | return false; | ||
3614 | if (info->flags & RATE_INFO_FLAGS_80_MHZ_WIDTH && | ||
3615 | nla_put_flag(msg, NL80211_RATE_INFO_80_MHZ_WIDTH)) | ||
3616 | return false; | ||
3617 | if (info->flags & RATE_INFO_FLAGS_160_MHZ_WIDTH && | ||
3618 | nla_put_flag(msg, NL80211_RATE_INFO_160_MHZ_WIDTH)) | ||
3619 | return false; | ||
3620 | if (info->flags & RATE_INFO_FLAGS_SHORT_GI && | 3636 | if (info->flags & RATE_INFO_FLAGS_SHORT_GI && |
3621 | nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) | 3637 | nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) |
3622 | return false; | 3638 | return false; |
diff --git a/net/wireless/util.c b/net/wireless/util.c index 6942d48f1ac5..3535e8ade48f 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -1073,9 +1073,24 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate) | |||
1073 | if (WARN_ON_ONCE(rate->mcs > 9)) | 1073 | if (WARN_ON_ONCE(rate->mcs > 9)) |
1074 | return 0; | 1074 | return 0; |
1075 | 1075 | ||
1076 | idx = rate->flags & RATE_INFO_FLAGS_160_MHZ_WIDTH ? 3 : | 1076 | switch (rate->bw) { |
1077 | rate->flags & RATE_INFO_FLAGS_80_MHZ_WIDTH ? 2 : | 1077 | case RATE_INFO_BW_160: |
1078 | rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH ? 1 : 0; | 1078 | idx = 3; |
1079 | break; | ||
1080 | case RATE_INFO_BW_80: | ||
1081 | idx = 2; | ||
1082 | break; | ||
1083 | case RATE_INFO_BW_40: | ||
1084 | idx = 1; | ||
1085 | break; | ||
1086 | case RATE_INFO_BW_5: | ||
1087 | case RATE_INFO_BW_10: | ||
1088 | default: | ||
1089 | WARN_ON(1); | ||
1090 | /* fall through */ | ||
1091 | case RATE_INFO_BW_20: | ||
1092 | idx = 0; | ||
1093 | } | ||
1079 | 1094 | ||
1080 | bitrate = base[idx][rate->mcs]; | 1095 | bitrate = base[idx][rate->mcs]; |
1081 | bitrate *= rate->nss; | 1096 | bitrate *= rate->nss; |
@@ -1106,8 +1121,7 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate) | |||
1106 | modulation = rate->mcs & 7; | 1121 | modulation = rate->mcs & 7; |
1107 | streams = (rate->mcs >> 3) + 1; | 1122 | streams = (rate->mcs >> 3) + 1; |
1108 | 1123 | ||
1109 | bitrate = (rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) ? | 1124 | bitrate = (rate->bw == RATE_INFO_BW_40) ? 13500000 : 6500000; |
1110 | 13500000 : 6500000; | ||
1111 | 1125 | ||
1112 | if (modulation < 4) | 1126 | if (modulation < 4) |
1113 | bitrate *= (modulation + 1); | 1127 | bitrate *= (modulation + 1); |