wifi: ath12k: Add callbacks in arch_ops for rx APIs

Facilitate modular and architecture-agnostic access to Wi-Fi 7 Rx functionality
by introducing wrapper APIs in common module for existing RX callbacks already
defined in arch_ops.

Also remove redundant ar usage in these APIs and registered callbacks
definitions, and change the callback names of few of the APIs to remove the
redundant usage of "dp".

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Pavankumar Nandeshwar <quic_pnandesh@quicinc.com>
Signed-off-by: Ripan Deuri <quic_rdeuri@quicinc.com>
Reviewed-by: Karthikeyan Periyasamy <karthikeyan.periyasamy@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20251103112111.2260639-2-quic_rdeuri@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
This commit is contained in:
Pavankumar Nandeshwar 2025-11-03 16:51:00 +05:30 committed by Jeff Johnson
parent 6633dca572
commit 73c928346d
6 changed files with 141 additions and 37 deletions

View File

@ -10,7 +10,6 @@
#include "hif.h"
#include "hal.h"
#include "debug.h"
#include "wifi7/dp_rx.h"
#include "peer.h"
#include "dp_mon.h"
#include "dp_cmn.h"
@ -99,7 +98,7 @@ int ath12k_dp_peer_setup(struct ath12k *ar, int vdev_id, const u8 *addr)
}
for (tid--; tid >= 0; tid--)
ath12k_wifi7_dp_rx_peer_tid_delete(ar, peer, tid);
ath12k_dp_arch_rx_peer_tid_delete(dp, peer, tid);
spin_unlock_bh(&dp->dp_lock);
@ -345,7 +344,7 @@ static int ath12k_dp_tx_get_bank_profile(struct ath12k_base *ab,
bool configure_register = false;
/* convert vdev params into hal_tx_bank_config */
bank_config = dp->ops->dp_tx_get_vdev_bank_config(ab, arvif);
bank_config = ath12k_dp_arch_tx_get_vdev_bank_config(dp, arvif);
spin_lock_bh(&dp->tx_bank_lock);
/* TODO: implement using idr kernel framework*/

View File

@ -21,6 +21,7 @@ struct ath12k_vif;
struct ath12k_link_vif;
struct hal_tcl_status_ring;
struct ath12k_ext_irq_grp;
struct ath12k_dp_rx_tid;
#define DP_MON_PURGE_TIMEOUT_MS 100
#define DP_MON_SERVICE_BUDGET 128
@ -389,8 +390,34 @@ struct ath12k_dp_arch_ops {
int (*service_srng)(struct ath12k_dp *dp,
struct ath12k_ext_irq_grp *irq_grp,
int budget);
u32 (*dp_tx_get_vdev_bank_config)(struct ath12k_base *ab,
struct ath12k_link_vif *arvif);
u32 (*tx_get_vdev_bank_config)(struct ath12k_base *ab,
struct ath12k_link_vif *arvif);
int (*reo_cmd_send)(struct ath12k_base *ab,
struct ath12k_dp_rx_tid *rx_tid,
enum hal_reo_cmd_type type,
struct ath12k_hal_reo_cmd *cmd,
void (*cb)(struct ath12k_dp *dp, void *ctx,
enum hal_reo_cmd_status status));
void (*setup_pn_check_reo_cmd)(struct ath12k_hal_reo_cmd *cmd,
struct ath12k_dp_rx_tid *rx_tid,
u32 cipher, enum set_key_cmd key_cmd);
void (*rx_peer_tid_delete)(struct ath12k_base *ab,
struct ath12k_dp_link_peer *peer, u8 tid);
void (*reo_cache_flush)(struct ath12k_base *ab,
struct ath12k_dp_rx_tid *rx_tid);
int (*rx_link_desc_return)(struct ath12k_base *ab,
struct ath12k_buffer_addr *buf_addr_info,
enum hal_wbm_rel_bm_act action);
int (*peer_rx_tid_reo_update)(struct ath12k_dp *dp,
struct ath12k_dp_link_peer *peer,
struct ath12k_dp_rx_tid *rx_tid,
u32 ba_win_sz, u16 ssn,
bool update_ssn);
int (*rx_assign_reoq)(struct ath12k_base *ab, struct ath12k_dp_peer *dp_peer,
struct ath12k_dp_rx_tid *rx_tid,
u16 ssn, enum hal_pn_type pn_type);
void (*peer_rx_tid_qref_setup)(struct ath12k_base *ab, u16 peer_id, u16 tid,
dma_addr_t paddr);
};
struct ath12k_dp {
@ -489,6 +516,77 @@ struct ath12k_dp {
struct rhashtable_params rhash_peer_addr_param;
};
static inline u32 ath12k_dp_arch_tx_get_vdev_bank_config(struct ath12k_dp *dp,
struct ath12k_link_vif *arvif)
{
return dp->ops->tx_get_vdev_bank_config(dp->ab, arvif);
}
static inline int ath12k_dp_arch_reo_cmd_send(struct ath12k_dp *dp,
struct ath12k_dp_rx_tid *rx_tid,
enum hal_reo_cmd_type type,
struct ath12k_hal_reo_cmd *cmd,
void (*cb)(struct ath12k_dp *dp, void *ctx,
enum hal_reo_cmd_status status))
{
return dp->ops->reo_cmd_send(dp->ab, rx_tid, type, cmd, cb);
}
static inline void ath12k_dp_arch_setup_pn_check_reo_cmd(struct ath12k_dp *dp,
struct ath12k_hal_reo_cmd *cmd,
struct ath12k_dp_rx_tid *rx_tid,
u32 cipher,
enum set_key_cmd key_cmd)
{
dp->ops->setup_pn_check_reo_cmd(cmd, rx_tid, cipher, key_cmd);
}
static inline void ath12k_dp_arch_rx_peer_tid_delete(struct ath12k_dp *dp,
struct ath12k_dp_link_peer *peer,
u8 tid)
{
dp->ops->rx_peer_tid_delete(dp->ab, peer, tid);
}
static inline void ath12k_dp_arch_reo_cache_flush(struct ath12k_dp *dp,
struct ath12k_dp_rx_tid *rx_tid)
{
dp->ops->reo_cache_flush(dp->ab, rx_tid);
}
static inline
int ath12k_dp_arch_rx_link_desc_return(struct ath12k_dp *dp,
struct ath12k_buffer_addr *buf_addr_info,
enum hal_wbm_rel_bm_act action)
{
return dp->ops->rx_link_desc_return(dp->ab, buf_addr_info, action);
}
static inline int ath12k_dp_arch_peer_rx_tid_reo_update(struct ath12k_dp *dp,
struct ath12k_dp_link_peer *peer,
struct ath12k_dp_rx_tid *rx_tid,
u32 ba_win_sz, u16 ssn,
bool update_ssn)
{
return dp->ops->peer_rx_tid_reo_update(dp, peer, rx_tid,
ba_win_sz, ssn, update_ssn);
}
static inline int ath12k_dp_arch_rx_assign_reoq(struct ath12k_dp *dp,
struct ath12k_dp_peer *dp_peer,
struct ath12k_dp_rx_tid *rx_tid,
u16 ssn, enum hal_pn_type pn_type)
{
return dp->ops->rx_assign_reoq(dp->ab, dp_peer, rx_tid, ssn, pn_type);
}
static inline void ath12k_dp_arch_peer_rx_tid_qref_setup(struct ath12k_dp *dp,
u16 peer_id, u16 tid,
dma_addr_t paddr)
{
dp->ops->peer_rx_tid_qref_setup(dp->ab, peer_id, tid, paddr);
}
static inline void ath12k_dp_get_mac_addr(u32 addr_l32, u16 addr_h16, u8 *addr)
{
memcpy(addr, &addr_l32, 4);

View File

@ -431,7 +431,7 @@ void ath12k_dp_rx_tid_del_func(struct ath12k_dp *dp, void *ctx,
*/
spin_unlock_bh(&dp->reo_cmd_lock);
ath12k_wifi7_dp_reo_cache_flush(ab, &elem->data);
ath12k_dp_arch_reo_cache_flush(dp, &elem->data);
kfree(elem);
spin_lock_bh(&dp->reo_cmd_lock);
}
@ -449,18 +449,16 @@ void ath12k_dp_rx_tid_del_func(struct ath12k_dp *dp, void *ctx,
void ath12k_dp_rx_frags_cleanup(struct ath12k_dp_rx_tid *rx_tid,
bool rel_link_desc)
{
enum hal_wbm_rel_bm_act act = HAL_WBM_REL_BM_ACT_PUT_IN_IDLE;
struct ath12k_buffer_addr *buf_addr_info;
struct ath12k_dp *dp = rx_tid->dp;
struct ath12k_base *ab = dp->ab;
lockdep_assert_held(&dp->dp_lock);
if (rx_tid->dst_ring_desc) {
if (rel_link_desc) {
buf_addr_info = &rx_tid->dst_ring_desc->buf_addr_info;
ath12k_wifi7_dp_rx_link_desc_return
(ab, buf_addr_info,
HAL_WBM_REL_BM_ACT_PUT_IN_IDLE);
ath12k_dp_arch_rx_link_desc_return(dp, buf_addr_info, act);
}
kfree(rx_tid->dst_ring_desc);
rx_tid->dst_ring_desc = NULL;
@ -487,7 +485,7 @@ void ath12k_dp_rx_peer_tid_cleanup(struct ath12k *ar, struct ath12k_dp_link_peer
for (i = 0; i <= IEEE80211_NUM_TIDS; i++) {
rx_tid = &peer->dp_peer->rx_tid[i];
ath12k_wifi7_dp_rx_peer_tid_delete(ar, peer, i);
ath12k_dp_arch_rx_peer_tid_delete(dp, peer, i);
ath12k_dp_rx_frags_cleanup(rx_tid, true);
spin_unlock_bh(&dp->dp_lock);
@ -539,8 +537,8 @@ int ath12k_dp_rx_peer_tid_setup(struct ath12k *ar, const u8 *peer_mac, int vdev_
rx_tid = &peer->dp_peer->rx_tid[tid];
/* Update the tid queue if it is already setup */
if (peer->rx_tid_active_bitmask & (1 << tid)) {
ret = ath12k_wifi7_peer_rx_tid_reo_update(ar, peer, rx_tid,
ba_win_sz, ssn, true);
ret = ath12k_dp_arch_peer_rx_tid_reo_update(dp, peer, rx_tid,
ba_win_sz, ssn, true);
spin_unlock_bh(&dp->dp_lock);
if (ret) {
ath12k_warn(ab, "failed to update reo for rx tid %d\n", tid);
@ -567,7 +565,7 @@ int ath12k_dp_rx_peer_tid_setup(struct ath12k *ar, const u8 *peer_mac, int vdev_
rx_tid->ba_win_sz = ba_win_sz;
ret = ath12k_wifi7_dp_rx_assign_reoq(ab, peer->dp_peer, rx_tid, ssn, pn_type);
ret = ath12k_dp_arch_rx_assign_reoq(dp, peer->dp_peer, rx_tid, ssn, pn_type);
if (ret) {
spin_unlock_bh(&dp->dp_lock);
ath12k_warn(ab, "failed to assign reoq buf for rx tid %u\n", tid);
@ -582,11 +580,11 @@ int ath12k_dp_rx_peer_tid_setup(struct ath12k *ar, const u8 *peer_mac, int vdev_
* and tid with qaddr.
*/
if (peer->mlo)
ath12k_wifi7_peer_rx_tid_qref_setup(ab, peer->ml_id, tid,
paddr_aligned);
ath12k_dp_arch_peer_rx_tid_qref_setup(dp, peer->ml_id, tid,
paddr_aligned);
else
ath12k_wifi7_peer_rx_tid_qref_setup(ab, peer->peer_id, tid,
paddr_aligned);
ath12k_dp_arch_peer_rx_tid_qref_setup(dp, peer->peer_id, tid,
paddr_aligned);
spin_unlock_bh(&dp->dp_lock);
} else {
@ -670,8 +668,8 @@ int ath12k_dp_rx_ampdu_stop(struct ath12k *ar,
return 0;
}
ret = ath12k_wifi7_peer_rx_tid_reo_update(ar, peer, peer->dp_peer->rx_tid,
1, 0, false);
ret = ath12k_dp_arch_peer_rx_tid_reo_update(dp, peer, peer->dp_peer->rx_tid,
1, 0, false);
spin_unlock_bh(&dp->dp_lock);
if (ret) {
ath12k_warn(ab, "failed to update reo for rx tid %d: %d\n",
@ -720,11 +718,11 @@ int ath12k_dp_rx_peer_pn_replay_config(struct ath12k_link_vif *arvif,
rx_tid = &peer->dp_peer->rx_tid[tid];
ath12k_wifi7_dp_setup_pn_check_reo_cmd(&cmd, rx_tid, key->cipher,
key_cmd);
ret = ath12k_wifi7_dp_reo_cmd_send(ab, rx_tid,
HAL_REO_CMD_UPDATE_RX_QUEUE,
&cmd, NULL);
ath12k_dp_arch_setup_pn_check_reo_cmd(dp, &cmd, rx_tid, key->cipher,
key_cmd);
ret = ath12k_dp_arch_reo_cmd_send(dp, rx_tid,
HAL_REO_CMD_UPDATE_RX_QUEUE,
&cmd, NULL);
if (ret) {
ath12k_warn(ab, "failed to configure rx tid %d queue of peer %pM for pn replay detection %d\n",
tid, peer_addr, ret);

View File

@ -138,7 +138,15 @@ static int ath12k_wifi7_dp_service_srng(struct ath12k_dp *dp,
static struct ath12k_dp_arch_ops ath12k_wifi7_dp_arch_ops = {
.service_srng = ath12k_wifi7_dp_service_srng,
.dp_tx_get_vdev_bank_config = ath12k_wifi7_dp_tx_get_vdev_bank_config,
.tx_get_vdev_bank_config = ath12k_wifi7_dp_tx_get_vdev_bank_config,
.reo_cmd_send = ath12k_wifi7_dp_reo_cmd_send,
.setup_pn_check_reo_cmd = ath12k_wifi7_dp_setup_pn_check_reo_cmd,
.rx_peer_tid_delete = ath12k_wifi7_dp_rx_peer_tid_delete,
.reo_cache_flush = ath12k_wifi7_dp_reo_cache_flush,
.rx_link_desc_return = ath12k_wifi7_dp_rx_link_desc_return,
.peer_rx_tid_reo_update = ath12k_wifi7_peer_rx_tid_reo_update,
.rx_assign_reoq = ath12k_wifi7_dp_rx_assign_reoq,
.peer_rx_tid_qref_setup = ath12k_wifi7_peer_rx_tid_qref_setup,
};
/* TODO: remove export once this file is built with wifi7 ko */

View File

@ -68,7 +68,7 @@ static void ath12k_wifi7_peer_rx_tid_qref_reset(struct ath12k_base *ab,
u32_encode_bits(tid, DP_REO_QREF_NUM);
}
void ath12k_wifi7_dp_rx_peer_tid_delete(struct ath12k *ar,
void ath12k_wifi7_dp_rx_peer_tid_delete(struct ath12k_base *ab,
struct ath12k_dp_link_peer *peer, u8 tid)
{
struct ath12k_hal_reo_cmd cmd = {};
@ -82,22 +82,22 @@ void ath12k_wifi7_dp_rx_peer_tid_delete(struct ath12k *ar,
cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned);
cmd.addr_hi = upper_32_bits(rx_tid->qbuf.paddr_aligned);
cmd.upd0 = HAL_REO_CMD_UPD0_VLD;
ret = ath12k_wifi7_dp_reo_cmd_send(ar->ab, rx_tid,
ret = ath12k_wifi7_dp_reo_cmd_send(ab, rx_tid,
HAL_REO_CMD_UPDATE_RX_QUEUE, &cmd,
ath12k_dp_rx_tid_del_func);
if (ret) {
ath12k_err(ar->ab, "failed to send HAL_REO_CMD_UPDATE_RX_QUEUE cmd, tid %d (%d)\n",
ath12k_err(ab, "failed to send HAL_REO_CMD_UPDATE_RX_QUEUE cmd, tid %d (%d)\n",
tid, ret);
dma_unmap_single(ar->ab->dev, rx_tid->qbuf.paddr_aligned,
dma_unmap_single(ab->dev, rx_tid->qbuf.paddr_aligned,
rx_tid->qbuf.size, DMA_BIDIRECTIONAL);
kfree(rx_tid->qbuf.vaddr);
rx_tid->qbuf.vaddr = NULL;
}
if (peer->mlo)
ath12k_wifi7_peer_rx_tid_qref_reset(ar->ab, peer->ml_id, tid);
ath12k_wifi7_peer_rx_tid_qref_reset(ab, peer->ml_id, tid);
else
ath12k_wifi7_peer_rx_tid_qref_reset(ar->ab, peer->peer_id, tid);
ath12k_wifi7_peer_rx_tid_qref_reset(ab, peer->peer_id, tid);
peer->rx_tid_active_bitmask &= ~(1 << tid);
}
@ -179,13 +179,14 @@ int ath12k_wifi7_dp_reo_cmd_send(struct ath12k_base *ab,
return 0;
}
int ath12k_wifi7_peer_rx_tid_reo_update(struct ath12k *ar,
int ath12k_wifi7_peer_rx_tid_reo_update(struct ath12k_dp *dp,
struct ath12k_dp_link_peer *peer,
struct ath12k_dp_rx_tid *rx_tid,
u32 ba_win_sz, u16 ssn,
bool update_ssn)
{
struct ath12k_hal_reo_cmd cmd = {};
struct ath12k_base *ab = dp->ab;
int ret;
cmd.addr_lo = lower_32_bits(rx_tid->qbuf.paddr_aligned);
@ -199,11 +200,11 @@ int ath12k_wifi7_peer_rx_tid_reo_update(struct ath12k *ar,
cmd.upd2 = u32_encode_bits(ssn, HAL_REO_CMD_UPD2_SSN);
}
ret = ath12k_wifi7_dp_reo_cmd_send(ar->ab, rx_tid,
ret = ath12k_wifi7_dp_reo_cmd_send(ab, rx_tid,
HAL_REO_CMD_UPDATE_RX_QUEUE, &cmd,
NULL);
if (ret) {
ath12k_warn(ar->ab, "failed to update rx tid queue, tid %d (%d)\n",
ath12k_warn(ab, "failed to update rx tid queue, tid %d (%d)\n",
rx_tid->tid, ret);
return ret;
}

View File

@ -33,7 +33,7 @@ int ath12k_wifi7_dp_rx_link_desc_return(struct ath12k_base *ab,
enum hal_wbm_rel_bm_act action);
void ath12k_wifi7_peer_rx_tid_qref_setup(struct ath12k_base *ab, u16 peer_id, u16 tid,
dma_addr_t paddr);
void ath12k_wifi7_dp_rx_peer_tid_delete(struct ath12k *ar,
void ath12k_wifi7_dp_rx_peer_tid_delete(struct ath12k_base *ab,
struct ath12k_dp_link_peer *peer, u8 tid);
int ath12k_wifi7_dp_reo_cmd_send(struct ath12k_base *ab, struct ath12k_dp_rx_tid *rx_tid,
enum hal_reo_cmd_type type,
@ -42,7 +42,7 @@ int ath12k_wifi7_dp_reo_cmd_send(struct ath12k_base *ab, struct ath12k_dp_rx_tid
enum hal_reo_cmd_status status));
void ath12k_wifi7_dp_reo_cache_flush(struct ath12k_base *ab,
struct ath12k_dp_rx_tid *rx_tid);
int ath12k_wifi7_peer_rx_tid_reo_update(struct ath12k *ar,
int ath12k_wifi7_peer_rx_tid_reo_update(struct ath12k_dp *dp,
struct ath12k_dp_link_peer *peer,
struct ath12k_dp_rx_tid *rx_tid,
u32 ba_win_sz, u16 ssn,