cfg80211: allow advertising vendor-specific capabilities
authorJohannes Berg <johannes.berg@intel.com>
Fri, 18 Jun 2021 10:41:52 +0000 (13:41 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 23 Jun 2021 11:05:09 +0000 (13:05 +0200)
There may be cases where vendor-specific elements need to be
used over the air. Rather than have driver or firmware add
them and possibly cause problems that way, add them to the
iftype-data band capabilities. This way we can advertise to
userspace first, and use them in mac80211 next.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210618133832.e8c4f0347276.Iee5964682b3e9ec51fc1cd57a7c62383eaf6ddd7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c

index 481e4e2..c93a2cd 100644 (file)
@@ -371,11 +371,18 @@ struct ieee80211_sta_he_cap {
  * @he_cap: holds the HE capabilities
  * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
  *     6 GHz band channel (and 0 may be valid value).
+ * @vendor_elems: vendor element(s) to advertise
+ * @vendor_elems.data: vendor element(s) data
+ * @vendor_elems.len: vendor element(s) length
  */
 struct ieee80211_sband_iftype_data {
        u16 types_mask;
        struct ieee80211_sta_he_cap he_cap;
        struct ieee80211_he_6ghz_capa he_6ghz_capa;
+       struct {
+               const u8 *data;
+               unsigned int len;
+       } vendor_elems;
 };
 
 /**
index 771f238..db47499 100644 (file)
@@ -3654,6 +3654,8 @@ enum nl80211_mpath_info {
  *     defined
  * @NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA: HE 6GHz band capabilities (__le16),
  *     given for all 6 GHz band channels
+ * @NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS: vendor element capabilities that are
+ *     advertised on this band/for this iftype (binary)
  * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use
  */
 enum nl80211_band_iftype_attr {
@@ -3665,6 +3667,7 @@ enum nl80211_band_iftype_attr {
        NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET,
        NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE,
        NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA,
+       NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS,
 
        /* keep last */
        __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST,
index 4c61cf6..50eb405 100644 (file)
@@ -1731,6 +1731,11 @@ nl80211_send_iftype_data(struct sk_buff *msg,
                    &iftdata->he_6ghz_capa))
                return -ENOBUFS;
 
+       if (iftdata->vendor_elems.data && iftdata->vendor_elems.len &&
+           nla_put(msg, NL80211_BAND_IFTYPE_ATTR_VENDOR_ELEMS,
+                   iftdata->vendor_elems.len, iftdata->vendor_elems.data))
+               return -ENOBUFS;
+
        return 0;
 }