mac.c (335a92765d308dfe22826f5562cd4b4389b45e71) mac.c (87bd401138161008fdb82fbca6e213af117bfeb9)
1// SPDX-License-Identifier: BSD-3-Clause-Clear
2/*
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
5 */
6
7#include <net/mac80211.h>
8#include <linux/etherdevice.h>

--- 1438 unchanged lines hidden (view full) ---

1447 if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
1448 WLAN_OUI_TYPE_MICROSOFT_WPA,
1449 ies, (skb_tail_pointer(bcn) - ies)))
1450 arvif->wpaie_present = true;
1451 else
1452 arvif->wpaie_present = false;
1453}
1454
1// SPDX-License-Identifier: BSD-3-Clause-Clear
2/*
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
5 */
6
7#include <net/mac80211.h>
8#include <linux/etherdevice.h>

--- 1438 unchanged lines hidden (view full) ---

1447 if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
1448 WLAN_OUI_TYPE_MICROSOFT_WPA,
1449 ies, (skb_tail_pointer(bcn) - ies)))
1450 arvif->wpaie_present = true;
1451 else
1452 arvif->wpaie_present = false;
1453}
1454
1455static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
1456{
1457 struct ath11k_vif *tx_arvif;
1458 struct ieee80211_ema_beacons *beacons;
1459 int ret = 0;
1460 bool nontx_vif_params_set = false;
1461 u32 params = 0;
1462 u8 i = 0;
1463
1464 tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv;
1465
1466 beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
1467 tx_arvif->vif, 0);
1468 if (!beacons || !beacons->cnt) {
1469 ath11k_warn(arvif->ar->ab,
1470 "failed to get ema beacon templates from mac80211\n");
1471 return -EPERM;
1472 }
1473
1474 if (tx_arvif == arvif)
1475 ath11k_mac_set_vif_params(tx_arvif, beacons->bcn[0].skb);
1476 else
1477 arvif->wpaie_present = tx_arvif->wpaie_present;
1478
1479 for (i = 0; i < beacons->cnt; i++) {
1480 if (tx_arvif != arvif && !nontx_vif_params_set)
1481 nontx_vif_params_set =
1482 ath11k_mac_set_nontx_vif_params(tx_arvif, arvif,
1483 beacons->bcn[i].skb);
1484
1485 params = beacons->cnt;
1486 params |= (i << WMI_EMA_TMPL_IDX_SHIFT);
1487 params |= ((!i ? 1 : 0) << WMI_EMA_FIRST_TMPL_SHIFT);
1488 params |= ((i + 1 == beacons->cnt ? 1 : 0) << WMI_EMA_LAST_TMPL_SHIFT);
1489
1490 ret = ath11k_wmi_bcn_tmpl(tx_arvif->ar, tx_arvif->vdev_id,
1491 &beacons->bcn[i].offs,
1492 beacons->bcn[i].skb, params);
1493 if (ret) {
1494 ath11k_warn(tx_arvif->ar->ab,
1495 "failed to set ema beacon template id %i error %d\n",
1496 i, ret);
1497 break;
1498 }
1499 }
1500
1501 ieee80211_beacon_free_ema_list(beacons);
1502
1503 if (tx_arvif != arvif && !nontx_vif_params_set)
1504 return -EINVAL; /* Profile not found in the beacons */
1505
1506 return ret;
1507}
1508
1455static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif)
1456{
1457 struct ath11k *ar = arvif->ar;
1458 struct ath11k_base *ab = ar->ab;
1459 struct ath11k_vif *tx_arvif = arvif;
1460 struct ieee80211_hw *hw = ar->hw;
1461 struct ieee80211_vif *vif = arvif->vif;
1462 struct ieee80211_mutable_offsets offs = {};

--- 16 unchanged lines hidden (view full) ---

1479 return -EPERM;
1480 }
1481
1482 if (tx_arvif == arvif)
1483 ath11k_mac_set_vif_params(tx_arvif, bcn);
1484 else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn))
1485 return -EINVAL;
1486
1509static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif)
1510{
1511 struct ath11k *ar = arvif->ar;
1512 struct ath11k_base *ab = ar->ab;
1513 struct ath11k_vif *tx_arvif = arvif;
1514 struct ieee80211_hw *hw = ar->hw;
1515 struct ieee80211_vif *vif = arvif->vif;
1516 struct ieee80211_mutable_offsets offs = {};

--- 16 unchanged lines hidden (view full) ---

1533 return -EPERM;
1534 }
1535
1536 if (tx_arvif == arvif)
1537 ath11k_mac_set_vif_params(tx_arvif, bcn);
1538 else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn))
1539 return -EINVAL;
1540
1487 ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn);
1541 ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, 0);
1488 kfree_skb(bcn);
1489
1490 if (ret)
1491 ath11k_warn(ab, "failed to submit beacon template command: %d\n",
1492 ret);
1493
1494 return ret;
1495}

--- 7 unchanged lines hidden (view full) ---

1503
1504 /* Target does not expect beacon templates for the already up
1505 * non-transmitting interfaces, and results in a crash if sent.
1506 */
1507 if (vif->mbssid_tx_vif &&
1508 arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up)
1509 return 0;
1510
1542 kfree_skb(bcn);
1543
1544 if (ret)
1545 ath11k_warn(ab, "failed to submit beacon template command: %d\n",
1546 ret);
1547
1548 return ret;
1549}

--- 7 unchanged lines hidden (view full) ---

1557
1558 /* Target does not expect beacon templates for the already up
1559 * non-transmitting interfaces, and results in a crash if sent.
1560 */
1561 if (vif->mbssid_tx_vif &&
1562 arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up)
1563 return 0;
1564
1565 if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif)
1566 return ath11k_mac_setup_bcn_tmpl_ema(arvif);
1567
1511 return ath11k_mac_setup_bcn_tmpl_mbssid(arvif);
1512}
1513
1514void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif)
1515{
1516 struct ieee80211_vif *vif = arvif->vif;
1517
1518 if (!vif->bss_conf.color_change_active && !arvif->bcca_zero_sent)

--- 8186 unchanged lines hidden ---
1568 return ath11k_mac_setup_bcn_tmpl_mbssid(arvif);
1569}
1570
1571void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif)
1572{
1573 struct ieee80211_vif *vif = arvif->vif;
1574
1575 if (!vif->bss_conf.color_change_active && !arvif->bcca_zero_sent)

--- 8186 unchanged lines hidden ---