linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Chen <mxchen@codeaurora.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Max Chen <mxchen@codeaurora.org>,
	linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com
Subject: [PATCH 1/2] cfg80211: Add phyrate conversion support for extended MCS in 60GHz band
Date: Wed,  6 Jan 2021 15:50:49 -0800	[thread overview]
Message-ID: <1609977050-7089-2-git-send-email-mxchen@codeaurora.org> (raw)
In-Reply-To: <1609977050-7089-1-git-send-email-mxchen@codeaurora.org>

The current phyrate conversion does not include extended MCS and provides
incorrect rates. Add a flag for extended MCS in DMG and add corresponding
phyrate table for the correct conversions using base MCS in DMG specs.

Signed-off-by: Max Chen <mxchen@codeaurora.org>
---
 include/net/cfg80211.h |  2 ++
 net/wireless/util.c    | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ab249ca..19c9c51 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1471,6 +1471,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
  * @RATE_INFO_FLAGS_DMG: 60GHz MCS
  * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
  * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
+ * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
  */
 enum rate_info_flags {
 	RATE_INFO_FLAGS_MCS			= BIT(0),
@@ -1479,6 +1480,7 @@ enum rate_info_flags {
 	RATE_INFO_FLAGS_DMG			= BIT(3),
 	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
 	RATE_INFO_FLAGS_EDMG			= BIT(5),
+	RATE_INFO_FLAGS_EXTENDED_SC_DMG		= BIT(6),
 };
 
 /**
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 5af8803..6143f6a 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1152,6 +1152,25 @@ static u32 cfg80211_calculate_bitrate_dmg(struct rate_info *rate)
 	return __mcs2bitrate[rate->mcs];
 }
 
+static u32 cfg80211_calculate_bitrate_extended_sc_dmg(struct rate_info *rate)
+{
+	static const u32 __mcs2bitrate[] = {
+		[6] = 26950, /* MCS 9.1 : 2695.0 mbps */
+		[7] = 50050, /* MCS 12.1 */
+		[8] = 53900,
+		[9] = 57750,
+		[10] = 63900,
+		[11] = 75075,
+		[12] = 80850,
+	};
+
+	/* Extended SC MCS not defined for base MCS below 6 or above 12 */
+	if (WARN_ON_ONCE(rate->mcs < 6) || WARN_ON_ONCE(rate->mcs > 12))
+		return 0;
+
+	return __mcs2bitrate[rate->mcs];
+}
+
 static u32 cfg80211_calculate_bitrate_edmg(struct rate_info *rate)
 {
 	static const u32 __mcs2bitrate[] = {
@@ -1362,6 +1381,8 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate)
 		return cfg80211_calculate_bitrate_ht(rate);
 	if (rate->flags & RATE_INFO_FLAGS_DMG)
 		return cfg80211_calculate_bitrate_dmg(rate);
+	if (rate->flags & RATE_INFO_FLAGS_EXTENDED_SC_DMG)
+		return cfg80211_calculate_bitrate_extended_sc_dmg(rate);
 	if (rate->flags & RATE_INFO_FLAGS_EDMG)
 		return cfg80211_calculate_bitrate_edmg(rate);
 	if (rate->flags & RATE_INFO_FLAGS_VHT_MCS)
-- 
2.7.4


  reply	other threads:[~2021-01-06 23:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 23:50 [PATCH 0/2] Add Extended MCS Phyrate Conversion Support on 60GHz Max Chen
2021-01-06 23:50 ` Max Chen [this message]
2021-01-06 23:50 ` [PATCH 2/2] wil6210: Add Support for Extended DMG MCS 12.1 Max Chen
2021-02-09  7:26   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1609977050-7089-2-git-send-email-mxchen@codeaurora.org \
    --to=mxchen@codeaurora.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wil6210@qti.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).