qcacmn: Change to remove void pointer usage for HAL SRNG

Add code to remove void pointer usage for hal_srng
and use opaque pointer dp_hal_ring_t instead.

Change-Id: I6907f7376d7fe3c9180b8795bd96f49fead2ec64
CRs-Fixed: 2484404
This commit is contained in:
Akshay Kosigi
2019-06-27 15:26:13 +05:30
committed by nshrivas
parent 91c56523d3
commit 0bca9fb200
20 changed files with 283 additions and 205 deletions

View File

@@ -580,8 +580,8 @@ static int htt_h2t_ver_req_msg(struct htt_soc *soc)
* *
* Return: 0 on success; error code on failure * Return: 0 on success; error code on failure
*/ */
int htt_srng_setup(void *htt_soc, int mac_id, void *hal_srng, int htt_srng_setup(void *htt_soc, int mac_id, hal_ring_handle_t hal_ring_hdl,
int hal_ring_type) int hal_ring_type)
{ {
struct htt_soc *soc = (struct htt_soc *)htt_soc; struct htt_soc *soc = (struct htt_soc *)htt_soc;
struct dp_htt_htc_pkt *pkt; struct dp_htt_htc_pkt *pkt;
@@ -604,9 +604,9 @@ int htt_srng_setup(void *htt_soc, int mac_id, void *hal_srng,
if (!htt_msg) if (!htt_msg)
goto fail0; goto fail0;
hal_get_srng_params(soc->hal_soc, hal_srng, &srng_params); hal_get_srng_params(soc->hal_soc, hal_ring_hdl, &srng_params);
hp_addr = hal_srng_get_hp_addr(soc->hal_soc, hal_srng); hp_addr = hal_srng_get_hp_addr(soc->hal_soc, hal_ring_hdl);
tp_addr = hal_srng_get_tp_addr(soc->hal_soc, hal_srng); tp_addr = hal_srng_get_tp_addr(soc->hal_soc, hal_ring_hdl);
switch (hal_ring_type) { switch (hal_ring_type) {
case RXDMA_BUF: case RXDMA_BUF:
@@ -846,9 +846,10 @@ fail0:
* @htt_tlv_filter: Rx SRNG TLV and filter setting * @htt_tlv_filter: Rx SRNG TLV and filter setting
* Return: 0 on success; error code on failure * Return: 0 on success; error code on failure
*/ */
int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id, void *hal_srng, int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id,
int hal_ring_type, int ring_buf_size, hal_ring_handle_t hal_ring_hdl,
struct htt_rx_ring_tlv_filter *htt_tlv_filter) int hal_ring_type, int ring_buf_size,
struct htt_rx_ring_tlv_filter *htt_tlv_filter)
{ {
struct htt_soc *soc = (struct htt_soc *)htt_soc; struct htt_soc *soc = (struct htt_soc *)htt_soc;
struct dp_htt_htc_pkt *pkt; struct dp_htt_htc_pkt *pkt;
@@ -866,7 +867,7 @@ int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id, void *hal_srng,
if (!htt_msg) if (!htt_msg)
goto fail0; goto fail0;
hal_get_srng_params(soc->hal_soc, hal_srng, &srng_params); hal_get_srng_params(soc->hal_soc, hal_ring_hdl, &srng_params);
switch (hal_ring_type) { switch (hal_ring_type) {
case RXDMA_BUF: case RXDMA_BUF:

View File

@@ -266,8 +266,8 @@ QDF_STATUS htt_soc_htc_prealloc(struct htt_soc *htt_soc);
void htt_soc_detach(void *soc); void htt_soc_detach(void *soc);
int htt_srng_setup(void *htt_soc, int pdev_id, void *hal_srng, int htt_srng_setup(void *htt_soc, int pdev_id, hal_ring_handle_t hal_ring_hdl,
int hal_ring_type); int hal_ring_type);
int htt_soc_attach_target(void *htt_soc); int htt_soc_attach_target(void *htt_soc);
@@ -283,9 +283,10 @@ int htt_soc_attach_target(void *htt_soc);
* *
* Return: 0 on success; error code on failure * Return: 0 on success; error code on failure
*/ */
int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id, void *hal_srng, int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id,
int hal_ring_type, int ring_buf_size, hal_ring_handle_t hal_ring_hdl,
struct htt_rx_ring_tlv_filter *htt_tlv_filter); int hal_ring_type, int ring_buf_size,
struct htt_rx_ring_tlv_filter *htt_tlv_filter);
/* /*
* htt_t2h_stats_handler() - target to host stats work handler * htt_t2h_stats_handler() - target to host stats work handler

View File

@@ -1214,7 +1214,7 @@ static inline void dp_peer_unref_del_find_by_id(struct dp_peer *peer)
* Return: 0 on success; error on failure * Return: 0 on success; error on failure
*/ */
int dp_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *dp_soc, int dp_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *dp_soc,
void *hal_ring); hal_ring_handle_t hal_ring_hdl);
/** /**
* dp_srng_access_end() - Wrapper function to log access end of a hal ring * dp_srng_access_end() - Wrapper function to log access end of a hal ring
@@ -1225,24 +1225,26 @@ int dp_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *dp_soc,
* Return: void * Return: void
*/ */
void dp_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *dp_soc, void dp_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *dp_soc,
void *hal_ring); hal_ring_handle_t hal_ring_hdl);
#else #else
static inline int dp_srng_access_start(struct dp_intr *int_ctx, static inline int dp_srng_access_start(struct dp_intr *int_ctx,
struct dp_soc *dp_soc, void *hal_ring) struct dp_soc *dp_soc,
hal_ring_handle_t hal_ring_hdl)
{ {
void *hal_soc = dp_soc->hal_soc; void *hal_soc = dp_soc->hal_soc;
return hal_srng_access_start(hal_soc, hal_ring); return hal_srng_access_start(hal_soc, hal_ring_hdl);
} }
static inline void dp_srng_access_end(struct dp_intr *int_ctx, static inline void dp_srng_access_end(struct dp_intr *int_ctx,
struct dp_soc *dp_soc, void *hal_ring) struct dp_soc *dp_soc,
hal_ring_handle_t hal_ring_hdl)
{ {
void *hal_soc = dp_soc->hal_soc; void *hal_soc = dp_soc->hal_soc;
return hal_srng_access_end(hal_soc, hal_ring); return hal_srng_access_end(hal_soc, hal_ring_hdl);
} }
#endif /* WLAN_FEATURE_DP_EVENT_HISTORY */ #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */

View File

@@ -258,7 +258,8 @@ static int dp_tx_ipa_uc_attach(struct dp_soc *soc, struct dp_pdev *pdev)
unsigned int uc_tx_buf_sz = CFG_IPA_UC_TX_BUF_SIZE_DEFAULT; unsigned int uc_tx_buf_sz = CFG_IPA_UC_TX_BUF_SIZE_DEFAULT;
unsigned int alloc_size = uc_tx_buf_sz + ring_base_align - 1; unsigned int alloc_size = uc_tx_buf_sz + ring_base_align - 1;
hal_get_srng_params(soc->hal_soc, (void *)wbm_srng, &srng_params); hal_get_srng_params(soc->hal_soc, hal_srng_to_hal_ring_handle(wbm_srng),
&srng_params);
num_entries = srng_params.num_entries; num_entries = srng_params.num_entries;
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
@@ -275,7 +276,8 @@ static int dp_tx_ipa_uc_attach(struct dp_soc *soc, struct dp_pdev *pdev)
return -ENOMEM; return -ENOMEM;
} }
hal_srng_access_start_unlocked(soc->hal_soc, (void *)wbm_srng); hal_srng_access_start_unlocked(soc->hal_soc,
hal_srng_to_hal_ring_handle(wbm_srng));
/* /*
* Allocate Tx buffers as many as possible * Allocate Tx buffers as many as possible
@@ -290,7 +292,7 @@ static int dp_tx_ipa_uc_attach(struct dp_soc *soc, struct dp_pdev *pdev)
break; break;
ring_entry = hal_srng_dst_get_next_hp(soc->hal_soc, ring_entry = hal_srng_dst_get_next_hp(soc->hal_soc,
(void *)wbm_srng); hal_srng_to_hal_ring_handle(wbm_srng));
if (!ring_entry) { if (!ring_entry) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
"%s: Failed to get WBM ring entry", "%s: Failed to get WBM ring entry",
@@ -404,7 +406,8 @@ int dp_ipa_ring_resource_setup(struct dp_soc *soc,
/* IPA TCL_DATA Ring - HAL_SRNG_SW2TCL3 */ /* IPA TCL_DATA Ring - HAL_SRNG_SW2TCL3 */
hal_srng = soc->tcl_data_ring[IPA_TCL_DATA_RING_IDX].hal_srng; hal_srng = soc->tcl_data_ring[IPA_TCL_DATA_RING_IDX].hal_srng;
hal_get_srng_params(hal_soc, (void *)hal_srng, &srng_params); hal_get_srng_params(hal_soc, hal_srng_to_hal_ring_handle(hal_srng),
&srng_params);
soc->ipa_uc_tx_rsc.ipa_tcl_ring_base_paddr = soc->ipa_uc_tx_rsc.ipa_tcl_ring_base_paddr =
srng_params.ring_base_paddr; srng_params.ring_base_paddr;
@@ -435,7 +438,8 @@ int dp_ipa_ring_resource_setup(struct dp_soc *soc,
/* IPA TX COMP Ring - HAL_SRNG_WBM2SW2_RELEASE */ /* IPA TX COMP Ring - HAL_SRNG_WBM2SW2_RELEASE */
hal_srng = soc->tx_comp_ring[IPA_TX_COMP_RING_IDX].hal_srng; hal_srng = soc->tx_comp_ring[IPA_TX_COMP_RING_IDX].hal_srng;
hal_get_srng_params(hal_soc, (void *)hal_srng, &srng_params); hal_get_srng_params(hal_soc, hal_srng_to_hal_ring_handle(hal_srng),
&srng_params);
soc->ipa_uc_tx_rsc.ipa_wbm_ring_base_paddr = soc->ipa_uc_tx_rsc.ipa_wbm_ring_base_paddr =
srng_params.ring_base_paddr; srng_params.ring_base_paddr;
@@ -459,7 +463,8 @@ int dp_ipa_ring_resource_setup(struct dp_soc *soc,
/* IPA REO_DEST Ring - HAL_SRNG_REO2SW4 */ /* IPA REO_DEST Ring - HAL_SRNG_REO2SW4 */
hal_srng = soc->reo_dest_ring[IPA_REO_DEST_RING_IDX].hal_srng; hal_srng = soc->reo_dest_ring[IPA_REO_DEST_RING_IDX].hal_srng;
hal_get_srng_params(hal_soc, (void *)hal_srng, &srng_params); hal_get_srng_params(hal_soc, hal_srng_to_hal_ring_handle(hal_srng),
&srng_params);
soc->ipa_uc_rx_rsc.ipa_reo_ring_base_paddr = soc->ipa_uc_rx_rsc.ipa_reo_ring_base_paddr =
srng_params.ring_base_paddr; srng_params.ring_base_paddr;
@@ -482,14 +487,16 @@ int dp_ipa_ring_resource_setup(struct dp_soc *soc,
soc->ipa_uc_rx_rsc.ipa_reo_ring_size); soc->ipa_uc_rx_rsc.ipa_reo_ring_size);
hal_srng = pdev->rx_refill_buf_ring2.hal_srng; hal_srng = pdev->rx_refill_buf_ring2.hal_srng;
hal_get_srng_params(hal_soc, (void *)hal_srng, &srng_params); hal_get_srng_params(hal_soc, hal_srng_to_hal_ring_handle(hal_srng),
&srng_params);
soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_ring_base_paddr = soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_ring_base_paddr =
srng_params.ring_base_paddr; srng_params.ring_base_paddr;
soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_ring_base_vaddr = soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_ring_base_vaddr =
srng_params.ring_base_vaddr; srng_params.ring_base_vaddr;
soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_ring_size = soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_ring_size =
(srng_params.num_entries * srng_params.entry_size) << 2; (srng_params.num_entries * srng_params.entry_size) << 2;
hp_addr = hal_srng_get_hp_addr(hal_soc, (void *)hal_srng); hp_addr = hal_srng_get_hp_addr(hal_soc,
hal_srng_to_hal_ring_handle(hal_srng));
soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_hp_paddr = soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_hp_paddr =
qdf_mem_paddr_from_dmaaddr(soc->osdev, hp_addr); qdf_mem_paddr_from_dmaaddr(soc->osdev, hp_addr);

View File

@@ -1416,35 +1416,35 @@ void *hif_get_hal_handle(void *hif_handle);
#ifdef WLAN_FEATURE_DP_EVENT_HISTORY #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
int dp_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *dp_soc, int dp_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *dp_soc,
void *hal_ring) hal_ring_handle_t hal_ring_hdl)
{ {
void *hal_soc = dp_soc->hal_soc; void *hal_soc = dp_soc->hal_soc;
uint32_t hp, tp; uint32_t hp, tp;
uint8_t ring_id; uint8_t ring_id;
hal_get_sw_hptp(hal_soc, hal_ring, &tp, &hp); hal_get_sw_hptp(hal_soc, hal_ring_hdl, &tp, &hp);
ring_id = hal_srng_ring_id_get(hal_ring); ring_id = hal_srng_ring_id_get(hal_ring_hdl);
hif_record_event(dp_soc->hif_handle, int_ctx->dp_intr_id, hif_record_event(dp_soc->hif_handle, int_ctx->dp_intr_id,
ring_id, hp, tp, HIF_EVENT_SRNG_ACCESS_START); ring_id, hp, tp, HIF_EVENT_SRNG_ACCESS_START);
return hal_srng_access_start(hal_soc, hal_ring); return hal_srng_access_start(hal_soc, hal_ring_hdl);
} }
void dp_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *dp_soc, void dp_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *dp_soc,
void *hal_ring) hal_ring_handle_t hal_ring_hdl)
{ {
void *hal_soc = dp_soc->hal_soc; void *hal_soc = dp_soc->hal_soc;
uint32_t hp, tp; uint32_t hp, tp;
uint8_t ring_id; uint8_t ring_id;
hal_get_sw_hptp(hal_soc, hal_ring, &tp, &hp); hal_get_sw_hptp(hal_soc, hal_ring_hdl, &tp, &hp);
ring_id = hal_srng_ring_id_get(hal_ring); ring_id = hal_srng_ring_id_get(hal_ring_hdl);
hif_record_event(dp_soc->hif_handle, int_ctx->dp_intr_id, hif_record_event(dp_soc->hif_handle, int_ctx->dp_intr_id,
ring_id, hp, tp, HIF_EVENT_SRNG_ACCESS_END); ring_id, hp, tp, HIF_EVENT_SRNG_ACCESS_END);
return hal_srng_access_end(hal_soc, hal_ring); return hal_srng_access_end(hal_soc, hal_ring_hdl);
} }
#endif /* WLAN_FEATURE_DP_EVENT_HISTORY */ #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */

