2023-09-21 03:01:40

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH v2 00/18] cfg80211/mac80211 patches from our internal tree 2023-09-18

From: Gregory Greenman <[email protected]>

Hi,

A bunch of patches from our internal tree with mac80211 and
cfg80211 changes. It's the usual developement, cleanups and
bugfixes.

v2: Modified patches 13 and 14 according to the received comments
(update draft version to D4, rename t2l_map to ttlm to have the
same terminology as the draft and add some kernel-doc); Fixed
typo in commit message of patch 11.

The changes in this patch set are:

* add implementation for set_antenna API
* CSA fixes
* initial support for TID to link mapping
* MLO improvements
* fixes and cleanups

Thanks,
Gregory

Ayala Beker (3):
wifi: mac80211: don't connect to an AP while it's in a CSA process
wifi: mac80211: add support for parsing TID to Link mapping element
wifi: mac80211: support handling of advertised TID-to-link mapping

Benjamin Berg (3):
wifi: cfg80211: report per-link errors during association
wifi: mac80211: report per-link error during association
wifi: mac80211: reject MLO channel configuration if not supported

Emmanuel Grumbach (1):
wifi: mac80211: update the rx_chains after set_antenna()

Ilan Peer (3):
wifi: cfg80211: Fix 6GHz scan configuration
wifi: mac80211: Notify the low level driver on change in MLO valid
links
wifi: mac80211_hwsim: Handle BSS_CHANGED_VALID_LINKS

Johannes Berg (8):
wifi: mac80211: use bandwidth indication element for CSA
wifi: mac80211: relax RCU check in for_each_vif_active_link()
wifi: mac80211: allow for_each_sta_active_link() under RCU
wifi: cfg80211: reg: describe return values in kernel-doc
wifi: mac80211: describe return values in kernel-doc
wifi: mac80211_hwsim: move kernel-doc description
wifi: mac80211: work around Cisco AP 9115 VHT MPDU length
wifi: mac80211: support antenna control in injection

drivers/net/wireless/virtual/mac80211_hwsim.c | 26 +-
include/linux/ieee80211.h | 83 +++++
include/net/cfg80211.h | 3 +
include/net/mac80211.h | 12 +-
net/mac80211/cfg.c | 11 +-
net/mac80211/ibss.c | 2 +-
net/mac80211/ieee80211_i.h | 22 +-
net/mac80211/main.c | 3 +-
net/mac80211/mesh_plink.c | 2 +-
net/mac80211/mlme.c | 284 +++++++++++++++++-
net/mac80211/spectmgmt.c | 13 +-
net/mac80211/tx.c | 16 +
net/mac80211/util.c | 52 +++-
net/mac80211/vht.c | 16 +-
net/wireless/nl80211.c | 50 ++-
net/wireless/reg.c | 16 +-
net/wireless/scan.c | 4 +
17 files changed, 562 insertions(+), 53 deletions(-)

--
2.38.1


2023-09-21 03:49:41

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH v2 07/18] wifi: mac80211: describe return values in kernel-doc

From: Johannes Berg <[email protected]>

Add descriptions for two return values for two functions
that are missing them.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
net/mac80211/tx.c | 2 ++
net/mac80211/util.c | 2 ++
2 files changed, 4 insertions(+)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 9b845fbf923c..932516f8cc13 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4474,6 +4474,8 @@ static void ieee80211_mlo_multicast_tx(struct net_device *dev,
* @dev: incoming interface
*
* On failure skb will be freed.
+ *
+ * Returns: the netdev TX status (but really only %NETDEV_TX_OK)
*/
netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
struct net_device *dev)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index a1e18938ce52..97c5823da0eb 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -4146,6 +4146,8 @@ u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs)
* This function calculates the RX timestamp at the given MPDU offset, taking
* into account what the RX timestamp was. An offset of 0 will just normalize
* the timestamp to TSF at beginning of MPDU reception.
+ *
+ * Returns: the calculated timestamp
*/
u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
struct ieee80211_rx_status *status,
--
2.38.1

2023-09-22 02:22:39

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH v2 13/18] wifi: mac80211: add support for parsing TID to Link mapping element

From: Ayala Beker <[email protected]>

Add the relevant definitions for TID to Link mapping element
according to the P802.11be_D4.0.

Signed-off-by: Ayala Beker <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
include/linux/ieee80211.h | 58 ++++++++++++++++++++++++++++++++++++++
net/mac80211/ieee80211_i.h | 3 ++
net/mac80211/util.c | 8 ++++++
3 files changed, 69 insertions(+)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index f11b7022d9eb..f2965ff3d7c1 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1246,6 +1246,30 @@ struct ieee80211_twt_setup {
u8 params[];
} __packed;

