mac80211: encode listen interval for S1G
authorThomas Pedersen <thomas@adapt-ip.com>
Tue, 22 Sep 2020 02:28:10 +0000 (19:28 -0700)
committerChristian Lamparter <chunkeey@gmail.com>
Fri, 5 Feb 2021 10:39:41 +0000 (11:39 +0100)
S1G allows listen interval up to 2^14 * 10000 beacon
intervals. In order to do this listen interval needs a
scaling factor applied to the lower 14 bits. Calculate
this and properly encode the listen interval for S1G STAs.

See IEEE802.11ah-2016 Table 9-44a for reference.

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
Link: https://lore.kernel.org/r/20200922022818.15855-10-thomas@adapt-ip.com
[move listen_int_usf into function using it]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
include/linux/ieee80211.h

index 38606456e3b638d8a930d99bd195b5fd88182d5a..5001b5f57e881ef5be887e689be77452f8923240 100644 (file)
@@ -2467,6 +2467,13 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)
 #define S1G_OPER_CH_WIDTH_PRIMARY_1MHZ BIT(0)
 #define S1G_OPER_CH_WIDTH_OPER         GENMASK(4, 1)
 
+
+#define LISTEN_INT_USF GENMASK(15, 14)
+#define LISTEN_INT_UI  GENMASK(13, 0)
+
+#define IEEE80211_MAX_USF      FIELD_MAX(LISTEN_INT_USF)
+#define IEEE80211_MAX_UI       FIELD_MAX(LISTEN_INT_UI)
+
 /* Authentication algorithms */
 #define WLAN_AUTH_OPEN 0
 #define WLAN_AUTH_SHARED_KEY 1