Skip to content

Commit 7b0a0e3

Browse files
committed
wifi: cfg80211: do some rework towards MLO link APIs
In order to support multi-link operation with multiple links, start adding some APIs. The notable addition here is to have the link ID in a new nl80211 attribute, that will be used to differentiate the links in many nl80211 operations. So far, this patch adds the netlink NL80211_ATTR_MLO_LINK_ID attribute (as well as the NL80211_ATTR_MLO_LINKS attribute) and plugs it through the system in some places, checking the validity etc. along with other infrastructure needed for it. For now, I've decided to include only the over-the-air link ID in the API. I know we discussed that we eventually need to have to have other ways of identifying a link, but for local AP mode and auth/assoc commands as well as set_key etc. we'll use the OTA ID. Also included in this patch is some refactoring of the data structures in struct wireless_dev, splitting for the first time the data into type dependent pieces, to make reasoning about these things easier. Signed-off-by: Johannes Berg <[email protected]>
1 parent 92ea8df commit 7b0a0e3

File tree

33 files changed

+1255
-533
lines changed

33 files changed

+1255
-533
lines changed

drivers/net/wireless/ath/ath6kl/cfg80211.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ void ath6kl_cfg80211_ch_switch_notify(struct ath6kl_vif *vif, int freq,
11191119
NL80211_CHAN_HT20 : NL80211_CHAN_NO_HT);
11201120

11211121
mutex_lock(&vif->wdev.mtx);
1122-
cfg80211_ch_switch_notify(vif->ndev, &chandef);
1122+
cfg80211_ch_switch_notify(vif->ndev, &chandef, 0);
11231123
mutex_unlock(&vif->wdev.mtx);
11241124
}
11251125

@@ -2967,7 +2967,8 @@ static int ath6kl_change_beacon(struct wiphy *wiphy, struct net_device *dev,
29672967
return ath6kl_set_ies(vif, beacon);
29682968
}
29692969

