size_t len;
};
-struct ath12k_device_dp_tx_err_stats {
- /* TCL Ring Descriptor unavailable */
- u32 desc_na[DP_TCL_NUM_RING_MAX];
- /* Other failures during dp_tx due to mem allocation failure
- * idr unavailable etc.
- */
- atomic_t misc_fail;
-};
-
-struct ath12k_device_dp_stats {
- u32 err_ring_pkts;
- u32 invalid_rbm;
- u32 rxdma_error[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX];
- u32 reo_error[HAL_REO_DEST_RING_ERROR_CODE_MAX];
- u32 hal_reo_error[DP_REO_DST_RING_MAX];
- struct ath12k_device_dp_tx_err_stats tx_err;
- u32 reo_rx[DP_REO_DST_RING_MAX][ATH12K_MAX_DEVICES];
- u32 rx_wbm_rel_source[HAL_WBM_REL_SRC_MODULE_MAX][ATH12K_MAX_DEVICES];
- u32 tqm_rel_reason[MAX_TQM_RELEASE_REASON];
- u32 fw_tx_status[MAX_FW_TX_STATUS];
- u32 tx_wbm_rel_source[HAL_WBM_REL_SRC_MODULE_MAX];
- u32 tx_enqueued[DP_TCL_NUM_RING_MAX];
- u32 tx_completed[DP_TCL_NUM_RING_MAX];
-};
-
struct ath12k_reg_freq {
u32 start_freq;
u32 end_freq;
/* Current DFS Regulatory */
enum ath12k_dfs_region dfs_region;
- struct ath12k_device_dp_stats device_stats;
#ifdef CONFIG_ATH12K_DEBUGFS
struct dentry *debugfs_soc;
#endif
// SPDX-License-Identifier: BSD-3-Clause-Clear
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ *
*/
#include <linux/vmalloc.h>
size_t count, loff_t *ppos)
{
struct ath12k_base *ab = file->private_data;
- struct ath12k_device_dp_stats *device_stats = &ab->device_stats;
+ struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
+ struct ath12k_device_dp_stats *device_stats = &dp->device_stats;
int len = 0, i, j, ret;
struct ath12k *ar;
const int size = 4096;
#include "dp_htt.h"
#include "dp_cmn.h"
#include <linux/rhashtable.h>
+#include "wifi7/hal_desc.h"
#define MAX_RXDMA_PER_PDEV 2
dma_addr_t paddr);
};
+struct ath12k_device_dp_tx_err_stats {
+ /* TCL Ring Descriptor unavailable */
+ u32 desc_na[DP_TCL_NUM_RING_MAX];
+ /* Other failures during dp_tx due to mem allocation failure
+ * idr unavailable etc.
+ */
+ atomic_t misc_fail;
+};
+
+struct ath12k_device_dp_stats {
+ u32 err_ring_pkts;
+ u32 invalid_rbm;
+ u32 rxdma_error[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX];
+ u32 reo_error[HAL_REO_DEST_RING_ERROR_CODE_MAX];
+ u32 hal_reo_error[DP_REO_DST_RING_MAX];
+ struct ath12k_device_dp_tx_err_stats tx_err;
+ u32 reo_rx[DP_REO_DST_RING_MAX][ATH12K_MAX_DEVICES];
+ u32 rx_wbm_rel_source[HAL_WBM_REL_SRC_MODULE_MAX][ATH12K_MAX_DEVICES];
+ u32 tqm_rel_reason[MAX_TQM_RELEASE_REASON];
+ u32 fw_tx_status[MAX_FW_TX_STATUS];
+ u32 tx_wbm_rel_source[HAL_WBM_REL_SRC_MODULE_MAX];
+ u32 tx_enqueued[DP_TCL_NUM_RING_MAX];
+ u32 tx_completed[DP_TCL_NUM_RING_MAX];
+};
+
struct ath12k_dp {
struct ath12k_base *ab;
u32 mon_dest_ring_stuck_cnt;
/* The rhashtable containing struct ath12k_link_peer keyed by mac addr */
struct rhashtable *rhead_peer_addr;
struct rhashtable_params rhash_peer_addr_param;
+ struct ath12k_device_dp_stats device_stats;
};
static inline u32 ath12k_dp_arch_tx_get_vdev_bank_config(struct ath12k_dp *dp,
ieee80211_rx_napi(ath12k_pdev_dp_to_hw(dp_pdev), pubsta, msdu, napi);
}
-bool ath12k_dp_rx_check_nwifi_hdr_len_valid(struct ath12k_base *ab,
+bool ath12k_dp_rx_check_nwifi_hdr_len_valid(struct ath12k_dp *dp,
struct hal_rx_desc *rx_desc,
struct sk_buff *msdu,
struct hal_rx_desc_data *rx_info)
if ((likely(hdr_len <= DP_MAX_NWIFI_HDR_LEN)))
return true;
- ab->device_stats.invalid_rbm++;
+ dp->device_stats.invalid_rbm++;
WARN_ON_ONCE(1);
return false;
}
void ath12k_dp_rx_deliver_msdu(struct ath12k_pdev_dp *dp_pdev, struct napi_struct *napi,
struct sk_buff *msdu,
struct hal_rx_desc_data *rx_info);
-bool ath12k_dp_rx_check_nwifi_hdr_len_valid(struct ath12k_base *ab,
+bool ath12k_dp_rx_check_nwifi_hdr_len_valid(struct ath12k_dp *dp,
struct hal_rx_desc *rx_desc,
struct sk_buff *msdu,
struct hal_rx_desc_data *rx_info);
}
}
- if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(ab, rx_desc, msdu,
+ if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(dp, rx_desc, msdu,
rx_info))) {
ret = -EINVAL;
goto free_out;
DMA_FROM_DEVICE);
num_buffs_reaped[device_id]++;
- ab->device_stats.reo_rx[ring_id][ab->device_id]++;
+ dp->device_stats.reo_rx[ring_id][ab->device_id]++;
push_reason = le32_get_bits(desc->info0,
HAL_REO_DEST_RING_INFO0_PUSH_REASON);
if (push_reason !=
HAL_REO_DEST_RING_PUSH_REASON_ROUTING_INSTRUCTION) {
dev_kfree_skb_any(msdu);
- ab->device_stats.hal_reo_error[ring_id]++;
+ dp->device_stats.hal_reo_error[ring_id]++;
continue;
}
RX_FLAG_IV_STRIPPED | RX_FLAG_DECRYPTED;
skb_pull(msdu, hal_rx_desc_sz);
- if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(ab, rx_desc, msdu,
+ if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(dp, rx_desc, msdu,
rx_info)))
return -EINVAL;
while (budget &&
(reo_desc = ath12k_hal_srng_dst_get_next_entry(ab, srng))) {
drop = false;
- ab->device_stats.err_ring_pkts++;
+ dp->device_stats.err_ring_pkts++;
ret = ath12k_wifi7_hal_desc_reo_parse_err(ab, reo_desc, &paddr,
&desc_bank);
rbm != HAL_RX_BUF_RBM_SW3_BM &&
rbm != partner_ab->hal.hal_params->rx_buf_rbm) {
act = HAL_WBM_REL_BM_ACT_REL_MSDU;
- ab->device_stats.invalid_rbm++;
+ dp->device_stats.invalid_rbm++;
ath12k_warn(ab, "invalid return buffer manager %d\n", rbm);
ath12k_wifi7_dp_rx_link_desc_return(partner_ab,
&reo_desc->buf_addr_info,
skb_put(msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);
skb_pull(msdu, hal_rx_desc_sz + l3pad_bytes);
}
- if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(ab, desc, msdu, rx_info)))
+ if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(dp, desc, msdu, rx_info)))
return -EINVAL;
ath12k_dp_rx_h_ppdu(dp_pdev, rx_info);
skb_put(msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);
skb_pull(msdu, hal_rx_desc_sz + l3pad_bytes);
- if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(ab, desc, msdu, rx_info)))
+ if (unlikely(!ath12k_dp_rx_check_nwifi_hdr_len_valid(dp, desc, msdu, rx_info)))
return true;
ath12k_dp_rx_h_ppdu(dp_pdev, rx_info);
struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu);
bool drop = false;
- dp->ab->device_stats.rxdma_error[rxcb->err_code]++;
+ dp->device_stats.rxdma_error[rxcb->err_code]++;
switch (rxcb->err_code) {
case HAL_REO_ENTR_RING_RXDMA_ECODE_DECRYPT_ERR:
struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu);
bool drop = false;
- dp->ab->device_stats.reo_error[rxcb->err_code]++;
+ dp->device_stats.reo_error[rxcb->err_code]++;
switch (rxcb->err_code) {
case HAL_REO_DEST_RING_ERROR_CODE_DESC_ADDR_ZERO:
int num_buffs_reaped[ATH12K_MAX_DEVICES] = {};
int total_num_buffs_reaped = 0;
struct ath12k_rx_desc_info *desc_info;
- struct ath12k_device_dp_stats *device_stats = &ab->device_stats;
+ struct ath12k_device_dp_stats *device_stats = &dp->device_stats;
struct ath12k_hw_link *hw_links = ag->hw_links;
u8 hw_link_id, device_id;
int ret, pdev_idx;
default:
/* TODO: Take care of other encap modes as well */
ret = -EINVAL;
- atomic_inc(&ab->device_stats.tx_err.misc_fail);
+ atomic_inc(&dp->device_stats.tx_err.misc_fail);
goto fail_remove_tx_buf;
}
map:
ti.paddr = dma_map_single(ab->dev, skb->data, skb->len, DMA_TO_DEVICE);
if (dma_mapping_error(ab->dev, ti.paddr)) {
- atomic_inc(&ab->device_stats.tx_err.misc_fail);
+ atomic_inc(&dp->device_stats.tx_err.misc_fail);
ath12k_warn(ab, "failed to DMA map data Tx buffer\n");
ret = -ENOMEM;
goto fail_remove_tx_buf;
* desc because the desc is directly enqueued onto hw queue.
*/
ath12k_hal_srng_access_end(ab, tcl_ring);
- ab->device_stats.tx_err.desc_na[ti.ring_id]++;
+ dp->device_stats.tx_err.desc_na[ti.ring_id]++;
spin_unlock_bh(&tcl_ring->lock);
ret = -ENOMEM;
arvif->link_stats.tx_enqueued++;
spin_unlock_bh(&arvif->link_stats_lock);
- ab->device_stats.tx_enqueued[ti.ring_id]++;
+ dp->device_stats.tx_enqueued[ti.ring_id]++;
ath12k_wifi7_hal_tx_cmd_desc_setup(ab, hal_tcl_desc, &ti);
ar = skb_cb->ar;
dp_pdev = &ar->dp;
- ab->device_stats.tx_completed[tx_ring->tcl_data_ring_id]++;
+ ab->dp->device_stats.tx_completed[tx_ring->tcl_data_ring_id]++;
if (atomic_dec_and_test(&ar->dp.num_tx_pending))
wake_up(&ar->dp.tx_empty_waitq);
struct htt_tx_wbm_completion *status_desc;
struct ath12k_dp_htt_wbm_tx_status ts = {};
enum hal_wbm_htt_tx_comp_status wbm_status;
+ struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
u16 peer_id;
status_desc = desc;
wbm_status = le32_get_bits(status_desc->info0,
HTT_TX_WBM_COMP_INFO0_STATUS);
- ab->device_stats.fw_tx_status[wbm_status]++;
+ dp->device_stats.fw_tx_status[wbm_status]++;
switch (wbm_status) {
case HAL_WBM_REL_HTT_TX_COMP_STATUS_OK:
}
skb_cb = ATH12K_SKB_CB(msdu);
- ab->device_stats.tx_completed[ring]++;
+ dp->device_stats.tx_completed[ring]++;
dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
if (skb_cb->paddr_ext_desc) {
/* Find the HAL_WBM_RELEASE_INFO0_REL_SRC_MODULE value */
buf_rel_source = le32_get_bits(tx_status->info0,
HAL_WBM_RELEASE_INFO0_REL_SRC_MODULE);
- ab->device_stats.tx_wbm_rel_source[buf_rel_source]++;
+ dp->device_stats.tx_wbm_rel_source[buf_rel_source]++;
rel_status = le32_get_bits(tx_status->info0,
HAL_WBM_COMPL_TX_INFO0_TQM_RELEASE_REASON);
- ab->device_stats.tqm_rel_reason[rel_status]++;
+ dp->device_stats.tqm_rel_reason[rel_status]++;
/* Release descriptor as soon as extracting necessary info
* to reduce contention
{
enum hal_reo_dest_ring_push_reason push_reason;
enum hal_reo_dest_ring_error_code err_code;
+ struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
u32 cookie, val;
push_reason = le32_get_bits(desc->info0,
HAL_REO_DEST_RING_INFO0_PUSH_REASON);
err_code = le32_get_bits(desc->info0,
HAL_REO_DEST_RING_INFO0_ERROR_CODE);
- ab->device_stats.reo_error[err_code]++;
+ dp->device_stats.reo_error[err_code]++;
if (push_reason != HAL_REO_DEST_RING_PUSH_REASON_ERR_DETECTED &&
push_reason != HAL_REO_DEST_RING_PUSH_REASON_ROUTING_INSTRUCTION) {
{
struct hal_wbm_release_ring *wbm_desc = desc;
struct hal_wbm_release_ring_cc_rx *wbm_cc_desc = desc;
+ struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
enum hal_wbm_rel_desc_type type;
enum hal_wbm_rel_src_module rel_src;
bool hw_cc_done;
val = le32_get_bits(wbm_desc->buf_addr_info.info1,
BUFFER_ADDR_INFO1_RET_BUF_MGR);
if (val != HAL_RX_BUF_RBM_SW3_BM) {
- ab->device_stats.invalid_rbm++;
+ dp->device_stats.invalid_rbm++;
return -EINVAL;
}
val = le32_get_bits(wbm_cc_desc->info0,
HAL_WBM_RELEASE_RX_CC_INFO0_RBM);
if (val != HAL_RX_BUF_RBM_SW3_BM) {
- ab->device_stats.invalid_rbm++;
+ dp->device_stats.invalid_rbm++;
return -EINVAL;
}