Skip to content

Commit

Permalink
wifi: nl80211: add MLO link ID to the NL80211_CMD_FRAME TX API
Browse files Browse the repository at this point in the history
Allow optionally specifying the link ID to transmit on,
which can be done instead of the link frequency, on an
MLD addressed frame. Both can also be omitted in which
case the frame must be MLD addressed and link selection
(and address translation) will be done on lower layers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Jul 22, 2022
1 parent 2ec833a commit 95f498b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -3411,6 +3411,9 @@ struct cfg80211_update_ft_ies_params {
* @dont_wait_for_ack: tells the low level not to wait for an ack
* @n_csa_offsets: length of csa_offsets array
* @csa_offsets: array of all the csa offsets in the frame
* @link_id: for MLO, the link ID to transmit on, -1 if not given; note
* that the link ID isn't validated (much), it's in range but the
* link might not exist (or be used by the receiver STA)
*/
struct cfg80211_mgmt_tx_params {
struct ieee80211_channel *chan;
Expand All @@ -3422,6 +3425,7 @@ struct cfg80211_mgmt_tx_params {
bool dont_wait_for_ack;
int n_csa_offsets;
const u16 *csa_offsets;
int link_id;
};

/**
Expand Down
4 changes: 4 additions & 0 deletions include/uapi/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@
* %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA
* counters which will be updated to the current value. This attribute
* is used during CSA period.
* For TX on an MLD, the frequency can be omitted and the link ID be
* specified, or if transmitting to a known peer MLD (with MLD addresses
* in the frame) both can be omitted and the link will be selected by
* lower layers.
* For RX notification, %NL80211_ATTR_RX_HW_TIMESTAMP may be included to
* indicate the frame RX timestamp and %NL80211_ATTR_TX_HW_TIMESTAMP may
* be included to indicate the ack TX timestamp.
Expand Down
12 changes: 12 additions & 0 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -12256,6 +12256,18 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
wdev_unlock(wdev);
return -EBUSY;
}

params.link_id = nl80211_link_id_or_invalid(info->attrs);
/*
* This now races due to the unlock, but we cannot check
* the valid links for the _station_ anyway, so that's up
* to the driver.
*/
if (params.link_id >= 0 &&
!(wdev->valid_links & BIT(params.link_id))) {
wdev_unlock(wdev);
return -EINVAL;
}
wdev_unlock(wdev);

params.buf = nla_data(info->attrs[NL80211_ATTR_FRAME]);
Expand Down

0 comments on commit 95f498b

Please sign in to comment.