2970-
static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev)
2970+
static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev,
2971+
unsigned int link_id)
29712972
{
29722973
struct ath6kl *ar = ath6kl_priv(dev);
29732974
struct ath6kl_vif *vif = netdev_priv(dev);
@@ -3368,6 +3369,7 @@ static int ath6kl_cfg80211_sscan_stop(struct wiphy *wiphy,
33683369

33693370
static int ath6kl_cfg80211_set_bitrate(struct wiphy *wiphy,
33703371
struct net_device *dev,
3372+
unsigned int link_id,
33713373
const u8 *addr,
33723374
const struct cfg80211_bitrate_mask *mask)
33733375
{

drivers/net/wireless/ath/wil6210/cfg80211.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,8 +2098,8 @@ static int wil_cfg80211_change_beacon(struct wiphy *wiphy,
20982098
bcon->tail_len))
20992099
privacy = 1;
21002100

2101-
memcpy(vif->ssid, wdev->ssid, wdev->ssid_len);
2102-
vif->ssid_len = wdev->ssid_len;
2101+
memcpy(vif->ssid, wdev->u.ap.ssid, wdev->u.ap.ssid_len);
2102+
vif->ssid_len = wdev->u.ap.ssid_len;
21032103

21042104
/* in case privacy has changed, need to restart the AP */
21052105
if (vif->privacy != privacy) {
@@ -2108,7 +2108,7 @@ static int wil_cfg80211_change_beacon(struct wiphy *wiphy,
21082108

21092109
rc = _wil_cfg80211_start_ap(wiphy, ndev, vif->ssid,
21102110
vif->ssid_len, privacy,
2111-
wdev->beacon_interval,
2111+
wdev->links[0].ap.beacon_interval,
21122112
vif->channel,
21132113
vif->wmi_edmg_channel, bcon,
21142114
vif->hidden_ssid,
@@ -2186,7 +2186,8 @@ static int wil_cfg80211_start_ap(struct wiphy *wiphy,
21862186
}
21872187

21882188
static int wil_cfg80211_stop_ap(struct wiphy *wiphy,
2189-
struct net_device *ndev)
2189+
struct net_device *ndev,
2190+
unsigned int link_id)
21902191
{
21912192
struct wil6210_priv *wil = wiphy_to_wil(wiphy);
21922193
struct wil6210_vif *vif = ndev_to_vif(ndev);

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4965,7 +4965,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
49654965
return err;
49664966
}
49674967

4968-
static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
4968+
static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev,
4969+
unsigned int link_id)
49694970
{
49704971
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
49714972
struct brcmf_if *ifp = netdev_priv(ndev);
@@ -5302,6 +5303,7 @@ brcmf_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
53025303

53035304
static int brcmf_cfg80211_get_channel(struct wiphy *wiphy,
53045305
struct wireless_dev *wdev,
5306+
unsigned int link_id,
53055307
struct cfg80211_chan_def *chandef)
53065308
{
53075309
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);

drivers/net/wireless/marvell/libertas/mesh.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ static int lbs_mesh_config(struct lbs_private *priv, uint16_t action,
109109

110110
if (priv->mesh_dev) {
111111
mesh_wdev = priv->mesh_dev->ieee80211_ptr;
112-
ie->val.mesh_id_len = mesh_wdev->mesh_id_up_len;
113-
memcpy(ie->val.mesh_id, mesh_wdev->ssid,
114-
mesh_wdev->mesh_id_up_len);
112+
ie->val.mesh_id_len = mesh_wdev->u.mesh.id_up_len;
113+
memcpy(ie->val.mesh_id, mesh_wdev->u.mesh.id,
114+
mesh_wdev->u.mesh.id_up_len);
115115
}
116116

117117
ie->len = sizeof(struct mrvl_meshie_val) -
@@ -986,8 +986,8 @@ static int lbs_add_mesh(struct lbs_private *priv)
986986
mesh_wdev->wiphy = priv->wdev->wiphy;
987987

988988
if (priv->mesh_tlv) {
989-
sprintf(mesh_wdev->ssid, "mesh");
990-
mesh_wdev->mesh_id_up_len = 4;
989+
sprintf(mesh_wdev->u.mesh.id, "mesh");
990+
mesh_wdev->u.mesh.id_up_len = 4;
991991
}
992992

993993
mesh_wdev->netdev = mesh_dev;

drivers/net/wireless/marvell/mwifiex/11h.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,6 @@ void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work)
304304
mwifiex_dbg(priv->adapter, MSG,
305305
"indicating channel switch completion to kernel\n");
306306
mutex_lock(&priv->wdev.mtx);
307-
cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef);
307+
cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef, 0);
308308
mutex_unlock(&priv->wdev.mtx);
309309
}

drivers/net/wireless/marvell/mwifiex/cfg80211.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,10 +1753,12 @@ mwifiex_mgmt_stypes[NUM_NL80211_IFTYPES] = {
17531753
* Function configures data rates to firmware using bitrate mask
17541754
* provided by cfg80211.
17551755
*/
1756-
static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
1757-
struct net_device *dev,
1758-
const u8 *peer,
1759-
const struct cfg80211_bitrate_mask *mask)
1756+
static int
1757+
mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
1758+
struct net_device *dev,
1759+
unsigned int link_id,
1760+
const u8 *peer,
1761+
const struct cfg80211_bitrate_mask *mask)
17601762
{
17611763
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
17621764
u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
@@ -1998,7 +2000,8 @@ mwifiex_cfg80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant)
19982000
/* cfg80211 operation handler for stop ap.
19992001
* Function stops BSS running at uAP interface.
20002002
*/
2001-
static int mwifiex_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
2003+
static int mwifiex_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
2004+
unsigned int link_id)
20022005
{
20032006
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
20042007

@@ -2421,7 +2424,7 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
24212424
return -EINVAL;
24222425
}
24232426

