#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"
}
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);
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*/
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
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 {
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);
*/
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);
}
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;
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);
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);
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);
* 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 {
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",
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);
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 */
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 = {};
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);
}
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);
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;
}
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,
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,