+#define IEEE80211_TTLM_MAX_CNT 2
+#define IEEE80211_TTLM_CONTROL_DIRECTION 0x03
+#define IEEE80211_TTLM_CONTROL_DEF_LINK_MAP 0x04
+#define IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT 0x08
+#define IEEE80211_TTLM_CONTROL_EXPECTED_DUR_PRESENT 0x10
+#define IEEE80211_TTLM_CONTROL_LINK_MAP_SIZE 0x20
+
+#define IEEE80211_TTLM_DIRECTION_DOWN 0
+#define IEEE80211_TTLM_DIRECTION_UP 1
+#define IEEE80211_TTLM_DIRECTION_BOTH 2
+
+/**
+ * struct ieee80211_ttlm_elem - TID-To-Link Mapping element
+ *
+ * Defined in section 9.4.2.314 in P802.11be_D4
+ *
+ * @control: the first part of control field
+ * @optional: the second part of control field
+ */
+struct ieee80211_ttlm_elem {
+ u8 control;
+ u8 optional[];
+} __packed;
+
struct ieee80211_mgmt {
__le16 frame_control;
__le16 duration;
@@ -3618,6 +3642,7 @@ enum ieee80211_eid_ext {
WLAN_EID_EXT_EHT_OPERATION = 106,
WLAN_EID_EXT_EHT_MULTI_LINK = 107,
WLAN_EID_EXT_EHT_CAPABILITY = 108,
+ WLAN_EID_EXT_TID_TO_LINK_MAPPING = 109,
WLAN_EID_EXT_BANDWIDTH_INDICATION = 135,
};

@@ -5155,6 +5180,39 @@ static inline bool ieee80211_mle_reconf_sta_prof_size_ok(const u8 *data,
fixed + prof->sta_info_len - 1 <= len;
}

+static inline bool ieee80211_tid_to_link_map_size_ok(const u8 *data, size_t len)
+{
+ const struct ieee80211_ttlm_elem *t2l = (const void *)data;
+ u8 control, fixed = sizeof(*t2l), elem_len = 0;
+
+ if (len < fixed)
+ return false;
+
+ control = t2l->control;
+
+ if (control & IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT)
+ elem_len += 2;
+ if (control & IEEE80211_TTLM_CONTROL_EXPECTED_DUR_PRESENT)
+ elem_len += 3;
+
+ if (!(control & IEEE80211_TTLM_CONTROL_DEF_LINK_MAP)) {
+ u8 bm_size;
+
+ elem_len += 1;
+ if (len < fixed + elem_len)
+ return false;
+
+ if (control & IEEE80211_TTLM_CONTROL_LINK_MAP_SIZE)
+ bm_size = 1;
+ else
+ bm_size = 2;
+
+ elem_len += hweight8(t2l->optional[0]) * bm_size;
+ }
+
+ return len >= fixed + elem_len;
+}
+
#define for_each_mle_subelement(_elem, _data, _len) \
if (ieee80211_mle_size_ok(_data, _len)) \
for_each_element(_elem, \
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 6c56ec42dde9..3209c7c11207 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1678,6 +1678,7 @@ struct ieee802_11_elems {
const struct ieee80211_multi_link_elem *ml_basic;
const struct ieee80211_multi_link_elem *ml_reconf;
const struct ieee80211_bandwidth_indication *bandwidth_indication;
+ const struct ieee80211_ttlm_elem *ttlm[IEEE80211_TTLM_MAX_CNT];

/* length of them, respectively */
u8 ext_capab_len;
@@ -1711,6 +1712,8 @@ struct ieee802_11_elems {
/* The reconfiguration Multi-Link element in the original IEs */
const struct element *ml_reconf_elem;

+ u8 ttlm_num;
+
/*
* store the per station profile pointer and length in case that the
* parsing also handled Multi-Link element parsing for a specific link
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 97c5823da0eb..98a3bffc6991 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -995,6 +995,14 @@ ieee80211_parse_extension_element(u32 *crc,
elems->bandwidth_indication = data;
calc_crc = true;
break;
+ case WLAN_EID_EXT_TID_TO_LINK_MAPPING:
+ calc_crc = true;
+ if (ieee80211_tid_to_link_map_size_ok(data, len) &&
+ elems->ttlm_num < ARRAY_SIZE(elems->ttlm)) {
+ elems->ttlm[elems->ttlm_num] = (void *)data;
+ elems->ttlm_num++;
+ }
+ break;
}

if (crc && calc_crc)
--
2.38.1

2023-09-22 05:24:53

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH v2 02/18] wifi: mac80211: update the rx_chains after set_antenna()

From: Emmanuel Grumbach <[email protected]>

rx_chains was set only upon registration and it we rely on it for the
active chains upon SMPS configuration after association.

When we use the set_antenna() API to limit the rx_chains from 2 to 1,
this caused issues with iwlwifi since we still had 2 active_chains
requested.

Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
net/mac80211/cfg.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e751d4eba8f5..6b3ccb55aae5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4044,11 +4044,17 @@ ieee80211_update_mgmt_frame_registrations(struct wiphy *wiphy,
static int ieee80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
{
struct ieee80211_local *local = wiphy_priv(wiphy);
+ int ret;

if (local->started)
return -EOPNOTSUPP;

- return drv_set_antenna(local, tx_ant, rx_ant);
+ ret = drv_set_antenna(local, tx_ant, rx_ant);
+ if (ret)
+ return ret;
+
+ local->rx_chains = hweight8(rx_ant);
+ return 0;
}

static int ieee80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant)
--
2.38.1