2023-09-28 17:14:26

by Greenman, Gregory

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

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.

Thanks,
Gregory

Benjamin Berg (2):
wifi: mac80211: cleanup auth_data only if association continues
wifi: mac80211: mesh: fix some kdoc warnings

Emmanuel Grumbach (1):
wifi: mac80211: fix a expired vs. cancel race in roc

Ilan Peer (5):
wifi: mac80211: Rename and update IEEE80211_VIF_DISABLE_SMPS_OVERRIDE
wifi: cfg80211: Include operating class 137 in 6GHz band
wifi: cfg80211: Handle specific BSSID in 6GHz scanning
wifi: mac80211: Fix setting vif links
wifi: cfg80211: Fix typo in documentation

Johannes Berg (4):
wifi: mac80211: drop robust action frames before assoc
wifi: mac80211: don't recreate driver link debugfs in reconfig
wifi: cfg80211: wext: convert return value to kernel-doc
wifi: mac80211: flush STA queues on unauthorization

Miri Korenblit (6):
wifi: mac80211: add a driver callback to add vif debugfs
wifi: mac80211: handle debugfs when switching to/from MLO
wifi: mac80211: Check if we had first beacon with relevant links
wifi: mac80211: add link id to mgd_prepare_tx()
wifi: mac80211: make mgd_protect_tdls_discover MLO-aware
wifi: mac80211: purge TX queues in flush_queues flow

.../wireless/intel/iwlwifi/mvm/mld-mac80211.c | 6 +-
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 +-
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c | 5 +-
include/net/cfg80211.h | 2 +-
include/net/mac80211.h | 18 ++++--
net/mac80211/cfg.c | 6 ++
net/mac80211/debugfs_netdev.c | 28 +++++++--
net/mac80211/debugfs_netdev.h | 15 ++++-
net/mac80211/driver-ops.c | 23 +++++--
net/mac80211/driver-ops.h | 32 +++++++++-
net/mac80211/ieee80211_i.h | 1 +
net/mac80211/iface.c | 2 +-
net/mac80211/link.c | 7 ++-
net/mac80211/mesh.c | 8 ++-
net/mac80211/mesh_hwmp.c | 2 +
net/mac80211/mesh_pathtbl.c | 20 ++++---
net/mac80211/mesh_plink.c | 6 +-
net/mac80211/mesh_ps.c | 6 +-
net/mac80211/mesh_sync.c | 4 +-
net/mac80211/mlme.c | 41 ++++++++++---
net/mac80211/offchannel.c | 17 ++++++
net/mac80211/rx.c | 9 +++
net/mac80211/sta_info.c | 60 ++++++++++++-------
net/mac80211/tdls.c | 2 +-
net/mac80211/util.c | 13 ++++
net/wireless/scan.c | 37 ++++++++++++
net/wireless/util.c | 1 +
net/wireless/wext-compat.c | 4 +-
28 files changed, 304 insertions(+), 74 deletions(-)

--
2.38.1


2023-09-28 17:31:10

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 01/18] wifi: mac80211: cleanup auth_data only if association continues

From: Benjamin Berg <[email protected]>

If the association command fails then the authentication is still valid
and it makes sense to keep it alive. Otherwise, we would currently get
into an inconsistent state because mac80211 on the one hand is
disconnected but on the other hand the state is not entirely cleared
and a new authentication could not continue.

Signed-off-by: Benjamin Berg <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
net/mac80211/mlme.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index dc9a94bd3b11..e92598dcf3ed 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -7715,7 +7715,10 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
match = ether_addr_equal(ifmgd->auth_data->ap_addr,
assoc_data->ap_addr) &&
ifmgd->auth_data->link_id == req->link_id;
- ieee80211_destroy_auth_data(sdata, match);
+
+ /* Cleanup is delayed if auth_data matches */
+ if (!match)
+ ieee80211_destroy_auth_data(sdata, false);
}

