]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: cfg80211: report per wiphy radio antenna mask
authorFelix Fietkau <nbd@nbd.name>
Wed, 9 Oct 2024 08:25:45 +0000 (10:25 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 23 Oct 2024 14:45:03 +0000 (16:45 +0200)
With multi-radio devices, each radio typically gets a fixed set of antennas.
In order to be able to disable specific antennas for some radios, user space
needs to know which antenna mask bits are assigned to which radio.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://patch.msgid.link/e0a26afa2c88eaa188ec96ec6d17ecac4e827641.1728462320.git-series.nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c

index 95d05e67e69aa653ce3b31bec70e02690464a4b3..3100733f3e231147c277ff109a19ecbacfed7697 100644 (file)
@@ -5434,6 +5434,8 @@ struct wiphy_radio_freq_range {
  * @iface_combinations: Valid interface combinations array, should not
  *     list single interface types.
  * @n_iface_combinations: number of entries in @iface_combinations array.
+ *
+ * @antenna_mask: bitmask of antennas connected to this radio.
  */
 struct wiphy_radio {
        const struct wiphy_radio_freq_range *freq_range;
@@ -5441,6 +5443,8 @@ struct wiphy_radio {
 
        const struct ieee80211_iface_combination *iface_combinations;
        int n_iface_combinations;
+
+       u32 antenna_mask;
 };
 
 #define CFG80211_HW_TIMESTAMP_ALL_PEERS        0xffff
index d31ccee99cc7652c4a095f7be725dfd3c66343b3..1b8827f920ff70563f627e27af2ac62b73f5786e 100644 (file)
@@ -8036,6 +8036,8 @@ enum nl80211_ap_settings_flags {
  * @NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION: Supported interface
  *     combination for this radio. Attribute may be present multiple times
  *     and contains attributes defined in &enum nl80211_if_combination_attrs.
+ * @NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK: bitmask (u32) of antennas
+ *     connected to this radio.
  *
  * @__NL80211_WIPHY_RADIO_ATTR_LAST: Internal
  * @NL80211_WIPHY_RADIO_ATTR_MAX: Highest attribute
@@ -8046,6 +8048,7 @@ enum nl80211_wiphy_radio_attrs {
        NL80211_WIPHY_RADIO_ATTR_INDEX,
        NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE,
        NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION,
+       NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK,
 
        /* keep last */
        __NL80211_WIPHY_RADIO_ATTR_LAST,
index a330347dd7a38c1b9ee38c2389f98bab32ca767f..aa78f18dd454cecf0066989f0059fa0ce65a3b4f 100644 (file)
@@ -2431,6 +2431,11 @@ static int nl80211_put_radio(struct wiphy *wiphy, struct sk_buff *msg, int idx)
        if (nla_put_u32(msg, NL80211_WIPHY_RADIO_ATTR_INDEX, idx))
                goto nla_put_failure;
 
+       if (r->antenna_mask &&
+           nla_put_u32(msg, NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK,
+                       r->antenna_mask))
+               goto nla_put_failure;
+
        for (i = 0; i < r->n_freq_range; i++) {
                const struct wiphy_radio_freq_range *range = &r->freq_range[i];