Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Feb 2025 20:27:15 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 00fc02712d23 - stable/14 - LinuxKPI; 802.11: start implementing cfg80211_calculate_bitrate()
Message-ID:  <202502242027.51OKRFei027417@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=00fc02712d23663b993f887aa41081fff9760163

commit 00fc02712d23663b993f887aa41081fff9760163
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-12-28 10:10:56 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-02-24 20:26:49 +0000

    LinuxKPI; 802.11: start implementing cfg80211_calculate_bitrate()
    
    For now we only return the legacy rate and have two TODOs for HT and
    VHT which still need to be implemented as needed.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit a7c19b8a99a604e8940c7475220df5de7e295ffa)
---
 sys/compat/linuxkpi/common/include/net/cfg80211.h |  6 ++---
 sys/compat/linuxkpi/common/src/linux_80211.c      | 30 +++++++++++++++++++++++
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h
index bcbf629abb2f..cf1e05dde7ea 100644
--- a/sys/compat/linuxkpi/common/include/net/cfg80211.h
+++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h
@@ -1304,6 +1304,7 @@ void linuxkpi_wiphy_delayed_work_cancel(struct wiphy *,
 
 int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
     struct linuxkpi_ieee80211_regdomain *regd);
+uint32_t linuxkpi_cfg80211_calculate_bitrate(struct rate_info *);
 uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band);
 uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t);
 struct linuxkpi_ieee80211_channel *
@@ -1574,11 +1575,10 @@ cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
 	return (__DECONST(uint8_t *, elem));
 }
 
-static __inline uint32_t
+static inline uint32_t
 cfg80211_calculate_bitrate(struct rate_info *rate)
 {
-	TODO();
-	return (-1);
+	return (linuxkpi_cfg80211_calculate_bitrate(rate));
 }
 
 static __inline uint32_t
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 0cffa36d96cb..7bb051a67ade 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -5891,6 +5891,36 @@ linuxkpi_wiphy_free(struct wiphy *wiphy)
 	kfree(lwiphy);
 }
 
+static uint32_t
+lkpi_cfg80211_calculate_bitrate_ht(struct rate_info *rate)
+{
+	TODO("cfg80211_calculate_bitrate_ht");
+	return (rate->legacy);
+}
+
+static uint32_t
+lkpi_cfg80211_calculate_bitrate_vht(struct rate_info *rate)
+{
+	TODO("cfg80211_calculate_bitrate_vht");
+	return (rate->legacy);
+}
+
+uint32_t
+linuxkpi_cfg80211_calculate_bitrate(struct rate_info *rate)
+{
+
+	/* Beware: order! */
+	if (rate->flags & RATE_INFO_FLAGS_MCS)
+		return (lkpi_cfg80211_calculate_bitrate_ht(rate));
+
+	if (rate->flags & RATE_INFO_FLAGS_VHT_MCS)
+		return (lkpi_cfg80211_calculate_bitrate_vht(rate));
+
+	IMPROVE("HE/EHT/...");
+
+	return (rate->legacy);
+}
+
 uint32_t
 linuxkpi_ieee80211_channel_to_frequency(uint32_t channel,
     enum nl80211_band band)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502242027.51OKRFei027417>