mac.c (0aea30a07ec6b50de0fc5f5b2ec34a68ead86b61) mac.c (ba9177fcef21fa98406e73c472b5ac2eb4ec5f31)
1// SPDX-License-Identifier: BSD-3-Clause-Clear
2/*
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
5 */
6
7#include <net/mac80211.h>
8#include <linux/etherdevice.h>
9#include "mac.h"
10#include "core.h"
11#include "debug.h"
12#include "wmi.h"
13#include "hw.h"
14#include "dp_tx.h"
15#include "dp_rx.h"
16#include "testmode.h"
17#include "peer.h"
18#include "debugfs_sta.h"
1// SPDX-License-Identifier: BSD-3-Clause-Clear
2/*
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
5 */
6
7#include <net/mac80211.h>
8#include <linux/etherdevice.h>
9#include "mac.h"
10#include "core.h"
11#include "debug.h"
12#include "wmi.h"
13#include "hw.h"
14#include "dp_tx.h"
15#include "dp_rx.h"
16#include "testmode.h"
17#include "peer.h"
18#include "debugfs_sta.h"
19#include "hif.h"
20#include "wow.h"
19
20#define CHAN2G(_channel, _freq, _flags) { \
21 .band = NL80211_BAND_2GHZ, \
22 .hw_value = (_channel), \
23 .center_freq = (_freq), \
24 .flags = (_flags), \
25 .max_antenna_gain = 0, \
26 .max_power = 30, \

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

7253 *
7254 * Hence implement a dummy callback just to say fragmentation isn't
7255 * supported. This effectively prevents mac80211 from doing frame
7256 * fragmentation in software.
7257 */
7258 return -EOPNOTSUPP;
7259}
7260
21
22#define CHAN2G(_channel, _freq, _flags) { \
23 .band = NL80211_BAND_2GHZ, \
24 .hw_value = (_channel), \
25 .center_freq = (_freq), \
26 .flags = (_flags), \
27 .max_antenna_gain = 0, \
28 .max_power = 30, \

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

