Skip to content

Commit

Permalink
nl80211: add new attributes for multi-radio support
Browse files Browse the repository at this point in the history
- vif radio mask: used to assign vifs to specific radios
- monitor skip_tx flag: do not pass locally transmitted packets on the monitor interface
- radio antenna mask: radio specific part of the phy antenna mask

Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
nbd168 committed Oct 23, 2024
1 parent 1423ad7 commit 8af77e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
10 changes: 10 additions & 0 deletions include/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -2868,6 +2868,9 @@ enum nl80211_commands {
* nested item, it contains attributes defined in
* &enum nl80211_if_combination_attrs.
*
* @NL80211_ATTR_VIF_RADIO_MASK: Bitmask of allowed radios (u32).
* A value of 0 means all radios.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
Expand Down Expand Up @@ -3416,6 +3419,8 @@ enum nl80211_attrs {
NL80211_ATTR_WIPHY_RADIOS,
NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS,

NL80211_ATTR_VIF_RADIO_MASK,

/* add attributes here, update the policy in nl80211.c */

__NL80211_ATTR_AFTER_LAST,
Expand Down Expand Up @@ -4698,6 +4703,7 @@ enum nl80211_survey_info {
* overrides all other flags.
* @NL80211_MNTR_FLAG_ACTIVE: use the configured MAC address
* and ACK incoming unicast packets.
* @NL80211_MNTR_FLAG_SKIP_TX: do not pass local tx packets
*
* @__NL80211_MNTR_FLAG_AFTER_LAST: internal use
* @NL80211_MNTR_FLAG_MAX: highest possible monitor flag
Expand All @@ -4710,6 +4716,7 @@ enum nl80211_mntr_flags {
NL80211_MNTR_FLAG_OTHER_BSS,
NL80211_MNTR_FLAG_COOK_FRAMES,
NL80211_MNTR_FLAG_ACTIVE,
NL80211_MNTR_FLAG_SKIP_TX,

/* keep last */
__NL80211_MNTR_FLAG_AFTER_LAST,
Expand Down Expand Up @@ -8031,6 +8038,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
Expand All @@ -8041,6 +8050,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,
Expand Down
9 changes: 6 additions & 3 deletions lib/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,15 @@ static const uc_nl_nested_spec_t nl80211_mesh_setup_nla = {

static const uc_nl_nested_spec_t nl80211_mntr_flags_nla = {
.headsize = 0,
.nattrs = 6,
.nattrs = 7,
.attrs = {
{ NL80211_MNTR_FLAG_FCSFAIL, "fcsfail", DT_FLAG, 0, NULL },
{ NL80211_MNTR_FLAG_PLCPFAIL, "plcpfail", DT_FLAG, 0, NULL },
{ NL80211_MNTR_FLAG_CONTROL, "control", DT_FLAG, 0, NULL },
{ NL80211_MNTR_FLAG_OTHER_BSS, "other_bss", DT_FLAG, 0, NULL },
{ NL80211_MNTR_FLAG_COOK_FRAMES, "cook_frames", DT_FLAG, 0, NULL },
{ NL80211_MNTR_FLAG_ACTIVE, "active", DT_FLAG, 0, NULL },
{ NL80211_MNTR_FLAG_SKIP_TX, "skip_tx", DT_FLAG, 0, NULL },
}
};

Expand Down Expand Up @@ -850,17 +851,18 @@ static const uc_nl_nested_spec_t nl80211_radio_freq_range_nla = {

static const uc_nl_nested_spec_t nl80211_wiphy_radio_nla = {
.headsize = 0,
.nattrs = 3,
.nattrs = 4,
.attrs = {
{ NL80211_WIPHY_RADIO_ATTR_INDEX, "index", DT_U32, 0, NULL },
{ NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE, "freq_ranges", DT_NESTED, DF_REPEATED, &nl80211_radio_freq_range_nla },
{ NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION, "interface_combinations", DT_NESTED, DF_REPEATED, &nl80211_ifcomb_nla },
{ NL80211_WIPHY_RADIO_ATTR_ANTENNA_MASK, "antenna_mask", DT_U32, 0, NULL },
}
};

static const uc_nl_nested_spec_t nl80211_msg = {
.headsize = 0,
.nattrs = 129,
.nattrs = 130,
.attrs = {
{ NL80211_ATTR_4ADDR, "4addr", DT_U8, 0, NULL },
{ NL80211_ATTR_AIRTIME_WEIGHT, "airtime_weight", DT_U16, 0, NULL },
Expand Down Expand Up @@ -991,6 +993,7 @@ static const uc_nl_nested_spec_t nl80211_msg = {
{ NL80211_ATTR_MAX_AP_ASSOC_STA, "max_ap_assoc", DT_U16, 0, NULL },
{ NL80211_ATTR_SURVEY_INFO, "survey_info", DT_NESTED, 0, &nl80211_survey_info_nla },
{ NL80211_ATTR_WIPHY_RADIOS, "radios", DT_NESTED, DF_MULTIPLE|DF_AUTOIDX, &nl80211_wiphy_radio_nla },
{ NL80211_ATTR_VIF_RADIO_MASK, "vif_radio_mask", DT_U32, 0, NULL },
}
};

Expand Down

0 comments on commit 8af77e7

Please sign in to comment.