/* prepare assoc data */
@@ -7938,11 +7941,17 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,

run_again(sdata, assoc_data->timeout);

+ /* We are associating, clean up auth_data */
+ if (ifmgd->auth_data)
+ ieee80211_destroy_auth_data(sdata, true);
+
return 0;
err_clear:
- eth_zero_addr(sdata->deflink.u.mgd.bssid);
- ieee80211_link_info_change_notify(sdata, &sdata->deflink,
- BSS_CHANGED_BSSID);
+ if (!ifmgd->auth_data) {
+ eth_zero_addr(sdata->deflink.u.mgd.bssid);
+ ieee80211_link_info_change_notify(sdata, &sdata->deflink,
+ BSS_CHANGED_BSSID);
+ }
ifmgd->assoc_data = NULL;
err_free:
kfree(assoc_data);
--
2.38.1

2023-09-28 18:04:25

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 15/18] wifi: mac80211: fix a expired vs. cancel race in roc

From: Emmanuel Grumbach <[email protected]>

When the remain on channel is removed at the time it should
have expired, we have a race: the driver could be handling
the flow of the expiration while mac80211 is cancelling
that very same remain on channel request.

This wouldn't be problem in itself, but since mac80211
can send the next request to the driver in the cancellation
flow, we can get to the following situation:

CPU0 CPU1
expiration of roc in driver
ieee80211_remain_on_channel_expired()
Cancellation of the roc
schedules a worker (hw_roc_done)
Add next roc
hw_roc_done_wk runs and ends
the second roc prematurely.

Since, by design, there is only one single request sent to the
driver at a time, we can safely assume that after the cancel()
request returns from the driver, we should not handle any worker
that handles the expiration of the request.

Cancel the hw_roc_done worker after the cancellation to make
sure we start the next one with a clean slate.

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

diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 071582dbe6a5..6c4080202573 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -717,6 +717,23 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
return ret;
}

+ /*
+ * We could be racing against the notification from the driver:
+ * + driver is handling the notification on CPU0
+ * + user space is cancelling the remain on channel and
+ * schedules the hw_roc_done worker.
+ *
+ * Now hw_roc_done might start to run after the next roc will
+ * start and mac80211 will think that this second roc has
+ * ended prematurely.
+ * Cancel the work to make sure that all the pending workers
+ * have completed execution.
+ * Note that this assumes that by the time the driver returns
+ * from drv_cancel_remain_on_channel, it has completed all
+ * the processing of related notifications.
+ */
+ wiphy_work_cancel(local->hw.wiphy, &local->hw_roc_done);
+
/* TODO:
* if multiple items were combined here then we really shouldn't
* cancel them all - we should wait for as much time as needed
--
2.38.1

2023-09-28 18:07:43

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 02/18] wifi: mac80211: drop robust action frames before assoc

From: Johannes Berg <[email protected]>

To be able to more easily understand the code, drop robust
action frames before being associated, even if there's no
MFP in the end, as they are Class 3 Frames and shouldn't
be transmitted in the first place.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
net/mac80211/rx.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index fb2d4a7436be..aec851c722f1 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2473,6 +2473,15 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
return RX_DROP_U_UNPROT_UNICAST_PUB_ACTION;
}

+ /*
+ * Drop robust action frames before assoc regardless of MFP state,
+ * after assoc we also have decided on MFP or not.
+ */
+ if (ieee80211_is_action(fc) &&
+ ieee80211_is_robust_mgmt_frame(rx->skb) &&
+ (!rx->sta || !test_sta_flag(rx->sta, WLAN_STA_ASSOC)))
+ return -EACCES;
+
return 0;
}

--
2.38.1

2023-09-28 18:10:40

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 13/18] wifi: mac80211: add link id to mgd_prepare_tx()

From: Miri Korenblit <[email protected]>

As we are moving to MLO and links terms, also the airtime protection
will be done for a link rather than for a vif. Thus, some
drivers will need to know for which link to protect airtime.
Add link id as a parameter to the mgd_prepare_tx() callback.