View File

@@ -55,15 +55,16 @@ void dp_rx_dump_info_and_assert(struct dp_soc *soc, void *hal_ring,
dp_rx_desc_dump(rx_desc); dp_rx_desc_dump(rx_desc);
} }
#else #else
void dp_rx_dump_info_and_assert(struct dp_soc *soc, void *hal_ring, void dp_rx_dump_info_and_assert(struct dp_soc *soc,
hal_ring_handle_t hal_ring_hdl,
hal_ring_desc_t ring_desc, hal_ring_desc_t ring_desc,
struct dp_rx_desc *rx_desc) struct dp_rx_desc *rx_desc)
{ {
void *hal_soc = soc->hal_soc; void *hal_soc = soc->hal_soc;
dp_rx_desc_dump(rx_desc); dp_rx_desc_dump(rx_desc);
hal_srng_dump_ring_desc(hal_soc, hal_ring, ring_desc); hal_srng_dump_ring_desc(hal_soc, hal_ring_hdl, ring_desc);
hal_srng_dump_ring(hal_soc, hal_ring); hal_srng_dump_ring(hal_soc, hal_ring_hdl);
qdf_assert_always(0); qdf_assert_always(0);
} }
#endif #endif
@@ -1618,7 +1619,7 @@ void dp_rx_deliver_to_stack_no_peer(struct dp_soc *soc, qdf_nbuf_t nbuf)
* *
* Return: uint32_t: No. of elements processed * Return: uint32_t: No. of elements processed
*/ */
uint32_t dp_rx_process(struct dp_intr *int_ctx, void *hal_ring, uint32_t dp_rx_process(struct dp_intr *int_ctx, hal_ring_handle_t hal_ring_hdl,
uint8_t reo_ring_num, uint32_t quota) uint8_t reo_ring_num, uint32_t quota)
{ {
void *hal_soc; void *hal_soc;
@@ -1662,7 +1663,7 @@ uint32_t dp_rx_process(struct dp_intr *int_ctx, void *hal_ring,
DP_HIST_INIT(); DP_HIST_INIT();
qdf_assert_always(soc && hal_ring); qdf_assert_always(soc && hal_ring_hdl);
hal_soc = soc->hal_soc; hal_soc = soc->hal_soc;
qdf_assert_always(hal_soc); qdf_assert_always(hal_soc);
@@ -1686,7 +1687,7 @@ more_data:
qdf_mem_zero(head, sizeof(head)); qdf_mem_zero(head, sizeof(head));
qdf_mem_zero(tail, sizeof(tail)); qdf_mem_zero(tail, sizeof(tail));
if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, hal_ring))) { if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, hal_ring_hdl))) {
/* /*
* Need API to convert from hal_ring pointer to * Need API to convert from hal_ring pointer to
@@ -1694,7 +1695,7 @@ more_data:
*/ */
DP_STATS_INC(soc, rx.err.hal_ring_access_fail, 1); DP_STATS_INC(soc, rx.err.hal_ring_access_fail, 1);
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
FL("HAL RING Access Failed -- %pK"), hal_ring); FL("HAL RING Access Failed -- %pK"), hal_ring_hdl);
goto done; goto done;
} }
@@ -1704,14 +1705,15 @@ more_data:
* Process the received pkts in a different per vdev loop. * Process the received pkts in a different per vdev loop.
*/ */
while (qdf_likely(quota && while (qdf_likely(quota &&
(ring_desc = hal_srng_dst_peek(hal_soc, hal_ring)))) { (ring_desc = hal_srng_dst_peek(hal_soc,
hal_ring_hdl)))) {
error = HAL_RX_ERROR_STATUS_GET(ring_desc); error = HAL_RX_ERROR_STATUS_GET(ring_desc);
ring_id = hal_srng_ring_id_get(hal_ring); ring_id = hal_srng_ring_id_get(hal_ring_hdl);
if (qdf_unlikely(error == HAL_REO_ERROR_DETECTED)) { if (qdf_unlikely(error == HAL_REO_ERROR_DETECTED)) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
FL("HAL RING 0x%pK:error %d"), hal_ring, error); FL("HAL RING 0x%pK:error %d"), hal_ring_hdl, error);
DP_STATS_INC(soc, rx.err.hal_reo_error[ring_id], 1); DP_STATS_INC(soc, rx.err.hal_reo_error[ring_id], 1);
/* Don't know how to deal with this -- assert */ /* Don't know how to deal with this -- assert */
qdf_assert(0); qdf_assert(0);
@@ -1732,18 +1734,18 @@ more_data:
if (qdf_unlikely(!rx_desc->in_use)) { if (qdf_unlikely(!rx_desc->in_use)) {
DP_STATS_INC(soc, rx.err.hal_reo_dest_dup, 1); DP_STATS_INC(soc, rx.err.hal_reo_dest_dup, 1);
dp_info_rl("Reaping rx_desc not in use!"); dp_info_rl("Reaping rx_desc not in use!");
dp_rx_dump_info_and_assert(soc, hal_ring, dp_rx_dump_info_and_assert(soc, hal_ring_hdl,
ring_desc, rx_desc); ring_desc, rx_desc);
/* ignore duplicate RX desc and continue to process */ /* ignore duplicate RX desc and continue to process */
/* Pop out the descriptor */ /* Pop out the descriptor */
hal_srng_dst_get_next(hal_soc, hal_ring); hal_srng_dst_get_next(hal_soc, hal_ring_hdl);
continue; continue;
} }
if (qdf_unlikely(!dp_rx_desc_check_magic(rx_desc))) { if (qdf_unlikely(!dp_rx_desc_check_magic(rx_desc))) {
dp_err("Invalid rx_desc cookie=%d", rx_buf_cookie); dp_err("Invalid rx_desc cookie=%d", rx_buf_cookie);
DP_STATS_INC(soc, rx.err.rx_desc_invalid_magic, 1); DP_STATS_INC(soc, rx.err.rx_desc_invalid_magic, 1);
dp_rx_dump_info_and_assert(soc, hal_ring, dp_rx_dump_info_and_assert(soc, hal_ring_hdl,
ring_desc, rx_desc); ring_desc, rx_desc);
} }
@@ -1776,7 +1778,8 @@ more_data:
is_prev_msdu_last = false; is_prev_msdu_last = false;
/* Get number of entries available in HW ring */ /* Get number of entries available in HW ring */
num_entries_avail = num_entries_avail =
hal_srng_dst_num_valid(hal_soc, hal_ring, 1); hal_srng_dst_num_valid(hal_soc,
hal_ring_hdl, 1);
/* For new MPDU check if we can read complete /* For new MPDU check if we can read complete
* MPDU by comparing the number of buffers * MPDU by comparing the number of buffers
@@ -1796,7 +1799,7 @@ more_data:
} }
/* Pop out the descriptor*/ /* Pop out the descriptor*/
hal_srng_dst_get_next(hal_soc, hal_ring); hal_srng_dst_get_next(hal_soc, hal_ring_hdl);
rx_bufs_reaped[rx_desc->pool_id]++; rx_bufs_reaped[rx_desc->pool_id]++;
peer_mdata = mpdu_desc_info.peer_meta_data; peer_mdata = mpdu_desc_info.peer_meta_data;
@@ -1855,7 +1858,7 @@ more_data:
break; break;
} }
done: done:
dp_srng_access_end(int_ctx, soc, hal_ring); dp_srng_access_end(int_ctx, soc, hal_ring_hdl);
if (nbuf_tail) if (nbuf_tail)
QDF_NBUF_CB_RX_FLUSH_IND(nbuf_tail) = 1; QDF_NBUF_CB_RX_FLUSH_IND(nbuf_tail) = 1;
@@ -2133,7 +2136,7 @@ done:
if (dp_rx_enable_eol_data_check(soc)) { if (dp_rx_enable_eol_data_check(soc)) {
if (quota && if (quota &&
hal_srng_dst_peek_sync_locked(soc, hal_ring)) { hal_srng_dst_peek_sync_locked(soc, hal_ring_hdl)) {
DP_STATS_INC(soc, rx.hp_oos2, 1); DP_STATS_INC(soc, rx.hp_oos2, 1);
if (!hif_exec_should_yield(scn, intr_id)) if (!hif_exec_should_yield(scn, intr_id))
goto more_data; goto more_data;

View File

@@ -460,7 +460,8 @@ void dp_rx_pdev_detach(struct dp_pdev *pdev);
uint32_t uint32_t
dp_rx_process(struct dp_intr *int_ctx, void *hal_ring, uint8_t reo_ring_num, dp_rx_process(struct dp_intr *int_ctx, hal_ring_handle_t hal_ring_hdl,
uint8_t reo_ring_num,
uint32_t quota); uint32_t quota);
/** /**
@@ -476,7 +477,7 @@ dp_rx_process(struct dp_intr *int_ctx, void *hal_ring, uint8_t reo_ring_num,
* Return: uint32_t: No. of elements processed * Return: uint32_t: No. of elements processed
*/ */
uint32_t dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc, uint32_t dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
void *hal_ring, uint32_t quota); hal_ring_handle_t hal_ring_hdl, uint32_t quota);
/** /**
* dp_rx_wbm_err_process() - Processes error frames routed to WBM release ring * dp_rx_wbm_err_process() - Processes error frames routed to WBM release ring
@@ -492,7 +493,7 @@ uint32_t dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
*/ */
uint32_t uint32_t
dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc, dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
void *hal_ring, uint32_t quota); hal_ring_handle_t hal_ring_hdl, uint32_t quota);
/** /**
* dp_rx_sg_create() - create a frag_list for MSDUs which are spread across * dp_rx_sg_create() - create a frag_list for MSDUs which are spread across
@@ -1184,7 +1185,8 @@ dp_rx_nbuf_prepare(struct dp_soc *soc, struct dp_pdev *pdev);
* *
* Return: void * Return: void
*/ */
void dp_rx_dump_info_and_assert(struct dp_soc *soc, void *hal_ring, void dp_rx_dump_info_and_assert(struct dp_soc *soc,
hal_ring_handle_t hal_ring_hdl,
hal_ring_desc_t ring_desc, hal_ring_desc_t ring_desc,
struct dp_rx_desc *rx_desc); struct dp_rx_desc *rx_desc);

