Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'wireless-next-2022-08-26-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next

Johannes berg says:

====================
Various updates:
* rtw88: operation, locking, warning, and code style fixes
* rtw89: small updates
* cfg80211/mac80211: more EHT/MLO (802.11be, WiFi 7) work
* brcmfmac: a couple of fixes
* misc cleanups etc.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+1850 -695
+4 -3
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
··· 20 20 21 21 reg: true 22 22 23 - spi-max-frequency: true 24 - 25 23 interrupts: 26 24 maxItems: 1 27 25 ··· 49 51 - compatible 50 52 - interrupts 51 53 52 - additionalProperties: false 54 + allOf: 55 + - $ref: /schemas/spi/spi-peripheral-props.yaml# 56 + 57 + unevaluatedProperties: false 53 58 54 59 examples: 55 60 - |
+5 -10
Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml
··· 29 29 Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more 30 30 information. 31 31 32 - For SPI: 33 - 34 - In add of the properties below, please consult 35 - Documentation/devicetree/bindings/spi/spi-controller.yaml for optional SPI 36 - related properties. 37 - 38 32 properties: 39 33 compatible: 40 34 items: ··· 45 51 the chip select address of the device as defined in the SPI devices 46 52 bindings. 47 53 maxItems: 1 48 - 49 - spi-max-frequency: true 50 54 51 55 interrupts: 52 56 description: The interrupt line. Should be IRQ_TYPE_EDGE_RISING. When SPI is ··· 76 84 77 85 mac-address: true 78 86 79 - additionalProperties: false 80 - 81 87 required: 82 88 - compatible 83 89 - reg 90 + 91 + allOf: 92 + - $ref: /schemas/spi/spi-peripheral-props.yaml# 93 + 94 + unevaluatedProperties: false 84 95 85 96 examples: 86 97 - |
+15 -15
Documentation/devicetree/bindings/net/wireless/ti,wlcore.yaml
··· 36 36 This is required when connected via SPI, and optional when connected via 37 37 SDIO. 38 38 39 - spi-max-frequency: true 40 - 41 39 interrupts: 42 40 minItems: 1 43 41 maxItems: 2 ··· 67 69 - compatible 68 70 - interrupts 69 71 70 - if: 71 - properties: 72 - compatible: 73 - contains: 74 - enum: 75 - - ti,wl1271 76 - - ti,wl1273 77 - - ti,wl1281 78 - - ti,wl1283 79 - then: 80 - required: 81 - - ref-clock-frequency 72 + allOf: 73 + - $ref: /schemas/spi/spi-peripheral-props.yaml# 74 + - if: 75 + properties: 76 + compatible: 77 + contains: 78 + enum: 79 + - ti,wl1271 80 + - ti,wl1273 81 + - ti,wl1281 82 + - ti,wl1283 83 + then: 84 + required: 85 + - ref-clock-frequency 82 86 83 - additionalProperties: false 87 + unevaluatedProperties: false 84 88 85 89 examples: 86 90 - |
+4 -4
drivers/net/wireless/ath/ath6kl/cfg80211.c
··· 1124 1124 } 1125 1125 1126 1126 static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, 1127 - u8 key_index, bool pairwise, 1127 + int link_id, u8 key_index, bool pairwise, 1128 1128 const u8 *mac_addr, 1129 1129 struct key_params *params) 1130 1130 { ··· 1249 1249 } 1250 1250 1251 1251 static int ath6kl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, 1252 - u8 key_index, bool pairwise, 1252 + int link_id, u8 key_index, bool pairwise, 1253 1253 const u8 *mac_addr) 1254 1254 { 1255 1255 struct ath6kl *ar = ath6kl_priv(ndev); ··· 1279 1279 } 1280 1280 1281 1281 static int ath6kl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, 1282 - u8 key_index, bool pairwise, 1282 + int link_id, u8 key_index, bool pairwise, 1283 1283 const u8 *mac_addr, void *cookie, 1284 1284 void (*callback) (void *cookie, 1285 1285 struct key_params *)) ··· 1314 1314 } 1315 1315 1316 1316 static int ath6kl_cfg80211_set_default_key(struct wiphy *wiphy, 1317 - struct net_device *ndev, 1317 + struct net_device *ndev, int link_id, 1318 1318 u8 key_index, bool unicast, 1319 1319 bool multicast) 1320 1320 {
+5 -5
drivers/net/wireless/ath/wil6210/cfg80211.c
··· 1620 1620 } 1621 1621 1622 1622 static int wil_cfg80211_add_key(struct wiphy *wiphy, 1623 - struct net_device *ndev, 1623 + struct net_device *ndev, int link_id, 1624 1624 u8 key_index, bool pairwise, 1625 1625 const u8 *mac_addr, 1626 1626 struct key_params *params) ··· 1696 1696 } 1697 1697 1698 1698 static int wil_cfg80211_del_key(struct wiphy *wiphy, 1699 - struct net_device *ndev, 1699 + struct net_device *ndev, int link_id, 1700 1700 u8 key_index, bool pairwise, 1701 1701 const u8 *mac_addr) 1702 1702 { ··· 1723 1723 1724 1724 /* Need to be present or wiphy_new() will WARN */ 1725 1725 static int wil_cfg80211_set_default_key(struct wiphy *wiphy, 1726 - struct net_device *ndev, 1726 + struct net_device *ndev, int link_id, 1727 1727 u8 key_index, bool unicast, 1728 1728 bool multicast) 1729 1729 { ··· 2072 2072 key_params.key = vif->gtk; 2073 2073 key_params.key_len = vif->gtk_len; 2074 2074 key_params.seq_len = IEEE80211_GCMP_PN_LEN; 2075 - rc = wil_cfg80211_add_key(wiphy, ndev, vif->gtk_index, false, 2076 - NULL, &key_params); 2075 + rc = wil_cfg80211_add_key(wiphy, ndev, -1, vif->gtk_index, 2076 + false, NULL, &key_params); 2077 2077 if (rc) 2078 2078 wil_err(wil, "vif %d recovery add key failed (%d)\n", 2079 2079 i, rc);
+1 -2
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
··· 368 368 369 369 /* await txstatus signal for firmware if active */ 370 370 if (brcmf_fws_fc_active(bcdc->fws)) { 371 - if (!success) 372 - brcmf_fws_bustxfail(bcdc->fws, txp); 371 + brcmf_fws_bustxcomplete(bcdc->fws, txp, success); 373 372 } else { 374 373 if (brcmf_proto_bcdc_hdrpull(bus_if->drvr, false, txp, &ifp)) 375 374 brcmu_pkt_buf_free_skb(txp);
+14 -9
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
··· 2361 2361 2362 2362 static s32 2363 2363 brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev, 2364 - u8 key_idx, bool unicast, bool multicast) 2364 + int link_id, u8 key_idx, bool unicast, 2365 + bool multicast) 2365 2366 { 2366 2367 struct brcmf_if *ifp = netdev_priv(ndev); 2367 2368 struct brcmf_pub *drvr = ifp->drvr; ··· 2396 2395 2397 2396 static s32 2398 2397 brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, 2399 - u8 key_idx, bool pairwise, const u8 *mac_addr) 2398 + int link_id, u8 key_idx, bool pairwise, 2399 + const u8 *mac_addr) 2400 2400 { 2401 2401 struct brcmf_if *ifp = netdev_priv(ndev); 2402 2402 struct brcmf_wsec_key *key; ··· 2434 2432 2435 2433 static s32 2436 2434 brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, 2437 - u8 key_idx, bool pairwise, const u8 *mac_addr, 2438 - struct key_params *params) 2435 + int link_id, u8 key_idx, bool pairwise, 2436 + const u8 *mac_addr, struct key_params *params) 2439 2437 { 2440 2438 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 2441 2439 struct brcmf_if *ifp = netdev_priv(ndev); ··· 2459 2457 } 2460 2458 2461 2459 if (params->key_len == 0) 2462 - return brcmf_cfg80211_del_key(wiphy, ndev, key_idx, pairwise, 2463 - mac_addr); 2460 + return brcmf_cfg80211_del_key(wiphy, ndev, -1, key_idx, 2461 + pairwise, mac_addr); 2464 2462 2465 2463 if (params->key_len > sizeof(key->data)) { 2466 2464 bphy_err(drvr, "Too long key length (%u)\n", params->key_len); ··· 2555 2553 } 2556 2554 2557 2555 static s32 2558 - brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, u8 key_idx, 2559 - bool pairwise, const u8 *mac_addr, void *cookie, 2556 + brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, 2557 + int link_id, u8 key_idx, bool pairwise, 2558 + const u8 *mac_addr, void *cookie, 2560 2559 void (*callback)(void *cookie, 2561 2560 struct key_params *params)) 2562 2561 { ··· 2613 2610 2614 2611 static s32 2615 2612 brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, 2616 - struct net_device *ndev, u8 key_idx) 2613 + struct net_device *ndev, int link_id, 2614 + u8 key_idx) 2617 2615 { 2618 2616 struct brcmf_if *ifp = netdev_priv(ndev); 2619 2617 ··· 6435 6431 cfg->dongle_up = false; /* dongle down */ 6436 6432 brcmf_abort_scanning(cfg); 6437 6433 brcmf_deinit_priv_mem(cfg); 6434 + brcmf_clear_assoc_ies(cfg); 6438 6435 } 6439 6436 6440 6437 static void init_vif_event(struct brcmf_cfg80211_vif_event *event)
+3 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
··· 1480 1480 !brcmf_get_pend_8021x_cnt(ifp), 1481 1481 MAX_WAIT_FOR_8021X_TX); 1482 1482 1483 - if (!err) 1483 + if (!err) { 1484 1484 bphy_err(drvr, "Timed out waiting for no pending 802.1x packets\n"); 1485 + atomic_set(&ifp->pend_8021x_cnt, 0); 1486 + } 1485 1487 1486 1488 return !err; 1487 1489 }
+1 -4
drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
··· 419 419 flowid = flow->hash[i].flowid; 420 420 if (flow->rings[flowid]->status != RING_OPEN) 421 421 continue; 422 - flow->rings[flowid]->status = RING_CLOSING; 423 422 brcmf_msgbuf_delete_flowring(drvr, flowid); 424 423 } 425 424 } ··· 457 458 if ((sta || (memcmp(hash[i].mac, peer, ETH_ALEN) == 0)) && 458 459 (hash[i].ifidx == ifidx)) { 459 460 flowid = flow->hash[i].flowid; 460 - if (flow->rings[flowid]->status == RING_OPEN) { 461 - flow->rings[flowid]->status = RING_CLOSING; 461 + if (flow->rings[flowid]->status == RING_OPEN) 462 462 brcmf_msgbuf_delete_flowring(drvr, flowid); 463 - } 464 463 } 465 464 } 466 465
+10 -6
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
··· 2475 2475 return fws->fcmode != BRCMF_FWS_FCMODE_NONE; 2476 2476 } 2477 2477 2478 - void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb) 2478 + void brcmf_fws_bustxcomplete(struct brcmf_fws_info *fws, struct sk_buff *skb, 2479 + bool success) 2479 2480 { 2480 2481 u32 hslot; 2481 2482 ··· 2484 2483 brcmu_pkt_buf_free_skb(skb); 2485 2484 return; 2486 2485 } 2487 - brcmf_fws_lock(fws); 2488 - hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); 2489 - brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 0, 0, 2490 - 1); 2491 - brcmf_fws_unlock(fws); 2486 + 2487 + if (!success) { 2488 + brcmf_fws_lock(fws); 2489 + hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); 2490 + brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 2491 + 0, 0, 1); 2492 + brcmf_fws_unlock(fws); 2493 + } 2492 2494 } 2493 2495 2494 2496 void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked)
+2 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h
··· 40 40 void brcmf_fws_reset_interface(struct brcmf_if *ifp); 41 41 void brcmf_fws_add_interface(struct brcmf_if *ifp); 42 42 void brcmf_fws_del_interface(struct brcmf_if *ifp); 43 - void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb); 43 + void brcmf_fws_bustxcomplete(struct brcmf_fws_info *fws, struct sk_buff *skb, 44 + bool success); 44 45 void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked); 45 46 void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb); 46 47
+24 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
··· 71 71 #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32 72 72 #define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48 73 73 74 + #define BRCMF_MAX_TXSTATUS_WAIT_RETRIES 10 74 75 75 76 struct msgbuf_common_hdr { 76 77 u8 msgtype; ··· 807 806 flowid = brcmf_flowring_lookup(flow, eh->h_dest, skb->priority, ifidx); 808 807 if (flowid == BRCMF_FLOWRING_INVALID_ID) { 809 808 flowid = brcmf_msgbuf_flowring_create(msgbuf, ifidx, skb); 810 - if (flowid == BRCMF_FLOWRING_INVALID_ID) 809 + if (flowid == BRCMF_FLOWRING_INVALID_ID) { 811 810 return -ENOMEM; 811 + } else { 812 + brcmf_flowring_enqueue(flow, flowid, skb); 813 + return 0; 814 + } 812 815 } 813 816 queue_count = brcmf_flowring_enqueue(flow, flowid, skb); 814 817 force = ((queue_count % BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS) == 0); ··· 1400 1395 struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd; 1401 1396 struct msgbuf_tx_flowring_delete_req *delete; 1402 1397 struct brcmf_commonring *commonring; 1398 + struct brcmf_commonring *commonring_del = msgbuf->flowrings[flowid]; 1399 + struct brcmf_flowring *flow = msgbuf->flow; 1403 1400 void *ret_ptr; 1404 1401 u8 ifidx; 1405 1402 int err; 1403 + int retry = BRCMF_MAX_TXSTATUS_WAIT_RETRIES; 1404 + 1405 + /* make sure it is not in txflow */ 1406 + brcmf_commonring_lock(commonring_del); 1407 + flow->rings[flowid]->status = RING_CLOSING; 1408 + brcmf_commonring_unlock(commonring_del); 1409 + 1410 + /* wait for commonring txflow finished */ 1411 + while (retry && atomic_read(&commonring_del->outstanding_tx)) { 1412 + usleep_range(5000, 10000); 1413 + retry--; 1414 + } 1415 + if (!retry) { 1416 + brcmf_err("timed out waiting for txstatus\n"); 1417 + atomic_set(&commonring_del->outstanding_tx, 0); 1418 + } 1406 1419 1407 1420 /* no need to submit if firmware can not be reached */ 1408 1421 if (drvr->bus_if->state != BRCMF_BUS_UP) {
+6 -6
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
··· 158 158 struct brcmf_pno_macaddr_le pfn_mac; 159 159 u8 *mac_addr = NULL; 160 160 u8 *mac_mask = NULL; 161 - int err, i; 161 + int err, i, ri; 162 162 163 - for (i = 0; i < pi->n_reqs; i++) 164 - if (pi->reqs[i]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { 165 - mac_addr = pi->reqs[i]->mac_addr; 166 - mac_mask = pi->reqs[i]->mac_addr_mask; 163 + for (ri = 0; ri < pi->n_reqs; ri++) 164 + if (pi->reqs[ri]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { 165 + mac_addr = pi->reqs[ri]->mac_addr; 166 + mac_mask = pi->reqs[ri]->mac_addr_mask; 167 167 break; 168 168 } 169 169 ··· 185 185 pfn_mac.mac[0] |= 0x02; 186 186 187 187 brcmf_dbg(SCAN, "enabling random mac: reqid=%llu mac=%pM\n", 188 - pi->reqs[i]->reqid, pfn_mac.mac); 188 + pi->reqs[ri]->reqid, pfn_mac.mac); 189 189 err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, 190 190 sizeof(pfn_mac)); 191 191 if (err)
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmsmac/types.h
··· 123 123 */ 124 124 125 125 /******************************************************************** 126 - * Phy/Core Configuration. Defines macros to to check core phy/rev * 126 + * Phy/Core Configuration. Defines macros to check core phy/rev * 127 127 * compile-time configuration. Defines default core support. * 128 128 * ****************************************************************** 129 129 */
+385 -9
drivers/net/wireless/mac80211_hwsim.c
··· 2995 2995 u16 old_links, u16 new_links, 2996 2996 struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]) 2997 2997 { 2998 - unsigned long rem = old_links & ~new_links ?: BIT(0); 2998 + unsigned long rem = old_links & ~new_links; 2999 2999 unsigned long add = new_links & ~old_links; 3000 3000 int i; 3001 + 3002 + if (!old_links) 3003 + rem |= BIT(0); 3004 + if (!new_links) 3005 + add |= BIT(0); 3001 3006 3002 3007 for_each_set_bit(i, &rem, IEEE80211_MLD_MAX_NUM_LINKS) 3003 3008 mac80211_hwsim_config_mac_nl(hw, old[i]->addr, false); ··· 3213 3208 3214 3209 static const struct ieee80211_sband_iftype_data sband_capa_2ghz[] = { 3215 3210 { 3216 - .types_mask = BIT(NL80211_IFTYPE_STATION) | 3217 - BIT(NL80211_IFTYPE_AP), 3211 + .types_mask = BIT(NL80211_IFTYPE_STATION), 3212 + .he_cap = { 3213 + .has_he = true, 3214 + .he_cap_elem = { 3215 + .mac_cap_info[0] = 3216 + IEEE80211_HE_MAC_CAP0_HTC_HE, 3217 + .mac_cap_info[1] = 3218 + IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | 3219 + IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, 3220 + .mac_cap_info[2] = 3221 + IEEE80211_HE_MAC_CAP2_BSR | 3222 + IEEE80211_HE_MAC_CAP2_MU_CASCADING | 3223 + IEEE80211_HE_MAC_CAP2_ACK_EN, 3224 + .mac_cap_info[3] = 3225 + IEEE80211_HE_MAC_CAP3_OMI_CONTROL | 3226 + IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3, 3227 + .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, 3228 + .phy_cap_info[1] = 3229 + IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | 3230 + IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | 3231 + IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD | 3232 + IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS, 3233 + .phy_cap_info[2] = 3234 + IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US | 3235 + IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ | 3236 + IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ | 3237 + IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO | 3238 + IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO, 3239 + 3240 + /* Leave all the other PHY capability bytes 3241 + * unset, as DCM, beam forming, RU and PPE 3242 + * threshold information are not supported 3243 + */ 3244 + }, 3245 + .he_mcs_nss_supp = { 3246 + .rx_mcs_80 = cpu_to_le16(0xfffa), 3247 + .tx_mcs_80 = cpu_to_le16(0xfffa), 3248 + .rx_mcs_160 = cpu_to_le16(0xffff), 3249 + .tx_mcs_160 = cpu_to_le16(0xffff), 3250 + .rx_mcs_80p80 = cpu_to_le16(0xffff), 3251 + .tx_mcs_80p80 = cpu_to_le16(0xffff), 3252 + }, 3253 + }, 3254 + .eht_cap = { 3255 + .has_eht = true, 3256 + .eht_cap_elem = { 3257 + .mac_cap_info[0] = 3258 + IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS | 3259 + IEEE80211_EHT_MAC_CAP0_OM_CONTROL | 3260 + IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1, 3261 + .phy_cap_info[0] = 3262 + IEEE80211_EHT_PHY_CAP0_242_TONE_RU_GT20MHZ | 3263 + IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI | 3264 + IEEE80211_EHT_PHY_CAP0_PARTIAL_BW_UL_MU_MIMO | 3265 + IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER | 3266 + IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE, 3267 + .phy_cap_info[3] = 3268 + IEEE80211_EHT_PHY_CAP3_NG_16_SU_FEEDBACK | 3269 + IEEE80211_EHT_PHY_CAP3_NG_16_MU_FEEDBACK | 3270 + IEEE80211_EHT_PHY_CAP3_CODEBOOK_4_2_SU_FDBK | 3271 + IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK | 3272 + IEEE80211_EHT_PHY_CAP3_TRIG_SU_BF_FDBK | 3273 + IEEE80211_EHT_PHY_CAP3_TRIG_MU_BF_PART_BW_FDBK | 3274 + IEEE80211_EHT_PHY_CAP3_TRIG_CQI_FDBK, 3275 + .phy_cap_info[4] = 3276 + IEEE80211_EHT_PHY_CAP4_PART_BW_DL_MU_MIMO | 3277 + IEEE80211_EHT_PHY_CAP4_PSR_SR_SUPP | 3278 + IEEE80211_EHT_PHY_CAP4_POWER_BOOST_FACT_SUPP | 3279 + IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI | 3280 + IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK, 3281 + .phy_cap_info[5] = 3282 + IEEE80211_EHT_PHY_CAP5_NON_TRIG_CQI_FEEDBACK | 3283 + IEEE80211_EHT_PHY_CAP5_TX_LESS_242_TONE_RU_SUPP | 3284 + IEEE80211_EHT_PHY_CAP5_RX_LESS_242_TONE_RU_SUPP | 3285 + IEEE80211_EHT_PHY_CAP5_PPE_THRESHOLD_PRESENT | 3286 + IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK | 3287 + IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK, 3288 + .phy_cap_info[6] = 3289 + IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK | 3290 + IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK, 3291 + .phy_cap_info[7] = 3292 + IEEE80211_EHT_PHY_CAP7_20MHZ_STA_RX_NDP_WIDER_BW, 3293 + }, 3294 + 3295 + /* For all MCS and bandwidth, set 8 NSS for both Tx and 3296 + * Rx 3297 + */ 3298 + .eht_mcs_nss_supp = { 3299 + /* 3300 + * Since B0, B1, B2 and B3 are not set in 3301 + * the supported channel width set field in the 3302 + * HE PHY capabilities information field the 3303 + * device is a 20MHz only device on 2.4GHz band. 3304 + */ 3305 + .only_20mhz = { 3306 + .rx_tx_mcs7_max_nss = 0x88, 3307 + .rx_tx_mcs9_max_nss = 0x88, 3308 + .rx_tx_mcs11_max_nss = 0x88, 3309 + .rx_tx_mcs13_max_nss = 0x88, 3310 + }, 3311 + }, 3312 + /* PPE threshold information is not supported */ 3313 + }, 3314 + }, 3315 + { 3316 + .types_mask = BIT(NL80211_IFTYPE_AP), 3218 3317 .he_cap = { 3219 3318 .has_he = true, 3220 3319 .he_cap_elem = { ··· 3465 3356 3466 3357 static const struct ieee80211_sband_iftype_data sband_capa_5ghz[] = { 3467 3358 { 3468 - /* TODO: should we support other types, e.g., P2P?*/ 3469 - .types_mask = BIT(NL80211_IFTYPE_STATION) | 3470 - BIT(NL80211_IFTYPE_AP), 3359 + /* TODO: should we support other types, e.g., P2P? */ 3360 + .types_mask = BIT(NL80211_IFTYPE_STATION), 3361 + .he_cap = { 3362 + .has_he = true, 3363 + .he_cap_elem = { 3364 + .mac_cap_info[0] = 3365 + IEEE80211_HE_MAC_CAP0_HTC_HE, 3366 + .mac_cap_info[1] = 3367 + IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | 3368 + IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, 3369 + .mac_cap_info[2] = 3370 + IEEE80211_HE_MAC_CAP2_BSR | 3371 + IEEE80211_HE_MAC_CAP2_MU_CASCADING | 3372 + IEEE80211_HE_MAC_CAP2_ACK_EN, 3373 + .mac_cap_info[3] = 3374 + IEEE80211_HE_MAC_CAP3_OMI_CONTROL | 3375 + IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3, 3376 + .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, 3377 + .phy_cap_info[0] = 3378 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | 3379 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | 3380 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G, 3381 + .phy_cap_info[1] = 3382 + IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | 3383 + IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | 3384 + IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD | 3385 + IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS, 3386 + .phy_cap_info[2] = 3387 + IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US | 3388 + IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ | 3389 + IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ | 3390 + IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO | 3391 + IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO, 3392 + 3393 + /* Leave all the other PHY capability bytes 3394 + * unset, as DCM, beam forming, RU and PPE 3395 + * threshold information are not supported 3396 + */ 3397 + }, 3398 + .he_mcs_nss_supp = { 3399 + .rx_mcs_80 = cpu_to_le16(0xfffa), 3400 + .tx_mcs_80 = cpu_to_le16(0xfffa), 3401 + .rx_mcs_160 = cpu_to_le16(0xfffa), 3402 + .tx_mcs_160 = cpu_to_le16(0xfffa), 3403 + .rx_mcs_80p80 = cpu_to_le16(0xfffa), 3404 + .tx_mcs_80p80 = cpu_to_le16(0xfffa), 3405 + }, 3406 + }, 3407 + .eht_cap = { 3408 + .has_eht = true, 3409 + .eht_cap_elem = { 3410 + .mac_cap_info[0] = 3411 + IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS | 3412 + IEEE80211_EHT_MAC_CAP0_OM_CONTROL | 3413 + IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1, 3414 + .phy_cap_info[0] = 3415 + IEEE80211_EHT_PHY_CAP0_242_TONE_RU_GT20MHZ | 3416 + IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI | 3417 + IEEE80211_EHT_PHY_CAP0_PARTIAL_BW_UL_MU_MIMO | 3418 + IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER | 3419 + IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE | 3420 + IEEE80211_EHT_PHY_CAP0_BEAMFORMEE_SS_80MHZ_MASK, 3421 + .phy_cap_info[1] = 3422 + IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_80MHZ_MASK | 3423 + IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_160MHZ_MASK, 3424 + .phy_cap_info[2] = 3425 + IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_80MHZ_MASK | 3426 + IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_160MHZ_MASK, 3427 + .phy_cap_info[3] = 3428 + IEEE80211_EHT_PHY_CAP3_NG_16_SU_FEEDBACK | 3429 + IEEE80211_EHT_PHY_CAP3_NG_16_MU_FEEDBACK | 3430 + IEEE80211_EHT_PHY_CAP3_CODEBOOK_4_2_SU_FDBK | 3431 + IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK | 3432 + IEEE80211_EHT_PHY_CAP3_TRIG_SU_BF_FDBK | 3433 + IEEE80211_EHT_PHY_CAP3_TRIG_MU_BF_PART_BW_FDBK | 3434 + IEEE80211_EHT_PHY_CAP3_TRIG_CQI_FDBK, 3435 + .phy_cap_info[4] = 3436 + IEEE80211_EHT_PHY_CAP4_PART_BW_DL_MU_MIMO | 3437 + IEEE80211_EHT_PHY_CAP4_PSR_SR_SUPP | 3438 + IEEE80211_EHT_PHY_CAP4_POWER_BOOST_FACT_SUPP | 3439 + IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI | 3440 + IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK, 3441 + .phy_cap_info[5] = 3442 + IEEE80211_EHT_PHY_CAP5_NON_TRIG_CQI_FEEDBACK | 3443 + IEEE80211_EHT_PHY_CAP5_TX_LESS_242_TONE_RU_SUPP | 3444 + IEEE80211_EHT_PHY_CAP5_RX_LESS_242_TONE_RU_SUPP | 3445 + IEEE80211_EHT_PHY_CAP5_PPE_THRESHOLD_PRESENT | 3446 + IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK | 3447 + IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK, 3448 + .phy_cap_info[6] = 3449 + IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK | 3450 + IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK, 3451 + .phy_cap_info[7] = 3452 + IEEE80211_EHT_PHY_CAP7_20MHZ_STA_RX_NDP_WIDER_BW | 3453 + IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ | 3454 + IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ | 3455 + IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ | 3456 + IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ, 3457 + }, 3458 + 3459 + /* For all MCS and bandwidth, set 8 NSS for both Tx and 3460 + * Rx 3461 + */ 3462 + .eht_mcs_nss_supp = { 3463 + /* 3464 + * As B1 and B2 are set in the supported 3465 + * channel width set field in the HE PHY 3466 + * capabilities information field include all 3467 + * the following MCS/NSS. 3468 + */ 3469 + .bw._80 = { 3470 + .rx_tx_mcs9_max_nss = 0x88, 3471 + .rx_tx_mcs11_max_nss = 0x88, 3472 + .rx_tx_mcs13_max_nss = 0x88, 3473 + }, 3474 + .bw._160 = { 3475 + .rx_tx_mcs9_max_nss = 0x88, 3476 + .rx_tx_mcs11_max_nss = 0x88, 3477 + .rx_tx_mcs13_max_nss = 0x88, 3478 + }, 3479 + }, 3480 + /* PPE threshold information is not supported */ 3481 + }, 3482 + }, 3483 + { 3484 + .types_mask = BIT(NL80211_IFTYPE_AP), 3471 3485 .he_cap = { 3472 3486 .has_he = true, 3473 3487 .he_cap_elem = { ··· 3761 3529 3762 3530 static const struct ieee80211_sband_iftype_data sband_capa_6ghz[] = { 3763 3531 { 3764 - /* TODO: should we support other types, e.g., P2P?*/ 3765 - .types_mask = BIT(NL80211_IFTYPE_STATION) | 3766 - BIT(NL80211_IFTYPE_AP), 3532 + /* TODO: should we support other types, e.g., P2P? */ 3533 + .types_mask = BIT(NL80211_IFTYPE_STATION), 3534 + .he_6ghz_capa = { 3535 + .capa = cpu_to_le16(IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START | 3536 + IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP | 3537 + IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN | 3538 + IEEE80211_HE_6GHZ_CAP_SM_PS | 3539 + IEEE80211_HE_6GHZ_CAP_RD_RESPONDER | 3540 + IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS | 3541 + IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS), 3542 + }, 3543 + .he_cap = { 3544 + .has_he = true, 3545 + .he_cap_elem = { 3546 + .mac_cap_info[0] = 3547 + IEEE80211_HE_MAC_CAP0_HTC_HE, 3548 + .mac_cap_info[1] = 3549 + IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | 3550 + IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, 3551 + .mac_cap_info[2] = 3552 + IEEE80211_HE_MAC_CAP2_BSR | 3553 + IEEE80211_HE_MAC_CAP2_MU_CASCADING | 3554 + IEEE80211_HE_MAC_CAP2_ACK_EN, 3555 + .mac_cap_info[3] = 3556 + IEEE80211_HE_MAC_CAP3_OMI_CONTROL | 3557 + IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3, 3558 + .mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU, 3559 + .phy_cap_info[0] = 3560 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | 3561 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | 3562 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G, 3563 + .phy_cap_info[1] = 3564 + IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | 3565 + IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | 3566 + IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD | 3567 + IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS, 3568 + .phy_cap_info[2] = 3569 + IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US | 3570 + IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ | 3571 + IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ | 3572 + IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO | 3573 + IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO, 3574 + 3575 + /* Leave all the other PHY capability bytes 3576 + * unset, as DCM, beam forming, RU and PPE 3577 + * threshold information are not supported 3578 + */ 3579 + }, 3580 + .he_mcs_nss_supp = { 3581 + .rx_mcs_80 = cpu_to_le16(0xfffa), 3582 + .tx_mcs_80 = cpu_to_le16(0xfffa), 3583 + .rx_mcs_160 = cpu_to_le16(0xfffa), 3584 + .tx_mcs_160 = cpu_to_le16(0xfffa), 3585 + .rx_mcs_80p80 = cpu_to_le16(0xfffa), 3586 + .tx_mcs_80p80 = cpu_to_le16(0xfffa), 3587 + }, 3588 + }, 3589 + .eht_cap = { 3590 + .has_eht = true, 3591 + .eht_cap_elem = { 3592 + .mac_cap_info[0] = 3593 + IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS | 3594 + IEEE80211_EHT_MAC_CAP0_OM_CONTROL | 3595 + IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1, 3596 + .phy_cap_info[0] = 3597 + IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ | 3598 + IEEE80211_EHT_PHY_CAP0_242_TONE_RU_GT20MHZ | 3599 + IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI | 3600 + IEEE80211_EHT_PHY_CAP0_PARTIAL_BW_UL_MU_MIMO | 3601 + IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER | 3602 + IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE | 3603 + IEEE80211_EHT_PHY_CAP0_BEAMFORMEE_SS_80MHZ_MASK, 3604 + .phy_cap_info[1] = 3605 + IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_80MHZ_MASK | 3606 + IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_160MHZ_MASK | 3607 + IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_320MHZ_MASK, 3608 + .phy_cap_info[2] = 3609 + IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_80MHZ_MASK | 3610 + IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_160MHZ_MASK | 3611 + IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK, 3612 + .phy_cap_info[3] = 3613 + IEEE80211_EHT_PHY_CAP3_NG_16_SU_FEEDBACK | 3614 + IEEE80211_EHT_PHY_CAP3_NG_16_MU_FEEDBACK | 3615 + IEEE80211_EHT_PHY_CAP3_CODEBOOK_4_2_SU_FDBK | 3616 + IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK | 3617 + IEEE80211_EHT_PHY_CAP3_TRIG_SU_BF_FDBK | 3618 + IEEE80211_EHT_PHY_CAP3_TRIG_MU_BF_PART_BW_FDBK | 3619 + IEEE80211_EHT_PHY_CAP3_TRIG_CQI_FDBK, 3620 + .phy_cap_info[4] = 3621 + IEEE80211_EHT_PHY_CAP4_PART_BW_DL_MU_MIMO | 3622 + IEEE80211_EHT_PHY_CAP4_PSR_SR_SUPP | 3623 + IEEE80211_EHT_PHY_CAP4_POWER_BOOST_FACT_SUPP | 3624 + IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI | 3625 + IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK, 3626 + .phy_cap_info[5] = 3627 + IEEE80211_EHT_PHY_CAP5_NON_TRIG_CQI_FEEDBACK | 3628 + IEEE80211_EHT_PHY_CAP5_TX_LESS_242_TONE_RU_SUPP | 3629 + IEEE80211_EHT_PHY_CAP5_RX_LESS_242_TONE_RU_SUPP | 3630 + IEEE80211_EHT_PHY_CAP5_PPE_THRESHOLD_PRESENT | 3631 + IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK | 3632 + IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK, 3633 + .phy_cap_info[6] = 3634 + IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK | 3635 + IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK | 3636 + IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP, 3637 + .phy_cap_info[7] = 3638 + IEEE80211_EHT_PHY_CAP7_20MHZ_STA_RX_NDP_WIDER_BW | 3639 + IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ | 3640 + IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ | 3641 + IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ | 3642 + IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ | 3643 + IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ | 3644 + IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ, 3645 + }, 3646 + 3647 + /* For all MCS and bandwidth, set 8 NSS for both Tx and 3648 + * Rx 3649 + */ 3650 + .eht_mcs_nss_supp = { 3651 + /* 3652 + * As B1 and B2 are set in the supported 3653 + * channel width set field in the HE PHY 3654 + * capabilities information field and 320MHz in 3655 + * 6GHz is supported include all the following 3656 + * MCS/NSS. 3657 + */ 3658 + .bw._80 = { 3659 + .rx_tx_mcs9_max_nss = 0x88, 3660 + .rx_tx_mcs11_max_nss = 0x88, 3661 + .rx_tx_mcs13_max_nss = 0x88, 3662 + }, 3663 + .bw._160 = { 3664 + .rx_tx_mcs9_max_nss = 0x88, 3665 + .rx_tx_mcs11_max_nss = 0x88, 3666 + .rx_tx_mcs13_max_nss = 0x88, 3667 + }, 3668 + .bw._320 = { 3669 + .rx_tx_mcs9_max_nss = 0x88, 3670 + .rx_tx_mcs11_max_nss = 0x88, 3671 + .rx_tx_mcs13_max_nss = 0x88, 3672 + }, 3673 + }, 3674 + /* PPE threshold information is not supported */ 3675 + }, 3676 + }, 3677 + { 3678 + .types_mask = BIT(NL80211_IFTYPE_AP), 3767 3679 .he_6ghz_capa = { 3768 3680 .capa = cpu_to_le16(IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START | 3769 3681 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP |
+5 -4
drivers/net/wireless/marvell/libertas/cfg.c
··· 1435 1435 } 1436 1436 1437 1437 static int lbs_cfg_set_default_key(struct wiphy *wiphy, 1438 - struct net_device *netdev, 1438 + struct net_device *netdev, int link_id, 1439 1439 u8 key_index, bool unicast, 1440 1440 bool multicast) 1441 1441 { ··· 1455 1455 1456 1456 1457 1457 static int lbs_cfg_add_key(struct wiphy *wiphy, struct net_device *netdev, 1458 - u8 idx, bool pairwise, const u8 *mac_addr, 1459 - struct key_params *params) 1458 + int link_id, u8 idx, bool pairwise, 1459 + const u8 *mac_addr, struct key_params *params) 1460 1460 { 1461 1461 struct lbs_private *priv = wiphy_priv(wiphy); 1462 1462 u16 key_info; ··· 1516 1516 1517 1517 1518 1518 static int lbs_cfg_del_key(struct wiphy *wiphy, struct net_device *netdev, 1519 - u8 key_index, bool pairwise, const u8 *mac_addr) 1519 + int link_id, u8 key_index, bool pairwise, 1520 + const u8 *mac_addr) 1520 1521 { 1521 1522 1522 1523 lbs_deb_assoc("del_key: key_idx %d, mac_addr %pM\n",
+6 -4
drivers/net/wireless/marvell/mwifiex/cfg80211.c
··· 142 142 */ 143 143 static int 144 144 mwifiex_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev, 145 - u8 key_index, bool pairwise, const u8 *mac_addr) 145 + int link_id, u8 key_index, bool pairwise, 146 + const u8 *mac_addr) 146 147 { 147 148 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); 148 149 static const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; ··· 432 431 */ 433 432 static int 434 433 mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev, 435 - u8 key_index, bool unicast, 434 + int link_id, u8 key_index, bool unicast, 436 435 bool multicast) 437 436 { 438 437 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); ··· 457 456 */ 458 457 static int 459 458 mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, 460 - u8 key_index, bool pairwise, const u8 *mac_addr, 461 - struct key_params *params) 459 + int link_id, u8 key_index, bool pairwise, 460 + const u8 *mac_addr, struct key_params *params) 462 461 { 463 462 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); 464 463 struct mwifiex_wep_key *wep_key; ··· 495 494 static int 496 495 mwifiex_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, 497 496 struct net_device *netdev, 497 + int link_id, 498 498 u8 key_index) 499 499 { 500 500 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev);
+10 -7
drivers/net/wireless/microchip/wilc1000/cfg80211.c
··· 540 540 return 0; 541 541 } 542 542 543 - static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, 544 - bool pairwise, const u8 *mac_addr, struct key_params *params) 543 + static int add_key(struct wiphy *wiphy, struct net_device *netdev, int link_id, 544 + u8 key_index, bool pairwise, const u8 *mac_addr, 545 + struct key_params *params) 545 546 546 547 { 547 548 int ret = 0, keylen = params->key_len; ··· 645 644 return ret; 646 645 } 647 646 648 - static int del_key(struct wiphy *wiphy, struct net_device *netdev, 647 + static int del_key(struct wiphy *wiphy, struct net_device *netdev, int link_id, 649 648 u8 key_index, 650 649 bool pairwise, 651 650 const u8 *mac_addr) ··· 686 685 return 0; 687 686 } 688 687 689 - static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, 690 - bool pairwise, const u8 *mac_addr, void *cookie, 688 + static int get_key(struct wiphy *wiphy, struct net_device *netdev, int link_id, 689 + u8 key_index, bool pairwise, const u8 *mac_addr, 690 + void *cookie, 691 691 void (*callback)(void *cookie, struct key_params *)) 692 692 { 693 693 struct wilc_vif *vif = netdev_priv(netdev); ··· 725 723 726 724 /* wiphy_new_nm() will WARNON if not present */ 727 725 static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, 728 - u8 key_index, bool unicast, bool multicast) 726 + int link_id, u8 key_index, bool unicast, 727 + bool multicast) 729 728 { 730 729 return 0; 731 730 } 732 731 733 732 static int set_default_mgmt_key(struct wiphy *wiphy, struct net_device *netdev, 734 - u8 key_index) 733 + int link_id, u8 key_index) 735 734 { 736 735 struct wilc_vif *vif = netdev_priv(netdev); 737 736
+8 -8
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
··· 532 532 } 533 533 534 534 static int qtnf_add_key(struct wiphy *wiphy, struct net_device *dev, 535 - u8 key_index, bool pairwise, const u8 *mac_addr, 536 - struct key_params *params) 535 + int link_id, u8 key_index, bool pairwise, 536 + const u8 *mac_addr, struct key_params *params) 537 537 { 538 538 struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); 539 539 int ret; ··· 548 548 } 549 549 550 550 static int qtnf_del_key(struct wiphy *wiphy, struct net_device *dev, 551 - u8 key_index, bool pairwise, const u8 *mac_addr) 551 + int link_id, u8 key_index, bool pairwise, 552 + const u8 *mac_addr) 552 553 { 553 554 struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); 554 555 int ret; ··· 570 569 } 571 570 572 571 static int qtnf_set_default_key(struct wiphy *wiphy, struct net_device *dev, 573 - u8 key_index, bool unicast, bool multicast) 572 + int link_id, u8 key_index, bool unicast, 573 + bool multicast) 574 574 { 575 575 struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); 576 576 int ret; ··· 587 585 588 586 static int 589 587 qtnf_set_default_mgmt_key(struct wiphy *wiphy, struct net_device *dev, 590 - u8 key_index) 588 + int link_id, u8 key_index) 591 589 { 592 590 struct qtnf_vif *vif = qtnf_netdev_get_priv(dev); 593 591 int ret; ··· 723 721 return -EFAULT; 724 722 } 725 723 726 - if (vif->wdev.iftype != NL80211_IFTYPE_STATION) { 724 + if (vif->wdev.iftype != NL80211_IFTYPE_STATION) 727 725 return -EOPNOTSUPP; 728 - } 729 726 730 727 ret = qtnf_cmd_send_disconnect(vif, reason_code); 731 728 if (ret) ··· 750 749 const struct cfg80211_chan_def *chandef = wdev_chandef(wdev, 0); 751 750 struct ieee80211_channel *chan; 752 751 int ret; 753 - 754 752 755 753 sband = wiphy->bands[NL80211_BAND_2GHZ]; 756 754 if (sband && idx >= sband->n_channels) {
+4 -5
drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
··· 2386 2386 rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD, 2387 2387 "Just Read IQK Matrix reg for channel:%d....\n", 2388 2388 channel); 2389 - _rtl92d_phy_patha_fill_iqk_matrix(hw, true, 2390 - rtlphy->iqk_matrix[ 2391 - indexforchannel].value, 0, 2392 - (rtlphy->iqk_matrix[ 2393 - indexforchannel].value[0][2] == 0)); 2389 + if (rtlphy->iqk_matrix[indexforchannel].value[0][0] != 0) 2390 + _rtl92d_phy_patha_fill_iqk_matrix(hw, true, 2391 + rtlphy->iqk_matrix[indexforchannel].value, 0, 2392 + rtlphy->iqk_matrix[indexforchannel].value[0][2] == 0); 2394 2393 if (IS_92D_SINGLEPHY(rtlhal->version)) { 2395 2394 if ((rtlphy->iqk_matrix[ 2396 2395 indexforchannel].value[0][4] != 0)
+1 -1
drivers/net/wireless/realtek/rtw88/bf.c
··· 30 30 void rtw_bf_assoc(struct rtw_dev *rtwdev, struct ieee80211_vif *vif, 31 31 struct ieee80211_bss_conf *bss_conf) 32 32 { 33 + const struct rtw_chip_info *chip = rtwdev->chip; 33 34 struct ieee80211_hw *hw = rtwdev->hw; 34 35 struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv; 35 36 struct rtw_bfee *bfee = &rtwvif->bfee; 36 37 struct rtw_bf_info *bfinfo = &rtwdev->bf_info; 37 - struct rtw_chip_info *chip = rtwdev->chip; 38 38 struct ieee80211_sta *sta; 39 39 struct ieee80211_sta_vht_cap *vht_cap; 40 40 struct ieee80211_sta_vht_cap *ic_vht_cap;
+44 -44
drivers/net/wireless/realtek/rtw88/coex.c
··· 13 13 static u8 rtw_coex_next_rssi_state(struct rtw_dev *rtwdev, u8 pre_state, 14 14 u8 rssi, u8 rssi_thresh) 15 15 { 16 - struct rtw_chip_info *chip = rtwdev->chip; 16 + const struct rtw_chip_info *chip = rtwdev->chip; 17 17 u8 tol = chip->rssi_tolerance; 18 18 u8 next_state; 19 19 ··· 36 36 static void rtw_coex_limited_tx(struct rtw_dev *rtwdev, 37 37 bool tx_limit_en, bool ampdu_limit_en) 38 38 { 39 - struct rtw_chip_info *chip = rtwdev->chip; 39 + const struct rtw_chip_info *chip = rtwdev->chip; 40 40 struct rtw_coex *coex = &rtwdev->coex; 41 41 struct rtw_coex_stat *coex_stat = &coex->stat; 42 42 u8 num_of_active_port = 1; ··· 365 365 366 366 void rtw_coex_write_scbd(struct rtw_dev *rtwdev, u16 bitpos, bool set) 367 367 { 368 - struct rtw_chip_info *chip = rtwdev->chip; 368 + const struct rtw_chip_info *chip = rtwdev->chip; 369 369 struct rtw_coex *coex = &rtwdev->coex; 370 370 struct rtw_coex_stat *coex_stat = &coex->stat; 371 371 u16 val = 0x2; ··· 400 400 401 401 static u16 rtw_coex_read_scbd(struct rtw_dev *rtwdev) 402 402 { 403 - struct rtw_chip_info *chip = rtwdev->chip; 403 + const struct rtw_chip_info *chip = rtwdev->chip; 404 404 405 405 if (!chip->scbd_support) 406 406 return 0; ··· 410 410 411 411 static void rtw_coex_check_rfk(struct rtw_dev *rtwdev) 412 412 { 413 - struct rtw_chip_info *chip = rtwdev->chip; 413 + const struct rtw_chip_info *chip = rtwdev->chip; 414 414 struct rtw_coex *coex = &rtwdev->coex; 415 415 struct rtw_coex_stat *coex_stat = &coex->stat; 416 416 struct rtw_coex_rfe *coex_rfe = &coex->rfe; ··· 489 489 490 490 static void rtw_coex_monitor_bt_enable(struct rtw_dev *rtwdev) 491 491 { 492 - struct rtw_chip_info *chip = rtwdev->chip; 492 + const struct rtw_chip_info *chip = rtwdev->chip; 493 493 struct rtw_coex *coex = &rtwdev->coex; 494 494 struct rtw_coex_stat *coex_stat = &coex->stat; 495 495 struct rtw_coex_dm *coex_dm = &coex->dm; ··· 524 524 525 525 static void rtw_coex_update_wl_link_info(struct rtw_dev *rtwdev, u8 reason) 526 526 { 527 + const struct rtw_chip_info *chip = rtwdev->chip; 527 528 struct rtw_coex *coex = &rtwdev->coex; 528 529 struct rtw_coex_stat *coex_stat = &coex->stat; 529 530 struct rtw_coex_dm *coex_dm = &coex->dm; 530 - struct rtw_chip_info *chip = rtwdev->chip; 531 531 struct rtw_traffic_stats *stats = &rtwdev->stats; 532 532 bool is_5G = false; 533 533 bool wl_busy = false; ··· 706 706 707 707 static void rtw_coex_update_bt_link_info(struct rtw_dev *rtwdev) 708 708 { 709 + const struct rtw_chip_info *chip = rtwdev->chip; 709 710 struct rtw_coex *coex = &rtwdev->coex; 710 711 struct rtw_coex_stat *coex_stat = &coex->stat; 711 712 struct rtw_coex_dm *coex_dm = &coex->dm; 712 - struct rtw_chip_info *chip = rtwdev->chip; 713 713 u8 i; 714 714 u8 rssi_state; 715 715 u8 rssi_step; ··· 806 806 807 807 static void rtw_coex_update_wl_ch_info(struct rtw_dev *rtwdev, u8 type) 808 808 { 809 - struct rtw_chip_info *chip = rtwdev->chip; 809 + const struct rtw_chip_info *chip = rtwdev->chip; 810 810 struct rtw_efuse *efuse = &rtwdev->efuse; 811 811 struct rtw_coex_dm *coex_dm = &rtwdev->coex.dm; 812 812 struct rtw_coex_stat *coex_stat = &rtwdev->coex.stat; ··· 933 933 934 934 static void rtw_coex_coex_ctrl_owner(struct rtw_dev *rtwdev, bool wifi_control) 935 935 { 936 - struct rtw_chip_info *chip = rtwdev->chip; 936 + const struct rtw_chip_info *chip = rtwdev->chip; 937 937 const struct rtw_hw_reg *btg_reg = chip->btg_reg; 938 938 939 939 if (wifi_control) { ··· 981 981 static void rtw_btc_wltoggle_table_a(struct rtw_dev *rtwdev, bool force, 982 982 u8 table_case) 983 983 { 984 - struct rtw_chip_info *chip = rtwdev->chip; 984 + const struct rtw_chip_info *chip = rtwdev->chip; 985 985 struct rtw_efuse *efuse = &rtwdev->efuse; 986 986 u8 h2c_para[6] = {0}; 987 987 u32 table_wl = 0x5a5a5a5a; ··· 1065 1065 1066 1066 static void rtw_coex_table(struct rtw_dev *rtwdev, bool force, u8 type) 1067 1067 { 1068 + const struct rtw_chip_info *chip = rtwdev->chip; 1068 1069 struct rtw_coex *coex = &rtwdev->coex; 1069 1070 struct rtw_coex_dm *coex_dm = &coex->dm; 1070 - struct rtw_chip_info *chip = rtwdev->chip; 1071 1071 struct rtw_efuse *efuse = &rtwdev->efuse; 1072 1072 struct rtw_coex_stat *coex_stat = &coex->stat; 1073 1073 ··· 1135 1135 static void rtw_coex_set_tdma(struct rtw_dev *rtwdev, u8 byte1, u8 byte2, 1136 1136 u8 byte3, u8 byte4, u8 byte5) 1137 1137 { 1138 + const struct rtw_chip_info *chip = rtwdev->chip; 1138 1139 struct rtw_coex *coex = &rtwdev->coex; 1139 1140 struct rtw_coex_dm *coex_dm = &coex->dm; 1140 - struct rtw_chip_info *chip = rtwdev->chip; 1141 1141 struct rtw_coex_stat *coex_stat = &coex->stat; 1142 1142 u8 ps_type = COEX_PS_WIFI_NATIVE; 1143 1143 bool ap_enable = false; ··· 1193 1193 1194 1194 static void rtw_coex_tdma(struct rtw_dev *rtwdev, bool force, u32 tcase) 1195 1195 { 1196 + const struct rtw_chip_info *chip = rtwdev->chip; 1196 1197 struct rtw_coex *coex = &rtwdev->coex; 1197 1198 struct rtw_coex_dm *coex_dm = &coex->dm; 1198 1199 struct rtw_coex_stat *coex_stat = &coex->stat; 1199 - struct rtw_chip_info *chip = rtwdev->chip; 1200 1200 struct rtw_efuse *efuse = &rtwdev->efuse; 1201 1201 u8 n, type; 1202 1202 bool turn_on; ··· 1526 1526 1527 1527 static void rtw_coex_action_coex_all_off(struct rtw_dev *rtwdev) 1528 1528 { 1529 + const struct rtw_chip_info *chip = rtwdev->chip; 1529 1530 struct rtw_efuse *efuse = &rtwdev->efuse; 1530 - struct rtw_chip_info *chip = rtwdev->chip; 1531 1531 u8 table_case, tdma_case; 1532 1532 1533 1533 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 1549 1549 1550 1550 static void rtw_coex_action_freerun(struct rtw_dev *rtwdev) 1551 1551 { 1552 + const struct rtw_chip_info *chip = rtwdev->chip; 1552 1553 struct rtw_coex *coex = &rtwdev->coex; 1553 1554 struct rtw_coex_stat *coex_stat = &coex->stat; 1554 1555 struct rtw_coex_dm *coex_dm = &coex->dm; 1555 1556 struct rtw_efuse *efuse = &rtwdev->efuse; 1556 - struct rtw_chip_info *chip = rtwdev->chip; 1557 1557 u8 level = 0; 1558 1558 bool bt_afh_loss = true; 1559 1559 ··· 1594 1594 1595 1595 static void rtw_coex_action_rf4ce(struct rtw_dev *rtwdev) 1596 1596 { 1597 + const struct rtw_chip_info *chip = rtwdev->chip; 1597 1598 struct rtw_efuse *efuse = &rtwdev->efuse; 1598 - struct rtw_chip_info *chip = rtwdev->chip; 1599 1599 u8 table_case, tdma_case; 1600 1600 1601 1601 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 1619 1619 1620 1620 static void rtw_coex_action_bt_whql_test(struct rtw_dev *rtwdev) 1621 1621 { 1622 + const struct rtw_chip_info *chip = rtwdev->chip; 1622 1623 struct rtw_efuse *efuse = &rtwdev->efuse; 1623 - struct rtw_chip_info *chip = rtwdev->chip; 1624 1624 u8 table_case, tdma_case; 1625 1625 1626 1626 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 1644 1644 1645 1645 static void rtw_coex_action_bt_relink(struct rtw_dev *rtwdev) 1646 1646 { 1647 + const struct rtw_chip_info *chip = rtwdev->chip; 1647 1648 struct rtw_coex *coex = &rtwdev->coex; 1648 1649 struct rtw_coex_stat *coex_stat = &coex->stat; 1649 1650 struct rtw_efuse *efuse = &rtwdev->efuse; 1650 - struct rtw_chip_info *chip = rtwdev->chip; 1651 1651 u8 table_case, tdma_case; 1652 1652 u32 slot_type = 0; 1653 1653 ··· 1684 1684 1685 1685 static void rtw_coex_action_bt_idle(struct rtw_dev *rtwdev) 1686 1686 { 1687 + const struct rtw_chip_info *chip = rtwdev->chip; 1687 1688 struct rtw_coex *coex = &rtwdev->coex; 1688 1689 struct rtw_coex_stat *coex_stat = &coex->stat; 1689 1690 struct rtw_coex_dm *coex_dm = &coex->dm; 1690 1691 struct rtw_efuse *efuse = &rtwdev->efuse; 1691 - struct rtw_chip_info *chip = rtwdev->chip; 1692 1692 struct rtw_coex_rfe *coex_rfe = &coex->rfe; 1693 1693 u8 table_case = 0xff, tdma_case = 0xff; 1694 1694 ··· 1753 1753 1754 1754 static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev) 1755 1755 { 1756 + const struct rtw_chip_info *chip = rtwdev->chip; 1756 1757 struct rtw_coex *coex = &rtwdev->coex; 1757 1758 struct rtw_coex_stat *coex_stat = &coex->stat; 1758 1759 struct rtw_efuse *efuse = &rtwdev->efuse; 1759 - struct rtw_chip_info *chip = rtwdev->chip; 1760 1760 bool wl_hi_pri = false; 1761 1761 u8 table_case, tdma_case; 1762 1762 u32 slot_type = 0; ··· 1853 1853 1854 1854 static void rtw_coex_action_bt_game_hid(struct rtw_dev *rtwdev) 1855 1855 { 1856 + const struct rtw_chip_info *chip = rtwdev->chip; 1856 1857 struct rtw_coex *coex = &rtwdev->coex; 1857 1858 struct rtw_coex_stat *coex_stat = &coex->stat; 1858 1859 struct rtw_efuse *efuse = &rtwdev->efuse; 1859 1860 struct rtw_coex_dm *coex_dm = &coex->dm; 1860 - struct rtw_chip_info *chip = rtwdev->chip; 1861 1861 u8 table_case, tdma_case; 1862 1862 1863 1863 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 1901 1901 1902 1902 static void rtw_coex_action_bt_hfp(struct rtw_dev *rtwdev) 1903 1903 { 1904 + const struct rtw_chip_info *chip = rtwdev->chip; 1904 1905 struct rtw_coex *coex = &rtwdev->coex; 1905 1906 struct rtw_coex_stat *coex_stat = &coex->stat; 1906 1907 struct rtw_efuse *efuse = &rtwdev->efuse; 1907 - struct rtw_chip_info *chip = rtwdev->chip; 1908 1908 u8 table_case, tdma_case; 1909 1909 1910 1910 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 1932 1932 1933 1933 static void rtw_coex_action_bt_hid(struct rtw_dev *rtwdev) 1934 1934 { 1935 + const struct rtw_chip_info *chip = rtwdev->chip; 1935 1936 struct rtw_coex *coex = &rtwdev->coex; 1936 1937 struct rtw_coex_stat *coex_stat = &coex->stat; 1937 1938 struct rtw_efuse *efuse = &rtwdev->efuse; 1938 - struct rtw_chip_info *chip = rtwdev->chip; 1939 1939 u8 table_case, tdma_case; 1940 1940 u32 slot_type = 0; 1941 1941 bool bt_multi_link_remain = false, is_toggle_table = false; ··· 2015 2015 2016 2016 static void rtw_coex_action_bt_a2dp(struct rtw_dev *rtwdev) 2017 2017 { 2018 + const struct rtw_chip_info *chip = rtwdev->chip; 2018 2019 struct rtw_coex *coex = &rtwdev->coex; 2019 2020 struct rtw_coex_stat *coex_stat = &coex->stat; 2020 2021 struct rtw_coex_dm *coex_dm = &coex->dm; 2021 2022 struct rtw_efuse *efuse = &rtwdev->efuse; 2022 - struct rtw_chip_info *chip = rtwdev->chip; 2023 2023 u8 table_case, tdma_case; 2024 2024 u32 slot_type = 0; 2025 2025 ··· 2057 2057 2058 2058 static void rtw_coex_action_bt_a2dpsink(struct rtw_dev *rtwdev) 2059 2059 { 2060 + const struct rtw_chip_info *chip = rtwdev->chip; 2060 2061 struct rtw_coex *coex = &rtwdev->coex; 2061 2062 struct rtw_coex_stat *coex_stat = &coex->stat; 2062 2063 struct rtw_efuse *efuse = &rtwdev->efuse; 2063 - struct rtw_chip_info *chip = rtwdev->chip; 2064 2064 u8 table_case, tdma_case; 2065 2065 bool ap_enable = false; 2066 2066 ··· 2096 2096 2097 2097 static void rtw_coex_action_bt_pan(struct rtw_dev *rtwdev) 2098 2098 { 2099 + const struct rtw_chip_info *chip = rtwdev->chip; 2099 2100 struct rtw_coex *coex = &rtwdev->coex; 2100 2101 struct rtw_coex_stat *coex_stat = &coex->stat; 2101 2102 struct rtw_efuse *efuse = &rtwdev->efuse; 2102 - struct rtw_chip_info *chip = rtwdev->chip; 2103 2103 u8 table_case, tdma_case; 2104 2104 2105 2105 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 2133 2133 2134 2134 static void rtw_coex_action_bt_a2dp_hid(struct rtw_dev *rtwdev) 2135 2135 { 2136 + const struct rtw_chip_info *chip = rtwdev->chip; 2136 2137 struct rtw_coex *coex = &rtwdev->coex; 2137 2138 struct rtw_coex_stat *coex_stat = &coex->stat; 2138 2139 struct rtw_coex_dm *coex_dm = &coex->dm; 2139 2140 struct rtw_efuse *efuse = &rtwdev->efuse; 2140 - struct rtw_chip_info *chip = rtwdev->chip; 2141 2141 u8 table_case, tdma_case, interval = 0; 2142 2142 u32 slot_type = 0; 2143 2143 bool is_toggle_table = false; ··· 2190 2190 2191 2191 static void rtw_coex_action_bt_a2dp_pan(struct rtw_dev *rtwdev) 2192 2192 { 2193 + const struct rtw_chip_info *chip = rtwdev->chip; 2193 2194 struct rtw_coex *coex = &rtwdev->coex; 2194 2195 struct rtw_coex_stat *coex_stat = &coex->stat; 2195 2196 struct rtw_efuse *efuse = &rtwdev->efuse; 2196 - struct rtw_chip_info *chip = rtwdev->chip; 2197 2197 u8 table_case, tdma_case; 2198 2198 bool wl_cpt_test = false, bt_cpt_test = false; 2199 2199 ··· 2247 2247 2248 2248 static void rtw_coex_action_bt_pan_hid(struct rtw_dev *rtwdev) 2249 2249 { 2250 + const struct rtw_chip_info *chip = rtwdev->chip; 2250 2251 struct rtw_coex *coex = &rtwdev->coex; 2251 2252 struct rtw_coex_stat *coex_stat = &coex->stat; 2252 2253 struct rtw_efuse *efuse = &rtwdev->efuse; 2253 - struct rtw_chip_info *chip = rtwdev->chip; 2254 2254 u8 table_case, tdma_case; 2255 2255 2256 2256 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 2282 2282 2283 2283 static void rtw_coex_action_bt_a2dp_pan_hid(struct rtw_dev *rtwdev) 2284 2284 { 2285 + const struct rtw_chip_info *chip = rtwdev->chip; 2285 2286 struct rtw_coex *coex = &rtwdev->coex; 2286 2287 struct rtw_coex_stat *coex_stat = &coex->stat; 2287 2288 struct rtw_efuse *efuse = &rtwdev->efuse; 2288 - struct rtw_chip_info *chip = rtwdev->chip; 2289 2289 u8 table_case, tdma_case; 2290 2290 2291 2291 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 2316 2316 2317 2317 static void rtw_coex_action_wl_under5g(struct rtw_dev *rtwdev) 2318 2318 { 2319 + const struct rtw_chip_info *chip = rtwdev->chip; 2319 2320 struct rtw_coex *coex = &rtwdev->coex; 2320 2321 struct rtw_efuse *efuse = &rtwdev->efuse; 2321 - struct rtw_chip_info *chip = rtwdev->chip; 2322 2322 struct rtw_coex_stat *coex_stat = &coex->stat; 2323 2323 u8 table_case, tdma_case; 2324 2324 ··· 2348 2348 2349 2349 static void rtw_coex_action_wl_only(struct rtw_dev *rtwdev) 2350 2350 { 2351 + const struct rtw_chip_info *chip = rtwdev->chip; 2351 2352 struct rtw_efuse *efuse = &rtwdev->efuse; 2352 - struct rtw_chip_info *chip = rtwdev->chip; 2353 2353 u8 table_case, tdma_case; 2354 2354 2355 2355 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 2372 2372 2373 2373 static void rtw_coex_action_wl_native_lps(struct rtw_dev *rtwdev) 2374 2374 { 2375 + const struct rtw_chip_info *chip = rtwdev->chip; 2375 2376 struct rtw_coex *coex = &rtwdev->coex; 2376 2377 struct rtw_efuse *efuse = &rtwdev->efuse; 2377 - struct rtw_chip_info *chip = rtwdev->chip; 2378 2378 struct rtw_coex_stat *coex_stat = &coex->stat; 2379 2379 u8 table_case, tdma_case; 2380 2380 ··· 2411 2411 2412 2412 static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev) 2413 2413 { 2414 + const struct rtw_chip_info *chip = rtwdev->chip; 2414 2415 struct rtw_coex *coex = &rtwdev->coex; 2415 2416 struct rtw_coex_stat *coex_stat = &coex->stat; 2416 2417 struct rtw_efuse *efuse = &rtwdev->efuse; 2417 - struct rtw_chip_info *chip = rtwdev->chip; 2418 2418 u8 table_case, tdma_case; 2419 2419 u32 slot_type = 0; 2420 2420 ··· 2451 2451 2452 2452 static void rtw_coex_action_wl_not_connected(struct rtw_dev *rtwdev) 2453 2453 { 2454 + const struct rtw_chip_info *chip = rtwdev->chip; 2454 2455 struct rtw_efuse *efuse = &rtwdev->efuse; 2455 - struct rtw_chip_info *chip = rtwdev->chip; 2456 2456 u8 table_case, tdma_case; 2457 2457 2458 2458 rtw_dbg(rtwdev, RTW_DBG_COEX, "[BTCoex], %s()\n", __func__); ··· 2528 2528 2529 2529 static void rtw_coex_run_coex(struct rtw_dev *rtwdev, u8 reason) 2530 2530 { 2531 + const struct rtw_chip_info *chip = rtwdev->chip; 2531 2532 struct rtw_coex *coex = &rtwdev->coex; 2532 - struct rtw_chip_info *chip = rtwdev->chip; 2533 2533 struct rtw_coex_dm *coex_dm = &coex->dm; 2534 2534 struct rtw_coex_stat *coex_stat = &coex->stat; 2535 2535 bool rf4ce_en = false; ··· 3002 3002 3003 3003 void rtw_coex_bt_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) 3004 3004 { 3005 + const struct rtw_chip_info *chip = rtwdev->chip; 3005 3006 struct rtw_coex *coex = &rtwdev->coex; 3006 3007 struct rtw_coex_stat *coex_stat = &coex->stat; 3007 - struct rtw_chip_info *chip = rtwdev->chip; 3008 3008 struct rtw_coex_dm *coex_dm = &coex->dm; 3009 3009 u32 bt_relink_time; 3010 3010 u8 i, rsp_source = 0, type; ··· 3270 3270 3271 3271 void rtw_coex_bt_hid_info_notify(struct rtw_dev *rtwdev, u8 *buf, u8 length) 3272 3272 { 3273 + const struct rtw_chip_info *chip = rtwdev->chip; 3273 3274 struct rtw_coex *coex = &rtwdev->coex; 3274 - struct rtw_chip_info *chip = rtwdev->chip; 3275 3275 struct rtw_coex_stat *coex_stat = &coex->stat; 3276 3276 struct rtw_coex_hid *hidinfo; 3277 3277 struct rtw_coex_hid_info_a *hida; ··· 3360 3360 3361 3361 void rtw_coex_query_bt_hid_list(struct rtw_dev *rtwdev) 3362 3362 { 3363 + const struct rtw_chip_info *chip = rtwdev->chip; 3363 3364 struct rtw_coex *coex = &rtwdev->coex; 3364 - struct rtw_chip_info *chip = rtwdev->chip; 3365 3365 struct rtw_coex_stat *coex_stat = &coex->stat; 3366 3366 struct rtw_coex_hid *hidinfo; 3367 3367 u8 i, handle; ··· 3582 3582 static u8 rtw_coex_get_table_index(struct rtw_dev *rtwdev, u32 wl_reg_6c0, 3583 3583 u32 wl_reg_6c4) 3584 3584 { 3585 - struct rtw_chip_info *chip = rtwdev->chip; 3585 + const struct rtw_chip_info *chip = rtwdev->chip; 3586 3586 struct rtw_efuse *efuse = &rtwdev->efuse; 3587 3587 u8 ans = 0xFF; 3588 3588 u8 n, i; ··· 3618 3618 3619 3619 static u8 rtw_coex_get_tdma_index(struct rtw_dev *rtwdev, u8 *tdma_para) 3620 3620 { 3621 + const struct rtw_chip_info *chip = rtwdev->chip; 3621 3622 struct rtw_efuse *efuse = &rtwdev->efuse; 3622 - struct rtw_chip_info *chip = rtwdev->chip; 3623 3623 u8 ans = 0xFF; 3624 3624 u8 n, i, j; 3625 3625 u8 load_cur_tab_val; ··· 3736 3736 3737 3737 static void rtw_coex_set_coexinfo_hw(struct rtw_dev *rtwdev, struct seq_file *m) 3738 3738 { 3739 - struct rtw_chip_info *chip = rtwdev->chip; 3739 + const struct rtw_chip_info *chip = rtwdev->chip; 3740 3740 const struct rtw_reg_domain *reg; 3741 3741 char addr_info[INFO_SIZE]; 3742 3742 int n_addr = 0; ··· 3910 3910 3911 3911 void rtw_coex_display_coex_info(struct rtw_dev *rtwdev, struct seq_file *m) 3912 3912 { 3913 - struct rtw_chip_info *chip = rtwdev->chip; 3913 + const struct rtw_chip_info *chip = rtwdev->chip; 3914 3914 struct rtw_dm_info *dm_info = &rtwdev->dm_info; 3915 3915 struct rtw_coex *coex = &rtwdev->coex; 3916 3916 struct rtw_coex_stat *coex_stat = &coex->stat;
+7 -7
drivers/net/wireless/realtek/rtw88/coex.h
··· 327 327 328 328 static inline void rtw_coex_set_init(struct rtw_dev *rtwdev) 329 329 { 330 - struct rtw_chip_info *chip = rtwdev->chip; 330 + const struct rtw_chip_info *chip = rtwdev->chip; 331 331 332 332 chip->ops->coex_set_init(rtwdev); 333 333 } ··· 335 335 static inline 336 336 void rtw_coex_set_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type, u8 pos_type) 337 337 { 338 - struct rtw_chip_info *chip = rtwdev->chip; 338 + const struct rtw_chip_info *chip = rtwdev->chip; 339 339 340 340 if (!chip->ops->coex_set_ant_switch) 341 341 return; ··· 345 345 346 346 static inline void rtw_coex_set_gnt_fix(struct rtw_dev *rtwdev) 347 347 { 348 - struct rtw_chip_info *chip = rtwdev->chip; 348 + const struct rtw_chip_info *chip = rtwdev->chip; 349 349 350 350 chip->ops->coex_set_gnt_fix(rtwdev); 351 351 } 352 352 353 353 static inline void rtw_coex_set_gnt_debug(struct rtw_dev *rtwdev) 354 354 { 355 - struct rtw_chip_info *chip = rtwdev->chip; 355 + const struct rtw_chip_info *chip = rtwdev->chip; 356 356 357 357 chip->ops->coex_set_gnt_debug(rtwdev); 358 358 } 359 359 360 360 static inline void rtw_coex_set_rfe_type(struct rtw_dev *rtwdev) 361 361 { 362 - struct rtw_chip_info *chip = rtwdev->chip; 362 + const struct rtw_chip_info *chip = rtwdev->chip; 363 363 364 364 chip->ops->coex_set_rfe_type(rtwdev); 365 365 } 366 366 367 367 static inline void rtw_coex_set_wl_tx_power(struct rtw_dev *rtwdev, u8 wl_pwr) 368 368 { 369 - struct rtw_chip_info *chip = rtwdev->chip; 369 + const struct rtw_chip_info *chip = rtwdev->chip; 370 370 371 371 chip->ops->coex_set_wl_tx_power(rtwdev, wl_pwr); 372 372 } ··· 374 374 static inline 375 375 void rtw_coex_set_wl_rx_gain(struct rtw_dev *rtwdev, bool low_gain) 376 376 { 377 - struct rtw_chip_info *chip = rtwdev->chip; 377 + const struct rtw_chip_info *chip = rtwdev->chip; 378 378 379 379 chip->ops->coex_set_wl_rx_gain(rtwdev, low_gain); 380 380 }
+7 -4
drivers/net/wireless/realtek/rtw88/debug.c
··· 621 621 struct rtw_debugfs_priv *debugfs_priv = m->private; 622 622 struct rtw_dev *rtwdev = debugfs_priv->rtwdev; 623 623 struct rtw_hal *hal = &rtwdev->hal; 624 - u8 path, rate; 624 + u8 path, rate, bw, ch, regd; 625 625 struct rtw_power_params pwr_param = {0}; 626 - u8 bw = hal->current_band_width; 627 - u8 ch = hal->current_channel; 628 - u8 regd = rtw_regd_get(rtwdev); 626 + 627 + mutex_lock(&rtwdev->mutex); 628 + bw = hal->current_band_width; 629 + ch = hal->current_channel; 630 + regd = rtw_regd_get(rtwdev); 629 631 630 632 seq_printf(m, "channel: %u\n", ch); 631 633 seq_printf(m, "bandwidth: %u\n", bw); ··· 669 667 } 670 668 671 669 mutex_unlock(&hal->tx_power_mutex); 670 + mutex_unlock(&rtwdev->mutex); 672 671 673 672 return 0; 674 673 }
+2 -2
drivers/net/wireless/realtek/rtw88/efuse.c
··· 86 86 87 87 static int rtw_dump_physical_efuse_map(struct rtw_dev *rtwdev, u8 *map) 88 88 { 89 - struct rtw_chip_info *chip = rtwdev->chip; 89 + const struct rtw_chip_info *chip = rtwdev->chip; 90 90 u32 size = rtwdev->efuse.physical_size; 91 91 u32 efuse_ctl; 92 92 u32 addr; ··· 145 145 146 146 int rtw_parse_efuse_map(struct rtw_dev *rtwdev) 147 147 { 148 - struct rtw_chip_info *chip = rtwdev->chip; 148 + const struct rtw_chip_info *chip = rtwdev->chip; 149 149 struct rtw_efuse *efuse = &rtwdev->efuse; 150 150 u32 phy_size = efuse->physical_size; 151 151 u32 log_size = efuse->logical_size;
+67 -28
drivers/net/wireless/realtek/rtw88/fw.c
··· 14 14 #include "util.h" 15 15 #include "wow.h" 16 16 #include "ps.h" 17 + #include "phy.h" 18 + #include "mac.h" 17 19 18 20 static void rtw_fw_c2h_cmd_handle_ext(struct rtw_dev *rtwdev, 19 21 struct sk_buff *skb) ··· 906 904 static struct sk_buff *rtw_nlo_info_get(struct ieee80211_hw *hw) 907 905 { 908 906 struct rtw_dev *rtwdev = hw->priv; 909 - struct rtw_chip_info *chip = rtwdev->chip; 907 + const struct rtw_chip_info *chip = rtwdev->chip; 910 908 struct rtw_pno_request *pno_req = &rtwdev->wow.pno_req; 911 909 struct rtw_nlo_info_hdr *nlo_hdr; 912 910 struct cfg80211_ssid *ssid; ··· 961 959 static struct sk_buff *rtw_cs_channel_info_get(struct ieee80211_hw *hw) 962 960 { 963 961 struct rtw_dev *rtwdev = hw->priv; 964 - struct rtw_chip_info *chip = rtwdev->chip; 962 + const struct rtw_chip_info *chip = rtwdev->chip; 965 963 struct rtw_pno_request *pno_req = &rtwdev->wow.pno_req; 966 964 struct ieee80211_channel *channels = pno_req->channels; 967 965 struct sk_buff *skb; ··· 995 993 static struct sk_buff *rtw_lps_pg_dpk_get(struct ieee80211_hw *hw) 996 994 { 997 995 struct rtw_dev *rtwdev = hw->priv; 998 - struct rtw_chip_info *chip = rtwdev->chip; 996 + const struct rtw_chip_info *chip = rtwdev->chip; 999 997 struct rtw_dpk_info *dpk_info = &rtwdev->dm_info.dpk_info; 1000 998 struct rtw_lps_pg_dpk_hdr *dpk_hdr; 1001 999 struct sk_buff *skb; ··· 1020 1018 static struct sk_buff *rtw_lps_pg_info_get(struct ieee80211_hw *hw) 1021 1019 { 1022 1020 struct rtw_dev *rtwdev = hw->priv; 1023 - struct rtw_chip_info *chip = rtwdev->chip; 1021 + const struct rtw_chip_info *chip = rtwdev->chip; 1024 1022 struct rtw_lps_conf *conf = &rtwdev->lps_conf; 1025 1023 struct rtw_lps_pg_info_hdr *pg_info_hdr; 1026 1024 struct rtw_wow_param *rtw_wow = &rtwdev->wow; ··· 1124 1122 enum rtw_rsvd_packet_type type) 1125 1123 { 1126 1124 struct rtw_tx_pkt_info pkt_info = {0}; 1127 - struct rtw_chip_info *chip = rtwdev->chip; 1125 + const struct rtw_chip_info *chip = rtwdev->chip; 1128 1126 u8 *pkt_desc; 1129 1127 1130 1128 rtw_tx_rsvd_page_pkt_info_update(rtwdev, &pkt_info, skb, type); ··· 1435 1433 static u8 *rtw_build_rsvd_page(struct rtw_dev *rtwdev, u32 *size) 1436 1434 { 1437 1435 struct ieee80211_hw *hw = rtwdev->hw; 1438 - struct rtw_chip_info *chip = rtwdev->chip; 1436 + const struct rtw_chip_info *chip = rtwdev->chip; 1439 1437 struct sk_buff *iter; 1440 1438 struct rtw_rsvd_page *rsvd_pkt; 1441 1439 u32 page = 0; ··· 1649 1647 static void rtw_fw_read_fifo(struct rtw_dev *rtwdev, enum rtw_fw_fifo_sel sel, 1650 1648 u32 offset, u32 size, u32 *buf) 1651 1649 { 1652 - struct rtw_chip_info *chip = rtwdev->chip; 1650 + const struct rtw_chip_info *chip = rtwdev->chip; 1653 1651 u32 start_pg, residue; 1654 1652 1655 1653 if (sel >= RTW_FW_FIFO_MAX) { ··· 1708 1706 static void __rtw_fw_update_pkt(struct rtw_dev *rtwdev, u8 pkt_id, u16 size, 1709 1707 u8 location) 1710 1708 { 1711 - struct rtw_chip_info *chip = rtwdev->chip; 1709 + const struct rtw_chip_info *chip = rtwdev->chip; 1712 1710 u8 h2c_pkt[H2C_PKT_SIZE] = {0}; 1713 1711 u16 total_size = H2C_PKT_HDR_SIZE + H2C_PKT_UPDATE_PKT_LEN; 1714 1712 ··· 1820 1818 struct sk_buff_head *list, u8 *bands, 1821 1819 struct rtw_vif *rtwvif) 1822 1820 { 1821 + const struct rtw_chip_info *chip = rtwdev->chip; 1823 1822 struct ieee80211_scan_ies *ies = rtwvif->scan_ies; 1824 - struct rtw_chip_info *chip = rtwdev->chip; 1825 1823 struct sk_buff *new; 1826 1824 u8 idx; 1827 1825 ··· 1843 1841 static int _rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev, u8 num_probes, 1844 1842 struct sk_buff_head *probe_req_list) 1845 1843 { 1846 - struct rtw_chip_info *chip = rtwdev->chip; 1844 + const struct rtw_chip_info *chip = rtwdev->chip; 1847 1845 struct sk_buff *skb, *tmp; 1848 1846 u8 page_offset = 1, *buf, page_size = chip->page_size; 1849 - u8 pages = page_offset + num_probes * RTW_PROBE_PG_CNT; 1850 1847 u16 pg_addr = rtwdev->fifo.rsvd_h2c_info_addr, loc; 1851 1848 u16 buf_offset = page_size * page_offset; 1852 1849 u8 tx_desc_sz = chip->tx_pkt_desc_sz; 1850 + u8 page_cnt, pages; 1853 1851 unsigned int pkt_len; 1854 1852 int ret; 1853 + 1854 + if (rtw_fw_feature_ext_check(&rtwdev->fw, FW_FEATURE_EXT_OLD_PAGE_NUM)) 1855 + page_cnt = RTW_OLD_PROBE_PG_CNT; 1856 + else 1857 + page_cnt = RTW_PROBE_PG_CNT; 1858 + 1859 + pages = page_offset + num_probes * page_cnt; 1855 1860 1856 1861 buf = kzalloc(page_size * pages, GFP_KERNEL); 1857 1862 if (!buf) ··· 1868 1859 skb_queue_walk_safe(probe_req_list, skb, tmp) { 1869 1860 skb_unlink(skb, probe_req_list); 1870 1861 rtw_fill_rsvd_page_desc(rtwdev, skb, RSVD_PROBE_REQ); 1871 - if (skb->len > page_size * RTW_PROBE_PG_CNT) { 1862 + if (skb->len > page_size * page_cnt) { 1872 1863 ret = -EINVAL; 1873 1864 goto out; 1874 1865 } ··· 1878 1869 loc = pg_addr - rtwdev->fifo.rsvd_boundary + page_offset; 1879 1870 __rtw_fw_update_pkt(rtwdev, RTW_PACKET_PROBE_REQ, pkt_len, loc); 1880 1871 1881 - buf_offset += RTW_PROBE_PG_CNT * page_size; 1882 - page_offset += RTW_PROBE_PG_CNT; 1872 + buf_offset += page_cnt * page_size; 1873 + page_offset += page_cnt; 1883 1874 kfree_skb(skb); 1884 1875 } 1885 1876 ··· 2057 2048 rtwvif->scan_req = req; 2058 2049 2059 2050 ieee80211_stop_queues(rtwdev->hw); 2051 + rtw_leave_lps_deep(rtwdev); 2052 + rtw_hci_flush_all_queues(rtwdev, false); 2053 + rtw_mac_flush_all_queues(rtwdev, false); 2060 2054 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) 2061 2055 get_random_mask_addr(mac_addr, req->mac_addr, 2062 2056 req->mac_addr_mask); ··· 2092 2080 rtw_core_scan_complete(rtwdev, vif, true); 2093 2081 2094 2082 rtwvif = (struct rtw_vif *)vif->drv_priv; 2095 - if (rtwvif->net_type == RTW_NET_MGD_LINKED) { 2096 - hal->current_channel = chan; 2097 - hal->current_band_type = chan > 14 ? RTW_BAND_5G : RTW_BAND_2G; 2098 - } 2083 + if (chan) 2084 + rtw_store_op_chan(rtwdev, false); 2085 + rtw_phy_set_tx_power_level(rtwdev, hal->current_channel); 2099 2086 ieee80211_wake_queues(rtwdev->hw); 2100 2087 ieee80211_scan_completed(rtwdev->hw, &info); 2101 2088 ··· 2135 2124 bool enable) 2136 2125 { 2137 2126 struct rtw_vif *rtwvif = vif ? (struct rtw_vif *)vif->drv_priv : NULL; 2127 + struct rtw_hw_scan_info *scan_info = &rtwdev->scan_info; 2138 2128 struct rtw_ch_switch_option cs_option = {0}; 2139 2129 struct rtw_chan_list chan_list = {0}; 2140 2130 int ret = 0; ··· 2144 2132 return -EINVAL; 2145 2133 2146 2134 cs_option.switch_en = enable; 2147 - cs_option.back_op_en = rtwvif->net_type == RTW_NET_MGD_LINKED; 2135 + cs_option.back_op_en = scan_info->op_chan != 0; 2148 2136 if (enable) { 2149 2137 ret = rtw_hw_scan_prehandle(rtwdev, rtwvif, &chan_list); 2150 2138 if (ret) ··· 2183 2171 rtw_dbg(rtwdev, RTW_DBG_HW_SCAN, "HW scan aborted with code: %d\n", rc); 2184 2172 } 2185 2173 2186 - void rtw_store_op_chan(struct rtw_dev *rtwdev) 2174 + void rtw_store_op_chan(struct rtw_dev *rtwdev, bool backup) 2187 2175 { 2188 2176 struct rtw_hw_scan_info *scan_info = &rtwdev->scan_info; 2189 2177 struct rtw_hal *hal = &rtwdev->hal; 2178 + u8 band; 2190 2179 2191 - scan_info->op_chan = hal->current_channel; 2192 - scan_info->op_bw = hal->current_band_width; 2193 - scan_info->op_pri_ch_idx = hal->current_primary_channel_index; 2180 + if (backup) { 2181 + scan_info->op_chan = hal->current_channel; 2182 + scan_info->op_bw = hal->current_band_width; 2183 + scan_info->op_pri_ch_idx = hal->current_primary_channel_index; 2184 + scan_info->op_pri_ch = hal->primary_channel; 2185 + } else { 2186 + band = scan_info->op_chan > 14 ? RTW_BAND_5G : RTW_BAND_2G; 2187 + rtw_update_channel(rtwdev, scan_info->op_chan, 2188 + scan_info->op_pri_ch, 2189 + band, scan_info->op_bw); 2190 + } 2191 + } 2192 + 2193 + void rtw_clear_op_chan(struct rtw_dev *rtwdev) 2194 + { 2195 + struct rtw_hw_scan_info *scan_info = &rtwdev->scan_info; 2196 + 2197 + scan_info->op_chan = 0; 2198 + scan_info->op_bw = 0; 2199 + scan_info->op_pri_ch_idx = 0; 2200 + scan_info->op_pri_ch = 0; 2194 2201 } 2195 2202 2196 2203 static bool rtw_is_op_chan(struct rtw_dev *rtwdev, u8 channel) ··· 2224 2193 struct rtw_hal *hal = &rtwdev->hal; 2225 2194 struct rtw_c2h_cmd *c2h; 2226 2195 enum rtw_scan_notify_id id; 2227 - u8 chan, status; 2196 + u8 chan, band, status; 2228 2197 2229 2198 if (!test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) 2230 2199 return; ··· 2235 2204 status = GET_CHAN_SWITCH_STATUS(c2h->payload); 2236 2205 2237 2206 if (id == RTW_SCAN_NOTIFY_ID_POSTSWITCH) { 2238 - if (rtw_is_op_chan(rtwdev, chan)) 2207 + band = chan > 14 ? RTW_BAND_5G : RTW_BAND_2G; 2208 + rtw_update_channel(rtwdev, chan, chan, band, 2209 + RTW_CHANNEL_WIDTH_20); 2210 + if (rtw_is_op_chan(rtwdev, chan)) { 2211 + rtw_store_op_chan(rtwdev, false); 2239 2212 ieee80211_wake_queues(rtwdev->hw); 2240 - hal->current_channel = chan; 2241 - hal->current_band_type = chan > 14 ? RTW_BAND_5G : RTW_BAND_2G; 2213 + } 2242 2214 } else if (id == RTW_SCAN_NOTIFY_ID_PRESWITCH) { 2243 2215 if (IS_CH_5G_BAND(chan)) { 2244 2216 rtw_coex_switchband_notify(rtwdev, COEX_SWITCH_TO_5G); ··· 2254 2220 chan_type = COEX_SWITCH_TO_24G_NOFORSCAN; 2255 2221 rtw_coex_switchband_notify(rtwdev, chan_type); 2256 2222 } 2257 - if (rtw_is_op_chan(rtwdev, chan)) 2223 + /* The channel of C2H RTW_SCAN_NOTIFY_ID_PRESWITCH is next 2224 + * channel that hardware will switch. We need to stop queue 2225 + * if next channel is non-op channel. 2226 + */ 2227 + if (!rtw_is_op_chan(rtwdev, chan) && 2228 + rtw_is_op_chan(rtwdev, hal->current_channel)) 2258 2229 ieee80211_stop_queues(rtwdev->hw); 2259 2230 } 2260 2231
+19 -2
drivers/net/wireless/realtek/rtw88/fw.h
··· 41 41 #define RTW_EX_CH_INFO_HDR_SIZE 2 42 42 #define RTW_SCAN_WIDTH 0 43 43 #define RTW_PRI_CH_IDX 1 44 - #define RTW_PROBE_PG_CNT 2 44 + #define RTW_OLD_PROBE_PG_CNT 2 45 + #define RTW_PROBE_PG_CNT 4 45 46 46 47 enum rtw_c2h_cmd_id { 47 48 C2H_CCX_TX_RPT = 0x03, ··· 119 118 FW_FEATURE_ADAPTIVITY = BIT(7), 120 119 FW_FEATURE_SCAN_OFFLOAD = BIT(8), 121 120 FW_FEATURE_MAX = BIT(31), 121 + }; 122 + 123 + enum rtw_fw_feature_ext { 124 + FW_FEATURE_EXT_OLD_PAGE_NUM = BIT(0), 122 125 }; 123 126 124 127 enum rtw_beacon_filter_offload_mode { ··· 327 322 __le32 rsvd4; /* 0x18 */ 328 323 __le32 rsvd5; 329 324 } __packed; 325 + 326 + #define RTW_FW_VER_CODE(ver, sub_ver, idx) \ 327 + (((ver) << 16) | ((sub_ver) << 8) | (idx)) 328 + #define RTW_FW_SUIT_VER_CODE(s) \ 329 + RTW_FW_VER_CODE((s).version, (s).sub_version, (s).sub_index) 330 330 331 331 /* C2H */ 332 332 #define GET_CCX_REPORT_SEQNUM_V0(c2h_payload) (c2h_payload[6] & 0xfc) ··· 780 770 return !!(fw->feature & feature); 781 771 } 782 772 773 + static inline bool rtw_fw_feature_ext_check(struct rtw_fw_state *fw, 774 + enum rtw_fw_feature_ext feature) 775 + { 776 + return !!(fw->feature_ext & feature); 777 + } 778 + 783 779 void rtw_fw_c2h_cmd_rx_irqsafe(struct rtw_dev *rtwdev, u32 pkt_offset, 784 780 struct sk_buff *skb); 785 781 void rtw_fw_c2h_cmd_handle(struct rtw_dev *rtwdev, struct sk_buff *skb); ··· 847 831 u32 *buffer); 848 832 void rtw_fw_scan_notify(struct rtw_dev *rtwdev, bool start); 849 833 void rtw_fw_adaptivity(struct rtw_dev *rtwdev); 850 - void rtw_store_op_chan(struct rtw_dev *rtwdev); 834 + void rtw_store_op_chan(struct rtw_dev *rtwdev, bool backup); 835 + void rtw_clear_op_chan(struct rtw_dev *rtwdev); 851 836 void rtw_hw_scan_start(struct rtw_dev *rtwdev, struct ieee80211_vif *vif, 852 837 struct ieee80211_scan_request *req); 853 838 void rtw_hw_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
+9 -9
drivers/net/wireless/realtek/rtw88/mac.c
··· 243 243 244 244 static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on) 245 245 { 246 - struct rtw_chip_info *chip = rtwdev->chip; 246 + const struct rtw_chip_info *chip = rtwdev->chip; 247 247 const struct rtw_pwr_seq_cmd **pwr_seq; 248 248 u8 rpwm; 249 249 bool cur_pwr; ··· 587 587 download_firmware_to_mem(struct rtw_dev *rtwdev, const u8 *data, 588 588 u32 src, u32 dst, u32 size) 589 589 { 590 - struct rtw_chip_info *chip = rtwdev->chip; 590 + const struct rtw_chip_info *chip = rtwdev->chip; 591 591 u32 desc_size = chip->tx_pkt_desc_sz; 592 592 u8 first_part; 593 593 u32 mem_offset; ··· 934 934 static void __rtw_mac_flush_prio_queue(struct rtw_dev *rtwdev, 935 935 u32 prio_queue, bool drop) 936 936 { 937 - struct rtw_chip_info *chip = rtwdev->chip; 937 + const struct rtw_chip_info *chip = rtwdev->chip; 938 938 const struct rtw_prioq_addr *addr; 939 939 bool wsize; 940 940 u16 avail_page, rsvd_page; ··· 996 996 997 997 static int txdma_queue_mapping(struct rtw_dev *rtwdev) 998 998 { 999 - struct rtw_chip_info *chip = rtwdev->chip; 999 + const struct rtw_chip_info *chip = rtwdev->chip; 1000 1000 const struct rtw_rqpn *rqpn = NULL; 1001 1001 u16 txdma_pq_map = 0; 1002 1002 ··· 1037 1037 1038 1038 static int set_trx_fifo_info(struct rtw_dev *rtwdev) 1039 1039 { 1040 + const struct rtw_chip_info *chip = rtwdev->chip; 1040 1041 struct rtw_fifo_conf *fifo = &rtwdev->fifo; 1041 - struct rtw_chip_info *chip = rtwdev->chip; 1042 1042 u16 cur_pg_addr; 1043 1043 u8 csi_buf_pg_num = chip->csi_buf_pg_num; 1044 1044 ··· 1092 1092 const struct rtw_page_table *pg_tbl, 1093 1093 u16 pubq_num) 1094 1094 { 1095 + const struct rtw_chip_info *chip = rtwdev->chip; 1095 1096 struct rtw_fifo_conf *fifo = &rtwdev->fifo; 1096 - struct rtw_chip_info *chip = rtwdev->chip; 1097 1097 1098 1098 rtw_write16(rtwdev, REG_FIFOPAGE_INFO_1, pg_tbl->hq_num); 1099 1099 rtw_write16(rtwdev, REG_FIFOPAGE_INFO_2, pg_tbl->lq_num); ··· 1123 1123 const struct rtw_page_table *pg_tbl, 1124 1124 u16 pubq_num) 1125 1125 { 1126 + const struct rtw_chip_info *chip = rtwdev->chip; 1126 1127 struct rtw_fifo_conf *fifo = &rtwdev->fifo; 1127 - struct rtw_chip_info *chip = rtwdev->chip; 1128 1128 u32 val32; 1129 1129 1130 1130 val32 = BIT_RQPN_NE(pg_tbl->nq_num, pg_tbl->exq_num); ··· 1149 1149 1150 1150 static int priority_queue_cfg(struct rtw_dev *rtwdev) 1151 1151 { 1152 + const struct rtw_chip_info *chip = rtwdev->chip; 1152 1153 struct rtw_fifo_conf *fifo = &rtwdev->fifo; 1153 - struct rtw_chip_info *chip = rtwdev->chip; 1154 1154 const struct rtw_page_table *pg_tbl = NULL; 1155 1155 u16 pubq_num; 1156 1156 int ret; ··· 1277 1277 1278 1278 int rtw_mac_init(struct rtw_dev *rtwdev) 1279 1279 { 1280 - struct rtw_chip_info *chip = rtwdev->chip; 1280 + const struct rtw_chip_info *chip = rtwdev->chip; 1281 1281 int ret; 1282 1282 1283 1283 ret = rtw_init_trx_cfg(rtwdev);
+10 -4
drivers/net/wireless/realtek/rtw88/mac80211.c
··· 101 101 rtw_set_channel(rtwdev); 102 102 103 103 if ((changed & IEEE80211_CONF_CHANGE_IDLE) && 104 - (hw->conf.flags & IEEE80211_CONF_IDLE)) 104 + (hw->conf.flags & IEEE80211_CONF_IDLE) && 105 + !test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) 105 106 rtw_enter_ips(rtwdev); 106 107 107 108 out: ··· 378 377 rtw_coex_media_status_notify(rtwdev, vif->cfg.assoc); 379 378 if (rtw_bf_support) 380 379 rtw_bf_assoc(rtwdev, vif, conf); 381 - rtw_store_op_chan(rtwdev); 382 380 } else { 383 381 rtw_leave_lps(rtwdev); 384 382 rtw_bf_disassoc(rtwdev, vif, conf); ··· 395 395 if (changed & BSS_CHANGED_BSSID) { 396 396 ether_addr_copy(rtwvif->bssid, conf->bssid); 397 397 config |= PORT_SET_BSSID; 398 + if (is_zero_ether_addr(rtwvif->bssid)) 399 + rtw_clear_op_chan(rtwdev); 400 + else 401 + rtw_store_op_chan(rtwdev, true); 398 402 } 399 403 400 404 if (changed & BSS_CHANGED_BEACON_INT) { ··· 438 434 struct ieee80211_bss_conf *link_conf) 439 435 { 440 436 struct rtw_dev *rtwdev = hw->priv; 441 - struct rtw_chip_info *chip = rtwdev->chip; 437 + const struct rtw_chip_info *chip = rtwdev->chip; 442 438 443 439 mutex_lock(&rtwdev->mutex); 444 440 chip->ops->phy_calibration(rtwdev); ··· 756 752 u32 rx_antenna) 757 753 { 758 754 struct rtw_dev *rtwdev = hw->priv; 759 - struct rtw_chip_info *chip = rtwdev->chip; 755 + const struct rtw_chip_info *chip = rtwdev->chip; 760 756 int ret; 761 757 762 758 if (!chip->ops->set_antenna) ··· 876 872 { 877 873 struct rtw_dev *rtwdev = hw->priv; 878 874 875 + mutex_lock(&rtwdev->mutex); 879 876 rtw_set_sar_specs(rtwdev, sar); 877 + mutex_unlock(&rtwdev->mutex); 880 878 881 879 return 0; 882 880 }
+130 -82
drivers/net/wireless/realtek/rtw88/main.c
··· 353 353 354 354 static int rtw_fwcd_prep(struct rtw_dev *rtwdev) 355 355 { 356 - struct rtw_chip_info *chip = rtwdev->chip; 356 + const struct rtw_chip_info *chip = rtwdev->chip; 357 357 struct rtw_fwcd_desc *desc = &rtwdev->fw.fwcd_desc; 358 358 const struct rtw_fwcd_segs *segs = chip->fwcd_segs; 359 359 u32 prep_size = chip->fw_rxff_size + sizeof(struct rtw_fwcd_hdr); ··· 675 675 rtw_write8(rtwdev, REG_DTIM_COUNTER_ROOT, dtim_period - 1); 676 676 } 677 677 678 + void rtw_update_channel(struct rtw_dev *rtwdev, u8 center_channel, 679 + u8 primary_channel, enum rtw_supported_band band, 680 + enum rtw_bandwidth bandwidth) 681 + { 682 + enum nl80211_band nl_band = rtw_hw_to_nl80211_band(band); 683 + struct rtw_hal *hal = &rtwdev->hal; 684 + u8 *cch_by_bw = hal->cch_by_bw; 685 + u32 center_freq, primary_freq; 686 + enum rtw_sar_bands sar_band; 687 + u8 primary_channel_idx; 688 + 689 + center_freq = ieee80211_channel_to_frequency(center_channel, nl_band); 690 + primary_freq = ieee80211_channel_to_frequency(primary_channel, nl_band); 691 + 692 + /* assign the center channel used while 20M bw is selected */ 693 + cch_by_bw[RTW_CHANNEL_WIDTH_20] = primary_channel; 694 + 695 + /* assign the center channel used while current bw is selected */ 696 + cch_by_bw[bandwidth] = center_channel; 697 + 698 + switch (bandwidth) { 699 + case RTW_CHANNEL_WIDTH_20: 700 + default: 701 + primary_channel_idx = RTW_SC_DONT_CARE; 702 + break; 703 + case RTW_CHANNEL_WIDTH_40: 704 + if (primary_freq > center_freq) 705 + primary_channel_idx = RTW_SC_20_UPPER; 706 + else 707 + primary_channel_idx = RTW_SC_20_LOWER; 708 + break; 709 + case RTW_CHANNEL_WIDTH_80: 710 + if (primary_freq > center_freq) { 711 + if (primary_freq - center_freq == 10) 712 + primary_channel_idx = RTW_SC_20_UPPER; 713 + else 714 + primary_channel_idx = RTW_SC_20_UPMOST; 715 + 716 + /* assign the center channel used 717 + * while 40M bw is selected 718 + */ 719 + cch_by_bw[RTW_CHANNEL_WIDTH_40] = center_channel + 4; 720 + } else { 721 + if (center_freq - primary_freq == 10) 722 + primary_channel_idx = RTW_SC_20_LOWER; 723 + else 724 + primary_channel_idx = RTW_SC_20_LOWEST; 725 + 726 + /* assign the center channel used 727 + * while 40M bw is selected 728 + */ 729 + cch_by_bw[RTW_CHANNEL_WIDTH_40] = center_channel - 4; 730 + } 731 + break; 732 + } 733 + 734 + switch (center_channel) { 735 + case 1 ... 14: 736 + sar_band = RTW_SAR_BAND_0; 737 + break; 738 + case 36 ... 64: 739 + sar_band = RTW_SAR_BAND_1; 740 + break; 741 + case 100 ... 144: 742 + sar_band = RTW_SAR_BAND_3; 743 + break; 744 + case 149 ... 177: 745 + sar_band = RTW_SAR_BAND_4; 746 + break; 747 + default: 748 + WARN(1, "unknown ch(%u) to SAR band\n", center_channel); 749 + sar_band = RTW_SAR_BAND_0; 750 + break; 751 + } 752 + 753 + hal->current_primary_channel_index = primary_channel_idx; 754 + hal->current_band_width = bandwidth; 755 + hal->primary_channel = primary_channel; 756 + hal->current_channel = center_channel; 757 + hal->current_band_type = band; 758 + hal->sar_band = sar_band; 759 + } 760 + 678 761 void rtw_get_channel_params(struct cfg80211_chan_def *chandef, 679 762 struct rtw_channel_params *chan_params) 680 763 { 681 764 struct ieee80211_channel *channel = chandef->chan; 682 765 enum nl80211_chan_width width = chandef->width; 683 - u8 *cch_by_bw = chan_params->cch_by_bw; 684 766 u32 primary_freq, center_freq; 685 767 u8 center_chan; 686 768 u8 bandwidth = RTW_CHANNEL_WIDTH_20; 687 - u8 primary_chan_idx = 0; 688 - u8 i; 689 769 690 770 center_chan = channel->hw_value; 691 771 primary_freq = channel->center_freq; 692 772 center_freq = chandef->center_freq1; 693 773 694 - /* assign the center channel used while 20M bw is selected */ 695 - cch_by_bw[RTW_CHANNEL_WIDTH_20] = channel->hw_value; 696 - 697 774 switch (width) { 698 775 case NL80211_CHAN_WIDTH_20_NOHT: 699 776 case NL80211_CHAN_WIDTH_20: 700 777 bandwidth = RTW_CHANNEL_WIDTH_20; 701 - primary_chan_idx = RTW_SC_DONT_CARE; 702 778 break; 703 779 case NL80211_CHAN_WIDTH_40: 704 780 bandwidth = RTW_CHANNEL_WIDTH_40; 705 - if (primary_freq > center_freq) { 706 - primary_chan_idx = RTW_SC_20_UPPER; 781 + if (primary_freq > center_freq) 707 782 center_chan -= 2; 708 - } else { 709 - primary_chan_idx = RTW_SC_20_LOWER; 783 + else 710 784 center_chan += 2; 711 - } 712 785 break; 713 786 case NL80211_CHAN_WIDTH_80: 714 787 bandwidth = RTW_CHANNEL_WIDTH_80; 715 788 if (primary_freq > center_freq) { 716 - if (primary_freq - center_freq == 10) { 717 - primary_chan_idx = RTW_SC_20_UPPER; 789 + if (primary_freq - center_freq == 10) 718 790 center_chan -= 2; 719 - } else { 720 - primary_chan_idx = RTW_SC_20_UPMOST; 791 + else 721 792 center_chan -= 6; 722 - } 723 - /* assign the center channel used 724 - * while 40M bw is selected 725 - */ 726 - cch_by_bw[RTW_CHANNEL_WIDTH_40] = center_chan + 4; 727 793 } else { 728 - if (center_freq - primary_freq == 10) { 729 - primary_chan_idx = RTW_SC_20_LOWER; 794 + if (center_freq - primary_freq == 10) 730 795 center_chan += 2; 731 - } else { 732 - primary_chan_idx = RTW_SC_20_LOWEST; 796 + else 733 797 center_chan += 6; 734 - } 735 - /* assign the center channel used 736 - * while 40M bw is selected 737 - */ 738 - cch_by_bw[RTW_CHANNEL_WIDTH_40] = center_chan - 4; 739 798 } 740 799 break; 741 800 default: ··· 804 745 805 746 chan_params->center_chan = center_chan; 806 747 chan_params->bandwidth = bandwidth; 807 - chan_params->primary_chan_idx = primary_chan_idx; 808 - 809 - /* assign the center channel used while current bw is selected */ 810 - cch_by_bw[bandwidth] = center_chan; 811 - 812 - for (i = bandwidth + 1; i <= RTW_MAX_CHANNEL_WIDTH; i++) 813 - cch_by_bw[i] = 0; 748 + chan_params->primary_chan = channel->hw_value; 814 749 } 815 750 816 751 void rtw_set_channel(struct rtw_dev *rtwdev) 817 752 { 753 + const struct rtw_chip_info *chip = rtwdev->chip; 818 754 struct ieee80211_hw *hw = rtwdev->hw; 819 755 struct rtw_hal *hal = &rtwdev->hal; 820 - struct rtw_chip_info *chip = rtwdev->chip; 821 756 struct rtw_channel_params ch_param; 822 - u8 center_chan, bandwidth, primary_chan_idx; 823 - u8 i; 757 + u8 center_chan, primary_chan, bandwidth, band; 824 758 825 759 rtw_get_channel_params(&hw->conf.chandef, &ch_param); 826 760 if (WARN(ch_param.center_chan == 0, "Invalid channel\n")) 827 761 return; 828 762 829 763 center_chan = ch_param.center_chan; 764 + primary_chan = ch_param.primary_chan; 830 765 bandwidth = ch_param.bandwidth; 831 - primary_chan_idx = ch_param.primary_chan_idx; 766 + band = ch_param.center_chan > 14 ? RTW_BAND_5G : RTW_BAND_2G; 832 767 833 - hal->current_band_width = bandwidth; 834 - hal->current_channel = center_chan; 835 - hal->current_primary_channel_index = primary_chan_idx; 836 - hal->current_band_type = center_chan > 14 ? RTW_BAND_5G : RTW_BAND_2G; 768 + rtw_update_channel(rtwdev, center_chan, primary_chan, band, bandwidth); 837 769 838 - switch (center_chan) { 839 - case 1 ... 14: 840 - hal->sar_band = RTW_SAR_BAND_0; 841 - break; 842 - case 36 ... 64: 843 - hal->sar_band = RTW_SAR_BAND_1; 844 - break; 845 - case 100 ... 144: 846 - hal->sar_band = RTW_SAR_BAND_3; 847 - break; 848 - case 149 ... 177: 849 - hal->sar_band = RTW_SAR_BAND_4; 850 - break; 851 - default: 852 - WARN(1, "unknown ch(%u) to SAR band\n", center_chan); 853 - hal->sar_band = RTW_SAR_BAND_0; 854 - break; 855 - } 856 - 857 - for (i = RTW_CHANNEL_WIDTH_20; i <= RTW_MAX_CHANNEL_WIDTH; i++) 858 - hal->cch_by_bw[i] = ch_param.cch_by_bw[i]; 859 - 860 - chip->ops->set_channel(rtwdev, center_chan, bandwidth, primary_chan_idx); 770 + chip->ops->set_channel(rtwdev, center_chan, bandwidth, 771 + hal->current_primary_channel_index); 861 772 862 773 if (hal->current_band_type == RTW_BAND_5G) { 863 774 rtw_coex_switchband_notify(rtwdev, COEX_SWITCH_TO_5G); ··· 850 821 851 822 void rtw_chip_prepare_tx(struct rtw_dev *rtwdev) 852 823 { 853 - struct rtw_chip_info *chip = rtwdev->chip; 824 + const struct rtw_chip_info *chip = rtwdev->chip; 854 825 855 826 if (rtwdev->need_rfk) { 856 827 rtwdev->need_rfk = false; ··· 919 890 920 891 static void rtw_hw_config_rf_ant_num(struct rtw_dev *rtwdev, u8 hw_ant_num) 921 892 { 893 + const struct rtw_chip_info *chip = rtwdev->chip; 922 894 struct rtw_hal *hal = &rtwdev->hal; 923 - struct rtw_chip_info *chip = rtwdev->chip; 924 895 925 896 if (hw_ant_num == EFUSE_HW_CAP_IGNORE || 926 897 hw_ant_num >= hal->rf_path_num) ··· 1269 1240 1270 1241 static int rtw_wait_firmware_completion(struct rtw_dev *rtwdev) 1271 1242 { 1272 - struct rtw_chip_info *chip = rtwdev->chip; 1243 + const struct rtw_chip_info *chip = rtwdev->chip; 1273 1244 struct rtw_fw_state *fw; 1274 1245 1275 1246 fw = &rtwdev->fw; ··· 1290 1261 static enum rtw_lps_deep_mode rtw_update_lps_deep_mode(struct rtw_dev *rtwdev, 1291 1262 struct rtw_fw_state *fw) 1292 1263 { 1293 - struct rtw_chip_info *chip = rtwdev->chip; 1264 + const struct rtw_chip_info *chip = rtwdev->chip; 1294 1265 1295 1266 if (rtw_disable_lps_deep_mode || !chip->lps_deep_mode_supported || 1296 1267 !fw->feature) ··· 1309 1280 1310 1281 static int rtw_power_on(struct rtw_dev *rtwdev) 1311 1282 { 1312 - struct rtw_chip_info *chip = rtwdev->chip; 1283 + const struct rtw_chip_info *chip = rtwdev->chip; 1313 1284 struct rtw_fw_state *fw = &rtwdev->fw; 1314 1285 bool wifi_only; 1315 1286 int ret; ··· 1498 1469 static void rtw_init_ht_cap(struct rtw_dev *rtwdev, 1499 1470 struct ieee80211_sta_ht_cap *ht_cap) 1500 1471 { 1472 + const struct rtw_chip_info *chip = rtwdev->chip; 1501 1473 struct rtw_efuse *efuse = &rtwdev->efuse; 1502 - struct rtw_chip_info *chip = rtwdev->chip; 1503 1474 1504 1475 ht_cap->ht_supported = true; 1505 1476 ht_cap->cap = 0; ··· 1581 1552 vht_cap->vht_mcs.tx_highest = highest; 1582 1553 } 1583 1554 1555 + static u16 rtw_get_max_scan_ie_len(struct rtw_dev *rtwdev) 1556 + { 1557 + u16 len; 1558 + 1559 + len = rtwdev->chip->max_scan_ie_len; 1560 + 1561 + if (!rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_SCAN_OFFLOAD) && 1562 + rtwdev->chip->id == RTW_CHIP_TYPE_8822C) 1563 + len = IEEE80211_MAX_DATA_LEN; 1564 + else if (rtw_fw_feature_ext_check(&rtwdev->fw, FW_FEATURE_EXT_OLD_PAGE_NUM)) 1565 + len -= RTW_OLD_PROBE_PG_CNT * TX_PAGE_SIZE; 1566 + 1567 + return len; 1568 + } 1569 + 1584 1570 static void rtw_set_supported_band(struct ieee80211_hw *hw, 1585 - struct rtw_chip_info *chip) 1571 + const struct rtw_chip_info *chip) 1586 1572 { 1587 1573 struct rtw_dev *rtwdev = hw->priv; 1588 1574 struct ieee80211_supported_band *sband; ··· 1629 1585 } 1630 1586 1631 1587 static void rtw_unset_supported_band(struct ieee80211_hw *hw, 1632 - struct rtw_chip_info *chip) 1588 + const struct rtw_chip_info *chip) 1633 1589 { 1634 1590 kfree(hw->wiphy->bands[NL80211_BAND_2GHZ]); 1635 1591 kfree(hw->wiphy->bands[NL80211_BAND_5GHZ]); ··· 1651 1607 1652 1608 void rtw_set_txrx_1ss(struct rtw_dev *rtwdev, bool txrx_1ss) 1653 1609 { 1654 - struct rtw_chip_info *chip = rtwdev->chip; 1610 + const struct rtw_chip_info *chip = rtwdev->chip; 1655 1611 struct rtw_hal *hal = &rtwdev->hal; 1656 1612 1657 1613 if (!chip->ops->config_txrx_mode || rtwdev->hal.txrx_1ss == txrx_1ss) ··· 1675 1631 1676 1632 feature = le32_to_cpu(fw_hdr->feature); 1677 1633 fw->feature = feature & FW_FEATURE_SIG ? feature : 0; 1634 + 1635 + if (rtwdev->chip->id == RTW_CHIP_TYPE_8822C && 1636 + RTW_FW_SUIT_VER_CODE(rtwdev->fw) < RTW_FW_VER_CODE(9, 9, 13)) 1637 + fw->feature_ext |= FW_FEATURE_EXT_OLD_PAGE_NUM; 1678 1638 } 1679 1639 1680 1640 static void __update_firmware_info(struct rtw_dev *rtwdev, ··· 1772 1724 1773 1725 static int rtw_chip_parameter_setup(struct rtw_dev *rtwdev) 1774 1726 { 1775 - struct rtw_chip_info *chip = rtwdev->chip; 1727 + const struct rtw_chip_info *chip = rtwdev->chip; 1776 1728 struct rtw_hal *hal = &rtwdev->hal; 1777 1729 struct rtw_efuse *efuse = &rtwdev->efuse; 1778 1730 ··· 2030 1982 2031 1983 int rtw_core_init(struct rtw_dev *rtwdev) 2032 1984 { 2033 - struct rtw_chip_info *chip = rtwdev->chip; 1985 + const struct rtw_chip_info *chip = rtwdev->chip; 2034 1986 struct rtw_coex *coex = &rtwdev->coex; 2035 1987 int ret; 2036 1988 ··· 2184 2136 2185 2137 hw->wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; 2186 2138 hw->wiphy->max_scan_ssids = RTW_SCAN_MAX_SSIDS; 2187 - hw->wiphy->max_scan_ie_len = RTW_SCAN_MAX_IE_LEN; 2139 + hw->wiphy->max_scan_ie_len = rtw_get_max_scan_ie_len(rtwdev); 2188 2140 2189 2141 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); 2190 2142 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_SCAN_RANDOM_SN); ··· 2228 2180 2229 2181 void rtw_unregister_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw) 2230 2182 { 2231 - struct rtw_chip_info *chip = rtwdev->chip; 2183 + const struct rtw_chip_info *chip = rtwdev->chip; 2232 2184 2233 2185 ieee80211_unregister_hw(hw); 2234 2186 rtw_unset_supported_band(hw, chip);
+24 -7
drivers/net/wireless/realtek/rtw88/main.h
··· 22 22 #define MAX_PG_CAM_BACKUP_NUM 8 23 23 24 24 #define RTW_SCAN_MAX_SSIDS 4 25 - #define RTW_SCAN_MAX_IE_LEN 128 26 25 27 26 #define RTW_MAX_PATTERN_NUM 12 28 27 #define RTW_MAX_PATTERN_MASK_SIZE 16 ··· 32 33 #define RFREG_MASK 0xfffff 33 34 #define INV_RF_DATA 0xffffffff 34 35 #define TX_PAGE_SIZE_SHIFT 7 36 + #define TX_PAGE_SIZE (1 << TX_PAGE_SIZE_SHIFT) 35 37 36 38 #define RTW_CHANNEL_WIDTH_MAX 3 37 39 #define RTW_RF_PATH_MAX 4 ··· 510 510 511 511 struct rtw_channel_params { 512 512 u8 center_chan; 513 + u8 primary_chan; 513 514 u8 bandwidth; 514 - u8 primary_chan_idx; 515 - /* center channel by different available bandwidth, 516 - * val of (bw > current bandwidth) is invalid 517 - */ 518 - u8 cch_by_bw[RTW_MAX_CHANNEL_WIDTH + 1]; 519 515 }; 520 516 521 517 struct rtw_hw_reg { ··· 1228 1232 const char *wow_fw_name; 1229 1233 const struct wiphy_wowlan_support *wowlan_stub; 1230 1234 const u8 max_sched_scan_ssids; 1235 + const u16 max_scan_ie_len; 1231 1236 1232 1237 /* coex paras */ 1233 1238 u32 coex_para_ver; ··· 1850 1853 u8 sub_index; 1851 1854 u16 h2c_version; 1852 1855 u32 feature; 1856 + u32 feature_ext; 1853 1857 }; 1854 1858 1855 1859 enum rtw_sar_sources { ··· 1894 1896 u8 current_primary_channel_index; 1895 1897 u8 current_band_width; 1896 1898 u8 current_band_type; 1899 + u8 primary_channel; 1897 1900 1898 1901 /* center channel for different available bandwidth, 1899 1902 * val of (bw > current_band_width) is invalid ··· 1966 1967 struct ieee80211_vif *scanning_vif; 1967 1968 u8 probe_pg_size; 1968 1969 u8 op_pri_ch_idx; 1970 + u8 op_pri_ch; 1969 1971 u8 op_chan; 1970 1972 u8 op_bw; 1971 1973 }; ··· 1978 1978 struct rtw_hci hci; 1979 1979 1980 1980 struct rtw_hw_scan_info scan_info; 1981 - struct rtw_chip_info *chip; 1981 + const struct rtw_chip_info *chip; 1982 1982 struct rtw_hal hal; 1983 1983 struct rtw_fifo_conf fifo; 1984 1984 struct rtw_fw_state fw; ··· 2132 2132 return 0; 2133 2133 } 2134 2134 2135 + static inline 2136 + enum nl80211_band rtw_hw_to_nl80211_band(enum rtw_supported_band hw_band) 2137 + { 2138 + switch (hw_band) { 2139 + default: 2140 + case RTW_BAND_2G: 2141 + return NL80211_BAND_2GHZ; 2142 + case RTW_BAND_5G: 2143 + return NL80211_BAND_5GHZ; 2144 + case RTW_BAND_60G: 2145 + return NL80211_BAND_60GHZ; 2146 + } 2147 + } 2148 + 2135 2149 void rtw_set_rx_freq_band(struct rtw_rx_pkt_stat *pkt_stat, u8 channel); 2136 2150 void rtw_set_dtim_period(struct rtw_dev *rtwdev, int dtim_period); 2137 2151 void rtw_get_channel_params(struct cfg80211_chan_def *chandef, ··· 2187 2173 u32 fwcd_item); 2188 2174 int rtw_dump_reg(struct rtw_dev *rtwdev, const u32 addr, const u32 size); 2189 2175 void rtw_set_txrx_1ss(struct rtw_dev *rtwdev, bool config_1ss); 2176 + void rtw_update_channel(struct rtw_dev *rtwdev, u8 center_channel, 2177 + u8 primary_channel, enum rtw_supported_band band, 2178 + enum rtw_bandwidth bandwidth); 2190 2179 #endif
+10 -10
drivers/net/wireless/realtek/rtw88/pci.c
··· 322 322 struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; 323 323 struct rtw_pci_tx_ring *tx_ring; 324 324 struct rtw_pci_rx_ring *rx_ring; 325 - struct rtw_chip_info *chip = rtwdev->chip; 325 + const struct rtw_chip_info *chip = rtwdev->chip; 326 326 int i = 0, j = 0, tx_alloced = 0, rx_alloced = 0; 327 327 int tx_desc_size, rx_desc_size; 328 328 u32 len; ··· 721 721 u32 idx) 722 722 { 723 723 struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; 724 - struct rtw_chip_info *chip = rtwdev->chip; 724 + const struct rtw_chip_info *chip = rtwdev->chip; 725 725 struct rtw_pci_rx_buffer_desc *buf_desc; 726 726 u32 desc_sz = chip->rx_buf_desc_sz; 727 727 u16 total_pkt_size; ··· 834 834 struct sk_buff *skb, u8 queue) 835 835 { 836 836 struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; 837 - struct rtw_chip_info *chip = rtwdev->chip; 837 + const struct rtw_chip_info *chip = rtwdev->chip; 838 838 struct rtw_pci_tx_ring *ring; 839 839 struct rtw_pci_tx_data *tx_data; 840 840 dma_addr_t dma; ··· 1073 1073 static u32 rtw_pci_rx_napi(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci, 1074 1074 u8 hw_queue, u32 limit) 1075 1075 { 1076 - struct rtw_chip_info *chip = rtwdev->chip; 1076 + const struct rtw_chip_info *chip = rtwdev->chip; 1077 1077 struct napi_struct *napi = &rtwpci->napi; 1078 1078 struct rtw_pci_rx_ring *ring = &rtwpci->rx_rings[RTW_RX_QUEUE_MPDU]; 1079 1079 struct rtw_rx_pkt_stat pkt_stat; ··· 1425 1425 1426 1426 static void rtw_pci_link_cfg(struct rtw_dev *rtwdev) 1427 1427 { 1428 - struct rtw_chip_info *chip = rtwdev->chip; 1428 + const struct rtw_chip_info *chip = rtwdev->chip; 1429 1429 struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; 1430 1430 struct pci_dev *pdev = rtwpci->pdev; 1431 1431 u16 link_ctrl; ··· 1467 1467 1468 1468 static void rtw_pci_interface_cfg(struct rtw_dev *rtwdev) 1469 1469 { 1470 - struct rtw_chip_info *chip = rtwdev->chip; 1470 + const struct rtw_chip_info *chip = rtwdev->chip; 1471 1471 1472 1472 switch (chip->id) { 1473 1473 case RTW_CHIP_TYPE_8822C: ··· 1483 1483 static void rtw_pci_phy_cfg(struct rtw_dev *rtwdev) 1484 1484 { 1485 1485 struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv; 1486 - struct rtw_chip_info *chip = rtwdev->chip; 1486 + const struct rtw_chip_info *chip = rtwdev->chip; 1487 1487 struct pci_dev *pdev = rtwpci->pdev; 1488 1488 const struct rtw_intf_phy_para *para; 1489 1489 u16 cut; ··· 1538 1538 { 1539 1539 struct ieee80211_hw *hw = dev_get_drvdata(dev); 1540 1540 struct rtw_dev *rtwdev = hw->priv; 1541 - struct rtw_chip_info *chip = rtwdev->chip; 1541 + const struct rtw_chip_info *chip = rtwdev->chip; 1542 1542 struct rtw_efuse *efuse = &rtwdev->efuse; 1543 1543 1544 1544 if (chip->id == RTW_CHIP_TYPE_8822C && efuse->rfe_option == 6) ··· 1550 1550 { 1551 1551 struct ieee80211_hw *hw = dev_get_drvdata(dev); 1552 1552 struct rtw_dev *rtwdev = hw->priv; 1553 - struct rtw_chip_info *chip = rtwdev->chip; 1553 + const struct rtw_chip_info *chip = rtwdev->chip; 1554 1554 struct rtw_efuse *efuse = &rtwdev->efuse; 1555 1555 1556 1556 if (chip->id == RTW_CHIP_TYPE_8822C && efuse->rfe_option == 6) ··· 1848 1848 { 1849 1849 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 1850 1850 struct rtw_dev *rtwdev; 1851 - struct rtw_chip_info *chip; 1851 + const struct rtw_chip_info *chip; 1852 1852 1853 1853 if (!hw) 1854 1854 return;
+30 -35
drivers/net/wireless/realtek/rtw88/phy.c
··· 138 138 139 139 void rtw_phy_adaptivity_set_mode(struct rtw_dev *rtwdev) 140 140 { 141 - struct rtw_chip_info *chip = rtwdev->chip; 141 + const struct rtw_chip_info *chip = rtwdev->chip; 142 142 struct rtw_dm_info *dm_info = &rtwdev->dm_info; 143 143 144 144 /* turn off in debugfs for debug usage */ ··· 165 165 166 166 static void rtw_phy_adaptivity_init(struct rtw_dev *rtwdev) 167 167 { 168 - struct rtw_chip_info *chip = rtwdev->chip; 168 + const struct rtw_chip_info *chip = rtwdev->chip; 169 169 170 170 rtw_phy_adaptivity_set_mode(rtwdev); 171 171 if (chip->ops->adaptivity_init) ··· 180 180 181 181 static void rtw_phy_cfo_init(struct rtw_dev *rtwdev) 182 182 { 183 - struct rtw_chip_info *chip = rtwdev->chip; 183 + const struct rtw_chip_info *chip = rtwdev->chip; 184 184 185 185 if (chip->ops->cfo_init) 186 186 chip->ops->cfo_init(rtwdev); ··· 199 199 200 200 void rtw_phy_init(struct rtw_dev *rtwdev) 201 201 { 202 - struct rtw_chip_info *chip = rtwdev->chip; 202 + const struct rtw_chip_info *chip = rtwdev->chip; 203 203 struct rtw_dm_info *dm_info = &rtwdev->dm_info; 204 204 u32 addr, mask; 205 205 ··· 226 226 227 227 void rtw_phy_dig_write(struct rtw_dev *rtwdev, u8 igi) 228 228 { 229 - struct rtw_chip_info *chip = rtwdev->chip; 229 + const struct rtw_chip_info *chip = rtwdev->chip; 230 230 struct rtw_hal *hal = &rtwdev->hal; 231 231 u32 addr, mask; 232 232 u8 path; ··· 245 245 246 246 static void rtw_phy_stat_false_alarm(struct rtw_dev *rtwdev) 247 247 { 248 - struct rtw_chip_info *chip = rtwdev->chip; 248 + const struct rtw_chip_info *chip = rtwdev->chip; 249 249 250 250 chip->ops->false_alarm_statistics(rtwdev); 251 251 } ··· 603 603 604 604 static void rtw_phy_dpk_track(struct rtw_dev *rtwdev) 605 605 { 606 - struct rtw_chip_info *chip = rtwdev->chip; 606 + const struct rtw_chip_info *chip = rtwdev->chip; 607 607 608 608 if (chip->ops->dpk_track) 609 609 chip->ops->dpk_track(rtwdev); ··· 659 659 660 660 static void rtw_phy_cfo_track(struct rtw_dev *rtwdev) 661 661 { 662 - struct rtw_chip_info *chip = rtwdev->chip; 662 + const struct rtw_chip_info *chip = rtwdev->chip; 663 663 664 664 if (chip->ops->cfo_track) 665 665 chip->ops->cfo_track(rtwdev); ··· 720 720 721 721 static void rtw_phy_cck_pd(struct rtw_dev *rtwdev) 722 722 { 723 + const struct rtw_chip_info *chip = rtwdev->chip; 723 724 struct rtw_dm_info *dm_info = &rtwdev->dm_info; 724 - struct rtw_chip_info *chip = rtwdev->chip; 725 725 u32 cck_fa = dm_info->cck_fa_cnt; 726 726 u8 level; 727 727 ··· 816 816 u8 j; 817 817 u32 dB; 818 818 819 - if (linear >= db_invert_table[11][7]) 820 - return 96; /* maximum 96 dB */ 821 - 822 819 for (i = 0; i < 12; i++) { 823 - if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][7]) 824 - break; 825 - else if (i > 2 && linear <= db_invert_table[i][7]) 826 - break; 820 + for (j = 0; j < 8; j++) { 821 + if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][j]) 822 + goto cnt; 823 + else if (i > 2 && linear <= db_invert_table[i][j]) 824 + goto cnt; 825 + } 827 826 } 828 827 829 - for (j = 0; j < 8; j++) { 830 - if (i <= 2 && (linear << FRAC_BITS) <= db_invert_table[i][j]) 831 - break; 832 - else if (i > 2 && linear <= db_invert_table[i][j]) 833 - break; 834 - } 828 + return 96; /* maximum 96 dB */ 835 829 830 + cnt: 836 831 if (j == 0 && i == 0) 837 832 goto end; 838 833 ··· 895 900 u32 addr, u32 mask) 896 901 { 897 902 struct rtw_hal *hal = &rtwdev->hal; 898 - struct rtw_chip_info *chip = rtwdev->chip; 903 + const struct rtw_chip_info *chip = rtwdev->chip; 899 904 const u32 *base_addr = chip->rf_base_addr; 900 905 u32 val, direct_addr; 901 906 ··· 918 923 u32 addr, u32 mask) 919 924 { 920 925 struct rtw_hal *hal = &rtwdev->hal; 921 - struct rtw_chip_info *chip = rtwdev->chip; 926 + const struct rtw_chip_info *chip = rtwdev->chip; 922 927 const struct rtw_rf_sipi_addr *rf_sipi_addr; 923 928 const struct rtw_rf_sipi_addr *rf_sipi_addr_a; 924 929 u32 val32; ··· 967 972 u32 addr, u32 mask, u32 data) 968 973 { 969 974 struct rtw_hal *hal = &rtwdev->hal; 970 - struct rtw_chip_info *chip = rtwdev->chip; 971 - u32 *sipi_addr = chip->rf_sipi_addr; 975 + const struct rtw_chip_info *chip = rtwdev->chip; 976 + const u32 *sipi_addr = chip->rf_sipi_addr; 972 977 u32 data_and_addr; 973 978 u32 old_data = 0; 974 979 u32 shift; ··· 1007 1012 u32 addr, u32 mask, u32 data) 1008 1013 { 1009 1014 struct rtw_hal *hal = &rtwdev->hal; 1010 - struct rtw_chip_info *chip = rtwdev->chip; 1015 + const struct rtw_chip_info *chip = rtwdev->chip; 1011 1016 const u32 *base_addr = chip->rf_base_addr; 1012 1017 u32 direct_addr; 1013 1018 ··· 1742 1747 1743 1748 static void rtw_load_rfk_table(struct rtw_dev *rtwdev) 1744 1749 { 1745 - struct rtw_chip_info *chip = rtwdev->chip; 1750 + const struct rtw_chip_info *chip = rtwdev->chip; 1746 1751 struct rtw_dpk_info *dpk_info = &rtwdev->dm_info.dpk_info; 1747 1752 1748 1753 if (!chip->rfk_init_tbl) ··· 1761 1766 1762 1767 void rtw_phy_load_tables(struct rtw_dev *rtwdev) 1763 1768 { 1764 - struct rtw_chip_info *chip = rtwdev->chip; 1769 + const struct rtw_chip_info *chip = rtwdev->chip; 1765 1770 u8 rf_path; 1766 1771 1767 1772 rtw_load_table(rtwdev, chip->mac_tbl); ··· 1870 1875 1871 1876 static s8 rtw_phy_get_dis_dpd_by_rate_diff(struct rtw_dev *rtwdev, u16 rate) 1872 1877 { 1873 - struct rtw_chip_info *chip = rtwdev->chip; 1878 + const struct rtw_chip_info *chip = rtwdev->chip; 1874 1879 s8 dpd_diff = 0; 1875 1880 1876 1881 if (!chip->en_dis_dpd) ··· 1904 1909 enum rtw_bandwidth bandwidth, 1905 1910 u8 rate, u8 group) 1906 1911 { 1907 - struct rtw_chip_info *chip = rtwdev->chip; 1912 + const struct rtw_chip_info *chip = rtwdev->chip; 1908 1913 u8 tx_power; 1909 1914 bool mcs_rate; 1910 1915 bool above_2ss; ··· 1951 1956 enum rtw_bandwidth bandwidth, 1952 1957 u8 rate, u8 group) 1953 1958 { 1954 - struct rtw_chip_info *chip = rtwdev->chip; 1959 + const struct rtw_chip_info *chip = rtwdev->chip; 1955 1960 u8 tx_power; 1956 1961 u8 upper, lower; 1957 1962 bool mcs_rate; ··· 2204 2209 2205 2210 void rtw_phy_set_tx_power_level(struct rtw_dev *rtwdev, u8 channel) 2206 2211 { 2207 - struct rtw_chip_info *chip = rtwdev->chip; 2212 + const struct rtw_chip_info *chip = rtwdev->chip; 2208 2213 struct rtw_hal *hal = &rtwdev->hal; 2209 2214 u8 path; 2210 2215 ··· 2479 2484 { 2480 2485 struct rtw_path_div *path_div = &rtwdev->dm_path_div; 2481 2486 enum rtw_bb_path tx_path_sel_cck = tx_path_sel_1ss; 2482 - struct rtw_chip_info *chip = rtwdev->chip; 2487 + const struct rtw_chip_info *chip = rtwdev->chip; 2483 2488 2484 2489 if (tx_path_sel_1ss == path_div->current_tx_path) 2485 2490 return; ··· 2534 2539 2535 2540 void rtw_phy_tx_path_diversity(struct rtw_dev *rtwdev) 2536 2541 { 2537 - struct rtw_chip_info *chip = rtwdev->chip; 2542 + const struct rtw_chip_info *chip = rtwdev->chip; 2538 2543 2539 2544 if (!chip->path_div_supported) 2540 2545 return;
+1 -1
drivers/net/wireless/realtek/rtw88/phy.h
··· 114 114 115 115 static inline const struct rtw_rfe_def *rtw_get_rfe_def(struct rtw_dev *rtwdev) 116 116 { 117 - struct rtw_chip_info *chip = rtwdev->chip; 117 + const struct rtw_chip_info *chip = rtwdev->chip; 118 118 struct rtw_efuse *efuse = &rtwdev->efuse; 119 119 const struct rtw_rfe_def *rfe_def = NULL; 120 120
+5 -2
drivers/net/wireless/realtek/rtw88/ps.c
··· 19 19 rtw_err(rtwdev, "leave idle state failed\n"); 20 20 21 21 rtw_set_channel(rtwdev); 22 - clear_bit(RTW_FLAG_INACTIVE_PS, rtwdev->flags); 23 22 24 23 return ret; 25 24 } 26 25 27 26 int rtw_enter_ips(struct rtw_dev *rtwdev) 28 27 { 29 - set_bit(RTW_FLAG_INACTIVE_PS, rtwdev->flags); 28 + if (test_and_set_bit(RTW_FLAG_INACTIVE_PS, rtwdev->flags)) 29 + return 0; 30 30 31 31 rtw_coex_ips_notify(rtwdev, COEX_IPS_ENTER); 32 32 ··· 49 49 int rtw_leave_ips(struct rtw_dev *rtwdev) 50 50 { 51 51 int ret; 52 + 53 + if (!test_and_clear_bit(RTW_FLAG_INACTIVE_PS, rtwdev->flags)) 54 + return 0; 52 55 53 56 rtw_hci_link_ps(rtwdev, false); 54 57
+2
drivers/net/wireless/realtek/rtw88/regd.c
··· 479 479 rtw_dbg(rtwdev, RTW_DBG_REGD, "regd state: %d -> %d\n", 480 480 rtwdev->regd.state, next_regd.state); 481 481 482 + mutex_lock(&rtwdev->mutex); 482 483 rtwdev->regd = next_regd; 483 484 rtw_dbg_regd_dump(rtwdev, "get alpha2 %c%c from initiator %d: ", 484 485 request->alpha2[0], ··· 488 487 489 488 rtw_phy_adaptivity_set_mode(rtwdev); 490 489 rtw_phy_set_tx_power_level(rtwdev, hal->current_channel); 490 + mutex_unlock(&rtwdev->mutex); 491 491 } 492 492 493 493 u8 rtw_regd_get(struct rtw_dev *rtwdev)
+2 -1
drivers/net/wireless/realtek/rtw88/rtw8723d.c
··· 2720 2720 .max_power_index = 0x3f, 2721 2721 .csi_buf_pg_num = 0, 2722 2722 .band = RTW_BAND_2G, 2723 - .page_size = 128, 2723 + .page_size = TX_PAGE_SIZE, 2724 2724 .dig_min = 0x20, 2725 2725 .ht_supported = true, 2726 2726 .vht_supported = false, ··· 2748 2748 .pwr_track_tbl = &rtw8723d_rtw_pwr_track_tbl, 2749 2749 .iqk_threshold = 8, 2750 2750 .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, 2751 + .max_scan_ie_len = IEEE80211_MAX_DATA_LEN, 2751 2752 2752 2753 .coex_para_ver = 0x2007022f, 2753 2754 .bt_desired_ver = 0x2f,
+2 -1
drivers/net/wireless/realtek/rtw88/rtw8821c.c
··· 1898 1898 .max_power_index = 0x3f, 1899 1899 .csi_buf_pg_num = 0, 1900 1900 .band = RTW_BAND_2G | RTW_BAND_5G, 1901 - .page_size = 128, 1901 + .page_size = TX_PAGE_SIZE, 1902 1902 .dig_min = 0x1c, 1903 1903 .ht_supported = true, 1904 1904 .vht_supported = true, ··· 1926 1926 .bfer_su_max_num = 2, 1927 1927 .bfer_mu_max_num = 1, 1928 1928 .ampdu_density = IEEE80211_HT_MPDU_DENSITY_2, 1929 + .max_scan_ie_len = IEEE80211_MAX_DATA_LEN, 1929 1930 1930 1931 .coex_para_ver = 0x19092746, 1931 1932 .bt_desired_ver = 0x46,
+2 -1
drivers/net/wireless/realtek/rtw88/rtw8822b.c
··· 2517 2517 .max_power_index = 0x3f, 2518 2518 .csi_buf_pg_num = 0, 2519 2519 .band = RTW_BAND_2G | RTW_BAND_5G, 2520 - .page_size = 128, 2520 + .page_size = TX_PAGE_SIZE, 2521 2521 .dig_min = 0x1c, 2522 2522 .ht_supported = true, 2523 2523 .vht_supported = true, ··· 2549 2549 .l2h_th_ini_cs = 10 + EDCCA_IGI_BASE, 2550 2550 .l2h_th_ini_ad = -14 + EDCCA_IGI_BASE, 2551 2551 .ampdu_density = IEEE80211_HT_MPDU_DENSITY_2, 2552 + .max_scan_ie_len = IEEE80211_MAX_DATA_LEN, 2552 2553 2553 2554 .coex_para_ver = 0x20070206, 2554 2555 .bt_desired_ver = 0x6,
+2 -1
drivers/net/wireless/realtek/rtw88/rtw8822c.c
··· 5330 5330 .max_power_index = 0x7f, 5331 5331 .csi_buf_pg_num = 50, 5332 5332 .band = RTW_BAND_2G | RTW_BAND_5G, 5333 - .page_size = 128, 5333 + .page_size = TX_PAGE_SIZE, 5334 5334 .dig_min = 0x20, 5335 5335 .default_1ss_tx_path = BB_PATH_A, 5336 5336 .path_div_supported = true, ··· 5375 5375 .wowlan_stub = &rtw_wowlan_stub_8822c, 5376 5376 .max_sched_scan_ssids = 4, 5377 5377 #endif 5378 + .max_scan_ie_len = (RTW_PROBE_PG_CNT - 1) * TX_PAGE_SIZE, 5378 5379 .coex_para_ver = 0x22020720, 5379 5380 .bt_desired_ver = 0x20, 5380 5381 .scbd_support = true,
+4 -4
drivers/net/wireless/realtek/rtw88/tx.c
··· 384 384 struct ieee80211_sta *sta, 385 385 struct sk_buff *skb) 386 386 { 387 - struct rtw_chip_info *chip = rtwdev->chip; 387 + const struct rtw_chip_info *chip = rtwdev->chip; 388 388 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 389 389 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 390 390 struct rtw_sta_info *si; ··· 424 424 struct sk_buff *skb, 425 425 enum rtw_rsvd_packet_type type) 426 426 { 427 - struct rtw_chip_info *chip = rtwdev->chip; 427 + const struct rtw_chip_info *chip = rtwdev->chip; 428 428 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 429 429 bool bmc; 430 430 ··· 475 475 struct rtw_tx_pkt_info *pkt_info, 476 476 u8 *buf, u32 size) 477 477 { 478 - struct rtw_chip_info *chip = rtwdev->chip; 478 + const struct rtw_chip_info *chip = rtwdev->chip; 479 479 struct sk_buff *skb; 480 480 u32 tx_pkt_desc_sz; 481 481 u32 length; ··· 501 501 struct rtw_tx_pkt_info *pkt_info, 502 502 u8 *buf, u32 size) 503 503 { 504 - struct rtw_chip_info *chip = rtwdev->chip; 504 + const struct rtw_chip_info *chip = rtwdev->chip; 505 505 struct sk_buff *skb; 506 506 u32 tx_pkt_desc_sz; 507 507 u32 length;
+2 -2
drivers/net/wireless/realtek/rtw88/util.c
··· 23 23 24 24 bool ltecoex_read_reg(struct rtw_dev *rtwdev, u16 offset, u32 *val) 25 25 { 26 - struct rtw_chip_info *chip = rtwdev->chip; 26 + const struct rtw_chip_info *chip = rtwdev->chip; 27 27 const struct rtw_ltecoex_addr *ltecoex = chip->ltecoex_addr; 28 28 29 29 if (!check_hw_ready(rtwdev, ltecoex->ctrl, LTECOEX_READY, 1)) ··· 37 37 38 38 bool ltecoex_reg_write(struct rtw_dev *rtwdev, u16 offset, u32 value) 39 39 { 40 - struct rtw_chip_info *chip = rtwdev->chip; 40 + const struct rtw_chip_info *chip = rtwdev->chip; 41 41 const struct rtw_ltecoex_addr *ltecoex = chip->ltecoex_addr; 42 42 43 43 if (!check_hw_ready(rtwdev, ltecoex->ctrl, LTECOEX_READY, 1))
+2 -1
drivers/net/wireless/realtek/rtw89/ps.c
··· 127 127 if (rtwvif->wifi_role != RTW89_WIFI_ROLE_STATION) 128 128 return; 129 129 130 - __rtw89_leave_ps_mode(rtwdev); 131 130 __rtw89_leave_lps(rtwdev, rtwvif->mac_id); 132 131 } 133 132 ··· 138 139 139 140 if (!test_and_clear_bit(RTW89_FLAG_LEISURE_PS, rtwdev->flags)) 140 141 return; 142 + 143 + __rtw89_leave_ps_mode(rtwdev); 141 144 142 145 rtw89_for_each_rtwvif(rtwdev, rtwvif) 143 146 rtw89_leave_lps_vif(rtwdev, rtwvif);
+8 -13
drivers/net/wireless/realtek/rtw89/reg.h
··· 1024 1024 B_AX_WDE_DATCHN_NULLPG_ERR_INT_EN | \ 1025 1025 B_AX_WDE_DATCHN_FRZTO_ERR_INT_EN) 1026 1026 #define B_AX_WDE_IMR_SET (B_AX_WDE_BUFREQ_QTAID_ERR_INT_EN | \ 1027 - B_AX_WDE_BUFREQ_SIZE0_INT_EN | \ 1028 - B_AX_WDE_BUFREQ_SIZELMT_INT_EN | \ 1029 - B_AX_WDE_BUFREQ_UNAVAL_ERR_INT_EN_V1 | \ 1030 - B_AX_WDE_BUFRTN_INVLD_PKTID_ERR_INT_EN_V1 | \ 1031 - B_AX_WDE_BUFRTN_SIZE_ERR_INT_EN_V1 | \ 1032 - B_AX_WDE_BUFREQ_SRCHTAILPG_ERR_INT_EN_V1 | \ 1033 - B_AX_WDE_GETNPG_STRPG_ERR_INT_EN_V1 | \ 1034 - B_AX_WDE_GETNPG_PGOFST_ERR_INT_EN_V1 | \ 1035 - B_AX_WDE_BUFMGN_FRZTO_ERR_INT_EN_V1 | \ 1027 + B_AX_WDE_BUFREQ_UNAVAL_ERR_INT_EN | \ 1028 + B_AX_WDE_BUFRTN_INVLD_PKTID_ERR_INT_EN | \ 1029 + B_AX_WDE_BUFRTN_SIZE_ERR_INT_EN | \ 1030 + B_AX_WDE_BUFREQ_SRCHTAILPG_ERR_INT_EN | \ 1031 + B_AX_WDE_GETNPG_STRPG_ERR_INT_EN | \ 1032 + B_AX_WDE_GETNPG_PGOFST_ERR_INT_EN | \ 1033 + B_AX_WDE_BUFMGN_FRZTO_ERR_INT_EN | \ 1036 1034 B_AX_WDE_QUE_CMDTYPE_ERR_INT_EN | \ 1037 1035 B_AX_WDE_QUE_DSTQUEID_ERR_INT_EN | \ 1038 1036 B_AX_WDE_QUE_SRCQUEID_ERR_INT_EN | \ ··· 1041 1043 B_AX_WDE_QUEMGN_FRZTO_ERR_INT_EN | \ 1042 1044 B_AX_WDE_DATCHN_ARBT_ERR_INT_EN | \ 1043 1045 B_AX_WDE_DATCHN_NULLPG_ERR_INT_EN | \ 1044 - B_AX_WDE_DATCHN_FRZTO_ERR_INT_EN | \ 1045 - B_AX_WDE_DATCHN_RRDY_ERR_INT_EN | \ 1046 - B_AX_WDE_DATCHN_ADRERR_ERR_INT_EN | \ 1047 - B_AX_WDE_DATCHN_CAMREQ_ERR_INT_EN) 1046 + B_AX_WDE_DATCHN_FRZTO_ERR_INT_EN) 1048 1047 1049 1048 #define B_AX_WDE_DATCHN_CAMREQ_ERR_INT_EN BIT(29) 1050 1049 #define B_AX_WDE_DATCHN_ADRERR_ERR_INT_EN BIT(28)
+12 -8
drivers/net/wireless/rndis_wlan.c
··· 489 489 static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev); 490 490 491 491 static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev, 492 - u8 key_index, bool pairwise, const u8 *mac_addr, 493 - struct key_params *params); 492 + int link_id, u8 key_index, bool pairwise, 493 + const u8 *mac_addr, struct key_params *params); 494 494 495 495 static int rndis_del_key(struct wiphy *wiphy, struct net_device *netdev, 496 - u8 key_index, bool pairwise, const u8 *mac_addr); 496 + int link_id, u8 key_index, bool pairwise, 497 + const u8 *mac_addr); 497 498 498 499 static int rndis_set_default_key(struct wiphy *wiphy, struct net_device *netdev, 499 - u8 key_index, bool unicast, bool multicast); 500 + int link_id, u8 key_index, bool unicast, 501 + bool multicast); 500 502 501 503 static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, 502 504 const u8 *mac, struct station_info *sinfo); ··· 2379 2377 } 2380 2378 2381 2379 static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev, 2382 - u8 key_index, bool pairwise, const u8 *mac_addr, 2383 - struct key_params *params) 2380 + int link_id, u8 key_index, bool pairwise, 2381 + const u8 *mac_addr, struct key_params *params) 2384 2382 { 2385 2383 struct rndis_wlan_private *priv = wiphy_priv(wiphy); 2386 2384 struct usbnet *usbdev = priv->usbdev; ··· 2415 2413 } 2416 2414 2417 2415 static int rndis_del_key(struct wiphy *wiphy, struct net_device *netdev, 2418 - u8 key_index, bool pairwise, const u8 *mac_addr) 2416 + int link_id, u8 key_index, bool pairwise, 2417 + const u8 *mac_addr) 2419 2418 { 2420 2419 struct rndis_wlan_private *priv = wiphy_priv(wiphy); 2421 2420 struct usbnet *usbdev = priv->usbdev; ··· 2427 2424 } 2428 2425 2429 2426 static int rndis_set_default_key(struct wiphy *wiphy, struct net_device *netdev, 2430 - u8 key_index, bool unicast, bool multicast) 2427 + int link_id, u8 key_index, bool unicast, 2428 + bool multicast) 2431 2429 { 2432 2430 struct rndis_wlan_private *priv = wiphy_priv(wiphy); 2433 2431 struct usbnet *usbdev = priv->usbdev;
+7 -6
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
··· 850 850 } 851 851 852 852 static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, 853 - u8 key_index, bool pairwise, const u8 *mac_addr, 854 - struct key_params *params) 853 + int link_id, u8 key_index, bool pairwise, 854 + const u8 *mac_addr, struct key_params *params) 855 855 { 856 856 char *alg_name; 857 857 u32 param_len; ··· 932 932 } 933 933 934 934 static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, 935 - u8 key_index, bool pairwise, const u8 *mac_addr, 936 - void *cookie, 935 + int link_id, u8 key_index, bool pairwise, 936 + const u8 *mac_addr, void *cookie, 937 937 void (*callback)(void *cookie, 938 938 struct key_params*)) 939 939 { ··· 941 941 } 942 942 943 943 static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, 944 - u8 key_index, bool pairwise, const u8 *mac_addr) 944 + int link_id, u8 key_index, bool pairwise, 945 + const u8 *mac_addr) 945 946 { 946 947 struct adapter *padapter = rtw_netdev_priv(ndev); 947 948 struct security_priv *psecuritypriv = &padapter->securitypriv; ··· 956 955 } 957 956 958 957 static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, 959 - struct net_device *ndev, u8 key_index 958 + struct net_device *ndev, int link_id, u8 key_index 960 959 , bool unicast, bool multicast 961 960 ) 962 961 {
+7 -5
drivers/staging/wlan-ng/cfg80211.c
··· 143 143 } 144 144 145 145 static int prism2_add_key(struct wiphy *wiphy, struct net_device *dev, 146 - u8 key_index, bool pairwise, const u8 *mac_addr, 147 - struct key_params *params) 146 + int link_id, u8 key_index, bool pairwise, 147 + const u8 *mac_addr, struct key_params *params) 148 148 { 149 149 struct wlandevice *wlandev = dev->ml_priv; 150 150 u32 did; ··· 172 172 } 173 173 174 174 static int prism2_get_key(struct wiphy *wiphy, struct net_device *dev, 175 - u8 key_index, bool pairwise, 175 + int link_id, u8 key_index, bool pairwise, 176 176 const u8 *mac_addr, void *cookie, 177 177 void (*callback)(void *cookie, struct key_params*)) 178 178 { ··· 202 202 } 203 203 204 204 static int prism2_del_key(struct wiphy *wiphy, struct net_device *dev, 205 - u8 key_index, bool pairwise, const u8 *mac_addr) 205 + int link_id, u8 key_index, bool pairwise, 206 + const u8 *mac_addr) 206 207 { 207 208 struct wlandevice *wlandev = dev->ml_priv; 208 209 u32 did; ··· 228 227 } 229 228 230 229 static int prism2_set_default_key(struct wiphy *wiphy, struct net_device *dev, 231 - u8 key_index, bool unicast, bool multicast) 230 + int link_id, u8 key_index, bool unicast, 231 + bool multicast) 232 232 { 233 233 struct wlandevice *wlandev = dev->ml_priv; 234 234
+10 -4
include/linux/ieee80211.h
··· 2886 2886 /* Calculate 802.11be EHT capabilities IE Tx/Rx EHT MCS NSS Support Field size */ 2887 2887 static inline u8 2888 2888 ieee80211_eht_mcs_nss_size(const struct ieee80211_he_cap_elem *he_cap, 2889 - const struct ieee80211_eht_cap_elem_fixed *eht_cap) 2889 + const struct ieee80211_eht_cap_elem_fixed *eht_cap, 2890 + bool from_ap) 2890 2891 { 2891 2892 u8 count = 0; 2892 2893 ··· 2908 2907 if (eht_cap->phy_cap_info[0] & IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ) 2909 2908 count += 3; 2910 2909 2911 - return count ? count : 4; 2910 + if (count) 2911 + return count; 2912 + 2913 + return from_ap ? 3 : 4; 2912 2914 } 2913 2915 2914 2916 /* 802.11be EHT PPE Thresholds */ ··· 2947 2943 } 2948 2944 2949 2945 static inline bool 2950 - ieee80211_eht_capa_size_ok(const u8 *he_capa, const u8 *data, u8 len) 2946 + ieee80211_eht_capa_size_ok(const u8 *he_capa, const u8 *data, u8 len, 2947 + bool from_ap) 2951 2948 { 2952 2949 const struct ieee80211_eht_cap_elem_fixed *elem = (const void *)data; 2953 2950 u8 needed = sizeof(struct ieee80211_eht_cap_elem_fixed); ··· 2957 2952 return false; 2958 2953 2959 2954 needed += ieee80211_eht_mcs_nss_size((const void *)he_capa, 2960 - (const void *)data); 2955 + (const void *)data, 2956 + from_ap); 2961 2957 if (len < needed) 2962 2958 return false; 2963 2959
+30 -13
include/net/cfg80211.h
··· 2316 2316 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 2317 2317 * 1..32767] 2318 2318 * @aifs: Arbitration interframe space [0..255] 2319 + * @link_id: link_id or -1 for non-MLD 2319 2320 */ 2320 2321 struct ieee80211_txq_params { 2321 2322 enum nl80211_ac ac; ··· 2324 2323 u16 cwmin; 2325 2324 u16 cwmax; 2326 2325 u8 aifs; 2326 + int link_id; 2327 2327 }; 2328 2328 2329 2329 /** ··· 3931 3929 * @del_intf_link: Remove an MLO link from the given interface. 3932 3930 * 3933 3931 * @add_key: add a key with the given parameters. @mac_addr will be %NULL 3934 - * when adding a group key. 3932 + * when adding a group key. @link_id will be -1 for non-MLO connection. 3933 + * For MLO connection, @link_id will be >= 0 for group key and -1 for 3934 + * pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key. 3935 3935 * 3936 3936 * @get_key: get information about the key with the given parameters. 3937 3937 * @mac_addr will be %NULL when requesting information for a group 3938 3938 * key. All pointers given to the @callback function need not be valid 3939 3939 * after it returns. This function should return an error if it is 3940 3940 * not possible to retrieve the key, -ENOENT if it doesn't exist. 3941 + * @link_id will be -1 for non-MLO connection. For MLO connection, 3942 + * @link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr 3943 + * will be peer's MLD address for MLO pairwise key. 3941 3944 * 3942 3945 * @del_key: remove a key given the @mac_addr (%NULL for a group key) 3943 - * and @key_index, return -ENOENT if the key doesn't exist. 3946 + * and @key_index, return -ENOENT if the key doesn't exist. @link_id will 3947 + * be -1 for non-MLO connection. For MLO connection, @link_id will be >= 0 3948 + * for group key and -1 for pairwise key, @mac_addr will be peer's MLD 3949 + * address for MLO pairwise key. 3944 3950 * 3945 - * @set_default_key: set the default key on an interface 3951 + * @set_default_key: set the default key on an interface. @link_id will be >= 0 3952 + * for MLO connection and -1 for non-MLO connection. 3946 3953 * 3947 - * @set_default_mgmt_key: set the default management frame key on an interface 3954 + * @set_default_mgmt_key: set the default management frame key on an interface. 3955 + * @link_id will be >= 0 for MLO connection and -1 for non-MLO connection. 3948 3956 * 3949 - * @set_default_beacon_key: set the default Beacon frame key on an interface 3957 + * @set_default_beacon_key: set the default Beacon frame key on an interface. 3958 + * @link_id will be >= 0 for MLO connection and -1 for non-MLO connection. 3950 3959 * 3951 3960 * @set_rekey_data: give the data necessary for GTK rekeying to the driver 3952 3961 * ··· 4306 4293 unsigned int link_id); 4307 4294 4308 4295 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 4309 - u8 key_index, bool pairwise, const u8 *mac_addr, 4310 - struct key_params *params); 4296 + int link_id, u8 key_index, bool pairwise, 4297 + const u8 *mac_addr, struct key_params *params); 4311 4298 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 4312 - u8 key_index, bool pairwise, const u8 *mac_addr, 4313 - void *cookie, 4299 + int link_id, u8 key_index, bool pairwise, 4300 + const u8 *mac_addr, void *cookie, 4314 4301 void (*callback)(void *cookie, struct key_params*)); 4315 4302 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 4316 - u8 key_index, bool pairwise, const u8 *mac_addr); 4303 + int link_id, u8 key_index, bool pairwise, 4304 + const u8 *mac_addr); 4317 4305 int (*set_default_key)(struct wiphy *wiphy, 4318 - struct net_device *netdev, 4306 + struct net_device *netdev, int link_id, 4319 4307 u8 key_index, bool unicast, bool multicast); 4320 4308 int (*set_default_mgmt_key)(struct wiphy *wiphy, 4321 - struct net_device *netdev, 4309 + struct net_device *netdev, int link_id, 4322 4310 u8 key_index); 4323 4311 int (*set_default_beacon_key)(struct wiphy *wiphy, 4324 4312 struct net_device *netdev, 4313 + int link_id, 4325 4314 u8 key_index); 4326 4315 4327 4316 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, ··· 8281 8266 * cfg80211_ch_switch_started_notify - notify channel switch start 8282 8267 * @dev: the device on which the channel switch started 8283 8268 * @chandef: the future channel definition 8269 + * @link_id: the link ID for MLO, must be 0 for non-MLO 8284 8270 * @count: the number of TBTTs until the channel switch happens 8285 8271 * @quiet: whether or not immediate quiet was requested by the AP 8286 8272 * ··· 8291 8275 */ 8292 8276 void cfg80211_ch_switch_started_notify(struct net_device *dev, 8293 8277 struct cfg80211_chan_def *chandef, 8294 - u8 count, bool quiet); 8278 + unsigned int link_id, u8 count, 8279 + bool quiet); 8295 8280 8296 8281 /** 8297 8282 * ieee80211_operating_class_to_band - convert operating class to band
+9
include/net/mac80211.h
··· 1480 1480 * each A-MPDU but the same for each subframe within one A-MPDU 1481 1481 * @ampdu_delimiter_crc: A-MPDU delimiter CRC 1482 1482 * @zero_length_psdu_type: radiotap type of the 0-length PSDU 1483 + * @link_valid: if the link which is identified by @link_id is valid. This flag 1484 + * is set only when connection is MLO. 1485 + * @link_id: id of the link used to receive the packet. This is used along with 1486 + * @link_valid. 1483 1487 */ 1484 1488 struct ieee80211_rx_status { 1485 1489 u64 mactime; ··· 1508 1504 s8 chain_signal[IEEE80211_MAX_CHAINS]; 1509 1505 u8 ampdu_delimiter_crc; 1510 1506 u8 zero_length_psdu_type; 1507 + u8 link_valid:1, link_id:4; 1511 1508 }; 1512 1509 1513 1510 static inline u32 ··· 1980 1975 * - Temporal Authenticator Rx MIC Key (64 bits) 1981 1976 * @icv_len: The ICV length for this key type 1982 1977 * @iv_len: The IV length for this key type 1978 + * @link_id: the link ID for MLO, or -1 for non-MLO or pairwise keys 1983 1979 */ 1984 1980 struct ieee80211_key_conf { 1985 1981 atomic64_t tx_pn; ··· 1990 1984 u8 hw_key_idx; 1991 1985 s8 keyidx; 1992 1986 u16 flags; 1987 + s8 link_id; 1993 1988 u8 keylen; 1994 1989 u8 key[]; 1995 1990 }; ··· 2135 2128 * @addr: MAC address of the Link STA. For non-MLO STA this is same as the addr 2136 2129 * in ieee80211_sta. For MLO Link STA this addr can be same or different 2137 2130 * from addr in ieee80211_sta (representing MLD STA addr) 2131 + * @link_id: the link ID for this link STA (0 for deflink) 2138 2132 * @supp_rates: Bitmap of supported rates 2139 2133 * @ht_cap: HT capabilities of this STA; restricted to our own capabilities 2140 2134 * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities ··· 2152 2144 */ 2153 2145 struct ieee80211_link_sta { 2154 2146 u8 addr[ETH_ALEN]; 2147 + u8 link_id; 2155 2148 2156 2149 u32 supp_rates[NUM_NL80211_BANDS]; 2157 2150 struct ieee80211_sta_ht_cap ht_cap;
+11 -3
include/uapi/linux/nl80211.h
··· 377 377 * the non-transmitting interfaces are deleted as well. 378 378 * 379 379 * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified 380 - * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. 380 + * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC 381 + * represents peer's MLD address for MLO pairwise key. For MLO group key, 382 + * the link is identified by %NL80211_ATTR_MLO_LINK_ID. 381 383 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, 382 384 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. 385 + * For MLO connection, the link to set default key is identified by 386 + * %NL80211_ATTR_MLO_LINK_ID. 383 387 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, 384 388 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, 385 - * and %NL80211_ATTR_KEY_SEQ attributes. 389 + * and %NL80211_ATTR_KEY_SEQ attributes. %NL80211_ATTR_MAC represents 390 + * peer's MLD address for MLO pairwise key. The link to add MLO 391 + * group key is identified by %NL80211_ATTR_MLO_LINK_ID. 386 392 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX 387 - * or %NL80211_ATTR_MAC. 393 + * or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC represents peer's MLD address 394 + * for MLO pairwise key. The link to delete group key is identified by 395 + * %NL80211_ATTR_MLO_LINK_ID. 388 396 * 389 397 * @NL80211_CMD_GET_BEACON: (not used) 390 398 * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface
+106 -23
net/mac80211/cfg.c
··· 23 23 #include "mesh.h" 24 24 #include "wme.h" 25 25 26 + static struct ieee80211_link_data * 27 + ieee80211_link_or_deflink(struct ieee80211_sub_if_data *sdata, int link_id, 28 + bool require_valid) 29 + { 30 + struct ieee80211_link_data *link; 31 + 32 + if (link_id < 0) { 33 + /* 34 + * For keys, if sdata is not an MLD, we might not use 35 + * the return value at all (if it's not a pairwise key), 36 + * so in that case (require_valid==false) don't error. 37 + */ 38 + if (require_valid && sdata->vif.valid_links) 39 + return ERR_PTR(-EINVAL); 40 + 41 + return &sdata->deflink; 42 + } 43 + 44 + link = sdata_dereference(sdata->link[link_id], sdata); 45 + if (!link) 46 + return ERR_PTR(-ENOLINK); 47 + return link; 48 + } 49 + 26 50 static void ieee80211_set_mu_mimo_follow(struct ieee80211_sub_if_data *sdata, 27 51 struct vif_params *params) 28 52 { ··· 458 434 } 459 435 460 436 static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, 461 - u8 key_idx, bool pairwise, const u8 *mac_addr, 462 - struct key_params *params) 437 + int link_id, u8 key_idx, bool pairwise, 438 + const u8 *mac_addr, struct key_params *params) 463 439 { 464 440 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 441 + struct ieee80211_link_data *link = 442 + ieee80211_link_or_deflink(sdata, link_id, false); 465 443 struct ieee80211_local *local = sdata->local; 466 444 struct sta_info *sta = NULL; 467 445 struct ieee80211_key *key; ··· 471 445 472 446 if (!ieee80211_sdata_running(sdata)) 473 447 return -ENETDOWN; 448 + 449 + if (IS_ERR(link)) 450 + return PTR_ERR(link); 474 451 475 452 if (pairwise && params->mode == NL80211_KEY_SET_TX) 476 453 return ieee80211_set_tx(sdata, mac_addr, key_idx); ··· 483 454 case WLAN_CIPHER_SUITE_WEP40: 484 455 case WLAN_CIPHER_SUITE_TKIP: 485 456 case WLAN_CIPHER_SUITE_WEP104: 457 + if (link_id >= 0) 458 + return -EINVAL; 486 459 if (WARN_ON_ONCE(fips_enabled)) 487 460 return -EINVAL; 488 461 break; ··· 496 465 params->key, params->seq_len, params->seq); 497 466 if (IS_ERR(key)) 498 467 return PTR_ERR(key); 468 + 469 + key->conf.link_id = link_id; 499 470 500 471 if (pairwise) 501 472 key->conf.flags |= IEEE80211_KEY_FLAG_PAIRWISE; ··· 560 527 break; 561 528 } 562 529 563 - err = ieee80211_key_link(key, sdata, sta); 530 + err = ieee80211_key_link(key, link, sta); 564 531 565 532 out_unlock: 566 533 mutex_unlock(&local->sta_mtx); ··· 569 536 } 570 537 571 538 static struct ieee80211_key * 572 - ieee80211_lookup_key(struct ieee80211_sub_if_data *sdata, 539 + ieee80211_lookup_key(struct ieee80211_sub_if_data *sdata, int link_id, 573 540 u8 key_idx, bool pairwise, const u8 *mac_addr) 574 541 { 575 542 struct ieee80211_local *local = sdata->local; 543 + struct ieee80211_link_data *link = &sdata->deflink; 576 544 struct ieee80211_key *key; 577 - struct sta_info *sta; 545 + 546 + if (link_id >= 0) { 547 + link = rcu_dereference_check(sdata->link[link_id], 548 + lockdep_is_held(&sdata->wdev.mtx)); 549 + if (!link) 550 + return NULL; 551 + } 578 552 579 553 if (mac_addr) { 554 + struct sta_info *sta; 555 + struct link_sta_info *link_sta; 556 + 580 557 sta = sta_info_get_bss(sdata, mac_addr); 581 558 if (!sta) 582 559 return NULL; 560 + 561 + if (link_id >= 0) { 562 + link_sta = rcu_dereference_check(sta->link[link_id], 563 + lockdep_is_held(&local->sta_mtx)); 564 + if (!link_sta) 565 + return NULL; 566 + } else { 567 + link_sta = &sta->deflink; 568 + } 583 569 584 570 if (pairwise && key_idx < NUM_DEFAULT_KEYS) 585 571 return rcu_dereference_check_key_mtx(local, ··· 609 557 NUM_DEFAULT_MGMT_KEYS + 610 558 NUM_DEFAULT_BEACON_KEYS) 611 559 return rcu_dereference_check_key_mtx(local, 612 - sta->deflink.gtk[key_idx]); 560 + link_sta->gtk[key_idx]); 613 561 614 562 return NULL; 615 563 } ··· 618 566 return rcu_dereference_check_key_mtx(local, 619 567 sdata->keys[key_idx]); 620 568 621 - key = rcu_dereference_check_key_mtx(local, sdata->deflink.gtk[key_idx]); 569 + key = rcu_dereference_check_key_mtx(local, link->gtk[key_idx]); 622 570 if (key) 623 571 return key; 624 572 ··· 630 578 } 631 579 632 580 static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, 633 - u8 key_idx, bool pairwise, const u8 *mac_addr) 581 + int link_id, u8 key_idx, bool pairwise, 582 + const u8 *mac_addr) 634 583 { 635 584 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 636 585 struct ieee80211_local *local = sdata->local; ··· 641 588 mutex_lock(&local->sta_mtx); 642 589 mutex_lock(&local->key_mtx); 643 590 644 - key = ieee80211_lookup_key(sdata, key_idx, pairwise, mac_addr); 591 + key = ieee80211_lookup_key(sdata, link_id, key_idx, pairwise, mac_addr); 645 592 if (!key) { 646 593 ret = -ENOENT; 647 594 goto out_unlock; ··· 658 605 } 659 606 660 607 static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev, 661 - u8 key_idx, bool pairwise, const u8 *mac_addr, 662 - void *cookie, 608 + int link_id, u8 key_idx, bool pairwise, 609 + const u8 *mac_addr, void *cookie, 663 610 void (*callback)(void *cookie, 664 611 struct key_params *params)) 665 612 { ··· 677 624 678 625 rcu_read_lock(); 679 626 680 - key = ieee80211_lookup_key(sdata, key_idx, pairwise, mac_addr); 627 + key = ieee80211_lookup_key(sdata, link_id, key_idx, pairwise, mac_addr); 681 628 if (!key) 682 629 goto out; 683 630 ··· 764 711 765 712 static int ieee80211_config_default_key(struct wiphy *wiphy, 766 713 struct net_device *dev, 767 - u8 key_idx, bool uni, 714 + int link_id, u8 key_idx, bool uni, 768 715 bool multi) 769 716 { 770 717 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 718 + struct ieee80211_link_data *link = 719 + ieee80211_link_or_deflink(sdata, link_id, false); 771 720 772 - ieee80211_set_default_key(sdata, key_idx, uni, multi); 721 + if (IS_ERR(link)) 722 + return PTR_ERR(link); 723 + 724 + ieee80211_set_default_key(link, key_idx, uni, multi); 773 725 774 726 return 0; 775 727 } 776 728 777 729 static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy, 778 730 struct net_device *dev, 779 - u8 key_idx) 731 + int link_id, u8 key_idx) 780 732 { 781 733 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 734 + struct ieee80211_link_data *link = 735 + ieee80211_link_or_deflink(sdata, link_id, true); 782 736 783 - ieee80211_set_default_mgmt_key(sdata, key_idx); 737 + if (IS_ERR(link)) 738 + return PTR_ERR(link); 739 + 740 + ieee80211_set_default_mgmt_key(link, key_idx); 784 741 785 742 return 0; 786 743 } 787 744 788 745 static int ieee80211_config_default_beacon_key(struct wiphy *wiphy, 789 746 struct net_device *dev, 790 - u8 key_idx) 747 + int link_id, u8 key_idx) 791 748 { 792 749 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 750 + struct ieee80211_link_data *link = 751 + ieee80211_link_or_deflink(sdata, link_id, true); 793 752 794 - ieee80211_set_default_beacon_key(sdata, key_idx); 753 + if (IS_ERR(link)) 754 + return PTR_ERR(link); 755 + 756 + ieee80211_set_default_beacon_key(link, key_idx); 795 757 796 758 return 0; 797 759 } ··· 1678 1610 rcu_dereference_protected(sta->link[link_id], 1679 1611 lockdep_is_held(&local->sta_mtx)); 1680 1612 1613 + /* 1614 + * If there are no changes, then accept a link that doesn't exist, 1615 + * unless it's a new link. 1616 + */ 1617 + if (params->link_id < 0 && !new_link && 1618 + !params->link_mac && !params->txpwr_set && 1619 + !params->supported_rates_len && 1620 + !params->ht_capa && !params->vht_capa && 1621 + !params->he_capa && !params->eht_capa && 1622 + !params->opmode_notif_used) 1623 + return 0; 1624 + 1681 1625 if (!link || !link_sta) 1682 1626 return -EINVAL; 1683 1627 ··· 1705 1625 params->link_mac)) { 1706 1626 return -EINVAL; 1707 1627 } 1628 + } else if (new_link) { 1629 + return -EINVAL; 1708 1630 } 1709 1631 1710 1632 if (params->txpwr_set) { ··· 2636 2554 { 2637 2555 struct ieee80211_local *local = wiphy_priv(wiphy); 2638 2556 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2639 - struct ieee80211_link_data *link = &sdata->deflink; 2557 + struct ieee80211_link_data *link = 2558 + ieee80211_link_or_deflink(sdata, params->link_id, true); 2640 2559 struct ieee80211_tx_queue_params p; 2641 2560 2642 2561 if (!local->ops->conf_tx) ··· 2645 2562 2646 2563 if (local->hw.queues < IEEE80211_NUM_ACS) 2647 2564 return -EOPNOTSUPP; 2565 + 2566 + if (IS_ERR(link)) 2567 + return PTR_ERR(link); 2648 2568 2649 2569 memset(&p, 0, sizeof(p)); 2650 2570 p.aifs = params->aifs; ··· 3683 3597 case NL80211_IFTYPE_MESH_POINT: { 3684 3598 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 3685 3599 3686 - if (params->chandef.width != sdata->vif.bss_conf.chandef.width) 3687 - return -EINVAL; 3688 - 3689 3600 /* changes into another band are not supported */ 3690 3601 if (sdata->vif.bss_conf.chandef.chan->band != 3691 3602 params->chandef.chan->band) ··· 3815 3732 IEEE80211_QUEUE_STOP_REASON_CSA); 3816 3733 3817 3734 cfg80211_ch_switch_started_notify(sdata->dev, 3818 - &sdata->deflink.csa_chandef, 3735 + &sdata->deflink.csa_chandef, 0, 3819 3736 params->count, params->block_tx); 3820 3737 3821 3738 if (changed) {
+3 -1
net/mac80211/eht.c
··· 30 30 return; 31 31 32 32 mcs_nss_size = ieee80211_eht_mcs_nss_size(he_cap_ie_elem, 33 - &eht_cap_ie_elem->fixed); 33 + &eht_cap_ie_elem->fixed, 34 + sdata->vif.type == 35 + NL80211_IFTYPE_STATION); 34 36 35 37 eht_total_size += mcs_nss_size; 36 38
+5 -5
net/mac80211/ethtool.c
··· 83 83 84 84 #define ADD_STA_STATS(sta) \ 85 85 do { \ 86 - data[i++] += (sta)->rx_stats.packets; \ 87 - data[i++] += (sta)->rx_stats.bytes; \ 86 + data[i++] += sinfo.rx_packets; \ 87 + data[i++] += sinfo.rx_bytes; \ 88 88 data[i++] += (sta)->rx_stats.num_duplicates; \ 89 89 data[i++] += (sta)->rx_stats.fragments; \ 90 - data[i++] += (sta)->rx_stats.dropped; \ 90 + data[i++] += sinfo.rx_dropped_misc; \ 91 91 \ 92 92 data[i++] += sinfo.tx_packets; \ 93 93 data[i++] += sinfo.tx_bytes; \ 94 94 data[i++] += (sta)->status_stats.filtered; \ 95 - data[i++] += (sta)->status_stats.retry_failed; \ 96 - data[i++] += (sta)->status_stats.retry_count; \ 95 + data[i++] += sinfo.tx_failed; \ 96 + data[i++] += sinfo.tx_retries; \ 97 97 } while (0) 98 98 99 99 /* For Managed stations, find the single station based on BSSID
+4 -4
net/mac80211/ibss.c
··· 1346 1346 capability, 0, true); 1347 1347 } 1348 1348 1349 - static unsigned ibss_setup_channels(struct wiphy *wiphy, 1350 - struct ieee80211_channel **channels, 1351 - unsigned int channels_max, 1352 - u32 center_freq, u32 width) 1349 + static unsigned int ibss_setup_channels(struct wiphy *wiphy, 1350 + struct ieee80211_channel **channels, 1351 + unsigned int channels_max, 1352 + u32 center_freq, u32 width) 1353 1353 { 1354 1354 struct ieee80211_channel *chan = NULL; 1355 1355 unsigned int n_chan = 0;
+7 -1
net/mac80211/ieee80211_i.h
··· 213 213 struct ieee80211_sub_if_data *sdata; 214 214 struct ieee80211_link_data *link; 215 215 struct sta_info *sta; 216 + struct link_sta_info *link_sta; 216 217 struct ieee80211_key *key; 217 218 218 219 unsigned int flags; ··· 2185 2184 * for that non-transmitting BSS is returned 2186 2185 * @link_id: the link ID to parse elements for, if a STA profile 2187 2186 * is present in the multi-link element, or -1 to ignore 2187 + * @from_ap: frame is received from an AP (currently used only 2188 + * for EHT capabilities parsing) 2188 2189 */ 2189 2190 struct ieee80211_elems_parse_params { 2190 2191 const u8 *start; ··· 2196 2193 u32 crc; 2197 2194 struct cfg80211_bss *bss; 2198 2195 int link_id; 2196 + bool from_ap; 2199 2197 }; 2200 2198 2201 2199 struct ieee802_11_elems * ··· 2386 2382 const struct ieee80211_sta_he_cap *he_cap, 2387 2383 u8 *end); 2388 2384 void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata, 2385 + enum ieee80211_smps_mode smps_mode, 2389 2386 struct sk_buff *skb); 2390 2387 u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef); 2391 2388 int ieee80211_parse_bitrates(enum nl80211_chan_width width, ··· 2518 2513 u8 *ieee80211_ie_build_eht_cap(u8 *pos, 2519 2514 const struct ieee80211_sta_he_cap *he_cap, 2520 2515 const struct ieee80211_sta_eht_cap *eht_cap, 2521 - u8 *end); 2516 + u8 *end, 2517 + bool for_ap); 2522 2518 2523 2519 void 2524 2520 ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
+12 -1
net/mac80211/iface.c
··· 406 406 case NL80211_IFTYPE_AP: 407 407 ether_addr_copy(link_conf->addr, 408 408 sdata->wdev.links[link_id].addr); 409 + link_conf->bssid = link_conf->addr; 409 410 WARN_ON(!(sdata->wdev.valid_links & BIT(link_id))); 410 411 break; 411 412 case NL80211_IFTYPE_STATION: 413 + /* station sets the bssid in ieee80211_mgd_setup_link */ 412 414 break; 413 415 default: 414 416 WARN_ON(1); ··· 434 432 static void ieee80211_free_links(struct ieee80211_sub_if_data *sdata, 435 433 struct link_container **links) 436 434 { 435 + LIST_HEAD(keys); 437 436 unsigned int link_id; 438 437 438 + for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) { 439 + if (!links[link_id]) 440 + continue; 441 + ieee80211_remove_link_keys(&links[link_id]->data, &keys); 442 + } 443 + 439 444 synchronize_rcu(); 445 + 446 + ieee80211_free_key_list(sdata->local, &keys); 440 447 441 448 for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) { 442 449 if (!links[link_id]) ··· 2278 2267 wdev = &sdata->wdev; 2279 2268 2280 2269 sdata->dev = NULL; 2281 - strlcpy(sdata->name, name, IFNAMSIZ); 2270 + strscpy(sdata->name, name, IFNAMSIZ); 2282 2271 ieee80211_assign_perm_addr(local, wdev->address, type); 2283 2272 memcpy(sdata->vif.addr, wdev->address, ETH_ALEN); 2284 2273 ether_addr_copy(sdata->vif.bss_conf.addr, sdata->vif.addr);
+131 -59
net/mac80211/key.c
··· 344 344 } 345 345 } 346 346 347 - static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, 347 + static void __ieee80211_set_default_key(struct ieee80211_link_data *link, 348 348 int idx, bool uni, bool multi) 349 349 { 350 + struct ieee80211_sub_if_data *sdata = link->sdata; 350 351 struct ieee80211_key *key = NULL; 351 352 352 353 assert_key_lock(sdata->local); ··· 355 354 if (idx >= 0 && idx < NUM_DEFAULT_KEYS) { 356 355 key = key_mtx_dereference(sdata->local, sdata->keys[idx]); 357 356 if (!key) 358 - key = key_mtx_dereference(sdata->local, sdata->deflink.gtk[idx]); 357 + key = key_mtx_dereference(sdata->local, link->gtk[idx]); 359 358 } 360 359 361 360 if (uni) { ··· 366 365 } 367 366 368 367 if (multi) 369 - rcu_assign_pointer(sdata->deflink.default_multicast_key, key); 368 + rcu_assign_pointer(link->default_multicast_key, key); 370 369 371 370 ieee80211_debugfs_key_update_default(sdata); 372 371 } 373 372 374 - void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx, 373 + void ieee80211_set_default_key(struct ieee80211_link_data *link, int idx, 375 374 bool uni, bool multi) 376 375 { 377 - mutex_lock(&sdata->local->key_mtx); 378 - __ieee80211_set_default_key(sdata, idx, uni, multi); 379 - mutex_unlock(&sdata->local->key_mtx); 376 + mutex_lock(&link->sdata->local->key_mtx); 377 + __ieee80211_set_default_key(link, idx, uni, multi); 378 + mutex_unlock(&link->sdata->local->key_mtx); 380 379 } 381 380 382 381 static void 383 - __ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, int idx) 382 + __ieee80211_set_default_mgmt_key(struct ieee80211_link_data *link, int idx) 384 383 { 384 + struct ieee80211_sub_if_data *sdata = link->sdata; 385 385 struct ieee80211_key *key = NULL; 386 386 387 387 assert_key_lock(sdata->local); 388 388 389 389 if (idx >= NUM_DEFAULT_KEYS && 390 390 idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) 391 - key = key_mtx_dereference(sdata->local, 392 - sdata->deflink.gtk[idx]); 391 + key = key_mtx_dereference(sdata->local, link->gtk[idx]); 393 392 394 - rcu_assign_pointer(sdata->deflink.default_mgmt_key, key); 393 + rcu_assign_pointer(link->default_mgmt_key, key); 395 394 396 395 ieee80211_debugfs_key_update_default(sdata); 397 396 } 398 397 399 - void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, 398 + void ieee80211_set_default_mgmt_key(struct ieee80211_link_data *link, 400 399 int idx) 401 400 { 402 - mutex_lock(&sdata->local->key_mtx); 403 - __ieee80211_set_default_mgmt_key(sdata, idx); 404 - mutex_unlock(&sdata->local->key_mtx); 401 + mutex_lock(&link->sdata->local->key_mtx); 402 + __ieee80211_set_default_mgmt_key(link, idx); 403 + mutex_unlock(&link->sdata->local->key_mtx); 405 404 } 406 405 407 406 static void 408 - __ieee80211_set_default_beacon_key(struct ieee80211_sub_if_data *sdata, int idx) 407 + __ieee80211_set_default_beacon_key(struct ieee80211_link_data *link, int idx) 409 408 { 409 + struct ieee80211_sub_if_data *sdata = link->sdata; 410 410 struct ieee80211_key *key = NULL; 411 411 412 412 assert_key_lock(sdata->local); ··· 415 413 if (idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS && 416 414 idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS + 417 415 NUM_DEFAULT_BEACON_KEYS) 418 - key = key_mtx_dereference(sdata->local, 419 - sdata->deflink.gtk[idx]); 416 + key = key_mtx_dereference(sdata->local, link->gtk[idx]); 420 417 421 - rcu_assign_pointer(sdata->deflink.default_beacon_key, key); 418 + rcu_assign_pointer(link->default_beacon_key, key); 422 419 423 420 ieee80211_debugfs_key_update_default(sdata); 424 421 } 425 422 426 - void ieee80211_set_default_beacon_key(struct ieee80211_sub_if_data *sdata, 423 + void ieee80211_set_default_beacon_key(struct ieee80211_link_data *link, 427 424 int idx) 428 425 { 429 - mutex_lock(&sdata->local->key_mtx); 430 - __ieee80211_set_default_beacon_key(sdata, idx); 431 - mutex_unlock(&sdata->local->key_mtx); 426 + mutex_lock(&link->sdata->local->key_mtx); 427 + __ieee80211_set_default_beacon_key(link, idx); 428 + mutex_unlock(&link->sdata->local->key_mtx); 432 429 } 433 430 434 431 static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, 435 - struct sta_info *sta, 436 - bool pairwise, 437 - struct ieee80211_key *old, 438 - struct ieee80211_key *new) 432 + struct ieee80211_link_data *link, 433 + struct sta_info *sta, 434 + bool pairwise, 435 + struct ieee80211_key *old, 436 + struct ieee80211_key *new) 439 437 { 438 + struct link_sta_info *link_sta = sta ? &sta->deflink : NULL; 439 + int link_id; 440 440 int idx; 441 441 int ret = 0; 442 442 bool defunikey, defmultikey, defmgmtkey, defbeaconkey; ··· 450 446 451 447 if (new) { 452 448 idx = new->conf.keyidx; 453 - list_add_tail_rcu(&new->list, &sdata->key_list); 454 449 is_wep = new->conf.cipher == WLAN_CIPHER_SUITE_WEP40 || 455 450 new->conf.cipher == WLAN_CIPHER_SUITE_WEP104; 451 + link_id = new->conf.link_id; 456 452 } else { 457 453 idx = old->conf.keyidx; 458 454 is_wep = old->conf.cipher == WLAN_CIPHER_SUITE_WEP40 || 459 455 old->conf.cipher == WLAN_CIPHER_SUITE_WEP104; 456 + link_id = old->conf.link_id; 457 + } 458 + 459 + if (WARN(old && old->conf.link_id != link_id, 460 + "old link ID %d doesn't match new link ID %d\n", 461 + old->conf.link_id, link_id)) 462 + return -EINVAL; 463 + 464 + if (link_id >= 0) { 465 + if (!link) { 466 + link = sdata_dereference(sdata->link[link_id], sdata); 467 + if (!link) 468 + return -ENOLINK; 469 + } 470 + 471 + if (sta) { 472 + link_sta = rcu_dereference_protected(sta->link[link_id], 473 + lockdep_is_held(&sta->local->sta_mtx)); 474 + if (!link_sta) 475 + return -ENOLINK; 476 + } 477 + } else { 478 + link = &sdata->deflink; 460 479 } 461 480 462 481 if ((is_wep || pairwise) && idx >= NUM_DEFAULT_KEYS) ··· 509 482 if (ret) 510 483 return ret; 511 484 485 + if (new) 486 + list_add_tail_rcu(&new->list, &sdata->key_list); 487 + 512 488 if (sta) { 513 489 if (pairwise) { 514 490 rcu_assign_pointer(sta->ptk[idx], new); ··· 519 489 !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX)) 520 490 _ieee80211_set_tx_key(new, true); 521 491 } else { 522 - rcu_assign_pointer(sta->deflink.gtk[idx], new); 492 + rcu_assign_pointer(link_sta->gtk[idx], new); 523 493 } 524 494 /* Only needed for transition from no key -> key. 525 495 * Still triggers unnecessary when using Extended Key ID ··· 533 503 sdata->default_unicast_key); 534 504 defmultikey = old && 535 505 old == key_mtx_dereference(sdata->local, 536 - sdata->deflink.default_multicast_key); 506 + link->default_multicast_key); 537 507 defmgmtkey = old && 538 508 old == key_mtx_dereference(sdata->local, 539 - sdata->deflink.default_mgmt_key); 509 + link->default_mgmt_key); 540 510 defbeaconkey = old && 541 511 old == key_mtx_dereference(sdata->local, 542 - sdata->deflink.default_beacon_key); 512 + link->default_beacon_key); 543 513 544 514 if (defunikey && !new) 545 - __ieee80211_set_default_key(sdata, -1, true, false); 515 + __ieee80211_set_default_key(link, -1, true, false); 546 516 if (defmultikey && !new) 547 - __ieee80211_set_default_key(sdata, -1, false, true); 517 + __ieee80211_set_default_key(link, -1, false, true); 548 518 if (defmgmtkey && !new) 549 - __ieee80211_set_default_mgmt_key(sdata, -1); 519 + __ieee80211_set_default_mgmt_key(link, -1); 550 520 if (defbeaconkey && !new) 551 - __ieee80211_set_default_beacon_key(sdata, -1); 521 + __ieee80211_set_default_beacon_key(link, -1); 552 522 553 523 if (is_wep || pairwise) 554 524 rcu_assign_pointer(sdata->keys[idx], new); 555 525 else 556 - rcu_assign_pointer(sdata->deflink.gtk[idx], new); 526 + rcu_assign_pointer(link->gtk[idx], new); 557 527 558 528 if (defunikey && new) 559 - __ieee80211_set_default_key(sdata, new->conf.keyidx, 529 + __ieee80211_set_default_key(link, new->conf.keyidx, 560 530 true, false); 561 531 if (defmultikey && new) 562 - __ieee80211_set_default_key(sdata, new->conf.keyidx, 532 + __ieee80211_set_default_key(link, new->conf.keyidx, 563 533 false, true); 564 534 if (defmgmtkey && new) 565 - __ieee80211_set_default_mgmt_key(sdata, 535 + __ieee80211_set_default_mgmt_key(link, 566 536 new->conf.keyidx); 567 537 if (defbeaconkey && new) 568 - __ieee80211_set_default_beacon_key(sdata, 538 + __ieee80211_set_default_beacon_key(link, 569 539 new->conf.keyidx); 570 540 } 571 541 ··· 599 569 key->conf.flags = 0; 600 570 key->flags = 0; 601 571 572 + key->conf.link_id = -1; 602 573 key->conf.cipher = cipher; 603 574 key->conf.keyidx = idx; 604 575 key->conf.keylen = key_len; ··· 828 797 } 829 798 830 799 int ieee80211_key_link(struct ieee80211_key *key, 831 - struct ieee80211_sub_if_data *sdata, 800 + struct ieee80211_link_data *link, 832 801 struct sta_info *sta) 833 802 { 803 + struct ieee80211_sub_if_data *sdata = link->sdata; 834 804 static atomic_t key_color = ATOMIC_INIT(0); 835 805 struct ieee80211_key *old_key = NULL; 836 806 int idx = key->conf.keyidx; ··· 859 827 (old_key && old_key->conf.cipher != key->conf.cipher)) 860 828 goto out; 861 829 } else if (sta) { 862 - old_key = key_mtx_dereference(sdata->local, 863 - sta->deflink.gtk[idx]); 830 + struct link_sta_info *link_sta = &sta->deflink; 831 + int link_id = key->conf.link_id; 832 + 833 + if (link_id >= 0) { 834 + link_sta = rcu_dereference_protected(sta->link[link_id], 835 + lockdep_is_held(&sta->local->sta_mtx)); 836 + if (!link_sta) 837 + return -ENOLINK; 838 + } 839 + 840 + old_key = key_mtx_dereference(sdata->local, link_sta->gtk[idx]); 864 841 } else { 865 842 if (idx < NUM_DEFAULT_KEYS) 866 843 old_key = key_mtx_dereference(sdata->local, 867 844 sdata->keys[idx]); 868 845 if (!old_key) 869 846 old_key = key_mtx_dereference(sdata->local, 870 - sdata->deflink.gtk[idx]); 847 + link->gtk[idx]); 871 848 } 872 849 873 850 /* Non-pairwise keys must also not switch the cipher on rekey */ ··· 907 866 908 867 increment_tailroom_need_count(sdata); 909 868 910 - ret = ieee80211_key_replace(sdata, sta, pairwise, old_key, key); 869 + ret = ieee80211_key_replace(sdata, link, sta, pairwise, old_key, key); 911 870 912 871 if (!ret) { 913 872 ieee80211_debugfs_key_add(key); ··· 931 890 * Replace key with nothingness if it was ever used. 932 891 */ 933 892 if (key->sdata) 934 - ieee80211_key_replace(key->sdata, key->sta, 935 - key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 936 - key, NULL); 893 + ieee80211_key_replace(key->sdata, NULL, key->sta, 894 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 895 + key, NULL); 937 896 ieee80211_key_destroy(key, delay_tailroom); 938 897 } 939 898 ··· 1060 1019 ieee80211_debugfs_key_remove_beacon_default(sdata); 1061 1020 1062 1021 list_for_each_entry_safe(key, tmp, &sdata->key_list, list) { 1063 - ieee80211_key_replace(key->sdata, key->sta, 1064 - key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 1065 - key, NULL); 1022 + ieee80211_key_replace(key->sdata, NULL, key->sta, 1023 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 1024 + key, NULL); 1066 1025 list_add_tail(&key->list, keys); 1067 1026 } 1068 1027 1069 1028 ieee80211_debugfs_key_update_default(sdata); 1029 + } 1030 + 1031 + void ieee80211_remove_link_keys(struct ieee80211_link_data *link, 1032 + struct list_head *keys) 1033 + { 1034 + struct ieee80211_sub_if_data *sdata = link->sdata; 1035 + struct ieee80211_local *local = sdata->local; 1036 + struct ieee80211_key *key, *tmp; 1037 + 1038 + mutex_lock(&local->key_mtx); 1039 + list_for_each_entry_safe(key, tmp, &sdata->key_list, list) { 1040 + if (key->conf.link_id != link->link_id) 1041 + continue; 1042 + ieee80211_key_replace(key->sdata, link, key->sta, 1043 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 1044 + key, NULL); 1045 + list_add_tail(&key->list, keys); 1046 + } 1047 + mutex_unlock(&local->key_mtx); 1048 + } 1049 + 1050 + void ieee80211_free_key_list(struct ieee80211_local *local, 1051 + struct list_head *keys) 1052 + { 1053 + struct ieee80211_key *key, *tmp; 1054 + 1055 + mutex_lock(&local->key_mtx); 1056 + list_for_each_entry_safe(key, tmp, keys, list) 1057 + __ieee80211_key_destroy(key, false); 1058 + mutex_unlock(&local->key_mtx); 1070 1059 } 1071 1060 1072 1061 void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, ··· 1158 1087 key = key_mtx_dereference(local, sta->deflink.gtk[i]); 1159 1088 if (!key) 1160 1089 continue; 1161 - ieee80211_key_replace(key->sdata, key->sta, 1162 - key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 1163 - key, NULL); 1090 + ieee80211_key_replace(key->sdata, NULL, key->sta, 1091 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 1092 + key, NULL); 1164 1093 __ieee80211_key_destroy(key, key->sdata->vif.type == 1165 1094 NL80211_IFTYPE_STATION); 1166 1095 } ··· 1169 1098 key = key_mtx_dereference(local, sta->ptk[i]); 1170 1099 if (!key) 1171 1100 continue; 1172 - ieee80211_key_replace(key->sdata, key->sta, 1173 - key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 1174 - key, NULL); 1101 + ieee80211_key_replace(key->sdata, NULL, key->sta, 1102 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 1103 + key, NULL); 1175 1104 __ieee80211_key_destroy(key, key->sdata->vif.type == 1176 1105 NL80211_IFTYPE_STATION); 1177 1106 } ··· 1378 1307 if (sdata->u.mgd.mfp != IEEE80211_MFP_DISABLED) 1379 1308 key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; 1380 1309 1381 - err = ieee80211_key_link(key, sdata, NULL); 1310 + /* FIXME: this function needs to get a link ID */ 1311 + err = ieee80211_key_link(key, &sdata->deflink, NULL); 1382 1312 if (err) 1383 1313 return ERR_PTR(err); 1384 1314
+9 -4
net/mac80211/key.h
··· 22 22 23 23 struct ieee80211_local; 24 24 struct ieee80211_sub_if_data; 25 + struct ieee80211_link_data; 25 26 struct sta_info; 26 27 27 28 /** ··· 145 144 * to make it used, free old key. On failure, also free the new key. 146 145 */ 147 146 int ieee80211_key_link(struct ieee80211_key *key, 148 - struct ieee80211_sub_if_data *sdata, 147 + struct ieee80211_link_data *link, 149 148 struct sta_info *sta); 150 149 int ieee80211_set_tx_key(struct ieee80211_key *key); 151 150 void ieee80211_key_free(struct ieee80211_key *key, bool delay_tailroom); 152 151 void ieee80211_key_free_unused(struct ieee80211_key *key); 153 - void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx, 152 + void ieee80211_set_default_key(struct ieee80211_link_data *link, int idx, 154 153 bool uni, bool multi); 155 - void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, 154 + void ieee80211_set_default_mgmt_key(struct ieee80211_link_data *link, 156 155 int idx); 157 - void ieee80211_set_default_beacon_key(struct ieee80211_sub_if_data *sdata, 156 + void ieee80211_set_default_beacon_key(struct ieee80211_link_data *link, 158 157 int idx); 158 + void ieee80211_remove_link_keys(struct ieee80211_link_data *link, 159 + struct list_head *keys); 160 + void ieee80211_free_key_list(struct ieee80211_local *local, 161 + struct list_head *keys); 159 162 void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, 160 163 bool force_synchronize); 161 164 void ieee80211_free_sta_keys(struct ieee80211_local *local,
+1 -1
net/mac80211/mesh.c
··· 634 634 if (!iftd) 635 635 return 0; 636 636 637 - ieee80211_ie_build_he_6ghz_cap(sdata, skb); 637 + ieee80211_ie_build_he_6ghz_cap(sdata, sdata->deflink.smps_mode, skb); 638 638 return 0; 639 639 } 640 640
+57 -16
net/mac80211/mlme.c
··· 695 695 static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata, 696 696 struct sk_buff *skb, 697 697 struct ieee80211_supported_band *sband, 698 + enum ieee80211_smps_mode smps_mode, 698 699 ieee80211_conn_flags_t conn_flags) 699 700 { 700 701 u8 *pos, *pre_he_pos; ··· 720 719 /* trim excess if any */ 721 720 skb_trim(skb, skb->len - (pre_he_pos + he_cap_size - pos)); 722 721 723 - ieee80211_ie_build_he_6ghz_cap(sdata, skb); 722 + ieee80211_ie_build_he_6ghz_cap(sdata, smps_mode, skb); 724 723 } 725 724 726 725 static void ieee80211_add_eht_ie(struct ieee80211_sub_if_data *sdata, ··· 747 746 eht_cap_size = 748 747 2 + 1 + sizeof(eht_cap->eht_cap_elem) + 749 748 ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, 750 - &eht_cap->eht_cap_elem) + 749 + &eht_cap->eht_cap_elem, 750 + false) + 751 751 ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], 752 752 eht_cap->eht_cap_elem.phy_cap_info); 753 753 pos = skb_put(skb, eht_cap_size); 754 - ieee80211_ie_build_eht_cap(pos, he_cap, eht_cap, pos + eht_cap_size); 754 + ieee80211_ie_build_eht_cap(pos, he_cap, eht_cap, pos + eht_cap_size, 755 + false); 755 756 } 756 757 757 758 static void ieee80211_assoc_add_rates(struct sk_buff *skb, ··· 1101 1098 offset); 1102 1099 1103 1100 if (!(assoc_data->link[link_id].conn_flags & IEEE80211_CONN_DISABLE_HE)) { 1104 - ieee80211_add_he_ie(sdata, skb, sband, 1101 + ieee80211_add_he_ie(sdata, skb, sband, smps_mode, 1105 1102 assoc_data->link[link_id].conn_flags); 1106 1103 ADD_PRESENT_EXT_ELEM(WLAN_EID_EXT_HE_CAPABILITY); 1107 1104 } ··· 1223 1220 ml_elem = skb_put(skb, sizeof(*ml_elem)); 1224 1221 ml_elem->control = 1225 1222 cpu_to_le16(IEEE80211_ML_CONTROL_TYPE_BASIC | 1226 - IEEE80211_MLC_BASIC_PRES_EML_CAPA | 1227 1223 IEEE80211_MLC_BASIC_PRES_MLD_CAPA_OP); 1228 1224 common = skb_put(skb, sizeof(*common)); 1229 1225 common->len = sizeof(*common) + 1230 - 2 + /* EML capabilities */ 1231 1226 2; /* MLD capa/ops */ 1232 1227 memcpy(common->mld_mac_addr, sdata->vif.addr, ETH_ALEN); 1233 - skb_put_data(skb, &eml_capa, sizeof(eml_capa)); 1228 + 1229 + /* add EML_CAPA only if needed, see Draft P802.11be_D2.1, 35.3.17 */ 1230 + if (eml_capa & 1231 + cpu_to_le16((IEEE80211_EML_CAP_EMLSR_SUPP | 1232 + IEEE80211_EML_CAP_EMLMR_SUPPORT))) { 1233 + common->len += 2; /* EML capabilities */ 1234 + ml_elem->control |= 1235 + cpu_to_le16(IEEE80211_MLC_BASIC_PRES_EML_CAPA); 1236 + skb_put_data(skb, &eml_capa, sizeof(eml_capa)); 1237 + } 1234 1238 /* need indication from userspace to support this */ 1235 1239 mld_capa_ops &= ~cpu_to_le16(IEEE80211_MLD_CAP_OP_TID_TO_LINK_MAP_NEG_SUPP); 1236 1240 skb_put_data(skb, &mld_capa_ops, sizeof(mld_capa_ops)); ··· 1912 1902 IEEE80211_QUEUE_STOP_REASON_CSA); 1913 1903 mutex_unlock(&local->mtx); 1914 1904 1915 - cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef, 1905 + cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef, 0, 1916 1906 csa_ie.count, csa_ie.mode); 1917 1907 1918 1908 if (local->ops->channel_switch) { ··· 3915 3905 .len = elem_len, 3916 3906 .bss = cbss, 3917 3907 .link_id = link == &sdata->deflink ? -1 : link->link_id, 3908 + .from_ap = true, 3918 3909 }; 3919 3910 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; 3920 3911 bool is_s1g = cbss->channel->band == NL80211_BAND_S1GHZ; ··· 4584 4573 bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ; 4585 4574 bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ; 4586 4575 struct ieee80211_bss *bss = (void *)cbss->priv; 4576 + struct ieee80211_elems_parse_params parse_params = { 4577 + .bss = cbss, 4578 + .link_id = -1, 4579 + .from_ap = true, 4580 + }; 4587 4581 struct ieee802_11_elems *elems; 4588 4582 const struct cfg80211_bss_ies *ies; 4589 4583 int ret; ··· 4598 4582 rcu_read_lock(); 4599 4583 4600 4584 ies = rcu_dereference(cbss->ies); 4601 - elems = ieee802_11_parse_elems(ies->data, ies->len, false, cbss); 4585 + parse_params.start = ies->data; 4586 + parse_params.len = ies->len; 4587 + elems = ieee802_11_parse_elems_full(&parse_params); 4602 4588 if (!elems) { 4603 4589 rcu_read_unlock(); 4604 4590 return -ENOMEM; ··· 4955 4937 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 4956 4938 struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; 4957 4939 u16 capab_info, status_code, aid; 4940 + struct ieee80211_elems_parse_params parse_params = { 4941 + .bss = NULL, 4942 + .link_id = -1, 4943 + .from_ap = true, 4944 + }; 4958 4945 struct ieee802_11_elems *elems; 4959 4946 int ac; 4960 4947 const u8 *elem_start; ··· 5014 4991 return; 5015 4992 5016 4993 elem_len = len - (elem_start - (u8 *)mgmt); 5017 - elems = ieee802_11_parse_elems(elem_start, elem_len, false, NULL); 4994 + parse_params.start = elem_start; 4995 + parse_params.len = elem_len; 4996 + elems = ieee802_11_parse_elems_full(&parse_params); 5018 4997 if (!elems) 5019 4998 goto notify_driver; 5020 4999 ··· 5149 5124 resp.req_ies = ifmgd->assoc_req_ies; 5150 5125 resp.req_ies_len = ifmgd->assoc_req_ies_len; 5151 5126 if (sdata->vif.valid_links) 5152 - resp.ap_mld_addr = assoc_data->ap_addr; 5127 + resp.ap_mld_addr = sdata->vif.cfg.ap_addr; 5153 5128 cfg80211_rx_assoc_resp(sdata->dev, &resp); 5154 5129 notify_driver: 5155 5130 drv_mgd_complete_tx(sdata->local, sdata, &info); ··· 5381 5356 u32 ncrc = 0; 5382 5357 u8 *bssid, *variable = mgmt->u.beacon.variable; 5383 5358 u8 deauth_buf[IEEE80211_DEAUTH_FRAME_LEN]; 5359 + struct ieee80211_elems_parse_params parse_params = { 5360 + .link_id = -1, 5361 + .from_ap = true, 5362 + }; 5384 5363 5385 5364 sdata_assert_lock(sdata); 5386 5365 ··· 5402 5373 baselen = (u8 *) variable - (u8 *) mgmt; 5403 5374 if (baselen > len) 5404 5375 return; 5376 + 5377 + parse_params.start = variable; 5378 + parse_params.len = len - baselen; 5405 5379 5406 5380 rcu_read_lock(); 5407 5381 chanctx_conf = rcu_dereference(link->conf->chanctx_conf); ··· 5424 5392 if (ifmgd->assoc_data && ifmgd->assoc_data->need_beacon && 5425 5393 !WARN_ON(sdata->vif.valid_links) && 5426 5394 ieee80211_rx_our_beacon(bssid, ifmgd->assoc_data->link[0].bss)) { 5427 - elems = ieee802_11_parse_elems(variable, len - baselen, false, 5428 - ifmgd->assoc_data->link[0].bss); 5395 + parse_params.bss = ifmgd->assoc_data->link[0].bss; 5396 + elems = ieee802_11_parse_elems_full(&parse_params); 5429 5397 if (!elems) 5430 5398 return; 5431 5399 ··· 5491 5459 */ 5492 5460 if (!ieee80211_is_s1g_beacon(hdr->frame_control)) 5493 5461 ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); 5494 - elems = ieee802_11_parse_elems_crc(variable, len - baselen, 5495 - false, care_about_ies, ncrc, 5496 - link->u.mgd.bss); 5462 + parse_params.bss = link->u.mgd.bss; 5463 + parse_params.filter = care_about_ies; 5464 + parse_params.crc = ncrc; 5465 + elems = ieee802_11_parse_elems_full(&parse_params); 5497 5466 if (!elems) 5498 5467 return; 5499 5468 ncrc = elems->crc; ··· 5704 5671 5705 5672 sdata_lock(sdata); 5706 5673 5674 + if (rx_status->link_valid) { 5675 + link = sdata_dereference(sdata->link[rx_status->link_id], 5676 + sdata); 5677 + if (!link) 5678 + goto out; 5679 + } 5680 + 5707 5681 switch (fc & IEEE80211_FCTL_STYPE) { 5708 5682 case IEEE80211_STYPE_BEACON: 5709 5683 ieee80211_rx_mgmt_beacon(link, (void *)mgmt, ··· 5787 5747 } 5788 5748 break; 5789 5749 } 5750 + out: 5790 5751 sdata_unlock(sdata); 5791 5752 } 5792 5753
+168 -32
net/mac80211/rx.c
··· 215 215 } 216 216 217 217 static void __ieee80211_queue_skb_to_iface(struct ieee80211_sub_if_data *sdata, 218 + int link_id, 218 219 struct sta_info *sta, 219 220 struct sk_buff *skb) 220 221 { 222 + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 223 + 224 + if (link_id >= 0) { 225 + status->link_valid = 1; 226 + status->link_id = link_id; 227 + } else { 228 + status->link_valid = 0; 229 + } 230 + 221 231 skb_queue_tail(&sdata->skb_queue, skb); 222 232 ieee80211_queue_work(&sdata->local->hw, &sdata->work); 223 233 if (sta) ··· 235 225 } 236 226 237 227 static void ieee80211_queue_skb_to_iface(struct ieee80211_sub_if_data *sdata, 228 + int link_id, 238 229 struct sta_info *sta, 239 230 struct sk_buff *skb) 240 231 { 241 232 skb->protocol = 0; 242 - __ieee80211_queue_skb_to_iface(sdata, sta, skb); 233 + __ieee80211_queue_skb_to_iface(sdata, link_id, sta, skb); 243 234 } 244 235 245 236 static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata, ··· 283 272 if (!skb) 284 273 return; 285 274 286 - ieee80211_queue_skb_to_iface(sdata, NULL, skb); 275 + ieee80211_queue_skb_to_iface(sdata, -1, NULL, skb); 287 276 } 288 277 289 278 /* ··· 1405 1394 /* if this mpdu is fragmented - terminate rx aggregation session */ 1406 1395 sc = le16_to_cpu(hdr->seq_ctrl); 1407 1396 if (sc & IEEE80211_SCTL_FRAG) { 1408 - ieee80211_queue_skb_to_iface(rx->sdata, NULL, skb); 1397 + ieee80211_queue_skb_to_iface(rx->sdata, rx->link_id, NULL, skb); 1409 1398 return; 1410 1399 } 1411 1400 ··· 1865 1854 ieee80211_rx_get_bigtk(struct ieee80211_rx_data *rx, int idx) 1866 1855 { 1867 1856 struct ieee80211_key *key = NULL; 1868 - struct ieee80211_sub_if_data *sdata = rx->sdata; 1869 1857 int idx2; 1870 1858 1871 1859 /* Make sure key gets set if either BIGTK key index is set so that ··· 1883 1873 idx2 = idx - 1; 1884 1874 } 1885 1875 1886 - if (rx->sta) 1887 - key = rcu_dereference(rx->sta->deflink.gtk[idx]); 1876 + if (rx->link_sta) 1877 + key = rcu_dereference(rx->link_sta->gtk[idx]); 1888 1878 if (!key) 1889 - key = rcu_dereference(sdata->deflink.gtk[idx]); 1890 - if (!key && rx->sta) 1891 - key = rcu_dereference(rx->sta->deflink.gtk[idx2]); 1879 + key = rcu_dereference(rx->link->gtk[idx]); 1880 + if (!key && rx->link_sta) 1881 + key = rcu_dereference(rx->link_sta->gtk[idx2]); 1892 1882 if (!key) 1893 - key = rcu_dereference(sdata->deflink.gtk[idx2]); 1883 + key = rcu_dereference(rx->link->gtk[idx2]); 1894 1884 1895 1885 return key; 1896 1886 } ··· 1996 1986 if (mmie_keyidx < NUM_DEFAULT_KEYS || 1997 1987 mmie_keyidx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) 1998 1988 return RX_DROP_MONITOR; /* unexpected BIP keyidx */ 1999 - if (rx->sta) { 1989 + if (rx->link_sta) { 2000 1990 if (ieee80211_is_group_privacy_action(skb) && 2001 1991 test_sta_flag(rx->sta, WLAN_STA_MFP)) 2002 1992 return RX_DROP_MONITOR; 2003 1993 2004 - rx->key = rcu_dereference(rx->sta->deflink.gtk[mmie_keyidx]); 1994 + rx->key = rcu_dereference(rx->link_sta->gtk[mmie_keyidx]); 2005 1995 } 2006 1996 if (!rx->key) 2007 - rx->key = rcu_dereference(rx->sdata->deflink.gtk[mmie_keyidx]); 1997 + rx->key = rcu_dereference(rx->link->gtk[mmie_keyidx]); 2008 1998 } else if (!ieee80211_has_protected(fc)) { 2009 1999 /* 2010 2000 * The frame was not protected, so skip decryption. However, we ··· 2013 2003 * have been expected. 2014 2004 */ 2015 2005 struct ieee80211_key *key = NULL; 2016 - struct ieee80211_sub_if_data *sdata = rx->sdata; 2017 2006 int i; 2018 2007 2019 2008 if (ieee80211_is_beacon(fc)) { 2020 2009 key = ieee80211_rx_get_bigtk(rx, -1); 2021 2010 } else if (ieee80211_is_mgmt(fc) && 2022 2011 is_multicast_ether_addr(hdr->addr1)) { 2023 - key = rcu_dereference(rx->sdata->deflink.default_mgmt_key); 2012 + key = rcu_dereference(rx->link->default_mgmt_key); 2024 2013 } else { 2025 - if (rx->sta) { 2014 + if (rx->link_sta) { 2026 2015 for (i = 0; i < NUM_DEFAULT_KEYS; i++) { 2027 - key = rcu_dereference(rx->sta->deflink.gtk[i]); 2016 + key = rcu_dereference(rx->link_sta->gtk[i]); 2028 2017 if (key) 2029 2018 break; 2030 2019 } 2031 2020 } 2032 2021 if (!key) { 2033 2022 for (i = 0; i < NUM_DEFAULT_KEYS; i++) { 2034 - key = rcu_dereference(sdata->deflink.gtk[i]); 2023 + key = rcu_dereference(rx->link->gtk[i]); 2035 2024 if (key) 2036 2025 break; 2037 2026 } ··· 2059 2050 return RX_DROP_UNUSABLE; 2060 2051 2061 2052 /* check per-station GTK first, if multicast packet */ 2062 - if (is_multicast_ether_addr(hdr->addr1) && rx->sta) 2063 - rx->key = rcu_dereference(rx->sta->deflink.gtk[keyidx]); 2053 + if (is_multicast_ether_addr(hdr->addr1) && rx->link_sta) 2054 + rx->key = rcu_dereference(rx->link_sta->gtk[keyidx]); 2064 2055 2065 2056 /* if not found, try default key */ 2066 2057 if (!rx->key) { 2067 2058 if (is_multicast_ether_addr(hdr->addr1)) 2068 - rx->key = rcu_dereference(rx->sdata->deflink.gtk[keyidx]); 2059 + rx->key = rcu_dereference(rx->link->gtk[keyidx]); 2069 2060 if (!rx->key) 2070 2061 rx->key = rcu_dereference(rx->sdata->keys[keyidx]); 2071 2062 ··· 3055 3046 (tf->action_code == WLAN_TDLS_CHANNEL_SWITCH_REQUEST || 3056 3047 tf->action_code == WLAN_TDLS_CHANNEL_SWITCH_RESPONSE)) { 3057 3048 rx->skb->protocol = cpu_to_be16(ETH_P_TDLS); 3058 - __ieee80211_queue_skb_to_iface(sdata, rx->sta, rx->skb); 3049 + __ieee80211_queue_skb_to_iface(sdata, rx->link_id, 3050 + rx->sta, rx->skb); 3059 3051 return RX_QUEUED; 3060 3052 } 3061 3053 } ··· 3646 3636 return RX_QUEUED; 3647 3637 3648 3638 queue: 3649 - ieee80211_queue_skb_to_iface(sdata, rx->sta, rx->skb); 3639 + ieee80211_queue_skb_to_iface(sdata, rx->link_id, rx->sta, rx->skb); 3650 3640 return RX_QUEUED; 3651 3641 } 3652 3642 ··· 3804 3794 return RX_DROP_MONITOR; 3805 3795 3806 3796 /* for now only beacons are ext, so queue them */ 3807 - ieee80211_queue_skb_to_iface(sdata, rx->sta, rx->skb); 3797 + ieee80211_queue_skb_to_iface(sdata, rx->link_id, rx->sta, rx->skb); 3808 3798 3809 3799 return RX_QUEUED; 3810 3800 } ··· 3861 3851 return RX_DROP_MONITOR; 3862 3852 } 3863 3853 3864 - ieee80211_queue_skb_to_iface(sdata, rx->sta, rx->skb); 3854 + ieee80211_queue_skb_to_iface(sdata, rx->link_id, rx->sta, rx->skb); 3865 3855 3866 3856 return RX_QUEUED; 3867 3857 } ··· 4518 4508 mutex_unlock(&local->sta_mtx); 4519 4509 } 4520 4510 4511 + static bool 4512 + ieee80211_rx_is_valid_sta_link_id(struct ieee80211_sta *sta, u8 link_id) 4513 + { 4514 + if (!sta->mlo) 4515 + return false; 4516 + 4517 + return !!(sta->valid_links & BIT(link_id)); 4518 + } 4519 + 4521 4520 static void ieee80211_rx_8023(struct ieee80211_rx_data *rx, 4522 4521 struct ieee80211_fast_rx *fast_rx, 4523 4522 int orig_len) ··· 4534 4515 struct ieee80211_sta_rx_stats *stats; 4535 4516 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); 4536 4517 struct sta_info *sta = rx->sta; 4518 + struct link_sta_info *link_sta; 4537 4519 struct sk_buff *skb = rx->skb; 4538 4520 void *sa = skb->data + ETH_ALEN; 4539 4521 void *da = skb->data; 4540 4522 4541 - stats = &sta->deflink.rx_stats; 4523 + if (rx->link_id >= 0) { 4524 + link_sta = rcu_dereference(sta->link[rx->link_id]); 4525 + if (WARN_ON_ONCE(!link_sta)) { 4526 + dev_kfree_skb(rx->skb); 4527 + return; 4528 + } 4529 + } else { 4530 + link_sta = &sta->deflink; 4531 + } 4532 + 4533 + stats = &link_sta->rx_stats; 4542 4534 if (fast_rx->uses_rss) 4543 - stats = this_cpu_ptr(sta->deflink.pcpu_rx_stats); 4535 + stats = this_cpu_ptr(link_sta->pcpu_rx_stats); 4544 4536 4545 4537 /* statistics part of ieee80211_rx_h_sta_process() */ 4546 4538 if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { 4547 4539 stats->last_signal = status->signal; 4548 4540 if (!fast_rx->uses_rss) 4549 - ewma_signal_add(&sta->deflink.rx_stats_avg.signal, 4541 + ewma_signal_add(&link_sta->rx_stats_avg.signal, 4550 4542 -status->signal); 4551 4543 } 4552 4544 ··· 4573 4543 4574 4544 stats->chain_signal_last[i] = signal; 4575 4545 if (!fast_rx->uses_rss) 4576 - ewma_signal_add(&sta->deflink.rx_stats_avg.chain_signal[i], 4546 + ewma_signal_add(&link_sta->rx_stats_avg.chain_signal[i], 4577 4547 -signal); 4578 4548 } 4579 4549 } ··· 4649 4619 u8 da[ETH_ALEN]; 4650 4620 u8 sa[ETH_ALEN]; 4651 4621 } addrs __aligned(2); 4652 - struct ieee80211_sta_rx_stats *stats = &sta->deflink.rx_stats; 4622 + struct link_sta_info *link_sta; 4623 + struct ieee80211_sta_rx_stats *stats; 4653 4624 4654 4625 /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write 4655 4626 * to a common data structure; drivers can implement that per queue ··· 4751 4720 return true; 4752 4721 drop: 4753 4722 dev_kfree_skb(skb); 4723 + 4724 + if (rx->link_id >= 0) { 4725 + link_sta = rcu_dereference(sta->link[rx->link_id]); 4726 + if (!link_sta) 4727 + return true; 4728 + } else { 4729 + link_sta = &sta->deflink; 4730 + } 4731 + 4754 4732 if (fast_rx->uses_rss) 4755 - stats = this_cpu_ptr(sta->deflink.pcpu_rx_stats); 4733 + stats = this_cpu_ptr(link_sta->pcpu_rx_stats); 4734 + else 4735 + stats = &link_sta->rx_stats; 4756 4736 4757 4737 stats->dropped++; 4758 4738 return true; ··· 4811 4769 if (!link) 4812 4770 return true; 4813 4771 rx->link = link; 4772 + 4773 + if (rx->sta) { 4774 + rx->link_sta = 4775 + rcu_dereference(rx->sta->link[rx->link_id]); 4776 + if (!rx->link_sta) 4777 + return true; 4778 + } 4814 4779 } else { 4780 + if (rx->sta) 4781 + rx->link_sta = &rx->sta->deflink; 4782 + 4815 4783 rx->link = &sdata->deflink; 4816 4784 } 4817 4785 ··· 4879 4827 struct list_head *list) 4880 4828 { 4881 4829 struct ieee80211_local *local = hw_to_local(hw); 4830 + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 4882 4831 struct ieee80211_fast_rx *fast_rx; 4883 4832 struct ieee80211_rx_data rx; 4884 4833 ··· 4900 4847 4901 4848 rx.sta = container_of(pubsta, struct sta_info, sta); 4902 4849 rx.sdata = rx.sta->sdata; 4903 - rx.link = &rx.sdata->deflink; 4850 + 4851 + if (status->link_valid && 4852 + !ieee80211_rx_is_valid_sta_link_id(pubsta, status->link_id)) 4853 + goto drop; 4854 + 4855 + /* 4856 + * TODO: Should the frame be dropped if the right link_id is not 4857 + * available? Or may be it is fine in the current form to proceed with 4858 + * the frame processing because with frame being in 802.3 format, 4859 + * link_id is used only for stats purpose and updating the stats on 4860 + * the deflink is fine? 4861 + */ 4862 + if (status->link_valid) 4863 + rx.link_id = status->link_id; 4864 + 4865 + if (rx.link_id >= 0) { 4866 + struct ieee80211_link_data *link; 4867 + 4868 + link = rcu_dereference(rx.sdata->link[rx.link_id]); 4869 + if (!link) 4870 + goto drop; 4871 + rx.link = link; 4872 + } else { 4873 + rx.link = &rx.sdata->deflink; 4874 + } 4904 4875 4905 4876 fast_rx = rcu_dereference(rx.sta->fast_rx); 4906 4877 if (!fast_rx) ··· 4954 4877 rx->sta = link_sta->sta; 4955 4878 rx->link_id = link_sta->link_id; 4956 4879 } else { 4880 + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 4881 + 4957 4882 rx->sta = sta_info_get_bss(rx->sdata, hdr->addr2); 4883 + if (rx->sta) { 4884 + if (status->link_valid && 4885 + !ieee80211_rx_is_valid_sta_link_id(&rx->sta->sta, 4886 + status->link_id)) 4887 + return false; 4888 + 4889 + rx->link_id = status->link_valid ? status->link_id : -1; 4890 + } else { 4891 + rx->link_id = -1; 4892 + } 4958 4893 } 4959 4894 4960 4895 return ieee80211_prepare_and_rx_handle(rx, skb, consume); ··· 4982 4893 struct list_head *list) 4983 4894 { 4984 4895 struct ieee80211_local *local = hw_to_local(hw); 4896 + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 4985 4897 struct ieee80211_sub_if_data *sdata; 4986 4898 struct ieee80211_hdr *hdr; 4987 4899 __le16 fc; ··· 5027 4937 5028 4938 if (ieee80211_is_data(fc)) { 5029 4939 struct sta_info *sta, *prev_sta; 4940 + u8 link_id = status->link_id; 5030 4941 5031 4942 if (pubsta) { 5032 4943 rx.sta = container_of(pubsta, struct sta_info, sta); 5033 4944 rx.sdata = rx.sta->sdata; 4945 + 4946 + if (status->link_valid && 4947 + !ieee80211_rx_is_valid_sta_link_id(pubsta, link_id)) 4948 + goto out; 4949 + 4950 + if (status->link_valid) 4951 + rx.link_id = status->link_id; 4952 + 4953 + /* 4954 + * In MLO connection, fetch the link_id using addr2 4955 + * when the driver does not pass link_id in status. 4956 + * When the address translation is already performed by 4957 + * driver/hw, the valid link_id must be passed in 4958 + * status. 4959 + */ 4960 + 4961 + if (!status->link_valid && pubsta->mlo) { 4962 + struct ieee80211_hdr *hdr = (void *)skb->data; 4963 + struct link_sta_info *link_sta; 4964 + 4965 + link_sta = link_sta_info_get_bss(rx.sdata, 4966 + hdr->addr2); 4967 + if (!link_sta) 4968 + goto out; 4969 + 4970 + rx.link_id = link_sta->link_id; 4971 + } 4972 + 5034 4973 if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) 5035 4974 return; 5036 4975 goto out; ··· 5073 4954 continue; 5074 4955 } 5075 4956 4957 + if ((status->link_valid && 4958 + !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta, 4959 + link_id)) || 4960 + (!status->link_valid && prev_sta->sta.mlo)) 4961 + continue; 4962 + 4963 + rx.link_id = status->link_valid ? link_id : -1; 5076 4964 rx.sta = prev_sta; 5077 4965 rx.sdata = prev_sta->sdata; 5078 4966 ieee80211_prepare_and_rx_handle(&rx, skb, false); ··· 5088 4962 } 5089 4963 5090 4964 if (prev_sta) { 4965 + if ((status->link_valid && 4966 + !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta, 4967 + link_id)) || 4968 + (!status->link_valid && prev_sta->sta.mlo)) 4969 + goto out; 4970 + 4971 + rx.link_id = status->link_valid ? link_id : -1; 5091 4972 rx.sta = prev_sta; 5092 4973 rx.sdata = prev_sta->sdata; 5093 4974 ··· 5236 5103 rate = &sband->bitrates[status->rate_idx]; 5237 5104 } 5238 5105 } 5106 + 5107 + if (WARN_ON_ONCE(status->link_id >= IEEE80211_LINK_UNSPECIFIED)) 5108 + goto drop; 5239 5109 5240 5110 status->rx_flags = 0; 5241 5111
+4 -5
net/mac80211/sta_info.c
··· 472 472 link_info->sta = sta; 473 473 link_info->link_id = link_id; 474 474 link_info->pub = link_sta; 475 + link_sta->link_id = link_id; 475 476 rcu_assign_pointer(sta->link[link_id], link_info); 476 477 rcu_assign_pointer(sta->sta.link[link_id], link_sta); 477 478 } ··· 2778 2777 2779 2778 sta->sta.valid_links = new_links; 2780 2779 2781 - if (!test_sta_flag(sta, WLAN_STA_INSERTED)) { 2782 - ret = 0; 2780 + if (!test_sta_flag(sta, WLAN_STA_INSERTED)) 2783 2781 goto hash; 2784 - } 2785 2782 2786 2783 ret = drv_change_sta_links(sdata->local, sdata, &sta->sta, 2787 2784 old_links, new_links); ··· 2798 2799 void ieee80211_sta_remove_link(struct sta_info *sta, unsigned int link_id) 2799 2800 { 2800 2801 struct ieee80211_sub_if_data *sdata = sta->sdata; 2802 + u16 old_links = sta->sta.valid_links; 2801 2803 2802 2804 lockdep_assert_held(&sdata->local->sta_mtx); 2803 2805 ··· 2806 2806 2807 2807 if (test_sta_flag(sta, WLAN_STA_INSERTED)) 2808 2808 drv_change_sta_links(sdata->local, sdata, &sta->sta, 2809 - sta->sta.valid_links, 2810 - sta->sta.valid_links & ~BIT(link_id)); 2809 + old_links, sta->sta.valid_links); 2811 2810 2812 2811 sta_remove_link(sta, link_id, true); 2813 2812 }
+52 -13
net/mac80211/tx.c
··· 576 576 return TX_CONTINUE; 577 577 } 578 578 579 + static struct ieee80211_key * 580 + ieee80211_select_link_key(struct ieee80211_tx_data *tx) 581 + { 582 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 583 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 584 + enum { 585 + USE_NONE, 586 + USE_MGMT_KEY, 587 + USE_MCAST_KEY, 588 + } which_key = USE_NONE; 589 + struct ieee80211_link_data *link; 590 + unsigned int link_id; 591 + 592 + if (ieee80211_is_group_privacy_action(tx->skb)) 593 + which_key = USE_MCAST_KEY; 594 + else if (ieee80211_is_mgmt(hdr->frame_control) && 595 + is_multicast_ether_addr(hdr->addr1) && 596 + ieee80211_is_robust_mgmt_frame(tx->skb)) 597 + which_key = USE_MGMT_KEY; 598 + else if (is_multicast_ether_addr(hdr->addr1)) 599 + which_key = USE_MCAST_KEY; 600 + else 601 + return NULL; 602 + 603 + link_id = u32_get_bits(info->control.flags, IEEE80211_TX_CTRL_MLO_LINK); 604 + if (link_id == IEEE80211_LINK_UNSPECIFIED) { 605 + link = &tx->sdata->deflink; 606 + } else { 607 + link = rcu_dereference(tx->sdata->link[link_id]); 608 + if (!link) 609 + return NULL; 610 + } 611 + 612 + switch (which_key) { 613 + case USE_NONE: 614 + break; 615 + case USE_MGMT_KEY: 616 + return rcu_dereference(link->default_mgmt_key); 617 + case USE_MCAST_KEY: 618 + return rcu_dereference(link->default_multicast_key); 619 + } 620 + 621 + return NULL; 622 + } 623 + 579 624 static ieee80211_tx_result debug_noinline 580 625 ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) 581 626 { ··· 636 591 if (tx->sta && 637 592 (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx]))) 638 593 tx->key = key; 639 - else if (ieee80211_is_group_privacy_action(tx->skb) && 640 - (key = rcu_dereference(tx->sdata->deflink.default_multicast_key))) 641 - tx->key = key; 642 - else if (ieee80211_is_mgmt(hdr->frame_control) && 643 - is_multicast_ether_addr(hdr->addr1) && 644 - ieee80211_is_robust_mgmt_frame(tx->skb) && 645 - (key = rcu_dereference(tx->sdata->deflink.default_mgmt_key))) 646 - tx->key = key; 647 - else if (is_multicast_ether_addr(hdr->addr1) && 648 - (key = rcu_dereference(tx->sdata->deflink.default_multicast_key))) 594 + else if ((key = ieee80211_select_link_key(tx))) 649 595 tx->key = key; 650 596 else if (!is_multicast_ether_addr(hdr->addr1) && 651 597 (key = rcu_dereference(tx->sdata->default_unicast_key))) ··· 2676 2640 goto free; 2677 2641 } 2678 2642 memcpy(hdr.addr2, link->conf->addr, ETH_ALEN); 2679 - } else if (link_id == IEEE80211_LINK_UNSPECIFIED) { 2643 + } else if (link_id == IEEE80211_LINK_UNSPECIFIED || 2644 + (sta && sta->sta.mlo)) { 2680 2645 memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); 2681 2646 } else { 2682 2647 struct ieee80211_bss_conf *conf; ··· 3772 3735 !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) && 3773 3736 (!(info->control.flags & 3774 3737 IEEE80211_TX_CTRL_PORT_CTRL_PROTO) || 3775 - !ether_addr_equal(tx.sdata->vif.addr, 3776 - hdr->addr2)))) { 3738 + !ieee80211_is_our_addr(tx.sdata, hdr->addr2, 3739 + NULL)))) { 3777 3740 I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); 3778 3741 ieee80211_free_txskb(&local->hw, skb); 3779 3742 goto begin; ··· 5098 5061 rate_control_get_rate(sdata, NULL, &txrc); 5099 5062 5100 5063 info->control.vif = vif; 5064 + info->control.flags |= u32_encode_bits(link->link_id, 5065 + IEEE80211_TX_CTRL_MLO_LINK); 5101 5066 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT | 5102 5067 IEEE80211_TX_CTL_ASSIGN_SEQ | 5103 5068 IEEE80211_TX_CTL_FIRST_FRAGMENT;
+22 -10
net/mac80211/util.c
··· 954 954 } 955 955 EXPORT_SYMBOL(ieee80211_queue_delayed_work); 956 956 957 - static void ieee80211_parse_extension_element(u32 *crc, 958 - const struct element *elem, 959 - struct ieee802_11_elems *elems) 957 + static void 958 + ieee80211_parse_extension_element(u32 *crc, 959 + const struct element *elem, 960 + struct ieee802_11_elems *elems, 961 + struct ieee80211_elems_parse_params *params) 960 962 { 961 963 const void *data = elem->data + 1; 962 964 u8 len; ··· 1015 1013 break; 1016 1014 case WLAN_EID_EXT_EHT_CAPABILITY: 1017 1015 if (ieee80211_eht_capa_size_ok(elems->he_cap, 1018 - data, len)) { 1016 + data, len, 1017 + params->from_ap)) { 1019 1018 elems->eht_cap = data; 1020 1019 elems->eht_cap_len = len; 1021 1020 } ··· 1388 1385 case WLAN_EID_EXTENSION: 1389 1386 ieee80211_parse_extension_element(calc_crc ? 1390 1387 &crc : NULL, 1391 - elem, elems); 1388 + elem, elems, params); 1392 1389 break; 1393 1390 case WLAN_EID_S1G_CAPABILITIES: 1394 1391 if (elen >= sizeof(*elems->s1g_capab)) ··· 2028 2025 cfg80211_any_usable_channels(local->hw.wiphy, BIT(sband->band), 2029 2026 IEEE80211_CHAN_NO_HE | 2030 2027 IEEE80211_CHAN_NO_EHT)) { 2031 - pos = ieee80211_ie_build_eht_cap(pos, he_cap, eht_cap, end); 2028 + pos = ieee80211_ie_build_eht_cap(pos, he_cap, eht_cap, end, 2029 + sdata->vif.type == NL80211_IFTYPE_AP); 2032 2030 if (!pos) 2033 2031 goto out_err; 2034 2032 } ··· 3084 3080 } 3085 3081 3086 3082 void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata, 3083 + enum ieee80211_smps_mode smps_mode, 3087 3084 struct sk_buff *skb) 3088 3085 { 3089 3086 struct ieee80211_supported_band *sband; ··· 3111 3106 cap = le16_to_cpu(iftd->he_6ghz_capa.capa); 3112 3107 cap &= ~IEEE80211_HE_6GHZ_CAP_SM_PS; 3113 3108 3114 - switch (sdata->deflink.smps_mode) { 3109 + switch (smps_mode) { 3115 3110 case IEEE80211_SMPS_AUTOMATIC: 3116 3111 case IEEE80211_SMPS_NUM_MODES: 3117 3112 WARN_ON(1); ··· 4775 4770 const struct ieee80211_sta_he_cap *he_cap; 4776 4771 const struct ieee80211_sta_eht_cap *eht_cap; 4777 4772 struct ieee80211_supported_band *sband; 4773 + bool is_ap; 4778 4774 u8 n; 4779 4775 4780 4776 sband = ieee80211_get_sband(sdata); ··· 4787 4781 if (!he_cap || !eht_cap) 4788 4782 return 0; 4789 4783 4784 + is_ap = iftype == NL80211_IFTYPE_AP || 4785 + iftype == NL80211_IFTYPE_P2P_GO; 4786 + 4790 4787 n = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, 4791 - &eht_cap->eht_cap_elem); 4788 + &eht_cap->eht_cap_elem, 4789 + is_ap); 4792 4790 return 2 + 1 + 4793 4791 sizeof(he_cap->he_cap_elem) + n + 4794 4792 ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], ··· 4803 4793 u8 *ieee80211_ie_build_eht_cap(u8 *pos, 4804 4794 const struct ieee80211_sta_he_cap *he_cap, 4805 4795 const struct ieee80211_sta_eht_cap *eht_cap, 4806 - u8 *end) 4796 + u8 *end, 4797 + bool for_ap) 4807 4798 { 4808 4799 u8 mcs_nss_len, ppet_len; 4809 4800 u8 ie_len; ··· 4815 4804 return orig_pos; 4816 4805 4817 4806 mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, 4818 - &eht_cap->eht_cap_elem); 4807 + &eht_cap->eht_cap_elem, 4808 + for_ap); 4819 4809 ppet_len = ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], 4820 4810 eht_cap->eht_cap_elem.phy_cap_info); 4821 4811
+16
net/wireless/core.c
··· 860 860 861 861 for (i = 0; i < sband->n_iftype_data; i++) { 862 862 const struct ieee80211_sband_iftype_data *iftd; 863 + bool has_ap, has_non_ap; 864 + u32 ap_bits = BIT(NL80211_IFTYPE_AP) | 865 + BIT(NL80211_IFTYPE_P2P_GO); 863 866 864 867 iftd = &sband->iftype_data[i]; 865 868 ··· 882 879 else 883 880 have_he = have_he && 884 881 iftd->he_cap.has_he; 882 + 883 + has_ap = iftd->types_mask & ap_bits; 884 + has_non_ap = iftd->types_mask & ~ap_bits; 885 + 886 + /* 887 + * For EHT 20 MHz STA, the capabilities format differs 888 + * but to simplify, don't check 20 MHz but rather check 889 + * only if AP and non-AP were mentioned at the same time, 890 + * reject if so. 891 + */ 892 + if (WARN_ON(iftd->eht_cap.has_eht && 893 + has_ap && has_non_ap)) 894 + return -EINVAL; 885 895 } 886 896 887 897 if (WARN_ON(!have_he && band == NL80211_BAND_6GHZ))
+1 -1
net/wireless/ibss.c
··· 171 171 */ 172 172 if (rdev->ops->del_key) 173 173 for (i = 0; i < 6; i++) 174 - rdev_del_key(rdev, dev, i, false, NULL); 174 + rdev_del_key(rdev, dev, -1, i, false, NULL); 175 175 176 176 if (wdev->u.ibss.current_bss) { 177 177 cfg80211_unhold_bss(wdev->u.ibss.current_bss);
+146 -40
net/wireless/nl80211.c
··· 1545 1545 return -ENOLINK; 1546 1546 case NL80211_IFTYPE_STATION: 1547 1547 case NL80211_IFTYPE_P2P_CLIENT: 1548 - /* for MLO, require driver validation of the link ID */ 1549 1548 if (wdev->connected) 1550 1549 return 0; 1551 1550 return -ENOLINK; ··· 1820 1821 if (eht_cap->has_eht && he_cap->has_he) { 1821 1822 u8 mcs_nss_size, ppe_thresh_size; 1822 1823 u16 ppe_thres_hdr; 1824 + bool is_ap; 1825 + 1826 + is_ap = iftdata->types_mask & BIT(NL80211_IFTYPE_AP) || 1827 + iftdata->types_mask & BIT(NL80211_IFTYPE_P2P_GO); 1823 1828 1824 1829 mcs_nss_size = 1825 1830 ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem, 1826 - &eht_cap->eht_cap_elem); 1831 + &eht_cap->eht_cap_elem, 1832 + is_ap); 1827 1833 1828 1834 ppe_thres_hdr = get_unaligned_le16(&eht_cap->eht_ppe_thres[0]); 1829 1835 ppe_thresh_size = ··· 3480 3476 if (result) 3481 3477 goto out; 3482 3478 3483 - result = rdev_set_txq_params(rdev, netdev, 3484 - &txq_params); 3479 + txq_params.link_id = 3480 + nl80211_link_id_or_invalid(info->attrs); 3481 + 3482 + wdev_lock(netdev->ieee80211_ptr); 3483 + if (txq_params.link_id >= 0 && 3484 + !(netdev->ieee80211_ptr->valid_links & 3485 + BIT(txq_params.link_id))) 3486 + result = -ENOLINK; 3487 + else if (txq_params.link_id >= 0 && 3488 + !netdev->ieee80211_ptr->valid_links) 3489 + result = -EINVAL; 3490 + else 3491 + result = rdev_set_txq_params(rdev, netdev, 3492 + &txq_params); 3493 + wdev_unlock(netdev->ieee80211_ptr); 3485 3494 if (result) 3486 3495 goto out; 3487 3496 } ··· 3865 3848 3866 3849 for_each_valid_link(wdev, link_id) { 3867 3850 struct nlattr *link = nla_nest_start(msg, link_id + 1); 3851 + struct cfg80211_chan_def chandef = {}; 3852 + int ret; 3868 3853 3869 3854 if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id)) 3870 3855 goto nla_put_failure; 3871 3856 if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, 3872 3857 wdev->links[link_id].addr)) 3873 3858 goto nla_put_failure; 3859 + 3860 + ret = rdev_get_channel(rdev, wdev, link_id, &chandef); 3861 + if (ret == 0 && nl80211_send_chandef(msg, &chandef)) 3862 + goto nla_put_failure; 3863 + 3874 3864 nla_nest_end(msg, link); 3875 3865 } 3876 3866 ··· 4344 4320 return rdev_set_noack_map(rdev, dev, noack_map); 4345 4321 } 4346 4322 4323 + static int nl80211_validate_key_link_id(struct genl_info *info, 4324 + struct wireless_dev *wdev, 4325 + int link_id, bool pairwise) 4326 + { 4327 + if (pairwise) { 4328 + if (link_id != -1) { 4329 + GENL_SET_ERR_MSG(info, 4330 + "link ID not allowed for pairwise key"); 4331 + return -EINVAL; 4332 + } 4333 + 4334 + return 0; 4335 + } 4336 + 4337 + if (wdev->valid_links) { 4338 + if (link_id == -1) { 4339 + GENL_SET_ERR_MSG(info, 4340 + "link ID must for MLO group key"); 4341 + return -EINVAL; 4342 + } 4343 + if (!(wdev->valid_links & BIT(link_id))) { 4344 + GENL_SET_ERR_MSG(info, "invalid link ID for MLO group key"); 4345 + return -EINVAL; 4346 + } 4347 + } else if (link_id != -1) { 4348 + GENL_SET_ERR_MSG(info, "link ID not allowed for non-MLO group key"); 4349 + return -EINVAL; 4350 + } 4351 + 4352 + return 0; 4353 + } 4354 + 4347 4355 struct get_key_cookie { 4348 4356 struct sk_buff *msg; 4349 4357 int error; ··· 4437 4381 void *hdr; 4438 4382 struct sk_buff *msg; 4439 4383 bool bigtk_support = false; 4384 + int link_id = nl80211_link_id_or_invalid(info->attrs); 4385 + struct wireless_dev *wdev = dev->ieee80211_ptr; 4440 4386 4441 4387 if (wiphy_ext_feature_isset(&rdev->wiphy, 4442 4388 NL80211_EXT_FEATURE_BEACON_PROTECTION)) 4443 4389 bigtk_support = true; 4444 4390 4445 - if ((dev->ieee80211_ptr->iftype == NL80211_IFTYPE_STATION || 4446 - dev->ieee80211_ptr->iftype == NL80211_IFTYPE_P2P_CLIENT) && 4391 + if ((wdev->iftype == NL80211_IFTYPE_STATION || 4392 + wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) && 4447 4393 wiphy_ext_feature_isset(&rdev->wiphy, 4448 4394 NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT)) 4449 4395 bigtk_support = true; ··· 4497 4439 nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr)) 4498 4440 goto nla_put_failure; 4499 4441 4500 - err = rdev_get_key(rdev, dev, key_idx, pairwise, mac_addr, &cookie, 4501 - get_key_callback); 4442 + err = nl80211_validate_key_link_id(info, wdev, link_id, pairwise); 4443 + if (err) 4444 + goto free_msg; 4445 + 4446 + err = rdev_get_key(rdev, dev, link_id, key_idx, pairwise, mac_addr, 4447 + &cookie, get_key_callback); 4502 4448 4503 4449 if (err) 4504 4450 goto free_msg; ··· 4526 4464 struct key_parse key; 4527 4465 int err; 4528 4466 struct net_device *dev = info->user_ptr[1]; 4467 + int link_id = nl80211_link_id_or_invalid(info->attrs); 4468 + struct wireless_dev *wdev = dev->ieee80211_ptr; 4529 4469 4530 4470 err = nl80211_parse_key(info, &key); 4531 4471 if (err) ··· 4543 4479 !(key.p.mode == NL80211_KEY_SET_TX)) 4544 4480 return -EINVAL; 4545 4481 4546 - wdev_lock(dev->ieee80211_ptr); 4482 + wdev_lock(wdev); 4547 4483 4548 4484 if (key.def) { 4549 4485 if (!rdev->ops->set_default_key) { ··· 4551 4487 goto out; 4552 4488 } 4553 4489 4554 - err = nl80211_key_allowed(dev->ieee80211_ptr); 4490 + err = nl80211_key_allowed(wdev); 4555 4491 if (err) 4556 4492 goto out; 4557 4493 4558 - err = rdev_set_default_key(rdev, dev, key.idx, 4559 - key.def_uni, key.def_multi); 4494 + err = nl80211_validate_key_link_id(info, wdev, link_id, false); 4495 + if (err) 4496 + goto out; 4497 + 4498 + err = rdev_set_default_key(rdev, dev, link_id, key.idx, 4499 + key.def_uni, key.def_multi); 4560 4500 4561 4501 if (err) 4562 4502 goto out; 4563 4503 4564 4504 #ifdef CONFIG_CFG80211_WEXT 4565 - dev->ieee80211_ptr->wext.default_key = key.idx; 4505 + wdev->wext.default_key = key.idx; 4566 4506 #endif 4567 4507 } else if (key.defmgmt) { 4568 4508 if (key.def_uni || !key.def_multi) { ··· 4579 4511 goto out; 4580 4512 } 4581 4513 4582 - err = nl80211_key_allowed(dev->ieee80211_ptr); 4514 + err = nl80211_key_allowed(wdev); 4583 4515 if (err) 4584 4516 goto out; 4585 4517 4586 - err = rdev_set_default_mgmt_key(rdev, dev, key.idx); 4518 + err = nl80211_validate_key_link_id(info, wdev, link_id, false); 4519 + if (err) 4520 + goto out; 4521 + 4522 + err = rdev_set_default_mgmt_key(rdev, dev, link_id, key.idx); 4587 4523 if (err) 4588 4524 goto out; 4589 4525 4590 4526 #ifdef CONFIG_CFG80211_WEXT 4591 - dev->ieee80211_ptr->wext.default_mgmt_key = key.idx; 4527 + wdev->wext.default_mgmt_key = key.idx; 4592 4528 #endif 4593 4529 } else if (key.defbeacon) { 4594 4530 if (key.def_uni || !key.def_multi) { ··· 4605 4533 goto out; 4606 4534 } 4607 4535 4608 - err = nl80211_key_allowed(dev->ieee80211_ptr); 4536 + err = nl80211_key_allowed(wdev); 4609 4537 if (err) 4610 4538 goto out; 4611 4539 4612 - err = rdev_set_default_beacon_key(rdev, dev, key.idx); 4540 + err = nl80211_validate_key_link_id(info, wdev, link_id, false); 4541 + if (err) 4542 + goto out; 4543 + 4544 + err = rdev_set_default_beacon_key(rdev, dev, link_id, key.idx); 4613 4545 if (err) 4614 4546 goto out; 4615 4547 } else if (key.p.mode == NL80211_KEY_SET_TX && ··· 4629 4553 goto out; 4630 4554 } 4631 4555 4632 - err = rdev_add_key(rdev, dev, key.idx, 4556 + err = nl80211_validate_key_link_id(info, wdev, link_id, true); 4557 + if (err) 4558 + goto out; 4559 + 4560 + err = rdev_add_key(rdev, dev, link_id, key.idx, 4633 4561 NL80211_KEYTYPE_PAIRWISE, 4634 4562 mac_addr, &key.p); 4635 4563 } else { 4636 4564 err = -EINVAL; 4637 4565 } 4638 4566 out: 4639 - wdev_unlock(dev->ieee80211_ptr); 4567 + wdev_unlock(wdev); 4640 4568 4641 4569 return err; 4642 4570 } ··· 4652 4572 struct net_device *dev = info->user_ptr[1]; 4653 4573 struct key_parse key; 4654 4574 const u8 *mac_addr = NULL; 4575 + int link_id = nl80211_link_id_or_invalid(info->attrs); 4576 + struct wireless_dev *wdev = dev->ieee80211_ptr; 4655 4577 4656 4578 err = nl80211_parse_key(info, &key); 4657 4579 if (err) ··· 4695 4613 return -EINVAL; 4696 4614 } 4697 4615 4698 - wdev_lock(dev->ieee80211_ptr); 4699 - err = nl80211_key_allowed(dev->ieee80211_ptr); 4616 + wdev_lock(wdev); 4617 + err = nl80211_key_allowed(wdev); 4700 4618 if (err) 4701 4619 GENL_SET_ERR_MSG(info, "key not allowed"); 4620 + 4621 + if (!err) 4622 + err = nl80211_validate_key_link_id(info, wdev, link_id, 4623 + key.type == NL80211_KEYTYPE_PAIRWISE); 4624 + 4702 4625 if (!err) { 4703 - err = rdev_add_key(rdev, dev, key.idx, 4626 + err = rdev_add_key(rdev, dev, link_id, key.idx, 4704 4627 key.type == NL80211_KEYTYPE_PAIRWISE, 4705 4628 mac_addr, &key.p); 4706 4629 if (err) 4707 4630 GENL_SET_ERR_MSG(info, "key addition failed"); 4708 4631 } 4709 - wdev_unlock(dev->ieee80211_ptr); 4632 + wdev_unlock(wdev); 4710 4633 4711 4634 return err; 4712 4635 } ··· 4723 4636 struct net_device *dev = info->user_ptr[1]; 4724 4637 u8 *mac_addr = NULL; 4725 4638 struct key_parse key; 4639 + int link_id = nl80211_link_id_or_invalid(info->attrs); 4640 + struct wireless_dev *wdev = dev->ieee80211_ptr; 4726 4641 4727 4642 err = nl80211_parse_key(info, &key); 4728 4643 if (err) ··· 4752 4663 if (!rdev->ops->del_key) 4753 4664 return -EOPNOTSUPP; 4754 4665 4755 - wdev_lock(dev->ieee80211_ptr); 4756 - err = nl80211_key_allowed(dev->ieee80211_ptr); 4666 + wdev_lock(wdev); 4667 + err = nl80211_key_allowed(wdev); 4757 4668 4758 4669 if (key.type == NL80211_KEYTYPE_GROUP && mac_addr && 4759 4670 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) 4760 4671 err = -ENOENT; 4761 4672 4762 4673 if (!err) 4763 - err = rdev_del_key(rdev, dev, key.idx, 4674 + err = nl80211_validate_key_link_id(info, wdev, link_id, 4675 + key.type == NL80211_KEYTYPE_PAIRWISE); 4676 + 4677 + if (!err) 4678 + err = rdev_del_key(rdev, dev, link_id, key.idx, 4764 4679 key.type == NL80211_KEYTYPE_PAIRWISE, 4765 4680 mac_addr); 4766 4681 4767 4682 #ifdef CONFIG_CFG80211_WEXT 4768 4683 if (!err) { 4769 - if (key.idx == dev->ieee80211_ptr->wext.default_key) 4770 - dev->ieee80211_ptr->wext.default_key = -1; 4771 - else if (key.idx == dev->ieee80211_ptr->wext.default_mgmt_key) 4772 - dev->ieee80211_ptr->wext.default_mgmt_key = -1; 4684 + if (key.idx == wdev->wext.default_key) 4685 + wdev->wext.default_key = -1; 4686 + else if (key.idx == wdev->wext.default_mgmt_key) 4687 + wdev->wext.default_mgmt_key = -1; 4773 4688 } 4774 4689 #endif 4775 - wdev_unlock(dev->ieee80211_ptr); 4690 + wdev_unlock(wdev); 4776 4691 4777 4692 return err; 4778 4693 } ··· 5680 5587 params->eht_cap = (void *)(cap->data + 1); 5681 5588 if (!ieee80211_eht_capa_size_ok((const u8 *)params->he_cap, 5682 5589 (const u8 *)params->eht_cap, 5683 - cap->datalen - 1)) 5590 + cap->datalen - 1, true)) 5684 5591 return -EINVAL; 5685 5592 } 5686 5593 cap = cfg80211_find_ext_elem(WLAN_EID_EXT_EHT_OPERATION, ies, ies_len); ··· 6909 6816 6910 6817 if (!ieee80211_eht_capa_size_ok((const u8 *)params->link_sta_params.he_capa, 6911 6818 (const u8 *)params->link_sta_params.eht_capa, 6912 - params->link_sta_params.eht_capa_len)) 6819 + params->link_sta_params.eht_capa_len, 6820 + false)) 6913 6821 return -EINVAL; 6914 6822 } 6915 6823 } ··· 7221 7127 7222 7128 if (!ieee80211_eht_capa_size_ok((const u8 *)params.link_sta_params.he_capa, 7223 7129 (const u8 *)params.link_sta_params.eht_capa, 7224 - params.link_sta_params.eht_capa_len)) 7130 + params.link_sta_params.eht_capa_len, 7131 + false)) 7225 7132 return -EINVAL; 7226 7133 } 7227 7134 } ··· 15982 15887 15983 15888 if (!ieee80211_eht_capa_size_ok((const u8 *)params.he_capa, 15984 15889 (const u8 *)params.eht_capa, 15985 - params.eht_capa_len)) 15890 + params.eht_capa_len, 15891 + false)) 15986 15892 return -EINVAL; 15987 15893 } 15988 15894 } ··· 18932 18836 18933 18837 static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, 18934 18838 struct net_device *netdev, 18839 + unsigned int link_id, 18935 18840 struct cfg80211_chan_def *chandef, 18936 18841 gfp_t gfp, 18937 18842 enum nl80211_commands notif, 18938 18843 u8 count, bool quiet) 18939 18844 { 18845 + struct wireless_dev *wdev = netdev->ieee80211_ptr; 18940 18846 struct sk_buff *msg; 18941 18847 void *hdr; 18942 18848 ··· 18953 18855 } 18954 18856 18955 18857 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) 18858 + goto nla_put_failure; 18859 + 18860 + if (wdev->valid_links && 18861 + nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id)) 18956 18862 goto nla_put_failure; 18957 18863 18958 18864 if (nl80211_send_chandef(msg, chandef)) ··· 19018 18916 19019 18917 cfg80211_sched_dfs_chan_update(rdev); 19020 18918 19021 - nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL, 18919 + nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL, 19022 18920 NL80211_CMD_CH_SWITCH_NOTIFY, 0, false); 19023 18921 } 19024 18922 EXPORT_SYMBOL(cfg80211_ch_switch_notify); 19025 18923 19026 18924 void cfg80211_ch_switch_started_notify(struct net_device *dev, 19027 18925 struct cfg80211_chan_def *chandef, 19028 - u8 count, bool quiet) 18926 + unsigned int link_id, u8 count, 18927 + bool quiet) 19029 18928 { 19030 18929 struct wireless_dev *wdev = dev->ieee80211_ptr; 19031 18930 struct wiphy *wiphy = wdev->wiphy; 19032 18931 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); 19033 18932 19034 - trace_cfg80211_ch_switch_started_notify(dev, chandef); 18933 + ASSERT_WDEV_LOCK(wdev); 18934 + WARN_INVALID_LINK_ID(wdev, link_id); 19035 18935 19036 - nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL, 18936 + trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id); 18937 + 18938 + nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL, 19037 18939 NL80211_CMD_CH_SWITCH_STARTED_NOTIFY, 19038 18940 count, quiet); 19039 18941 }
+32 -26
net/wireless/rdev-ops.h
··· 77 77 } 78 78 79 79 static inline int rdev_add_key(struct cfg80211_registered_device *rdev, 80 - struct net_device *netdev, u8 key_index, 81 - bool pairwise, const u8 *mac_addr, 80 + struct net_device *netdev, int link_id, 81 + u8 key_index, bool pairwise, const u8 *mac_addr, 82 82 struct key_params *params) 83 83 { 84 84 int ret; 85 - trace_rdev_add_key(&rdev->wiphy, netdev, key_index, pairwise, 85 + trace_rdev_add_key(&rdev->wiphy, netdev, link_id, key_index, pairwise, 86 86 mac_addr, params->mode); 87 - ret = rdev->ops->add_key(&rdev->wiphy, netdev, key_index, pairwise, 88 - mac_addr, params); 87 + ret = rdev->ops->add_key(&rdev->wiphy, netdev, link_id, key_index, 88 + pairwise, mac_addr, params); 89 89 trace_rdev_return_int(&rdev->wiphy, ret); 90 90 return ret; 91 91 } 92 92 93 93 static inline int 94 94 rdev_get_key(struct cfg80211_registered_device *rdev, struct net_device *netdev, 95 - u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie, 95 + int link_id, u8 key_index, bool pairwise, const u8 *mac_addr, 96 + void *cookie, 96 97 void (*callback)(void *cookie, struct key_params*)) 97 98 { 98 99 int ret; 99 - trace_rdev_get_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr); 100 - ret = rdev->ops->get_key(&rdev->wiphy, netdev, key_index, pairwise, 101 - mac_addr, cookie, callback); 100 + trace_rdev_get_key(&rdev->wiphy, netdev, link_id, key_index, pairwise, 101 + mac_addr); 102 + ret = rdev->ops->get_key(&rdev->wiphy, netdev, link_id, key_index, 103 + pairwise, mac_addr, cookie, callback); 102 104 trace_rdev_return_int(&rdev->wiphy, ret); 103 105 return ret; 104 106 } 105 107 106 108 static inline int rdev_del_key(struct cfg80211_registered_device *rdev, 107 - struct net_device *netdev, u8 key_index, 108 - bool pairwise, const u8 *mac_addr) 109 + struct net_device *netdev, int link_id, 110 + u8 key_index, bool pairwise, const u8 *mac_addr) 109 111 { 110 112 int ret; 111 - trace_rdev_del_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr); 112 - ret = rdev->ops->del_key(&rdev->wiphy, netdev, key_index, pairwise, 113 - mac_addr); 113 + trace_rdev_del_key(&rdev->wiphy, netdev, link_id, key_index, pairwise, 114 + mac_addr); 115 + ret = rdev->ops->del_key(&rdev->wiphy, netdev, link_id, key_index, 116 + pairwise, mac_addr); 114 117 trace_rdev_return_int(&rdev->wiphy, ret); 115 118 return ret; 116 119 } 117 120 118 121 static inline int 119 122 rdev_set_default_key(struct cfg80211_registered_device *rdev, 120 - struct net_device *netdev, u8 key_index, bool unicast, 121 - bool multicast) 123 + struct net_device *netdev, int link_id, u8 key_index, 124 + bool unicast, bool multicast) 122 125 { 123 126 int ret; 124 - trace_rdev_set_default_key(&rdev->wiphy, netdev, key_index, 127 + trace_rdev_set_default_key(&rdev->wiphy, netdev, link_id, key_index, 125 128 unicast, multicast); 126 - ret = rdev->ops->set_default_key(&rdev->wiphy, netdev, key_index, 127 - unicast, multicast); 129 + ret = rdev->ops->set_default_key(&rdev->wiphy, netdev, link_id, 130 + key_index, unicast, multicast); 128 131 trace_rdev_return_int(&rdev->wiphy, ret); 129 132 return ret; 130 133 } 131 134 132 135 static inline int 133 136 rdev_set_default_mgmt_key(struct cfg80211_registered_device *rdev, 134 - struct net_device *netdev, u8 key_index) 137 + struct net_device *netdev, int link_id, u8 key_index) 135 138 { 136 139 int ret; 137 - trace_rdev_set_default_mgmt_key(&rdev->wiphy, netdev, key_index); 138 - ret = rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev, 140 + trace_rdev_set_default_mgmt_key(&rdev->wiphy, netdev, link_id, 141 + key_index); 142 + ret = rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev, link_id, 139 143 key_index); 140 144 trace_rdev_return_int(&rdev->wiphy, ret); 141 145 return ret; ··· 147 143 148 144 static inline int 149 145 rdev_set_default_beacon_key(struct cfg80211_registered_device *rdev, 150 - struct net_device *netdev, u8 key_index) 146 + struct net_device *netdev, int link_id, 147 + u8 key_index) 151 148 { 152 149 int ret; 153 150 154 - trace_rdev_set_default_beacon_key(&rdev->wiphy, netdev, key_index); 155 - ret = rdev->ops->set_default_beacon_key(&rdev->wiphy, netdev, 156 - key_index); 151 + trace_rdev_set_default_beacon_key(&rdev->wiphy, netdev, link_id, 152 + key_index); 153 + ret = rdev->ops->set_default_beacon_key(&rdev->wiphy, netdev, link_id, 154 + key_index); 157 155 trace_rdev_return_int(&rdev->wiphy, ret); 158 156 return ret; 159 157 }
+4
net/wireless/reg.c
··· 2389 2389 switch (iftype) { 2390 2390 case NL80211_IFTYPE_AP: 2391 2391 case NL80211_IFTYPE_P2P_GO: 2392 + if (!wdev->links[link].ap.beacon_interval) 2393 + continue; 2394 + chandef = wdev->links[link].ap.chandef; 2395 + break; 2392 2396 case NL80211_IFTYPE_MESH_POINT: 2393 2397 if (!wdev->u.mesh.beacon_interval) 2394 2398 continue;
+1 -1
net/wireless/scan.c
··· 540 540 memcpy(entry->bssid, pos, ETH_ALEN); 541 541 pos += ETH_ALEN; 542 542 543 - if (length == IEEE80211_TBTT_INFO_OFFSET_BSSID_SSSID_BSS_PARAM) { 543 + if (length >= IEEE80211_TBTT_INFO_OFFSET_BSSID_SSSID_BSS_PARAM) { 544 544 memcpy(&entry->short_ssid, pos, 545 545 sizeof(entry->short_ssid)); 546 546 entry->short_ssid_valid = true;
+4 -1
net/wireless/sme.c
··· 747 747 if (WARN_ON(!cr->links[link].addr)) 748 748 goto out; 749 749 } 750 + 751 + if (WARN_ON(wdev->connect_keys)) 752 + goto out; 750 753 } 751 754 752 755 wdev->unprot_beacon_reported = 0; ··· 1328 1325 NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT)) 1329 1326 max_key_idx = 7; 1330 1327 for (i = 0; i <= max_key_idx; i++) 1331 - rdev_del_key(rdev, dev, i, false, NULL); 1328 + rdev_del_key(rdev, dev, -1, i, false, NULL); 1332 1329 } 1333 1330 1334 1331 rdev_set_qos_map(rdev, dev, NULL);
+59 -38
net/wireless/trace.h
··· 434 434 ); 435 435 436 436 DECLARE_EVENT_CLASS(key_handle, 437 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, 438 - bool pairwise, const u8 *mac_addr), 439 - TP_ARGS(wiphy, netdev, key_index, pairwise, mac_addr), 437 + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int link_id, 438 + u8 key_index, bool pairwise, const u8 *mac_addr), 439 + TP_ARGS(wiphy, netdev, link_id, key_index, pairwise, mac_addr), 440 440 TP_STRUCT__entry( 441 441 WIPHY_ENTRY 442 442 NETDEV_ENTRY 443 443 MAC_ENTRY(mac_addr) 444 + __field(int, link_id) 444 445 __field(u8, key_index) 445 446 __field(bool, pairwise) 446 447 ), ··· 449 448 WIPHY_ASSIGN; 450 449 NETDEV_ASSIGN; 451 450 MAC_ASSIGN(mac_addr, mac_addr); 451 + __entry->link_id = link_id; 452 452 __entry->key_index = key_index; 453 453 __entry->pairwise = pairwise; 454 454 ), 455 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", key_index: %u, pairwise: %s, mac addr: " MAC_PR_FMT, 456 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index, 457 - BOOL_TO_STR(__entry->pairwise), MAC_PR_ARG(mac_addr)) 455 + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id: %d, " 456 + "key_index: %u, pairwise: %s, mac addr: " MAC_PR_FMT, 457 + WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id, 458 + __entry->key_index, BOOL_TO_STR(__entry->pairwise), 459 + MAC_PR_ARG(mac_addr)) 458 460 ); 459 461 460 462 DEFINE_EVENT(key_handle, rdev_get_key, 461 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, 462 - bool pairwise, const u8 *mac_addr), 463 - TP_ARGS(wiphy, netdev, key_index, pairwise, mac_addr) 463 + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int link_id, 464 + u8 key_index, bool pairwise, const u8 *mac_addr), 465 + TP_ARGS(wiphy, netdev, link_id, key_index, pairwise, mac_addr) 464 466 ); 465 467 466 468 DEFINE_EVENT(key_handle, rdev_del_key, 467 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, 468 - bool pairwise, const u8 *mac_addr), 469 - TP_ARGS(wiphy, netdev, key_index, pairwise, mac_addr) 469 + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int link_id, 470 + u8 key_index, bool pairwise, const u8 *mac_addr), 471 + TP_ARGS(wiphy, netdev, link_id, key_index, pairwise, mac_addr) 470 472 ); 471 473 472 474 TRACE_EVENT(rdev_add_key, 473 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, 474 - bool pairwise, const u8 *mac_addr, u8 mode), 475 - TP_ARGS(wiphy, netdev, key_index, pairwise, mac_addr, mode), 475 + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int link_id, 476 + u8 key_index, bool pairwise, const u8 *mac_addr, u8 mode), 477 + TP_ARGS(wiphy, netdev, link_id, key_index, pairwise, mac_addr, mode), 476 478 TP_STRUCT__entry( 477 479 WIPHY_ENTRY 478 480 NETDEV_ENTRY 479 481 MAC_ENTRY(mac_addr) 482 + __field(int, link_id) 480 483 __field(u8, key_index) 481 484 __field(bool, pairwise) 482 485 __field(u8, mode) ··· 489 484 WIPHY_ASSIGN; 490 485 NETDEV_ASSIGN; 491 486 MAC_ASSIGN(mac_addr, mac_addr); 487 + __entry->link_id = link_id; 492 488 __entry->key_index = key_index; 493 489 __entry->pairwise = pairwise; 494 490 __entry->mode = mode; 495 491 ), 496 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", key_index: %u, " 497 - "mode: %u, pairwise: %s, mac addr: " MAC_PR_FMT, 498 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index, 499 - __entry->mode, BOOL_TO_STR(__entry->pairwise), 500 - MAC_PR_ARG(mac_addr)) 492 + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id: %d, " 493 + "key_index: %u, mode: %u, pairwise: %s, " 494 + "mac addr: " MAC_PR_FMT, 495 + WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id, 496 + __entry->key_index, __entry->mode, 497 + BOOL_TO_STR(__entry->pairwise), MAC_PR_ARG(mac_addr)) 501 498 ); 502 499 503 500 TRACE_EVENT(rdev_set_default_key, 504 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, 505 - bool unicast, bool multicast), 506 - TP_ARGS(wiphy, netdev, key_index, unicast, multicast), 501 + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int link_id, 502 + u8 key_index, bool unicast, bool multicast), 503 + TP_ARGS(wiphy, netdev, link_id, key_index, unicast, multicast), 507 504 TP_STRUCT__entry( 508 505 WIPHY_ENTRY 509 506 NETDEV_ENTRY 507 + __field(int, link_id) 510 508 __field(u8, key_index) 511 509 __field(bool, unicast) 512 510 __field(bool, multicast) ··· 517 509 TP_fast_assign( 518 510 WIPHY_ASSIGN; 519 511 NETDEV_ASSIGN; 512 + __entry->link_id = link_id; 520 513 __entry->key_index = key_index; 521 514 __entry->unicast = unicast; 522 515 __entry->multicast = multicast; 523 516 ), 524 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", key index: %u, unicast: %s, multicast: %s", 525 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index, 526 - BOOL_TO_STR(__entry->unicast), 517 + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id: %d, " 518 + "key index: %u, unicast: %s, multicast: %s", 519 + WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id, 520 + __entry->key_index, BOOL_TO_STR(__entry->unicast), 527 521 BOOL_TO_STR(__entry->multicast)) 528 522 ); 529 523 530 524 TRACE_EVENT(rdev_set_default_mgmt_key, 531 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index), 532 - TP_ARGS(wiphy, netdev, key_index), 525 + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int link_id, 526 + u8 key_index), 527 + TP_ARGS(wiphy, netdev, link_id, key_index), 533 528 TP_STRUCT__entry( 534 529 WIPHY_ENTRY 535 530 NETDEV_ENTRY 531 + __field(int, link_id) 536 532 __field(u8, key_index) 537 533 ), 538 534 TP_fast_assign( 539 535 WIPHY_ASSIGN; 540 536 NETDEV_ASSIGN; 537 + __entry->link_id = link_id; 541 538 __entry->key_index = key_index; 542 539 ), 543 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", key index: %u", 544 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index) 540 + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id: %d, " 541 + "key index: %u", WIPHY_PR_ARG, NETDEV_PR_ARG, 542 + __entry->link_id, __entry->key_index) 545 543 ); 546 544 547 545 TRACE_EVENT(rdev_set_default_beacon_key, 548 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index), 549 - TP_ARGS(wiphy, netdev, key_index), 546 + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int link_id, 547 + u8 key_index), 548 + TP_ARGS(wiphy, netdev, link_id, key_index), 550 549 TP_STRUCT__entry( 551 550 WIPHY_ENTRY 552 551 NETDEV_ENTRY 552 + __field(int, link_id) 553 553 __field(u8, key_index) 554 554 ), 555 555 TP_fast_assign( 556 556 WIPHY_ASSIGN; 557 557 NETDEV_ASSIGN; 558 + __entry->link_id = link_id; 558 559 __entry->key_index = key_index; 559 560 ), 560 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", key index: %u", 561 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index) 561 + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id: %d, " 562 + "key index: %u", WIPHY_PR_ARG, NETDEV_PR_ARG, 563 + __entry->link_id, __entry->key_index) 562 564 ); 563 565 564 566 TRACE_EVENT(rdev_start_ap, ··· 3263 3245 3264 3246 TRACE_EVENT(cfg80211_ch_switch_started_notify, 3265 3247 TP_PROTO(struct net_device *netdev, 3266 - struct cfg80211_chan_def *chandef), 3267 - TP_ARGS(netdev, chandef), 3248 + struct cfg80211_chan_def *chandef, 3249 + unsigned int link_id), 3250 + TP_ARGS(netdev, chandef, link_id), 3268 3251 TP_STRUCT__entry( 3269 3252 NETDEV_ENTRY 3270 3253 CHAN_DEF_ENTRY 3254 + __field(unsigned int, link_id) 3271 3255 ), 3272 3256 TP_fast_assign( 3273 3257 NETDEV_ASSIGN; 3274 3258 CHAN_DEF_ASSIGN(chandef); 3259 + __entry->link_id = link_id; 3275 3260 ), 3276 - TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT, 3277 - NETDEV_PR_ARG, CHAN_DEF_PR_ARG) 3261 + TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d", 3262 + NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id) 3278 3263 ); 3279 3264 3280 3265 TRACE_EVENT(cfg80211_radar_event,
+2 -2
net/wireless/util.c
··· 935 935 for (i = 0; i < CFG80211_MAX_WEP_KEYS; i++) { 936 936 if (!wdev->connect_keys->params[i].cipher) 937 937 continue; 938 - if (rdev_add_key(rdev, dev, i, false, NULL, 938 + if (rdev_add_key(rdev, dev, -1, i, false, NULL, 939 939 &wdev->connect_keys->params[i])) { 940 940 netdev_err(dev, "failed to set key %d\n", i); 941 941 continue; 942 942 } 943 943 if (wdev->connect_keys->def == i && 944 - rdev_set_default_key(rdev, dev, i, true, true)) { 944 + rdev_set_default_key(rdev, dev, -1, i, true, true)) { 945 945 netdev_err(dev, "failed to set defkey %d\n", i); 946 946 continue; 947 947 }
+13 -5
net/wireless/wext-compat.c
··· 470 470 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) 471 471 err = -ENOENT; 472 472 else 473 - err = rdev_del_key(rdev, dev, idx, pairwise, 473 + err = rdev_del_key(rdev, dev, -1, idx, pairwise, 474 474 addr); 475 475 } 476 476 wdev->wext.connect.privacy = false; ··· 509 509 if (wdev->connected || 510 510 (wdev->iftype == NL80211_IFTYPE_ADHOC && 511 511 wdev->u.ibss.current_bss)) 512 - err = rdev_add_key(rdev, dev, idx, pairwise, addr, params); 512 + err = rdev_add_key(rdev, dev, -1, idx, pairwise, addr, params); 513 513 else if (params->cipher != WLAN_CIPHER_SUITE_WEP40 && 514 514 params->cipher != WLAN_CIPHER_SUITE_WEP104) 515 515 return -EINVAL; ··· 546 546 __cfg80211_leave_ibss(rdev, wdev->netdev, true); 547 547 rejoin = true; 548 548 } 549 - err = rdev_set_default_key(rdev, dev, idx, true, true); 549 + err = rdev_set_default_key(rdev, dev, -1, idx, true, 550 + true); 550 551 } 551 552 if (!err) { 552 553 wdev->wext.default_key = idx; ··· 562 561 if (wdev->connected || 563 562 (wdev->iftype == NL80211_IFTYPE_ADHOC && 564 563 wdev->u.ibss.current_bss)) 565 - err = rdev_set_default_mgmt_key(rdev, dev, idx); 564 + err = rdev_set_default_mgmt_key(rdev, dev, -1, idx); 566 565 if (!err) 567 566 wdev->wext.default_mgmt_key = idx; 568 567 return err; ··· 633 632 if (wdev->connected || 634 633 (wdev->iftype == NL80211_IFTYPE_ADHOC && 635 634 wdev->u.ibss.current_bss)) 636 - err = rdev_set_default_key(rdev, dev, idx, true, 635 + err = rdev_set_default_key(rdev, dev, -1, idx, true, 637 636 true); 638 637 if (!err) 639 638 wdev->wext.default_key = idx; ··· 685 684 !rdev->ops->add_key || 686 685 !rdev->ops->set_default_key) 687 686 return -EOPNOTSUPP; 687 + 688 + wdev_lock(wdev); 689 + if (wdev->valid_links) { 690 + wdev_unlock(wdev); 691 + return -EOPNOTSUPP; 692 + } 693 + wdev_unlock(wdev); 688 694 689 695 switch (ext->alg) { 690 696 case IW_ENCODE_ALG_NONE: