Skip to content

Commit 37cec6e

Browse files
committed
Merge tag 'wireless-2023-06-14' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless
Johannes Berg says: ==================== A couple of straggler fixes, mostly in the stack: - fix fragmentation for multi-link related elements - fix callback copy/paste error - fix multi-link locking - remove double-locking of wiphy mutex - transmit only on active links, not all - activate links in the correct order - don't remove links that weren't added - disable soft-IRQs for LQ lock in iwlwifi * tag 'wireless-2023-06-14' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless: wifi: iwlwifi: mvm: spin_lock_bh() to fix lockdep regression wifi: mac80211: fragment per STA profile correctly wifi: mac80211: Use active_links instead of valid_links in Tx wifi: cfg80211: remove links only on AP wifi: mac80211: take lock before setting vif links wifi: cfg80211: fix link del callback to call correct handler wifi: mac80211: fix link activation settings order wifi: cfg80211: fix double lock bug in reg_wdev_chan_valid() ==================== Link: https://lore.kernel.org/r/20230614075502.11765-1-johannes@sipsolutions.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents bef68e2 + f1a0898 commit 37cec6e

10 files changed

Lines changed: 36 additions & 24 deletions

File tree

drivers/net/wireless/intel/iwlwifi/mvm/rs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,7 +2692,7 @@ static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta,
26922692

26932693
lq_sta = mvm_sta;
26942694

2695-
spin_lock(&lq_sta->pers.lock);
2695+
spin_lock_bh(&lq_sta->pers.lock);
26962696
iwl_mvm_hwrate_to_tx_rate_v1(lq_sta->last_rate_n_flags,
26972697
info->band, &info->control.rates[0]);
26982698
info->control.rates[0].count = 1;
@@ -2707,7 +2707,7 @@ static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta,
27072707
iwl_mvm_hwrate_to_tx_rate_v1(last_ucode_rate, info->band,
27082708
&txrc->reported_rate);
27092709
}
2710-
spin_unlock(&lq_sta->pers.lock);
2710+
spin_unlock_bh(&lq_sta->pers.lock);
27112711
}
27122712

27132713
static void *rs_drv_alloc_sta(void *mvm_rate, struct ieee80211_sta *sta,
@@ -3264,11 +3264,11 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
32643264
/* If it's locked we are in middle of init flow
32653265
* just wait for next tx status to update the lq_sta data
32663266
*/
3267-
if (!spin_trylock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock))
3267+
if (!spin_trylock_bh(&mvmsta->deflink.lq_sta.rs_drv.pers.lock))
32683268
return;
32693269

32703270
__iwl_mvm_rs_tx_status(mvm, sta, tid, info, ndp);
3271-
spin_unlock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
3271+
spin_unlock_bh(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
32723272
}
32733273

32743274
#ifdef CONFIG_MAC80211_DEBUGFS
@@ -4117,9 +4117,9 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm,
41174117
} else {
41184118
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
41194119

4120-
spin_lock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
4120+
spin_lock_bh(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
41214121
rs_drv_rate_init(mvm, sta, band);
4122-
spin_unlock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
4122+
spin_unlock_bh(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
41234123
}
41244124
}
41254125

net/mac80211/cfg.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4865,11 +4865,16 @@ static int ieee80211_add_intf_link(struct wiphy *wiphy,
48654865
unsigned int link_id)
48664866
{
48674867
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
4868+
int res;
48684869

48694870
if (wdev->use_4addr)
48704871
return -EOPNOTSUPP;
48714872

4872-
return ieee80211_vif_set_links(sdata, wdev->valid_links);
4873+
mutex_lock(&sdata->local->mtx);
4874+
res = ieee80211_vif_set_links(sdata, wdev->valid_links);
4875+
mutex_unlock(&sdata->local->mtx);
4876+
4877+
return res;
48734878
}
48744879

48754880
static void ieee80211_del_intf_link(struct wiphy *wiphy,
@@ -4878,7 +4883,9 @@ static void ieee80211_del_intf_link(struct wiphy *wiphy,
48784883
{
48794884
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
48804885

4886+
mutex_lock(&sdata->local->mtx);
48814887
ieee80211_vif_set_links(sdata, wdev->valid_links);
4888+
mutex_unlock(&sdata->local->mtx);
48824889
}
48834890

48844891
static int sta_add_link_station(struct ieee80211_local *local,

net/mac80211/ieee80211_i.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,7 @@ ieee802_11_parse_elems(const u8 *start, size_t len, bool action,
23122312
return ieee802_11_parse_elems_crc(start, len, action, 0, 0, bss);
23132313
}
23142314

2315-
void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos);
2315+
void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id);
23162316

23172317
extern const int ieee802_1d_to_ac[8];
23182318

net/mac80211/link.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* MLO link handling
44
*
5-
* Copyright (C) 2022 Intel Corporation
5+
* Copyright (C) 2022-2023 Intel Corporation
66
*/
77
#include <linux/slab.h>
88
#include <linux/kernel.h>
@@ -409,6 +409,7 @@ static int _ieee80211_set_active_links(struct ieee80211_sub_if_data *sdata,
409409
IEEE80211_CHANCTX_SHARED);
410410
WARN_ON_ONCE(ret);
411411

412+
ieee80211_mgd_set_link_qos_params(link);
412413
ieee80211_link_info_change_notify(sdata, link,
413414
BSS_CHANGED_ERP_CTS_PROT |
414415
BSS_CHANGED_ERP_PREAMBLE |
@@ -423,7 +424,6 @@ static int _ieee80211_set_active_links(struct ieee80211_sub_if_data *sdata,
423424
BSS_CHANGED_TWT |
424425
BSS_CHANGED_HE_OBSS_PD |
425426
BSS_CHANGED_HE_BSS_COLOR);
426-
ieee80211_mgd_set_link_qos_params(link);
427427
}
428428

429429
old_active = sdata->vif.active_links;

net/mac80211/mlme.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,10 +1372,11 @@ static void ieee80211_assoc_add_ml_elem(struct ieee80211_sub_if_data *sdata,
13721372
ieee80211_add_non_inheritance_elem(skb, outer_present_elems,
13731373
link_present_elems);
13741374

1375-
ieee80211_fragment_element(skb, subelem_len);
1375+
ieee80211_fragment_element(skb, subelem_len,
1376+
IEEE80211_MLE_SUBELEM_FRAGMENT);
13761377
}
13771378

1378-
ieee80211_fragment_element(skb, ml_elem_len);
1379+
ieee80211_fragment_element(skb, ml_elem_len, WLAN_EID_FRAGMENT);
13791380
}
13801381

13811382
static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)

net/mac80211/tx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4445,7 +4445,7 @@ static void ieee80211_mlo_multicast_tx(struct net_device *dev,
44454445
struct sk_buff *skb)
44464446
{
44474447
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
4448-
unsigned long links = sdata->vif.valid_links;
4448+
unsigned long links = sdata->vif.active_links;
44494449
unsigned int link;
44504450
u32 ctrl_flags = IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX;
44514451

@@ -6040,7 +6040,7 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
60406040
rcu_read_unlock();
60416041

60426042
if (WARN_ON_ONCE(link == ARRAY_SIZE(sdata->vif.link_conf)))
6043-
link = ffs(sdata->vif.valid_links) - 1;
6043+
link = ffs(sdata->vif.active_links) - 1;
60446044
}
60456045

60466046
IEEE80211_SKB_CB(skb)->control.flags |=
@@ -6076,7 +6076,7 @@ void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
60766076
band = chanctx_conf->def.chan->band;
60776077
} else {
60786078
WARN_ON(link_id >= 0 &&
6079-
!(sdata->vif.valid_links & BIT(link_id)));
6079+
!(sdata->vif.active_links & BIT(link_id)));
60806080
/* MLD transmissions must not rely on the band */
60816081
band = 0;
60826082
}

net/mac80211/util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5049,7 +5049,7 @@ u8 *ieee80211_ie_build_eht_cap(u8 *pos,
50495049
return pos;
50505050
}
50515051

5052-
void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos)
5052+
void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id)
50535053
{
50545054
unsigned int elem_len;
50555055

@@ -5069,7 +5069,7 @@ void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos)
50695069
memmove(len_pos + 255 + 3, len_pos + 255 + 1, elem_len);
50705070
/* place the fragment ID */
50715071
len_pos += 255 + 1;
5072-
*len_pos = WLAN_EID_FRAGMENT;
5072+
*len_pos = frag_id;
50735073
/* and point to fragment length to update later */
50745074
len_pos++;
50755075
}

net/wireless/rdev-ops.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Portions of this file
44
* Copyright(c) 2016-2017 Intel Deutschland GmbH
5-
* Copyright (C) 2018, 2021-2022 Intel Corporation
5+
* Copyright (C) 2018, 2021-2023 Intel Corporation
66
*/
77
#ifndef __CFG80211_RDEV_OPS
88
#define __CFG80211_RDEV_OPS
@@ -1441,8 +1441,8 @@ rdev_del_intf_link(struct cfg80211_registered_device *rdev,
14411441
unsigned int link_id)
14421442
{
14431443
trace_rdev_del_intf_link(&rdev->wiphy, wdev, link_id);
1444-
if (rdev->ops->add_intf_link)
1445-
rdev->ops->add_intf_link(&rdev->wiphy, wdev, link_id);
1444+
if (rdev->ops->del_intf_link)
1445+
rdev->ops->del_intf_link(&rdev->wiphy, wdev, link_id);
14461446
trace_rdev_return_void(&rdev->wiphy);
14471447
}
14481448

net/wireless/reg.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,11 +2404,8 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
24042404
case NL80211_IFTYPE_P2P_GO:
24052405
case NL80211_IFTYPE_ADHOC:
24062406
case NL80211_IFTYPE_MESH_POINT:
2407-
wiphy_lock(wiphy);
24082407
ret = cfg80211_reg_can_beacon_relax(wiphy, &chandef,
24092408
iftype);
2410-
wiphy_unlock(wiphy);
2411-
24122409
if (!ret)
24132410
return ret;
24142411
break;

net/wireless/util.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright 2007-2009 Johannes Berg <johannes@sipsolutions.net>
66
* Copyright 2013-2014 Intel Mobile Communications GmbH
77
* Copyright 2017 Intel Deutschland GmbH
8-
* Copyright (C) 2018-2022 Intel Corporation
8+
* Copyright (C) 2018-2023 Intel Corporation
99
*/
1010
#include <linux/export.h>
1111
#include <linux/bitops.h>
@@ -2558,6 +2558,13 @@ void cfg80211_remove_links(struct wireless_dev *wdev)
25582558
{
25592559
unsigned int link_id;
25602560

2561+
/*
2562+
* links are controlled by upper layers (userspace/cfg)
2563+
* only for AP mode, so only remove them here for AP
2564+
*/
2565+
if (wdev->iftype != NL80211_IFTYPE_AP)
2566+
return;
2567+
25612568
wdev_lock(wdev);
25622569
if (wdev->valid_links) {
25632570
for_each_valid_link(wdev, link_id)

0 commit comments

Comments
 (0)