View File

@@ -1089,7 +1089,7 @@ fail:
uint32_t uint32_t
dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc, dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
void *hal_ring, uint32_t quota) hal_ring_handle_t hal_ring_hdl, uint32_t quota)
{ {
void *hal_soc; void *hal_soc;
hal_ring_desc_t ring_desc; hal_ring_desc_t ring_desc;
@@ -1111,14 +1111,14 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
struct dp_rx_desc *rx_desc = NULL; struct dp_rx_desc *rx_desc = NULL;
/* Debug -- Remove later */ /* Debug -- Remove later */
qdf_assert(soc && hal_ring); qdf_assert(soc && hal_ring_hdl);
hal_soc = soc->hal_soc; hal_soc = soc->hal_soc;
/* Debug -- Remove later */ /* Debug -- Remove later */
qdf_assert(hal_soc); qdf_assert(hal_soc);
if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, hal_ring))) { if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, hal_ring_hdl))) {
/* TODO */ /* TODO */
/* /*
@@ -1127,12 +1127,13 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
*/ */
DP_STATS_INC(soc, rx.err.hal_ring_access_fail, 1); DP_STATS_INC(soc, rx.err.hal_ring_access_fail, 1);
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
FL("HAL RING Access Failed -- %pK"), hal_ring); FL("HAL RING Access Failed -- %pK"), hal_ring_hdl);
goto done; goto done;
} }
while (qdf_likely(quota-- && (ring_desc = while (qdf_likely(quota-- && (ring_desc =
hal_srng_dst_get_next(hal_soc, hal_ring)))) { hal_srng_dst_get_next(hal_soc,
hal_ring_hdl)))) {
DP_STATS_INC(soc, rx.err_ring_pkts, 1); DP_STATS_INC(soc, rx.err_ring_pkts, 1);
@@ -1246,7 +1247,7 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
} }
done: done:
dp_srng_access_end(int_ctx, soc, hal_ring); dp_srng_access_end(int_ctx, soc, hal_ring_hdl);
if (soc->rx.flags.defrag_timeout_check) { if (soc->rx.flags.defrag_timeout_check) {
uint32_t now_ms = uint32_t now_ms =
@@ -1276,7 +1277,7 @@ done:
uint32_t uint32_t
dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc, dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
void *hal_ring, uint32_t quota) hal_ring_handle_t hal_ring_hdl, uint32_t quota)
{ {
void *hal_soc; void *hal_soc;
hal_ring_desc_t ring_desc; hal_ring_desc_t ring_desc;
@@ -1300,14 +1301,14 @@ dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
uint8_t tid = 0; uint8_t tid = 0;
/* Debug -- Remove later */ /* Debug -- Remove later */
qdf_assert(soc && hal_ring); qdf_assert(soc && hal_ring_hdl);
hal_soc = soc->hal_soc; hal_soc = soc->hal_soc;
/* Debug -- Remove later */ /* Debug -- Remove later */
qdf_assert(hal_soc); qdf_assert(hal_soc);
if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, hal_ring))) { if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, hal_ring_hdl))) {
/* TODO */ /* TODO */
/* /*
@@ -1315,12 +1316,13 @@ dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
* Ring Type / Ring Id combo * Ring Type / Ring Id combo
*/ */
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
FL("HAL RING Access Failed -- %pK"), hal_ring); FL("HAL RING Access Failed -- %pK"), hal_ring_hdl);
goto done; goto done;
} }
while (qdf_likely(quota-- && (ring_desc = while (qdf_likely(quota-- && (ring_desc =
hal_srng_dst_get_next(hal_soc, hal_ring)))) { hal_srng_dst_get_next(hal_soc,
hal_ring_hdl)))) {
/* XXX */ /* XXX */
buf_type = HAL_RX_WBM_BUF_TYPE_GET(ring_desc); buf_type = HAL_RX_WBM_BUF_TYPE_GET(ring_desc);
@@ -1370,7 +1372,7 @@ dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
*/ */
if (qdf_unlikely(!rx_desc->in_use)) { if (qdf_unlikely(!rx_desc->in_use)) {
DP_STATS_INC(soc, rx.err.hal_wbm_rel_dup, 1); DP_STATS_INC(soc, rx.err.hal_wbm_rel_dup, 1);
dp_rx_dump_info_and_assert(soc, hal_ring, dp_rx_dump_info_and_assert(soc, hal_ring_hdl,
ring_desc, rx_desc); ring_desc, rx_desc);
} }
@@ -1394,7 +1396,7 @@ dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
rx_desc); rx_desc);
} }
done: done:
dp_srng_access_end(int_ctx, soc, hal_ring); dp_srng_access_end(int_ctx, soc, hal_ring_hdl);
for (mac_id = 0; mac_id < MAX_PDEV_CNT; mac_id++) { for (mac_id = 0; mac_id < MAX_PDEV_CNT; mac_id++) {
if (rx_bufs_reaped[mac_id]) { if (rx_bufs_reaped[mac_id]) {

View File

@@ -58,7 +58,7 @@ dp_rx_mon_link_desc_return(struct dp_pdev *dp_pdev,
void *buf_addr_info, int mac_id) void *buf_addr_info, int mac_id)
{ {
struct dp_srng *dp_srng; struct dp_srng *dp_srng;
void *hal_srng; hal_ring_handle_t hal_ring_hdl;
void *hal_soc; void *hal_soc;
QDF_STATUS status = QDF_STATUS_E_FAILURE; QDF_STATUS status = QDF_STATUS_E_FAILURE;
void *src_srng_desc; void *src_srng_desc;
@@ -67,11 +67,11 @@ dp_rx_mon_link_desc_return(struct dp_pdev *dp_pdev,
hal_soc = dp_pdev->soc->hal_soc; hal_soc = dp_pdev->soc->hal_soc;
dp_srng = &dp_pdev->rxdma_mon_desc_ring[mac_for_pdev]; dp_srng = &dp_pdev->rxdma_mon_desc_ring[mac_for_pdev];
hal_srng = dp_srng->hal_srng; hal_ring_hdl = dp_srng->hal_srng;
qdf_assert(hal_srng); qdf_assert(hal_ring_hdl);
if (qdf_unlikely(hal_srng_access_start(hal_soc, hal_srng))) { if (qdf_unlikely(hal_srng_access_start(hal_soc, hal_ring_hdl))) {
/* TODO */ /* TODO */
/* /*
@@ -81,11 +81,11 @@ dp_rx_mon_link_desc_return(struct dp_pdev *dp_pdev,
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s %d : \ "%s %d : \
HAL RING Access For WBM Release SRNG Failed -- %pK", HAL RING Access For WBM Release SRNG Failed -- %pK",
__func__, __LINE__, hal_srng); __func__, __LINE__, hal_ring_hdl);
goto done; goto done;
} }
src_srng_desc = hal_srng_src_get_next(hal_soc, hal_srng); src_srng_desc = hal_srng_src_get_next(hal_soc, hal_ring_hdl);
if (qdf_likely(src_srng_desc)) { if (qdf_likely(src_srng_desc)) {
/* Return link descriptor through WBM ring (SW2WBM)*/ /* Return link descriptor through WBM ring (SW2WBM)*/
@@ -98,7 +98,7 @@ dp_rx_mon_link_desc_return(struct dp_pdev *dp_pdev,
__func__, __LINE__); __func__, __LINE__);
} }
done: done:
hal_srng_access_end(hal_soc, hal_srng); hal_srng_access_end(hal_soc, hal_ring_hdl);
return status; return status;
} }

View File

@@ -1000,7 +1000,7 @@ static QDF_STATUS dp_tx_hw_enqueue(struct dp_soc *soc, struct dp_vdev *vdev,
/* Return Buffer Manager ID */ /* Return Buffer Manager ID */
uint8_t bm_id = ring_id; uint8_t bm_id = ring_id;
void *hal_srng = soc->tcl_data_ring[ring_id].hal_srng; hal_ring_handle_t hal_ring_hdl = soc->tcl_data_ring[ring_id].hal_srng;
hal_tx_desc_cached = (void *) cached_desc; hal_tx_desc_cached = (void *) cached_desc;
qdf_mem_zero(hal_tx_desc_cached, HAL_TX_DESC_LEN_BYTES); qdf_mem_zero(hal_tx_desc_cached, HAL_TX_DESC_LEN_BYTES);
@@ -1064,7 +1064,7 @@ static QDF_STATUS dp_tx_hw_enqueue(struct dp_soc *soc, struct dp_vdev *vdev,
tx_desc->timestamp = qdf_ktime_to_ms(qdf_ktime_get()); tx_desc->timestamp = qdf_ktime_to_ms(qdf_ktime_get());
/* Sync cached descriptor with HW */ /* Sync cached descriptor with HW */
hal_tx_desc = hal_srng_src_get_next(soc->hal_soc, hal_srng); hal_tx_desc = hal_srng_src_get_next(soc->hal_soc, hal_ring_hdl);
if (!hal_tx_desc) { if (!hal_tx_desc) {
dp_verbose_debug("TCL ring full ring_id:%d", ring_id); dp_verbose_debug("TCL ring full ring_id:%d", ring_id);
@@ -1422,7 +1422,8 @@ static qdf_nbuf_t dp_tx_send_msdu_single(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
struct dp_tx_desc_s *tx_desc; struct dp_tx_desc_s *tx_desc;
QDF_STATUS status; QDF_STATUS status;
struct dp_tx_queue *tx_q = &(msdu_info->tx_queue); struct dp_tx_queue *tx_q = &(msdu_info->tx_queue);
void *hal_srng = soc->tcl_data_ring[tx_q->ring_id].hal_srng; hal_ring_handle_t hal_ring_hdl =
soc->tcl_data_ring[tx_q->ring_id].hal_srng;
uint16_t htt_tcl_metadata = 0; uint16_t htt_tcl_metadata = 0;
uint8_t tid = msdu_info->tid; uint8_t tid = msdu_info->tid;
struct cdp_tid_tx_stats *tid_stats = NULL; struct cdp_tid_tx_stats *tid_stats = NULL;
@@ -1450,10 +1451,10 @@ static qdf_nbuf_t dp_tx_send_msdu_single(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
dp_tx_update_tdls_flags(tx_desc); dp_tx_update_tdls_flags(tx_desc);
if (qdf_unlikely(hal_srng_access_start(soc->hal_soc, hal_srng))) { if (qdf_unlikely(hal_srng_access_start(soc->hal_soc, hal_ring_hdl))) {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s %d : HAL RING Access Failed -- %pK", "%s %d : HAL RING Access Failed -- %pK",
__func__, __LINE__, hal_srng); __func__, __LINE__, hal_ring_hdl);
dp_tx_get_tid(vdev, nbuf, msdu_info); dp_tx_get_tid(vdev, nbuf, msdu_info);
tid_stats = &pdev->stats.tid_stats. tid_stats = &pdev->stats.tid_stats.
tid_tx_stats[tx_q->ring_id][tid]; tid_tx_stats[tx_q->ring_id][tid];
@@ -1501,10 +1502,10 @@ static qdf_nbuf_t dp_tx_send_msdu_single(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
fail_return: fail_return:
if (hif_pm_runtime_get(soc->hif_handle) == 0) { if (hif_pm_runtime_get(soc->hif_handle) == 0) {
hal_srng_access_end(soc->hal_soc, hal_srng); hal_srng_access_end(soc->hal_soc, hal_ring_hdl);
hif_pm_runtime_put(soc->hif_handle); hif_pm_runtime_put(soc->hif_handle);
} else { } else {
hal_srng_access_end_reap(soc->hal_soc, hal_srng); hal_srng_access_end_reap(soc->hal_soc, hal_ring_hdl);
} }
return nbuf; return nbuf;
@@ -1536,13 +1537,14 @@ qdf_nbuf_t dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
QDF_STATUS status; QDF_STATUS status;
uint16_t htt_tcl_metadata = 0; uint16_t htt_tcl_metadata = 0;
struct dp_tx_queue *tx_q = &msdu_info->tx_queue; struct dp_tx_queue *tx_q = &msdu_info->tx_queue;
void *hal_srng = soc->tcl_data_ring[tx_q->ring_id].hal_srng; hal_ring_handle_t hal_ring_hdl =
soc->tcl_data_ring[tx_q->ring_id].hal_srng;
struct cdp_tid_tx_stats *tid_stats = NULL; struct cdp_tid_tx_stats *tid_stats = NULL;
if (qdf_unlikely(hal_srng_access_start(soc->hal_soc, hal_srng))) { if (qdf_unlikely(hal_srng_access_start(soc->hal_soc, hal_ring_hdl))) {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s %d : HAL RING Access Failed -- %pK", "%s %d : HAL RING Access Failed -- %pK",
__func__, __LINE__, hal_srng); __func__, __LINE__, hal_ring_hdl);
dp_tx_get_tid(vdev, nbuf, msdu_info); dp_tx_get_tid(vdev, nbuf, msdu_info);
tid_stats = &pdev->stats.tid_stats. tid_stats = &pdev->stats.tid_stats.
tid_tx_stats[tx_q->ring_id][msdu_info->tid]; tid_tx_stats[tx_q->ring_id][msdu_info->tid];
@@ -1670,10 +1672,10 @@ qdf_nbuf_t dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
done: done:
if (hif_pm_runtime_get(soc->hif_handle) == 0) { if (hif_pm_runtime_get(soc->hif_handle) == 0) {
hal_srng_access_end(soc->hal_soc, hal_srng); hal_srng_access_end(soc->hal_soc, hal_ring_hdl);
hif_pm_runtime_put(soc->hif_handle); hif_pm_runtime_put(soc->hif_handle);
} else { } else {
hal_srng_access_end_reap(soc->hal_soc, hal_srng); hal_srng_access_end_reap(soc->hal_soc, hal_ring_hdl);
} }
return nbuf; return nbuf;
@@ -3312,7 +3314,8 @@ static inline bool dp_tx_comp_enable_eol_data_check(struct dp_soc *soc)
#endif #endif
uint32_t dp_tx_comp_handler(struct dp_intr *int_ctx, struct dp_soc *soc, uint32_t dp_tx_comp_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
void *hal_srng, uint8_t ring_id, uint32_t quota) hal_ring_handle_t hal_ring_hdl, uint8_t ring_id,
uint32_t quota)
{ {
void *tx_comp_hal_desc; void *tx_comp_hal_desc;
uint8_t buffer_src; uint8_t buffer_src;
@@ -3331,16 +3334,16 @@ more_data:
/* Re-initialize local variables to be re-used */ /* Re-initialize local variables to be re-used */
head_desc = NULL; head_desc = NULL;
tail_desc = NULL; tail_desc = NULL;
if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, hal_srng))) { if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, hal_ring_hdl))) {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"%s %d : HAL RING Access Failed -- %pK", "%s %d : HAL RING Access Failed -- %pK",
__func__, __LINE__, hal_srng); __func__, __LINE__, hal_ring_hdl);
return 0; return 0;
} }
/* Find head descriptor from completion ring */ /* Find head descriptor from completion ring */
while (qdf_likely(tx_comp_hal_desc = while (qdf_likely(tx_comp_hal_desc =
hal_srng_dst_get_next(soc->hal_soc, hal_srng))) { hal_srng_dst_get_next(soc->hal_soc, hal_ring_hdl))) {
buffer_src = hal_tx_comp_get_buffer_source(tx_comp_hal_desc); buffer_src = hal_tx_comp_get_buffer_source(tx_comp_hal_desc);
@@ -3450,7 +3453,7 @@ more_data:
break; break;
} }
dp_srng_access_end(int_ctx, soc, hal_srng); dp_srng_access_end(int_ctx, soc, hal_ring_hdl);
/* Process the reaped descriptors */ /* Process the reaped descriptors */
if (head_desc) if (head_desc)
@@ -3458,7 +3461,7 @@ more_data:
if (dp_tx_comp_enable_eol_data_check(soc)) { if (dp_tx_comp_enable_eol_data_check(soc)) {
if (!force_break && if (!force_break &&
hal_srng_dst_peek_sync_locked(soc, hal_srng)) { hal_srng_dst_peek_sync_locked(soc, hal_ring_hdl)) {
DP_STATS_INC(soc, tx.hp_oos2, 1); DP_STATS_INC(soc, tx.hp_oos2, 1);
if (!hif_exec_should_yield(soc->hif_handle, if (!hif_exec_should_yield(soc->hif_handle,
int_ctx->dp_intr_id)) int_ctx->dp_intr_id))

View File

@@ -218,7 +218,8 @@ qdf_nbuf_t dp_tx_non_std(struct cdp_vdev *vdev_handle,
* Return: Number of TX completions processed * Return: Number of TX completions processed
*/ */
uint32_t dp_tx_comp_handler(struct dp_intr *int_ctx, struct dp_soc *soc, uint32_t dp_tx_comp_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
void *hal_srng, uint8_t ring_id, uint32_t quota); hal_ring_handle_t hal_srng, uint8_t ring_id,
uint32_t quota);
QDF_STATUS QDF_STATUS
dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf); dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);

View File

@@ -474,7 +474,7 @@ struct dp_txrx_pool_stats {
}; };
struct dp_srng { struct dp_srng {
void *hal_srng; hal_ring_handle_t hal_srng;
void *base_vaddr_unaligned; void *base_vaddr_unaligned;
qdf_dma_addr_t base_paddr_unaligned; qdf_dma_addr_t base_paddr_unaligned;
uint32_t alloc_size; uint32_t alloc_size;

View File

@@ -523,11 +523,11 @@ extern void hal_srng_dst_init_hp(struct hal_srng *srng, uint32_t *vaddr);
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_srng: Opaque HAL SRNG pointer * @hal_srng: Opaque HAL SRNG pointer
*/ */
extern void hal_srng_cleanup(void *hal_soc, void *hal_srng); void hal_srng_cleanup(void *hal_soc, hal_ring_handle_t hal_ring_hdl);
static inline bool hal_srng_initialized(void *hal_ring) static inline bool hal_srng_initialized(hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
return !!srng->initialized; return !!srng->initialized;
} }
@@ -535,16 +535,16 @@ static inline bool hal_srng_initialized(void *hal_ring)
/** /**
* hal_srng_dst_peek - Check if there are any entries in the ring (peek) * hal_srng_dst_peek - Check if there are any entries in the ring (peek)
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Destination ring pointer * @hal_ring_hdl: Destination ring pointer
* *
* Caller takes responsibility for any locking needs. * Caller takes responsibility for any locking needs.
* *
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline static inline
void *hal_srng_dst_peek(void *hal_soc, void *hal_ring) void *hal_srng_dst_peek(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
if (srng->u.dst_ring.tp != srng->u.dst_ring.cached_hp) if (srng->u.dst_ring.tp != srng->u.dst_ring.cached_hp)
return (void *)(&srng->ring_base_vaddr[srng->u.dst_ring.tp]); return (void *)(&srng->ring_base_vaddr[srng->u.dst_ring.tp]);
@@ -557,15 +557,15 @@ void *hal_srng_dst_peek(void *hal_soc, void *hal_ring)
* hal_srng_access_start if locked access is required * hal_srng_access_start if locked access is required
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Ring pointer (Source or Destination ring) * @hal_ring_hdl: Ring pointer (Source or Destination ring)
* *
* Return: 0 on success; error on failire * Return: 0 on success; error on failire
*/ */
static inline int static inline int
hal_srng_access_start_unlocked(hal_soc_handle_t hal_soc_hdl, hal_srng_access_start_unlocked(hal_soc_handle_t hal_soc_hdl,
void *hal_ring) hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl; struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
uint32_t *desc; uint32_t *desc;
@@ -577,7 +577,7 @@ hal_srng_access_start_unlocked(hal_soc_handle_t hal_soc_hdl,
*(volatile uint32_t *)(srng->u.dst_ring.hp_addr); *(volatile uint32_t *)(srng->u.dst_ring.hp_addr);
if (srng->flags & HAL_SRNG_CACHED_DESC) { if (srng->flags & HAL_SRNG_CACHED_DESC) {
desc = hal_srng_dst_peek(hal_soc_hdl, hal_ring); desc = hal_srng_dst_peek(hal_soc_hdl, hal_ring_hdl);
if (qdf_likely(desc)) { if (qdf_likely(desc)) {
qdf_mem_dma_cache_sync(soc->qdf_dev, qdf_mem_dma_cache_sync(soc->qdf_dev,
qdf_mem_virt_to_phys qdf_mem_virt_to_phys
@@ -597,23 +597,23 @@ hal_srng_access_start_unlocked(hal_soc_handle_t hal_soc_hdl,
* hal_srng_access_start - Start (locked) ring access * hal_srng_access_start - Start (locked) ring access
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Ring pointer (Source or Destination ring) * @hal_ring_hdl: Ring pointer (Source or Destination ring)
* *
* Return: 0 on success; error on failire * Return: 0 on success; error on failire
*/ */
static inline int hal_srng_access_start(hal_soc_handle_t hal_soc_hdl, static inline int hal_srng_access_start(hal_soc_handle_t hal_soc_hdl,
void *hal_ring) hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
if (qdf_unlikely(!hal_ring)) { if (qdf_unlikely(!hal_ring_hdl)) {
qdf_print("Error: Invalid hal_ring\n"); qdf_print("Error: Invalid hal_ring\n");
return -EINVAL; return -EINVAL;
} }
SRNG_LOCK(&(srng->lock)); SRNG_LOCK(&(srng->lock));
return hal_srng_access_start_unlocked(hal_soc_hdl, hal_ring); return hal_srng_access_start_unlocked(hal_soc_hdl, hal_ring_hdl);
} }
/** /**
@@ -621,13 +621,15 @@ static inline int hal_srng_access_start(hal_soc_handle_t hal_soc_hdl,
* cached tail pointer * cached tail pointer
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Destination ring pointer * @hal_ring_hdl: Destination ring pointer
* *
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline void *hal_srng_dst_get_next(void *hal_soc, void *hal_ring) static inline
void *hal_srng_dst_get_next(void *hal_soc,
hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
struct hal_soc *soc = (struct hal_soc *)hal_soc; struct hal_soc *soc = (struct hal_soc *)hal_soc;
uint32_t *desc; uint32_t *desc;
uint32_t *desc_next; uint32_t *desc_next;
@@ -666,13 +668,15 @@ static inline void *hal_srng_dst_get_next(void *hal_soc, void *hal_ring)
* cached head pointer * cached head pointer
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Destination ring pointer * @hal_ring_hdl: Destination ring pointer
* *
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline void *hal_srng_dst_get_next_hp(void *hal_soc, void *hal_ring) static inline void *
hal_srng_dst_get_next_hp(void *hal_soc,
hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
uint32_t *desc; uint32_t *desc;
/* TODO: Using % is expensive, but we have to do this since /* TODO: Using % is expensive, but we have to do this since
* size of some SRNG rings is not power of 2 (due to descriptor * size of some SRNG rings is not power of 2 (due to descriptor
@@ -695,7 +699,7 @@ static inline void *hal_srng_dst_get_next_hp(void *hal_soc, void *hal_ring)
/** /**
* hal_srng_dst_peek_sync - Check if there are any entries in the ring (peek) * hal_srng_dst_peek_sync - Check if there are any entries in the ring (peek)
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Destination ring pointer * @hal_ring_hdl: Destination ring pointer
* *
* Sync cached head pointer with HW. * Sync cached head pointer with HW.
* Caller takes responsibility for any locking needs. * Caller takes responsibility for any locking needs.
@@ -703,9 +707,9 @@ static inline void *hal_srng_dst_get_next_hp(void *hal_soc, void *hal_ring)
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline static inline
void *hal_srng_dst_peek_sync(void *hal_soc, void *hal_ring) void *hal_srng_dst_peek_sync(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
srng->u.dst_ring.cached_hp = srng->u.dst_ring.cached_hp =
*(volatile uint32_t *)(srng->u.dst_ring.hp_addr); *(volatile uint32_t *)(srng->u.dst_ring.hp_addr);
@@ -719,7 +723,7 @@ void *hal_srng_dst_peek_sync(void *hal_soc, void *hal_ring)
/** /**
* hal_srng_dst_peek_sync_locked - Peek for any entries in the ring * hal_srng_dst_peek_sync_locked - Peek for any entries in the ring
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Destination ring pointer * @hal_ring_hdl: Destination ring pointer
* *
* Sync cached head pointer with HW. * Sync cached head pointer with HW.
* This function takes up SRNG_LOCK. Should not be called with SRNG lock held. * This function takes up SRNG_LOCK. Should not be called with SRNG lock held.
@@ -727,19 +731,20 @@ void *hal_srng_dst_peek_sync(void *hal_soc, void *hal_ring)
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline static inline
void *hal_srng_dst_peek_sync_locked(void *hal_soc, void *hal_ring) void *hal_srng_dst_peek_sync_locked(void *hal_soc,
hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
void *ring_desc_ptr = NULL; void *ring_desc_ptr = NULL;
if (qdf_unlikely(!hal_ring)) { if (qdf_unlikely(!hal_ring_hdl)) {
qdf_print("Error: Invalid hal_ring\n"); qdf_print("Error: Invalid hal_ring\n");
return NULL; return NULL;
} }
SRNG_LOCK(&srng->lock); SRNG_LOCK(&srng->lock);
ring_desc_ptr = hal_srng_dst_peek_sync(hal_soc, hal_ring); ring_desc_ptr = hal_srng_dst_peek_sync(hal_soc, hal_ring_hdl);
SRNG_UNLOCK(&srng->lock); SRNG_UNLOCK(&srng->lock);
@@ -751,14 +756,15 @@ void *hal_srng_dst_peek_sync_locked(void *hal_soc, void *hal_ring)
* by SW) in destination ring * by SW) in destination ring
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Destination ring pointer * @hal_ring_hdl: Destination ring pointer
* @sync_hw_ptr: Sync cached head pointer with HW * @sync_hw_ptr: Sync cached head pointer with HW
* *
*/ */
static inline uint32_t hal_srng_dst_num_valid(void *hal_soc, void *hal_ring, static inline uint32_t hal_srng_dst_num_valid(void *hal_soc,
int sync_hw_ptr) hal_ring_handle_t hal_ring_hdl,
int sync_hw_ptr)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
uint32_t hp; uint32_t hp;
uint32_t tp = srng->u.dst_ring.tp; uint32_t tp = srng->u.dst_ring.tp;
@@ -783,13 +789,14 @@ static inline uint32_t hal_srng_dst_num_valid(void *hal_soc, void *hal_ring,
* hal_srng_src_get_next_reaped when this function is used for reaping. * hal_srng_src_get_next_reaped when this function is used for reaping.
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* *
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline void *hal_srng_src_reap_next(void *hal_soc, void *hal_ring) static inline void *
hal_srng_src_reap_next(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
uint32_t *desc; uint32_t *desc;
/* TODO: Using % is expensive, but we have to do this since /* TODO: Using % is expensive, but we have to do this since
@@ -816,13 +823,14 @@ static inline void *hal_srng_src_reap_next(void *hal_soc, void *hal_ring)
* the ring * the ring
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* *
* Return: Opaque pointer for next (reaped) source ring entry; NULL on failire * Return: Opaque pointer for next (reaped) source ring entry; NULL on failire
*/ */
static inline void *hal_srng_src_get_next_reaped(void *hal_soc, void *hal_ring) static inline void *
hal_srng_src_get_next_reaped(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
uint32_t *desc; uint32_t *desc;
if (srng->u.src_ring.hp != srng->u.src_ring.reap_hp) { if (srng->u.src_ring.hp != srng->u.src_ring.reap_hp) {
@@ -842,13 +850,14 @@ static inline void *hal_srng_src_get_next_reaped(void *hal_soc, void *hal_ring)
* associated with ring entries which are pending reap. * associated with ring entries which are pending reap.
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* *
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline void *hal_srng_src_pending_reap_next(void *hal_soc, void *hal_ring) static inline void *
hal_srng_src_pending_reap_next(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
uint32_t *desc; uint32_t *desc;
uint32_t next_reap_hp = (srng->u.src_ring.reap_hp + srng->entry_size) % uint32_t next_reap_hp = (srng->u.src_ring.reap_hp + srng->entry_size) %
@@ -867,13 +876,14 @@ static inline void *hal_srng_src_pending_reap_next(void *hal_soc, void *hal_ring
* hal_srng_src_done_val - * hal_srng_src_done_val -
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* *
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline uint32_t hal_srng_src_done_val(void *hal_soc, void *hal_ring) static inline uint32_t
hal_srng_src_done_val(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
/* TODO: Using % is expensive, but we have to do this since /* TODO: Using % is expensive, but we have to do this since
* size of some SRNG rings is not power of 2 (due to descriptor * size of some SRNG rings is not power of 2 (due to descriptor
* sizes). Need to create separate API for rings used * sizes). Need to create separate API for rings used
@@ -896,14 +906,14 @@ static inline uint32_t hal_srng_src_done_val(void *hal_soc, void *hal_ring)
/** /**
* hal_get_entrysize_from_srng() - Retrieve ring entry size * hal_get_entrysize_from_srng() - Retrieve ring entry size
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* *
* Return: uint8_t * Return: uint8_t
*/ */
static inline static inline
uint8_t hal_get_entrysize_from_srng(void *hal_ring) uint8_t hal_get_entrysize_from_srng(hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
return srng->entry_size; return srng->entry_size;
} }
@@ -911,16 +921,17 @@ uint8_t hal_get_entrysize_from_srng(void *hal_ring)
/** /**
* hal_get_sw_hptp - Get SW head and tail pointer location for any ring * hal_get_sw_hptp - Get SW head and tail pointer location for any ring
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* @tailp: Tail Pointer * @tailp: Tail Pointer
* @headp: Head Pointer * @headp: Head Pointer
* *
* Return: Update tail pointer and head pointer in arguments. * Return: Update tail pointer and head pointer in arguments.
*/ */
static inline void hal_get_sw_hptp(void *hal_soc, void *hal_ring, static inline
uint32_t *tailp, uint32_t *headp) void hal_get_sw_hptp(void *hal_soc, hal_ring_handle_t hal_ring_hdl,
uint32_t *tailp, uint32_t *headp)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
if (srng->ring_dir == HAL_SRNG_SRC_RING) { if (srng->ring_dir == HAL_SRNG_SRC_RING) {
*headp = srng->u.src_ring.hp; *headp = srng->u.src_ring.hp;
@@ -935,13 +946,15 @@ static inline void hal_get_sw_hptp(void *hal_soc, void *hal_ring,
* hal_srng_src_get_next - Get next entry from a source ring and move cached tail pointer * hal_srng_src_get_next - Get next entry from a source ring and move cached tail pointer
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* *
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline void *hal_srng_src_get_next(void *hal_soc, void *hal_ring) static inline
void *hal_srng_src_get_next(void *hal_soc,
hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
uint32_t *desc; uint32_t *desc;
/* TODO: Using % is expensive, but we have to do this since /* TODO: Using % is expensive, but we have to do this since
* size of some SRNG rings is not power of 2 (due to descriptor * size of some SRNG rings is not power of 2 (due to descriptor
@@ -972,13 +985,14 @@ static inline void *hal_srng_src_get_next(void *hal_soc, void *hal_ring)
* hal_srng_src_get_next should be called subsequently to move the head pointer * hal_srng_src_get_next should be called subsequently to move the head pointer
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* *
* Return: Opaque pointer for next ring entry; NULL on failire * Return: Opaque pointer for next ring entry; NULL on failire
*/ */
static inline void *hal_srng_src_peek(void *hal_soc, void *hal_ring) static inline void *
hal_srng_src_peek(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
uint32_t *desc; uint32_t *desc;
/* TODO: Using % is expensive, but we have to do this since /* TODO: Using % is expensive, but we have to do this since
@@ -1000,14 +1014,15 @@ static inline void *hal_srng_src_peek(void *hal_soc, void *hal_ring)
* hal_srng_src_num_avail - Returns number of available entries in src ring * hal_srng_src_num_avail - Returns number of available entries in src ring
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* @sync_hw_ptr: Sync cached tail pointer with HW * @sync_hw_ptr: Sync cached tail pointer with HW
* *
*/ */
static inline uint32_t hal_srng_src_num_avail(void *hal_soc, static inline uint32_t
void *hal_ring, int sync_hw_ptr) hal_srng_src_num_avail(void *hal_soc,
hal_ring_handle_t hal_ring_hdl, int sync_hw_ptr)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
uint32_t tp; uint32_t tp;
uint32_t hp = srng->u.src_ring.hp; uint32_t hp = srng->u.src_ring.hp;
@@ -1031,13 +1046,14 @@ static inline uint32_t hal_srng_src_num_avail(void *hal_soc,
* access * access
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Ring pointer (Source or Destination ring) * @hal_ring_hdl: Ring pointer (Source or Destination ring)
* *
* Return: 0 on success; error on failire * Return: 0 on success; error on failire
*/ */
static inline void hal_srng_access_end_unlocked(void *hal_soc, void *hal_ring) static inline void
hal_srng_access_end_unlocked(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
/* TODO: See if we need a write memory barrier here */ /* TODO: See if we need a write memory barrier here */
if (srng->flags & HAL_SRNG_LMAC_RING) { if (srng->flags & HAL_SRNG_LMAC_RING) {
@@ -1067,20 +1083,21 @@ static inline void hal_srng_access_end_unlocked(void *hal_soc, void *hal_ring)
* This should be used only if hal_srng_access_start to start ring access * This should be used only if hal_srng_access_start to start ring access
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Ring pointer (Source or Destination ring) * @hal_ring_hdl: Ring pointer (Source or Destination ring)
* *
* Return: 0 on success; error on failire * Return: 0 on success; error on failire
*/ */
static inline void hal_srng_access_end(void *hal_soc, void *hal_ring) static inline void
hal_srng_access_end(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
if (qdf_unlikely(!hal_ring)) { if (qdf_unlikely(!hal_ring_hdl)) {
qdf_print("Error: Invalid hal_ring\n"); qdf_print("Error: Invalid hal_ring\n");
return; return;
} }
hal_srng_access_end_unlocked(hal_soc, hal_ring); hal_srng_access_end_unlocked(hal_soc, hal_ring_hdl);
SRNG_UNLOCK(&(srng->lock)); SRNG_UNLOCK(&(srng->lock));
} }
@@ -1090,13 +1107,14 @@ static inline void hal_srng_access_end(void *hal_soc, void *hal_ring)
* and should be used only while reaping SRC ring completions * and should be used only while reaping SRC ring completions
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Ring pointer (Source or Destination ring) * @hal_ring_hdl: Ring pointer (Source or Destination ring)
* *
* Return: 0 on success; error on failire * Return: 0 on success; error on failire
*/ */
static inline void hal_srng_access_end_reap(void *hal_soc, void *hal_ring) static inline void
hal_srng_access_end_reap(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
SRNG_UNLOCK(&(srng->lock)); SRNG_UNLOCK(&(srng->lock));
} }
@@ -1295,12 +1313,14 @@ extern void hal_reo_qdesc_setup(void *hal_soc, int tid, uint32_t ba_window_size,
* hal_srng_get_hp_addr - Get head pointer physical address * hal_srng_get_hp_addr - Get head pointer physical address
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Ring pointer (Source or Destination ring) * @hal_ring_hdl: Ring pointer (Source or Destination ring)
* *
*/ */
static inline qdf_dma_addr_t hal_srng_get_hp_addr(void *hal_soc, void *hal_ring) static inline qdf_dma_addr_t
hal_srng_get_hp_addr(void *hal_soc,
hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
struct hal_soc *hal = (struct hal_soc *)hal_soc; struct hal_soc *hal = (struct hal_soc *)hal_soc;
if (srng->ring_dir == HAL_SRNG_SRC_RING) { if (srng->ring_dir == HAL_SRNG_SRC_RING) {
@@ -1318,12 +1338,13 @@ static inline qdf_dma_addr_t hal_srng_get_hp_addr(void *hal_soc, void *hal_ring)
* hal_srng_get_tp_addr - Get tail pointer physical address * hal_srng_get_tp_addr - Get tail pointer physical address
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Ring pointer (Source or Destination ring) * @hal_ring_hdl: Ring pointer (Source or Destination ring)
* *
*/ */
static inline qdf_dma_addr_t hal_srng_get_tp_addr(void *hal_soc, void *hal_ring) static inline qdf_dma_addr_t
hal_srng_get_tp_addr(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
struct hal_soc *hal = (struct hal_soc *)hal_soc; struct hal_soc *hal = (struct hal_soc *)hal_soc;
if (srng->ring_dir == HAL_SRNG_SRC_RING) { if (srng->ring_dir == HAL_SRNG_SRC_RING) {
@@ -1341,11 +1362,11 @@ static inline qdf_dma_addr_t hal_srng_get_tp_addr(void *hal_soc, void *hal_ring)
* hal_get_srng_params - Retrieve SRNG parameters for a given ring from HAL * hal_get_srng_params - Retrieve SRNG parameters for a given ring from HAL
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Ring pointer (Source or Destination ring) * @hal_ring_hdl: Ring pointer (Source or Destination ring)
* @ring_params: SRNG parameters will be returned through this structure * @ring_params: SRNG parameters will be returned through this structure
*/ */
extern void hal_get_srng_params(void *hal_soc, void *hal_ring, void hal_get_srng_params(void *hal_soc, hal_ring_handle_t hal_ring_hdl,
struct hal_srng_params *ring_params); struct hal_srng_params *ring_params);
/** /**
* hal_mem_info - Retrieve hal memory base address * hal_mem_info - Retrieve hal memory base address
@@ -1407,20 +1428,22 @@ static inline void hal_srng_src_hw_init(struct hal_soc *hal,
/** /**
* hal_get_hw_hptp() - Get HW head and tail pointer value for any ring * hal_get_hw_hptp() - Get HW head and tail pointer value for any ring
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* @headp: Head Pointer * @headp: Head Pointer
* @tailp: Tail Pointer * @tailp: Tail Pointer
* @ring_type: Ring * @ring_type: Ring
* *
* Return: Update tail pointer and head pointer in arguments. * Return: Update tail pointer and head pointer in arguments.
*/ */
static inline void hal_get_hw_hptp(hal_soc_handle_t hal_soc_hdl, void *hal_ring, static inline
uint32_t *headp, uint32_t *tailp, void hal_get_hw_hptp(hal_soc_handle_t hal_soc_hdl,
uint8_t ring_type) hal_ring_handle_t hal_ring_hdl,
uint32_t *headp, uint32_t *tailp,
uint8_t ring_type)
{ {
struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
hal_soc->ops->hal_get_hw_hptp(hal_soc_hdl, hal_ring, hal_soc->ops->hal_get_hw_hptp(hal_soc_hdl, hal_ring_hdl,
headp, tailp, ring_type); headp, tailp, ring_type);
} }
@@ -1470,13 +1493,14 @@ static inline void hal_setup_link_idle_list(void *halsoc,
* hal_srng_dump_ring_desc() - Dump ring descriptor info * hal_srng_dump_ring_desc() - Dump ring descriptor info
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
* @ring_desc: Opaque ring descriptor handle * @ring_desc: Opaque ring descriptor handle
*/ */
static inline void hal_srng_dump_ring_desc(struct hal_soc *hal, void *hal_ring, static inline void hal_srng_dump_ring_desc(struct hal_soc *hal,
hal_ring_handle_t hal_ring_hdl,
hal_ring_desc_t ring_desc) hal_ring_desc_t ring_desc)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH,
ring_desc, (srng->entry_size << 2)); ring_desc, (srng->entry_size << 2));
@@ -1486,11 +1510,12 @@ static inline void hal_srng_dump_ring_desc(struct hal_soc *hal, void *hal_ring,
* hal_srng_dump_ring() - Dump last 128 descs of the ring * hal_srng_dump_ring() - Dump last 128 descs of the ring
* *
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_ring: Source ring pointer * @hal_ring_hdl: Source ring pointer
*/ */
static inline void hal_srng_dump_ring(struct hal_soc *hal, void *hal_ring) static inline void hal_srng_dump_ring(struct hal_soc *hal,
hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
uint32_t *desc; uint32_t *desc;
uint32_t tp, i; uint32_t tp, i;

View File

@@ -1563,12 +1563,13 @@ static void hal_reo_setup_generic(void *hal_soc,
* Return: Update tail pointer and head pointer in arguments. * Return: Update tail pointer and head pointer in arguments.
*/ */
static inline static inline
void hal_get_hw_hptp_generic(hal_soc_handle_t hal_soc_hdl, void *hal_ring, void hal_get_hw_hptp_generic(hal_soc_handle_t hal_soc_hdl,
hal_ring_handle_t hal_ring_hdl,
uint32_t *headp, uint32_t *tailp, uint32_t *headp, uint32_t *tailp,
uint8_t ring) uint8_t ring)
{ {
struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
struct hal_hw_srng_config *ring_config; struct hal_hw_srng_config *ring_config;
enum hal_ring_type ring_type = (enum hal_ring_type)ring; enum hal_ring_type ring_type = (enum hal_ring_type)ring;

View File

@@ -179,6 +179,12 @@ struct hal_soc;
struct hal_ring_desc; struct hal_ring_desc;
typedef struct hal_ring_desc *hal_ring_desc_t; typedef struct hal_ring_desc *hal_ring_desc_t;
/**
* dp_hal_ring - opaque handle for DP HAL SRNG
*/
struct hal_ring_handle;
typedef struct hal_ring_handle *hal_ring_handle_t;
#define MAX_SRNG_REG_GROUPS 2 #define MAX_SRNG_REG_GROUPS 2
/* Common SRNG ring structure for source and destination rings */ /* Common SRNG ring structure for source and destination rings */
@@ -307,7 +313,8 @@ struct hal_hw_txrx_ops {
struct hal_srng *srng); struct hal_srng *srng);
void (*hal_srng_src_hw_init)(void *hal, void (*hal_srng_src_hw_init)(void *hal,
struct hal_srng *srng); struct hal_srng *srng);
void (*hal_get_hw_hptp)(hal_soc_handle_t hal_soc_hdl, void *hal_ring, void (*hal_get_hw_hptp)(hal_soc_handle_t hal_soc_hdl,
hal_ring_handle_t hal_ring_hdl,
uint32_t *headp, uint32_t *tailp, uint32_t *headp, uint32_t *tailp,
uint8_t ring_type); uint8_t ring_type);
void (*hal_reo_setup)(void *hal_soc, void *reoparams); void (*hal_reo_setup)(void *hal_soc, void *reoparams);
@@ -412,9 +419,29 @@ void hal_qca6390_attach(struct hal_soc *hal_soc);
void hal_qca6290_attach(struct hal_soc *hal_soc); void hal_qca6290_attach(struct hal_soc *hal_soc);
void hal_qca8074_attach(struct hal_soc *hal_soc); void hal_qca8074_attach(struct hal_soc *hal_soc);
/*
* hal_soc_to_dp_hal_roc - API to convert hal_soc to opaque
* dp_hal_soc handle type
* @hal_soc - hal_soc type
*
* Return: hal_soc_handle_t type
*/
static inline static inline
hal_soc_handle_t hal_soc_to_hal_soc_handle(struct hal_soc *hal_soc) hal_soc_handle_t hal_soc_to_hal_soc_handle(struct hal_soc *hal_soc)
{ {
return (hal_soc_handle_t)hal_soc; return (hal_soc_handle_t)hal_soc;
} }
/*
* hal_srng_to_hal_ring_handle - API to convert hal_srng to opaque
* dp_hal_ring handle type
* @hal_srng - hal_srng type
*
* Return: hal_ring_handle_t type
*/
static inline
hal_ring_handle_t hal_srng_to_hal_ring_handle(struct hal_srng *hal_srng)
{
return (hal_ring_handle_t)hal_srng;
}
#endif /* _HAL_INTERNAL_H_ */ #endif /* _HAL_INTERNAL_H_ */

View File

@@ -1328,7 +1328,8 @@ qdf_export_symbol(hal_reo_rx_update_queue_status);
* *
* Return: none * Return: none
*/ */
inline void hal_reo_init_cmd_ring(hal_soc_handle_t hal_soc_hdl, void *hal_srng) inline void hal_reo_init_cmd_ring(hal_soc_handle_t hal_soc_hdl,
hal_ring_handle_t hal_srng_hdl)
{ {
int cmd_num; int cmd_num;
uint32_t *desc_addr; uint32_t *desc_addr;
@@ -1337,7 +1338,7 @@ inline void hal_reo_init_cmd_ring(hal_soc_handle_t hal_soc_hdl, void *hal_srng)
uint32_t num_desc; uint32_t num_desc;
struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl; struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
hal_get_srng_params(soc, hal_srng, &srng_params); hal_get_srng_params(soc, hal_srng_hdl, &srng_params);
desc_addr = (uint32_t *)(srng_params.ring_base_vaddr); desc_addr = (uint32_t *)(srng_params.ring_base_vaddr);
desc_addr += (sizeof(struct tlv_32_hdr) >> 2); desc_addr += (sizeof(struct tlv_32_hdr) >> 2);

View File

@@ -534,6 +534,7 @@ void hal_reo_rx_update_queue_status(uint32_t *reo_desc,
struct hal_reo_update_rx_queue_status *st, struct hal_reo_update_rx_queue_status *st,
hal_soc_handle_t hal_soc_hdl); hal_soc_handle_t hal_soc_hdl);
void hal_reo_init_cmd_ring(hal_soc_handle_t hal_soc_hdl, void *hal_srng); void hal_reo_init_cmd_ring(hal_soc_handle_t hal_soc_hdl,
hal_ring_handle_t hal_ring_hdl);
#endif /* _HAL_REO_H */ #endif /* _HAL_REO_H */

View File

@@ -2741,9 +2741,9 @@ static inline void hal_rx_dump_pkt_hdr_tlv(struct rx_pkt_tlvs *pkt_tlvs,
* *
* Return: ring_id * Return: ring_id
*/ */
static inline uint8_t hal_srng_ring_id_get(void *hal_ring) static inline uint8_t hal_srng_ring_id_get(hal_ring_handle_t hal_ring_hdl)
{ {
return ((struct hal_srng *)hal_ring)->ring_id; return ((struct hal_srng *)hal_ring_hdl)->ring_id;
} }
/* Rx MSDU link pointer info */ /* Rx MSDU link pointer info */

View File

@@ -727,9 +727,9 @@ qdf_export_symbol(hal_srng_setup);
* @hal_soc: Opaque HAL SOC handle * @hal_soc: Opaque HAL SOC handle
* @hal_srng: Opaque HAL SRNG pointer * @hal_srng: Opaque HAL SRNG pointer
*/ */
void hal_srng_cleanup(void *hal_soc, void *hal_srng) void hal_srng_cleanup(void *hal_soc, hal_ring_handle_t hal_ring_hdl)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_srng; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
SRNG_LOCK_DESTROY(&srng->lock); SRNG_LOCK_DESTROY(&srng->lock);
srng->initialized = 0; srng->initialized = 0;
} }
@@ -806,10 +806,10 @@ void hal_srng_dump(struct hal_srng *srng)
* @hal_ring: Ring pointer (Source or Destination ring) * @hal_ring: Ring pointer (Source or Destination ring)
* @ring_params: SRNG parameters will be returned through this structure * @ring_params: SRNG parameters will be returned through this structure
*/ */
extern void hal_get_srng_params(void *hal_soc, void *hal_ring, extern void hal_get_srng_params(void *hal_soc, hal_ring_handle_t hal_ring_hdl,
struct hal_srng_params *ring_params) struct hal_srng_params *ring_params)
{ {
struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
int i =0; int i =0;
ring_params->ring_id = srng->ring_id; ring_params->ring_id = srng->ring_id;
ring_params->ring_dir = srng->ring_dir; ring_params->ring_dir = srng->ring_dir;

View File

@@ -863,14 +863,15 @@ static inline void hal_tx_comp_get_htt_desc(void *hw_desc, uint8_t *htt_desc)
* *
* Return: none * Return: none
*/ */
static inline void hal_tx_init_data_ring(void *hal_soc, void *hal_srng) static inline void hal_tx_init_data_ring(void *hal_soc,
hal_ring_handle_t hal_ring_hdl)
{ {
uint8_t *desc_addr; uint8_t *desc_addr;
struct hal_srng_params srng_params; struct hal_srng_params srng_params;
uint32_t desc_size; uint32_t desc_size;
uint32_t num_desc; uint32_t num_desc;
hal_get_srng_params(hal_soc, hal_srng, &srng_params); hal_get_srng_params(hal_soc, hal_ring_hdl, &srng_params);
desc_addr = (uint8_t *)srng_params.ring_base_vaddr; desc_addr = (uint8_t *)srng_params.ring_base_vaddr;
desc_size = sizeof(struct tcl_data_cmd); desc_size = sizeof(struct tcl_data_cmd);