Signed-off-by: Miri Korenblit <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
include/net/mac80211.h | 3 +++
net/mac80211/driver-ops.h | 1 +
net/mac80211/mlme.c | 9 ++++++++-
3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 7dae9aac089c..db3e3bd62a61 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3641,11 +3641,14 @@ enum ieee80211_reconfig_type {
* @success: whether the frame exchange was successful, only
* used with the mgd_complete_tx() method, and then only
* valid for auth and (re)assoc.
+ * @link_id: the link id on which the frame will be TX'ed.
+ * Only used with the mgd_prepare_tx() method.
*/
struct ieee80211_prep_tx_info {
u16 duration;
u16 subtype;
u8 success:1;
+ int link_id;
};

/**
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index e07e65da15ee..3c8eb6afd6fd 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -928,6 +928,7 @@ static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
return;
WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);

+ info->link_id = info->link_id < 0 ? 0 : info->link_id;
trace_drv_mgd_prepare_tx(local, sdata, info->duration,
info->subtype, info->success);
if (local->ops->mgd_prepare_tx)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e3db27ec6793..d19940864774 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1583,6 +1583,7 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)

ifmgd->assoc_req_ies_len = pos - ie_start;

+ info.link_id = assoc_data->assoc_link_id;
drv_mgd_prepare_tx(local, sdata, &info);

IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
@@ -2947,8 +2948,10 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
if (link->u.mgd.have_beacon)
break;
}
- if (link_id == IEEE80211_MLD_MAX_NUM_LINKS)
+ if (link_id == IEEE80211_MLD_MAX_NUM_LINKS) {
+ info.link_id = ffs(sdata->vif.active_links) - 1;
drv_mgd_prepare_tx(sdata->local, sdata, &info);
+ }
}

ieee80211_send_deauth_disassoc(sdata, sdata->vif.cfg.ap_addr,
@@ -3576,6 +3579,7 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
u32 tx_flags = 0;
struct ieee80211_prep_tx_info info = {
.subtype = IEEE80211_STYPE_AUTH,
+ .link_id = auth_data->link_id,
};

pos = mgmt->u.auth.variable;
@@ -6566,6 +6570,7 @@ static int ieee80211_auth(struct ieee80211_sub_if_data *sdata)
if (auth_data->algorithm == WLAN_AUTH_SAE)
info.duration = jiffies_to_msecs(IEEE80211_AUTH_TIMEOUT_SAE);

+ info.link_id = auth_data->link_id;
drv_mgd_prepare_tx(local, sdata, &info);

sdata_info(sdata, "send auth to %pM (try %d/%d)\n",
@@ -7986,6 +7991,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
req->bssid, req->reason_code,
ieee80211_get_reason_code_string(req->reason_code));

+ info.link_id = ifmgd->auth_data->link_id;
drv_mgd_prepare_tx(sdata->local, sdata, &info);
ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid,
IEEE80211_STYPE_DEAUTH,
@@ -8006,6 +8012,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
req->bssid, req->reason_code,
ieee80211_get_reason_code_string(req->reason_code));

+ info.link_id = ifmgd->assoc_data->assoc_link_id;
drv_mgd_prepare_tx(sdata->local, sdata, &info);
ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid,
IEEE80211_STYPE_DEAUTH,
--
2.38.1

2023-09-28 18:33:51

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 08/18] wifi: mac80211: mesh: fix some kdoc warnings

From: Benjamin Berg <[email protected]>

These were mostly missing or incorrectly tagged return values.

Signed-off-by: Benjamin Berg <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
net/mac80211/mesh.c | 8 ++++++--
net/mac80211/mesh_hwmp.c | 2 ++
net/mac80211/mesh_pathtbl.c | 20 +++++++++++++-------
net/mac80211/mesh_plink.c | 6 +++++-
net/mac80211/mesh_ps.c | 6 +++++-
net/mac80211/mesh_sync.c | 4 +++-
6 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 0d0fbae51b61..9b1fd43df6ef 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -56,6 +56,8 @@ static void ieee80211_mesh_housekeeping_timer(struct timer_list *t)
*
* This function checks if the mesh configuration of a mesh point matches the
* local mesh configuration, i.e. if both nodes belong to the same mesh network.
+ *
+ * Returns: %true if both nodes belong to the same mesh
*/
bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
struct ieee802_11_elems *ie)
@@ -119,6 +121,8 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
* mesh_peer_accepts_plinks - check if an mp is willing to establish peer links
*
* @ie: information elements of a management frame from the mesh peer
+ *
+ * Returns: %true if the mesh peer is willing to establish peer links
*/
bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie)
{
@@ -858,7 +862,7 @@ bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata,
* @meshsa: source address in the mesh. Same as TA, as frame is
* locally originated.
*
- * Return the length of the 802.11 (does not include a mesh control header)
+ * Returns: the length of the 802.11 frame header (excludes mesh control header)
*/
int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,
const u8 *meshda, const u8 *meshsa)
@@ -891,7 +895,7 @@ int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,
* @addr6: 2nd address in the ae header, which corresponds to addr6 of the
* mesh frame
*
- * Return the header length.
+ * Returns: the header length
*/
unsigned int ieee80211_new_mesh_header(struct ieee80211_sub_if_data *sdata,
struct ieee80211s_hdr *meshhdr,
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 51369072984e..775d52561c54 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -230,6 +230,8 @@ static void prepare_frame_for_deferred_tx(struct ieee80211_sub_if_data *sdata,
* Note: This function may be called with driver locks taken that the driver
* also acquires in the TX path. To avoid a deadlock we don't transmit the
* frame directly but add it to the pending queue instead.
+ *
+ * Returns: 0 on success
*/
int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata,
u8 ttl, const u8 *target, u32 target_sn,
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 3e52aaa57b1f..8a3f44ce3e04 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2008, 2009 open80211s Ltd.
+ * Copyright (C) 2023 Intel Corporation
* Author: Luis Carlos Cobo <[email protected]>
*/

@@ -173,6 +174,11 @@ static void prepare_for_gate(struct sk_buff *skb, char *dst_addr,
/**
* mesh_path_move_to_queue - Move or copy frames from one mpath queue to another
*
+ * @gate_mpath: An active mpath the frames will be sent to (i.e. the gate)
+ * @from_mpath: The failed mpath
+ * @copy: When true, copy all the frames to the new mpath queue. When false,
+ * move them.
+ *
* This function is used to transfer or copy frames from an unresolved mpath to
* a gate mpath. The function also adds the Address Extension field and
* updates the next hop.
@@ -181,11 +187,6 @@ static void prepare_for_gate(struct sk_buff *skb, char *dst_addr,
* destination addresses are updated.
*
* The gate mpath must be an active mpath with a valid mpath->next_hop.
- *
- * @gate_mpath: An active mpath the frames will be sent to (i.e. the gate)
- * @from_mpath: The failed mpath
- * @copy: When true, copy all the frames to the new mpath queue. When false,
- * move them.
*/
static void mesh_path_move_to_queue(struct mesh_path *gate_mpath,
struct mesh_path *from_mpath,
@@ -330,6 +331,8 @@ mpp_path_lookup_by_idx(struct ieee80211_sub_if_data *sdata, int idx)
/**
* mesh_path_add_gate - add the given mpath to a mesh gate to our path table
* @mpath: gate path to add to table
+ *
+ * Returns: 0 on success, -EEXIST
*/
int mesh_path_add_gate(struct mesh_path *mpath)
{
@@ -388,6 +391,8 @@ static void mesh_gate_del(struct mesh_table *tbl, struct mesh_path *mpath)
/**
* mesh_gate_num - number of gates known to this interface
* @sdata: subif data
+ *
+ * Returns: The number of gates
*/
int mesh_gate_num(struct ieee80211_sub_if_data *sdata)
{
@@ -861,10 +866,9 @@ static void table_flush_by_iface(struct mesh_table *tbl)
/**
* mesh_path_flush_by_iface - Deletes all mesh paths associated with a given iface
*
- * This function deletes both mesh paths as well as mesh portal paths.
- *
* @sdata: interface data to match
*
+ * This function deletes both mesh paths as well as mesh portal paths.
*/
void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
{
@@ -944,6 +948,8 @@ void mesh_path_tx_pending(struct mesh_path *mpath)
* queue to that gate's queue. If there are more than one gates, the frames
* are copied from each gate to the next. After frames are copied, the
* mpath queues are emptied onto the transmission queue.
+ *
+ * Returns: 0 on success, -EHOSTUNREACH
*/
int mesh_path_send_to_gates(struct mesh_path *mpath)
{
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index a1e526419e9d..dbabeefe4515 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -153,6 +153,8 @@ static u64 mesh_set_short_slot_time(struct ieee80211_sub_if_data *sdata)
* selected if any non-HT peers are present in our MBSS. 20MHz-protection mode
* is selected if all peers in our 20/40MHz MBSS support HT and at least one
* HT20 peer is present. Otherwise no-protection mode is selected.
+ *
+ * Returns: BSS_CHANGED_HT or 0 for no change
*/
static u64 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata)
{
@@ -362,7 +364,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
* Mesh paths with this peer as next hop should be flushed
* by the caller outside of plink_lock.
*
- * Returns beacon changed flag if the beacon content changed.
+ * Returns: beacon changed flag if the beacon content changed.
*
* Locking: the caller must hold sta->mesh->plink_lock
*/
@@ -390,6 +392,8 @@ static u64 __mesh_plink_deactivate(struct sta_info *sta)
* @sta: mesh peer link to deactivate
*
* All mesh paths with this peer as next hop will be flushed
+ *
+ * Returns: beacon changed flag if the beacon content changed.
*/
u64 mesh_plink_deactivate(struct sta_info *sta)
{
diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c
index 35eacca43e49..20e022a03933 100644
--- a/net/mac80211/mesh_ps.c
+++ b/net/mac80211/mesh_ps.c
@@ -15,6 +15,8 @@
/**
* mps_qos_null_get - create pre-addressed QoS Null frame for mesh powersave
* @sta: the station to get the frame for
+ *
+ * Returns: A newly allocated SKB
*/
static struct sk_buff *mps_qos_null_get(struct sta_info *sta)
{
@@ -77,6 +79,8 @@ static void mps_qos_null_tx(struct sta_info *sta)
*
* sets the non-peer power mode and triggers the driver PS (re-)configuration
* Return BSS_CHANGED_BEACON if a beacon update is necessary.
+ *
+ * Returns: BSS_CHANGED_BEACON if a beacon update is in order.
*/
u64 ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata)
{
@@ -147,7 +151,7 @@ u64 ieee80211_mps_local_status_update(struct ieee80211_sub_if_data *sdata)
*
* @sta: mesh STA
* @pm: the power mode to set
- * Return BSS_CHANGED_BEACON if a beacon update is in order.
+ * Returns: BSS_CHANGED_BEACON if a beacon update is in order.
*/
u64 ieee80211_mps_set_sta_local_pm(struct sta_info *sta,
enum nl80211_mesh_power_mode pm)
diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c
index 9e342cc2504c..8cf3f395f52f 100644
--- a/net/mac80211/mesh_sync.c
+++ b/net/mac80211/mesh_sync.c
@@ -3,7 +3,7 @@
* Copyright 2011-2012, Pavel Zubarev <[email protected]>
* Copyright 2011-2012, Marco Porsch <[email protected]>
* Copyright 2011-2012, cozybit Inc.
- * Copyright (C) 2021 Intel Corporation
+ * Copyright (C) 2021,2023 Intel Corporation
*/

#include "ieee80211_i.h"
@@ -37,6 +37,8 @@ struct sync_method {
* mesh_peer_tbtt_adjusting - check if an mp is currently adjusting its TBTT
*
* @cfg: mesh config element from the mesh peer (or %NULL)
+ *
+ * Returns: If the mesh peer is currently adjusting its TBTT
*/
static bool mesh_peer_tbtt_adjusting(const struct ieee80211_meshconf_ie *cfg)
{
--
2.38.1

2023-09-28 18:58:48

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 11/18] wifi: cfg80211: Fix typo in documentation

From: Ilan Peer <[email protected]>

Fix a small typo in a comment.

Signed-off-by: Ilan Peer <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
include/net/cfg80211.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 34c50f7273d1..f4cba7e601e2 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2661,7 +2661,7 @@ static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
* or no match (RSSI only)
* @rssi_thold: don't report scan results below this threshold (in s32 dBm)
* @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
- * for filtering out scan results received. Drivers advertize this support
+ * for filtering out scan results received. Drivers advertise this support
* of band specific rssi based filtering through the feature capability
* %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
* specific rssi thresholds take precedence over rssi_thold, if specified.
--
2.38.1

2023-09-28 23:09:07

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 07/18] wifi: cfg80211: Include operating class 137 in 6GHz band

From: Ilan Peer <[email protected]>

Draft P802.11be_D3.1 added operating class to describe 320 MHz
operation in the 6GHz band. Include this new operating class in
ieee80211_operating_class_to_band().

Signed-off-by: Ilan Peer <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
net/wireless/util.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index 213c9405e645..0893b7f57832 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1999,6 +1999,7 @@ bool ieee80211_operating_class_to_band(u8 operating_class,
*band = NL80211_BAND_5GHZ;
return true;
case 131 ... 135:
+ case 137:
*band = NL80211_BAND_6GHZ;
return true;
case 81:
--
2.38.1

2023-09-29 08:38:05

by Berg, Benjamin

[permalink] [raw]
Subject: Re: [PATCH 08/18] wifi: mac80211: mesh: fix some kdoc warnings

On Fri, 2023-09-29 at 08:48 +0200, Johannes Berg wrote:
> Hi,
>
> > > +++ b/net/mac80211/mesh.c
> > > @@ -56,6 +56,8 @@ static void ieee80211_mesh_housekeeping_timer(struct timer_list *t)
> > >    *
> > >    * This function checks if the mesh configuration of a mesh point matches the
> > >    * local mesh configuration, i.e. if both nodes belong to the same mesh network.
> > > + *
> > > + * Returns: %true if both nodes belong to the same mesh
> >
> > I thought kdoc used Return: not Returns:
> >
> > <https://static.lwn.net/kerneldoc/doc-guide/kernel-doc.html#function-documentation>
>
> Huh, indeed.
>
> I'm sure this actually fixed it though because we did start running
> kernel-doc on this code internally (via W=1), the issue at hand was that
> we used to compile without mesh (not supported by iwlwifi) and now added
> it for hwsim testing.
>
> So ... I looked, and indeed _both_ are accepted:

Hah, I suspect I used "Returns:" here because the file already used it
in other places. But, I am also used to "Returns:" from gtk-doc, so it
might also have felt natural to me because of that.

My hunch is, that it really doesn't matter and it can be left as-is for
now. But it is also obviously true that it may be surprising and the
extra consistency would help. So, a follow up patch to make everything
consistent seems reasonable to me.

Benjamin

> scripts/kernel-doc:
>
>         } elsif ($newsection =~ m/^returns?$/i) {
>             $newsection = $section_return;
>         } elsif ($newsection =~ m/^\@return$/) {
>             # special: @return is a section, not a param description
>             $newsection = $section_return;
>
>
> which I guess means
>
>  /**
>   * foo - ...
>   *
>   * Returns: bar
>   */
>
> and
>
>  /**
>   * foo - ...
>   *
>   * Return: bar
>   */
>
> and
>
>  /**
>   * foo - ...
>   *
>   * @return
>   * bar
>   */
>
> are all accepted.
>
>
> Though "Return:" is more common, perhaps due to the docs:
>
> $ git grep ' \* Returns:' -- | wc -l
> 3066
> $ git grep ' \* Return:' -- | wc -l
> 9189
>
>
> Personally, I find "Returns: %true if both nodes ..." to be nicer to
> read, since it's more like a sentence?
>
> But then again it depends on whether you're reading it as a description
> or an instruction, I guess. "Returns: something" is a description, and
> "Return: something" is an instruction (for the function). Hmm.
>
> I'm inclined to say I like the descriptive text better, but since it
> shows up in the generated documentation with "Return" anyway, maybe it's
> better to have it in the same way in the code?
>
> Though of course it's (slightly) easier to just apply it as is :)
>
> What do you (and others!) think? Does it matter?
>
> johannes

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, http://www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

2023-09-29 15:19:18

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH 08/18] wifi: mac80211: mesh: fix some kdoc warnings

On 9/28/2023 7:35 AM, [email protected] wrote:
> From: Benjamin Berg <[email protected]>
>
> These were mostly missing or incorrectly tagged return values.
>
> Signed-off-by: Benjamin Berg <[email protected]>
> Signed-off-by: Gregory Greenman <[email protected]>
> ---
> net/mac80211/mesh.c | 8 ++++++--
> net/mac80211/mesh_hwmp.c | 2 ++
> net/mac80211/mesh_pathtbl.c | 20 +++++++++++++-------
> net/mac80211/mesh_plink.c | 6 +++++-
> net/mac80211/mesh_ps.c | 6 +++++-
> net/mac80211/mesh_sync.c | 4 +++-
> 6 files changed, 34 insertions(+), 12 deletions(-)
>
> diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
> index 0d0fbae51b61..9b1fd43df6ef 100644
> --- a/net/mac80211/mesh.c
> +++ b/net/mac80211/mesh.c
> @@ -56,6 +56,8 @@ static void ieee80211_mesh_housekeeping_timer(struct timer_list *t)
> *
> * This function checks if the mesh configuration of a mesh point matches the
> * local mesh configuration, i.e. if both nodes belong to the same mesh network.
> + *
> + * Returns: %true if both nodes belong to the same mesh

I thought kdoc used Return: not Returns:

<https://static.lwn.net/kerneldoc/doc-guide/kernel-doc.html#function-documentation>

2023-09-29 15:52:00

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 08/18] wifi: mac80211: mesh: fix some kdoc warnings

Hi,

> > +++ b/net/mac80211/mesh.c
> > @@ -56,6 +56,8 @@ static void ieee80211_mesh_housekeeping_timer(struct timer_list *t)
> > *
> > * This function checks if the mesh configuration of a mesh point matches the
> > * local mesh configuration, i.e. if both nodes belong to the same mesh network.
> > + *
> > + * Returns: %true if both nodes belong to the same mesh
>
> I thought kdoc used Return: not Returns:
>
> <https://static.lwn.net/kerneldoc/doc-guide/kernel-doc.html#function-documentation>

Huh, indeed.

I'm sure this actually fixed it though because we did start running
kernel-doc on this code internally (via W=1), the issue at hand was that
we used to compile without mesh (not supported by iwlwifi) and now added
it for hwsim testing.

So ... I looked, and indeed _both_ are accepted:

scripts/kernel-doc:

} elsif ($newsection =~ m/^returns?$/i) {
$newsection = $section_return;
} elsif ($newsection =~ m/^\@return$/) {
# special: @return is a section, not a param description
$newsection = $section_return;


which I guess means

/**
* foo - ...
*
* Returns: bar
*/

and

/**
* foo - ...
*
* Return: bar
*/

and

/**
* foo - ...
*
* @return
* bar
*/

are all accepted.


Though "Return:" is more common, perhaps due to the docs:

$ git grep ' \* Returns:' -- | wc -l
3066
$ git grep ' \* Return:' -- | wc -l
9189


Personally, I find "Returns: %true if both nodes ..." to be nicer to
read, since it's more like a sentence?

But then again it depends on whether you're reading it as a description
or an instruction, I guess. "Returns: something" is a description, and
"Return: something" is an instruction (for the function). Hmm.

I'm inclined to say I like the descriptive text better, but since it
shows up in the generated documentation with "Return" anyway, maybe it's
better to have it in the same way in the code?

Though of course it's (slightly) easier to just apply it as is :)

What do you (and others!) think? Does it matter?

johannes

2023-09-30 06:42:58

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 14/18] wifi: mac80211: make mgd_protect_tdls_discover MLO-aware

From: Miri Korenblit <[email protected]>

Since userspace can choose now what link to establish the
TDLS on, we should know on what channel to do session protection.
Add a link id parameter to this callback.

Signed-off-by: Miri Korenblit <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 ++-
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c | 5 +++--
include/net/mac80211.h | 3 ++-
net/mac80211/driver-ops.h | 8 ++++++--
net/mac80211/tdls.c | 2 +-
5 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 66d9de0f1511..74cb2f863472 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -2345,7 +2345,8 @@ void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm);
void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
bool sta_added);
void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif);
+ struct ieee80211_vif *vif,
+ unsigned int link_id);
int iwl_mvm_tdls_channel_switch(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u8 oper_class,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tdls.c b/drivers/net/wireless/intel/iwlwifi/mvm/tdls.c
index dae6f2a1aad9..fac992af3ddb 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tdls.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tdls.c
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2014 Intel Mobile Communications GmbH
* Copyright (C) 2017 Intel Deutschland GmbH
- * Copyright (C) 2018-2020, 2022 Intel Corporation
+ * Copyright (C) 2018-2020, 2022-2023 Intel Corporation
*/
#include <linux/etherdevice.h>
#include "mvm.h"
@@ -144,7 +144,8 @@ void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
}

void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif)
+ struct ieee80211_vif *vif,
+ unsigned int link_id)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
u32 duration = 2 * vif->bss_conf.dtim_period * vif->bss_conf.beacon_int;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index db3e3bd62a61..c839a04ad9db 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4525,7 +4525,8 @@ struct ieee80211_ops {
struct ieee80211_prep_tx_info *info);

void (*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif);
+ struct ieee80211_vif *vif,
+ unsigned int link_id);

int (*add_chanctx)(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *ctx);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 3c8eb6afd6fd..568633b38c47 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -956,7 +956,8 @@ static inline void drv_mgd_complete_tx(struct ieee80211_local *local,

static inline void
drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata)
+ struct ieee80211_sub_if_data *sdata,
+ int link_id)
{
might_sleep();
lockdep_assert_wiphy(local->hw.wiphy);
@@ -965,9 +966,12 @@ drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
return;
WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);

+ link_id = link_id > 0 ? link_id : 0;
+
trace_drv_mgd_protect_tdls_discover(local, sdata);
if (local->ops->mgd_protect_tdls_discover)
- local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif);
+ local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif,
+ link_id);
trace_drv_return_void(local);
}

diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index f3fd66d30b84..05a7dff69fe9 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -1318,7 +1318,7 @@ int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
* response frame. It is transmitted directly and not buffered
* by the AP.
*/
- drv_mgd_protect_tdls_discover(sdata->local, sdata);
+ drv_mgd_protect_tdls_discover(sdata->local, sdata, link_id);
fallthrough;
case WLAN_TDLS_SETUP_CONFIRM:
case WLAN_PUB_ACTION_TDLS_DISCOVER_RES:
--
2.38.1