On 2020-08-28 00:52, Kalle Valo wrote:
Thomas Pedersen <thomas@xxxxxxxxxxxx> writes:
Advertise S1G Capabilities and channels to mac80211.
Requires a few fixups to account for missing
sband->bitrates, and a custom regulatory db to actually
enable the S1G channels.
Signed-off-by: Thomas Pedersen <thomas@xxxxxxxxxxxx>
---
drivers/net/wireless/mac80211_hwsim.c | 80
++++++++++++++++++++++++---
include/linux/ieee80211.h | 12 +++-
IMHO a mac80211_hwsim patch should not touch ieee80211.h.
Fair enough, I'll split it out.
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2385,6 +2385,9 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)
return spr_len;
}
+#define SM(f, v) (((v) << f##_SHIFT) & f)
+#define MS(f, v) (((v) & f) >> f##_SHIFT)
+
/* S1G Capabilities Information field */
#define S1G_CAPAB_B0_S1G_LONG BIT(0)
#define S1G_CAPAB_B0_SGI_1MHZ BIT(1)
@@ -2392,9 +2395,16 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)
#define S1G_CAPAB_B0_SGI_4MHZ BIT(3)
#define S1G_CAPAB_B0_SGI_8MHZ BIT(4)
#define S1G_CAPAB_B0_SGI_16MHZ BIT(5)
-#define S1G_CAPAB_B0_SUPP_CH_WIDTH_MASK (BIT(6) | BIT(7))
+#define S1G_CAPAB_B0_SUPP_CH_WIDTH (BIT(6) | BIT(7))
#define S1G_CAPAB_B0_SUPP_CH_WIDTH_SHIFT 6
+#define S1G_SUPP_CH_WIDTH_2 0
+#define S1G_SUPP_CH_WIDTH_4 1
+#define S1G_SUPP_CH_WIDTH_8 2
+#define S1G_SUPP_CH_WIDTH_16 3
+#define S1G_SUPP_CH_WIDTH_MAX(cap) ((1 <<
MS(S1G_CAPAB_B0_SUPP_CH_WIDTH, \
+ cap[0])) << 1)
We have GENMASK(), FIELD_GET() & co nowadays so no need for custom
macros.
Nice. Thanks for the heads up.
--
thomas