git: a7c19b8a99a6 - main - LinuxKPI; 802.11: start implementing cfg80211_calculate_bitrate()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 16 Feb 2025 22:40:45 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=a7c19b8a99a604e8940c7475220df5de7e295ffa
commit a7c19b8a99a604e8940c7475220df5de7e295ffa
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-16 22:33:03 +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
MFC after: 3 days
---
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 f1738a30993c..1d834673fa74 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -5890,6 +5890,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)