2424-
if (priv->wdev.current_bss) {
2427+
if (priv->wdev.connected) {
24252428
mwifiex_dbg(adapter, ERROR,
24262429
"%s: already connected\n", dev->name);
24272430
return -EALREADY;
@@ -2649,7 +2652,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
26492652
return -EBUSY;
26502653
}
26512654

2652-
if (!priv->wdev.current_bss && priv->scan_block)
2655+
if (!priv->wdev.connected && priv->scan_block)
26532656
priv->scan_block = false;
26542657

26552658
if (!mwifiex_stop_bg_scan(priv))
@@ -4025,6 +4028,7 @@ mwifiex_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
40254028

40264029
static int mwifiex_cfg80211_get_channel(struct wiphy *wiphy,
40274030
struct wireless_dev *wdev,
4031+
unsigned int link_id,
40284032
struct cfg80211_chan_def *chandef)
40294033
{
40304034
struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev);

drivers/net/wireless/microchip/wilc1000/cfg80211.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,8 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
14261426
return wilc_add_beacon(vif, 0, 0, beacon);
14271427
}
14281428

1429-
static int stop_ap(struct wiphy *wiphy, struct net_device *dev)
1429+
static int stop_ap(struct wiphy *wiphy, struct net_device *dev,
1430+
unsigned int link_id)
14301431
{
14311432
int ret;
14321433
struct wilc_vif *vif = netdev_priv(dev);

drivers/net/wireless/quantenna/qtnfmac/cfg80211.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev,
352352
return ret;
353353
}
354354

