aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>2012-07-05 07:25:50 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-07-05 09:18:32 -0400
commit95ddc1fc4519ed48ddc7d622bd5c84dff3eebb0a (patch)
treedaf30d3a4e3b1371c268f0aaac1c95e795fda53c
parent8eb41c8dfb9e2396d2452ada9023a83d610b9051 (diff)
cfg80211: bitrate calculation for 60g
60g band uses different from .11n MCS scheme, so bitrate should be calculated differently Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--net/wireless/util.c49
2 files changed, 51 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 8837efc368f9..51f67a9003a9 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -580,11 +580,13 @@ enum station_info_flags {
580 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 580 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
581 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 581 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
582 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 582 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
583 * @RATE_INFO_FLAGS_60G: 60gHz MCS
583 */ 584 */
584enum rate_info_flags { 585enum rate_info_flags {
585 RATE_INFO_FLAGS_MCS = 1<<0, 586 RATE_INFO_FLAGS_MCS = 1<<0,
586 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 587 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
587 RATE_INFO_FLAGS_SHORT_GI = 1<<2, 588 RATE_INFO_FLAGS_SHORT_GI = 1<<2,
589 RATE_INFO_FLAGS_60G = 1<<3,
588}; 590};
589 591
590/** 592/**
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 6e52726f7fe3..e31f1dba79ec 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -900,12 +900,61 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
900 return err; 900 return err;
901} 901}
902 902
903static u32 cfg80211_calculate_bitrate_60g(struct rate_info *rate)
904{
905 static const u32 __mcs2bitrate[] = {
906 /* control PHY */
907 [0] = 275,
908 /* SC PHY */
909 [1] = 3850,
910 [2] = 7700,
911 [3] = 9625,
912 [4] = 11550,
913 [5] = 12512, /* 1251.25 mbps */
914 [6] = 15400,
915 [7] = 19250,
916 [8] = 23100,
917 [9] = 25025,
918 [10] = 30800,
919 [11] = 38500,
920 [12] = 46200,
921 /* OFDM PHY */
922 [13] = 6930,
923 [14] = 8662, /* 866.25 mbps */
924 [15] = 13860,
925 [16] = 17325,
926 [17] = 20790,
927 [18] = 27720,
928 [19] = 34650,
929 [20] = 41580,
930 [21] = 45045,
931 [22] = 51975,
932 [23] = 62370,
933 [24] = 67568, /* 6756.75 mbps */
934 /* LP-SC PHY */
935 [25] = 6260,
936 [26] = 8340,
937 [27] = 11120,
938 [28] = 12510,
939 [29] = 16680,
940 [30] = 22240,
941 [31] = 25030,
942 };
943
944 if (WARN_ON_ONCE(rate->mcs >= ARRAY_SIZE(__mcs2bitrate)))
945 return 0;
946
947 return __mcs2bitrate[rate->mcs];
948}
949
903u32 cfg80211_calculate_bitrate(struct rate_info *rate) 950u32 cfg80211_calculate_bitrate(struct rate_info *rate)
904{ 951{
905 int modulation, streams, bitrate; 952 int modulation, streams, bitrate;
906 953
907 if (!(rate->flags & RATE_INFO_FLAGS_MCS)) 954 if (!(rate->flags & RATE_INFO_FLAGS_MCS))
908 return rate->legacy; 955 return rate->legacy;
956 if (rate->flags & RATE_INFO_FLAGS_60G)
957 return cfg80211_calculate_bitrate_60g(rate);
909 958
910 /* the formula below does only work for MCS values smaller than 32 */ 959 /* the formula below does only work for MCS values smaller than 32 */
911 if (WARN_ON_ONCE(rate->mcs >= 32)) 960 if (WARN_ON_ONCE(rate->mcs >= 32))