History

wifi: cfg80211: report per wiphy radio antenna mask

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.

Felix Fietkau committed 2 years ago

Commit ebda7161 parent 7b68f633 files · +12 −0Browse files

Unified · Split

3 files
  1. include/net/cfg80211.h +4 −0
  2. include/uapi/linux/nl80211.h +3 −0
  3. net/wireless/nl80211.c +5 −0
include/net/cfg80211.h+4−0
@@ -5434,6 +5434,8 @@ struct wiphy_radio_freq_range { · 5433 unmodified lines
54345434 * @iface_combinations: Valid interface combinations array, should not
54355435 * list single interface types.
54365436 * @n_iface_combinations: number of entries in @iface_combinations array.
5437+ *
5438+ * @antenna_mask: bitmask of antennas connected to this radio.
54375439 */
54385440 struct wiphy_radio {
54395441 const struct wiphy_radio_freq_range *freq_range;
@@ -5441,6 +5443,8 @@ struct wiphy_radio { · 1 unmodified line
54415443
54425444 const struct ieee80211_iface_combination *iface_combinations;
54435445 int n_iface_combinations;
5446+
5447+ u32 antenna_mask;
54445448 };
54455449
54465450 #define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff
include/uapi/linux/nl80211.h+3−0
@@ -8036,6 +8036,8 @@ enum nl80211_ap_settings_flags { · 8035 unmodified lines
80368036 * @NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION: Supported interface
80378037 * combination for this radio. Attribute may be present multiple times
80388038 * and contains attributes defined in &enum nl80211_if_combination_attrs.
8039+ * @NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK: bitmask (u32) of antennas
8040+ * connected to this radio.
80398041 *
80408042 * @__NL80211_WIPHY_RADIO_ATTR_LAST: Internal
80418043 * @NL80211_WIPHY_RADIO_ATTR_MAX: Highest attribute
@@ -8046,6 +8048,7 @@ enum nl80211_wiphy_radio_attrs { · 4 unmodified lines
80468048 NL80211_WIPHY_RADIO_ATTR_INDEX,
80478049 NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE,
80488050 NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION,
8051+ NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK,
80498052
80508053 /* keep last */
80518054 __NL80211_WIPHY_RADIO_ATTR_LAST,
net/wireless/nl80211.c+5−0
@@ -2431,6 +2431,11 @@ static int nl80211_put_radio(struct wiphy *wiphy, struct sk_buff *msg, int idx) · 2430 unmodified lines
24312431 if (nla_put_u32(msg, NL80211_WIPHY_RADIO_ATTR_INDEX, idx))
24322432 goto nla_put_failure;
24332433
2434+ if (r->antenna_mask &&
2435+ nla_put_u32(msg, NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK,
2436+ r->antenna_mask))
2437+ goto nla_put_failure;
2438+
24342439 for (i = 0; i < r->n_freq_range; i++) {
24352440 const struct wiphy_radio_freq_range *range = &r->freq_range[i];
24362441