355-
static int qtnf_stop_ap(struct wiphy *wiphy, struct net_device *dev)
355+
static int qtnf_stop_ap(struct wiphy *wiphy, struct net_device *dev,
356+
unsigned int link_id)
356357
{
357358
struct qtnf_vif *vif = qtnf_netdev_get_priv(dev);
358359
int ret;
@@ -500,7 +501,7 @@ qtnf_dump_station(struct wiphy *wiphy, struct net_device *dev,
500501

501502
switch (vif->wdev.iftype) {
502503
case NL80211_IFTYPE_STATION:
503-
if (idx != 0 || !vif->wdev.current_bss)
504+
if (idx != 0 || !vif->wdev.connected)
504505
return -ENOENT;
505506

506507
ether_addr_copy(mac, vif->bssid);
@@ -729,7 +730,7 @@ qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev,
729730
pr_err("VIF%u.%u: failed to disconnect\n",
730731
mac->macid, vif->vifid);
731732

732-
if (vif->wdev.current_bss) {
733+
if (vif->wdev.connected) {
733734
netif_carrier_off(vif->netdev);
734735
cfg80211_disconnected(vif->netdev, reason_code,
735736
NULL, 0, true, GFP_KERNEL);
@@ -745,10 +746,11 @@ qtnf_dump_survey(struct wiphy *wiphy, struct net_device *dev,
745746
struct qtnf_wmac *mac = wiphy_priv(wiphy);
746747
struct wireless_dev *wdev = dev->ieee80211_ptr;
747748
struct ieee80211_supported_band *sband;
748-
const struct cfg80211_chan_def *chandef = &wdev->chandef;
749+
const struct cfg80211_chan_def *chandef = wdev_chandef(wdev, 0);
749750
struct ieee80211_channel *chan;
750751
int ret;
751752

753+
752754
sband = wiphy->bands[NL80211_BAND_2GHZ];
753755
if (sband && idx >= sband->n_channels) {
754756
idx -= sband->n_channels;
@@ -765,7 +767,7 @@ qtnf_dump_survey(struct wiphy *wiphy, struct net_device *dev,
765767
survey->channel = chan;
766768
survey->filled = 0x0;
767769

768-
if (chan == chandef->chan)
770+
if (chandef && chan == chandef->chan)
769771
survey->filled = SURVEY_INFO_IN_USE;
770772

771773
ret = qtnf_cmd_get_chan_stats(mac, chan->center_freq, survey);
@@ -778,7 +780,7 @@ qtnf_dump_survey(struct wiphy *wiphy, struct net_device *dev,
778780

779781
static int
780782
qtnf_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
781-
struct cfg80211_chan_def *chandef)
783+
unsigned int link_id, struct cfg80211_chan_def *chandef)
782784
{
783785
struct net_device *ndev = wdev->netdev;
784786
struct qtnf_vif *vif;

drivers/net/wireless/quantenna/qtnfmac/commands.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,7 @@ int qtnf_cmd_send_scan(struct qtnf_wmac *mac)
20052005
dwell_active = scan_req->duration;
20062006
dwell_passive = scan_req->duration;
20072007
} else if (wdev->iftype == NL80211_IFTYPE_STATION &&
2008-
wdev->current_bss) {
2008+
wdev->connected) {
20092009
/* let device select dwell based on traffic conditions */
20102010
dwell_active = QTNF_SCAN_TIME_AUTO;
20112011
dwell_passive = QTNF_SCAN_TIME_AUTO;

drivers/net/wireless/quantenna/qtnfmac/event.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,15 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif,
189189
vif->mac->macid, vif->vifid,
190190
join_info->bssid, chandef.chan->hw_value);
191191

192-
if (!vif->wdev.ssid_len) {
192+
if (!vif->wdev.u.client.ssid_len) {
193193
pr_warn("VIF%u.%u: SSID unknown for BSS:%pM\n",
194194
vif->mac->macid, vif->vifid,
195195
join_info->bssid);
196196
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
197197
goto done;
198198
}
199199

200-
ie = kzalloc(2 + vif->wdev.ssid_len, GFP_KERNEL);
200+
ie = kzalloc(2 + vif->wdev.u.client.ssid_len, GFP_KERNEL);
201201
if (!ie) {
202202
pr_warn("VIF%u.%u: IE alloc failed for BSS:%pM\n",
203203
vif->mac->macid, vif->vifid,
@@ -207,14 +207,15 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif,
207207
}
208208

209209
ie[0] = WLAN_EID_SSID;
210-
ie[1] = vif->wdev.ssid_len;
211-
memcpy(ie + 2, vif->wdev.ssid, vif->wdev.ssid_len);
210+
ie[1] = vif->wdev.u.client.ssid_len;
211+
memcpy(ie + 2, vif->wdev.u.client.ssid,
212+
vif->wdev.u.client.ssid_len);
212213

213214
bss = cfg80211_inform_bss(wiphy, chandef.chan,
214215
CFG80211_BSS_FTYPE_UNKNOWN,
215216
join_info->bssid, 0,
216217
WLAN_CAPABILITY_ESS, 100,
217-
ie, 2 + vif->wdev.ssid_len,
218+
ie, 2 + vif->wdev.u.client.ssid_len,
218219
0, GFP_KERNEL);
219220
if (!bss) {
220221
pr_warn("VIF%u.%u: can't connect to unknown BSS: %pM\n",
@@ -470,14 +471,14 @@ qtnf_event_handle_freq_change(struct qtnf_wmac *mac,
470471
continue;
471472

472473
if (vif->wdev.iftype == NL80211_IFTYPE_STATION &&
473-
!vif->wdev.current_bss)
474+
!vif->wdev.connected)
474475
continue;
475476

476477
if (!vif->netdev)
477478
continue;
478479

479480
mutex_lock(&vif->wdev.mtx);
480-
cfg80211_ch_switch_notify(vif->netdev, &chandef);
481+
cfg80211_ch_switch_notify(vif->netdev, &chandef, 0);
481482
mutex_unlock(&vif->wdev.mtx);
482483
}
483484

drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,7 @@ static u8 rtw_get_chan_type(struct adapter *adapter)
20862086
}
20872087

20882088
static int cfg80211_rtw_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
2089+
unsigned int link_id,
20892090
struct cfg80211_chan_def *chandef)
20902091
{
20912092
struct adapter *adapter = wiphy_to_adapter(wiphy);
@@ -2446,7 +2447,8 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd
24462447
return rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
24472448
}
24482449

2449-
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
2450+
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev,
2451+
unsigned int link_id)
24502452
{
24512453
return 0;
24522454
}

include/linux/ieee80211.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4376,4 +4376,7 @@ enum ieee80211_range_params_max_total_ltf {
43764376
IEEE80211_RANGE_PARAMS_MAX_TOTAL_LTF_UNSPECIFIED,
43774377
};
43784378

4379+
/* multi-link device */
4380+
#define IEEE80211_MLD_MAX_NUM_LINKS 15
4381+
43794382
#endif /* LINUX_IEEE80211_H */

0 commit comments

Comments
 (0)