]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nl80211: extend support to config spatial reuse parameter set
authorRajkumar Manoharan <rmanohar@codeaurora.org>
Mon, 28 Sep 2020 07:28:11 +0000 (00:28 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 28 Sep 2020 13:07:41 +0000 (15:07 +0200)
Allow the user to configure below Spatial Reuse Parameter Set element.
  * Non-SRG OBSS PD Max Offset
  * SRG BSS Color Bitmap
  * SRG Partial BSSID Bitmap

Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
Link: https://lore.kernel.org/r/1601278091-20313-2-git-send-email-rmanohar@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/linux/ieee80211.h
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c

index f2f56b287aedc6a3d1d9f28ccc9019d037e3cf83..770408b2fdafb4c9cdb7670a2e1dd78ca0afd4b5 100644 (file)
@@ -2350,8 +2350,11 @@ ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper)
 }
 
 /* HE Spatial Reuse defines */
-#define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT                        0x4
-#define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT               0x8
+#define IEEE80211_HE_SPR_PSR_DISALLOWED                                BIT(0)
+#define IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED         BIT(1)
+#define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT                        BIT(2)
+#define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT               BIT(3)
+#define IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED               BIT(4)
 
 /*
  * ieee80211_he_spr_size - calculate 802.11ax HE Spatial Reuse IE size
index bead4b9afeca96817e39d1d46643d61ef31ec206..aee47f2b5709e2589a4910a16bf6f548a448dd01 100644 (file)
@@ -269,13 +269,23 @@ struct ieee80211_rate {
  * struct ieee80211_he_obss_pd - AP settings for spatial reuse
  *
  * @enable: is the feature enabled.
+ * @sr_ctrl: The SR Control field of SRP element.
+ * @non_srg_max_offset: non-SRG maximum tx power offset
  * @min_offset: minimal tx power offset an associated station shall use
  * @max_offset: maximum tx power offset an associated station shall use
+ * @bss_color_bitmap: bitmap that indicates the BSS color values used by
+ *     members of the SRG
+ * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
+ *     used by members of the SRG
  */
 struct ieee80211_he_obss_pd {
        bool enable;
+       u8 sr_ctrl;
+       u8 non_srg_max_offset;
        u8 min_offset;
        u8 max_offset;
+       u8 bss_color_bitmap[8];
+       u8 partial_bssid_bitmap[8];
 };
 
 /**
index 1e51445f81cd0cdefaca6d145c9adb3c666ccca6..47700a2b9af962f387a7759af4092e2a6a04412a 100644 (file)
@@ -6991,6 +6991,13 @@ enum nl80211_peer_measurement_ftm_resp {
  *
  * @NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET: the OBSS PD minimum tx power offset.
  * @NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET: the OBSS PD maximum tx power offset.
+ * @NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET: the non-SRG OBSS PD maximum
+ *     tx power offset.
+ * @NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP: bitmap that indicates the BSS color
+ *     values used by members of the SRG.
+ * @NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP: bitmap that indicates the partial
+ *     BSSID values used by members of the SRG.
+ * @NL80211_HE_OBSS_PD_ATTR_SR_CTRL: The SR Control field of SRP element.
  *
  * @__NL80211_HE_OBSS_PD_ATTR_LAST: Internal
  * @NL80211_HE_OBSS_PD_ATTR_MAX: highest OBSS PD attribute.
@@ -7000,6 +7007,10 @@ enum nl80211_obss_pd_attributes {
 
        NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET,
        NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET,
+       NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET,
+       NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP,
+       NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP,
+       NL80211_HE_OBSS_PD_ATTR_SR_CTRL,
 
        /* keep last */
        __NL80211_HE_OBSS_PD_ATTR_LAST,
index e501bce864365db1de52e75027b820d09da380f9..d76b8bd0e1d18f9416357793149bff2bc00633ac 100644 (file)
@@ -329,6 +329,13 @@ he_obss_pd_policy[NL80211_HE_OBSS_PD_ATTR_MAX + 1] = {
                NLA_POLICY_RANGE(NLA_U8, 1, 20),
        [NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET] =
                NLA_POLICY_RANGE(NLA_U8, 1, 20),
+       [NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET] =
+               NLA_POLICY_RANGE(NLA_U8, 1, 20),
+       [NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP] =
+               NLA_POLICY_EXACT_LEN(8),
+       [NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP] =
+               NLA_POLICY_EXACT_LEN(8),
+       [NL80211_HE_OBSS_PD_ATTR_SR_CTRL] = { .type = NLA_U8 },
 };
 
 static const struct nla_policy
@@ -4857,16 +4864,34 @@ static int nl80211_parse_he_obss_pd(struct nlattr *attrs,
        if (err)
                return err;
 
+       if (!tb[NL80211_HE_OBSS_PD_ATTR_SR_CTRL])
+               return -EINVAL;
+
+       he_obss_pd->sr_ctrl = nla_get_u8(tb[NL80211_HE_OBSS_PD_ATTR_SR_CTRL]);
+
        if (tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET])
                he_obss_pd->min_offset =
                        nla_get_u8(tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET]);
        if (tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET])
                he_obss_pd->max_offset =
                        nla_get_u8(tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET]);
+       if (tb[NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET])
+               he_obss_pd->non_srg_max_offset =
+                       nla_get_u8(tb[NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET]);
 
        if (he_obss_pd->min_offset > he_obss_pd->max_offset)
                return -EINVAL;
 
+       if (tb[NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP])
+               memcpy(he_obss_pd->bss_color_bitmap,
+                      nla_data(tb[NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP]),
+                      sizeof(he_obss_pd->bss_color_bitmap));
+
+       if (tb[NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP])
+               memcpy(he_obss_pd->partial_bssid_bitmap,
+                      nla_data(tb[NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP]),
+                      sizeof(he_obss_pd->partial_bssid_bitmap));
+
        he_obss_pd->enable = true;
 
        return 0;