7255 *
7256 * Hence implement a dummy callback just to say fragmentation isn't
7257 * supported. This effectively prevents mac80211 from doing frame
7258 * fragmentation in software.
7259 */
7260 return -EOPNOTSUPP;
7261}
7262
7261static void ath11k_mac_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
7262 u32 queues, bool drop)
7263static int ath11k_mac_flush_tx_complete(struct ath11k *ar)
7263{
7264{
7264 struct ath11k *ar = hw->priv;
7265 long time_left;
7265 long time_left;
7266 int ret = 0;
7266
7267
7267 if (drop)
7268 return;
7269
7270 time_left = wait_event_timeout(ar->dp.tx_empty_waitq,
7271 (atomic_read(&ar->dp.num_tx_pending) == 0),
7272 ATH11K_FLUSH_TIMEOUT);
7268 time_left = wait_event_timeout(ar->dp.tx_empty_waitq,
7269 (atomic_read(&ar->dp.num_tx_pending) == 0),
7270 ATH11K_FLUSH_TIMEOUT);
7273 if (time_left == 0)
7274 ath11k_warn(ar->ab, "failed to flush transmit queue %ld\n", time_left);
7271 if (time_left == 0) {
7272 ath11k_warn(ar->ab, "failed to flush transmit queue, data pkts pending %d\n",
7273 atomic_read(&ar->dp.num_tx_pending));
7274 ret = -ETIMEDOUT;
7275 }
7275
7276 time_left = wait_event_timeout(ar->txmgmt_empty_waitq,
7277 (atomic_read(&ar->num_pending_mgmt_tx) == 0),
7278 ATH11K_FLUSH_TIMEOUT);
7276
7277 time_left = wait_event_timeout(ar->txmgmt_empty_waitq,
7278 (atomic_read(&ar->num_pending_mgmt_tx) == 0),
7279 ATH11K_FLUSH_TIMEOUT);
7279 if (time_left == 0)
7280 ath11k_warn(ar->ab, "failed to flush mgmt transmit queue %ld\n",
7281 time_left);
7280 if (time_left == 0) {
7281 ath11k_warn(ar->ab, "failed to flush mgmt transmit queue, mgmt pkts pending %d\n",
7282 atomic_read(&ar->num_pending_mgmt_tx));
7283 ret = -ETIMEDOUT;
7284 }
7282
7285
7283 ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
7284 "mac mgmt tx flush mgmt pending %d\n",
7285 atomic_read(&ar->num_pending_mgmt_tx));
7286 return ret;
7286}
7287
7287}
7288
7289int ath11k_mac_wait_tx_complete(struct ath11k *ar)
7290{
7291 ath11k_mac_drain_tx(ar);
7292 return ath11k_mac_flush_tx_complete(ar);
7293}
7294
7295static void ath11k_mac_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
7296 u32 queues, bool drop)
7297{
7298 struct ath11k *ar = hw->priv;
7299
7300 if (drop)
7301 return;
7302
7303 ath11k_mac_flush_tx_complete(ar);
7304}
7305
7288static int
7289ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar,
7290 enum nl80211_band band,
7291 const struct cfg80211_bitrate_mask *mask)
7292{
7293 int num_rates = 0;
7294 int i;
7295

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

8099 .switch_vif_chanctx = ath11k_mac_op_switch_vif_chanctx,
8100 .set_rts_threshold = ath11k_mac_op_set_rts_threshold,
8101 .set_frag_threshold = ath11k_mac_op_set_frag_threshold,
8102 .set_bitrate_mask = ath11k_mac_op_set_bitrate_mask,
8103 .get_survey = ath11k_mac_op_get_survey,
8104 .flush = ath11k_mac_op_flush,
8105 .sta_statistics = ath11k_mac_op_sta_statistics,
8106 CFG80211_TESTMODE_CMD(ath11k_tm_cmd)
7306static int
7307ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar,
7308 enum nl80211_band band,
7309 const struct cfg80211_bitrate_mask *mask)
7310{
7311 int num_rates = 0;
7312 int i;
7313

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

8117 .switch_vif_chanctx = ath11k_mac_op_switch_vif_chanctx,
8118 .set_rts_threshold = ath11k_mac_op_set_rts_threshold,
8119 .set_frag_threshold = ath11k_mac_op_set_frag_threshold,
8120 .set_bitrate_mask = ath11k_mac_op_set_bitrate_mask,
8121 .get_survey = ath11k_mac_op_get_survey,
8122 .flush = ath11k_mac_op_flush,
8123 .sta_statistics = ath11k_mac_op_sta_statistics,
8124 CFG80211_TESTMODE_CMD(ath11k_tm_cmd)
8125
8126#ifdef CONFIG_PM
8127 .suspend = ath11k_wow_op_suspend,
8128 .resume = ath11k_wow_op_resume,
8129 .set_wakeup = ath11k_wow_op_set_wakeup,
8130#endif
8131
8107#ifdef CONFIG_ATH11K_DEBUGFS
8108 .sta_add_debugfs = ath11k_debugfs_sta_op_add,
8109#endif
8110};
8111
8112static void ath11k_mac_update_ch_list(struct ath11k *ar,
8113 struct ieee80211_supported_band *band,
8114 u32 freq_low, u32 freq_high)

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

8468
8469 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations;
8470
8471 if (test_bit(WMI_TLV_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi->wmi_ab->svc_map)) {
8472 ar->hw->wiphy->features |=
8473 NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
8474 }
8475
8132#ifdef CONFIG_ATH11K_DEBUGFS
8133 .sta_add_debugfs = ath11k_debugfs_sta_op_add,
8134#endif
8135};
8136
8137static void ath11k_mac_update_ch_list(struct ath11k *ar,
8138 struct ieee80211_supported_band *band,
8139 u32 freq_low, u32 freq_high)

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

8493
8494 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations;
8495
8496 if (test_bit(WMI_TLV_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi->wmi_ab->svc_map)) {
8497 ar->hw->wiphy->features |=
8498 NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
8499 }
8500
8501 ret = ath11k_wow_init(ar);
8502 if (ret) {
8503 ath11k_warn(ar->ab, "failed to init wow: %d\n", ret);
8504 goto err_free_if_combs;
8505 }
8506
8476 ar->hw->queues = ATH11K_HW_MAX_QUEUES;
8477 ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN;
8478 ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1;
8479 ar->hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
8480
8481 ar->hw->vif_data_size = sizeof(struct ath11k_vif);
8482 ar->hw->sta_data_size = sizeof(struct ath11k_sta);
8483

--- 212 unchanged lines hidden ---
8507 ar->hw->queues = ATH11K_HW_MAX_QUEUES;
8508 ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN;
8509 ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1;
8510 ar->hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
8511
8512 ar->hw->vif_data_size = sizeof(struct ath11k_vif);
8513 ar->hw->sta_data_size = sizeof(struct ath11k_sta);
8514

--- 212 unchanged lines hidden ---