qcacmn: Set invalid bit in cookie for exception ring descriptor

On returning the msdu link descriptor to HW via WBM
release ring, the rx exception ring contents are not
zeroed. This could result in host reading stale ring
descriptor content in the scenario when HP is updated
even before the latest values are reflected in the ring
descriptor.

Fix is to set invalid bit in cookie for exception ring
descriptor and add cookie sanity check.

Change-Id: I01a294c92b260ebe8e584ef20e9550b1febec913
CRs-Fixed: 2730759
此提交包含在:
Yeshwanth Sriram Guntuka
2020-07-14 21:23:58 +05:30
提交者 snandini
父節點 199049f281
當前提交 8007762d6a
共有 4 個檔案被更改,包括 87 行新增8 行删除

查看文件

@@ -1381,6 +1381,46 @@ fail:
return;
}
#ifdef DP_RX_DESC_COOKIE_INVALIDATE
/**
* dp_rx_link_cookie_check() - Validate link desc cookie
* @ring_desc: ring descriptor
*
* Return: qdf status
*/
static inline QDF_STATUS
dp_rx_link_cookie_check(hal_ring_desc_t ring_desc)
{
if (qdf_unlikely(HAL_RX_REO_BUF_LINK_COOKIE_INVALID_GET(ring_desc)))
return QDF_STATUS_E_FAILURE;
return QDF_STATUS_SUCCESS;
}
/**
* dp_rx_link_cookie_invalidate() - Invalidate link desc cookie
* @ring_desc: ring descriptor
*
* Return: None
*/
static inline void
dp_rx_link_cookie_invalidate(hal_ring_desc_t ring_desc)
{
HAL_RX_REO_BUF_LINK_COOKIE_INVALID_SET(ring_desc);
}
#else
static inline QDF_STATUS
dp_rx_link_cookie_check(hal_ring_desc_t ring_desc)
{
return QDF_STATUS_SUCCESS;
}
static inline void
dp_rx_link_cookie_invalidate(hal_ring_desc_t ring_desc)
{
}
#endif
uint32_t
dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
hal_ring_handle_t hal_ring_hdl, uint32_t quota)
@@ -1403,6 +1443,7 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
struct hal_rx_msdu_list msdu_list; /* MSDU's per MPDU */
uint16_t num_msdus;
struct dp_rx_desc *rx_desc = NULL;
QDF_STATUS status;
/* Debug -- Remove later */
qdf_assert(soc && hal_ring_hdl);
@@ -1426,8 +1467,8 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
}
while (qdf_likely(quota-- && (ring_desc =
hal_srng_dst_get_next(hal_soc,
hal_ring_hdl)))) {
hal_srng_dst_peek(hal_soc,
hal_ring_hdl)))) {
DP_STATS_INC(soc, rx.err_ring_pkts, 1);
@@ -1448,6 +1489,12 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
qdf_assert_always((cookie >> LINK_DESC_ID_SHIFT) &
LINK_DESC_ID_START);
status = dp_rx_link_cookie_check(ring_desc);
if (qdf_unlikely(QDF_IS_STATUS_ERROR(status))) {
DP_STATS_INC(soc, rx.err.invalid_link_cookie, 1);
break;
}
/*
* Check if the buffer is to be processed on this processor
*/
@@ -1475,7 +1522,7 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
/* Return link descriptor through WBM ring (SW2WBM)*/
dp_rx_link_desc_return(soc, ring_desc,
HAL_BM_ACTION_RELEASE_MSDU_LIST);
continue;
goto next_entry;
}
rx_desc = dp_rx_cookie_2_va_rxdma_buf(soc,
@@ -1498,7 +1545,7 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
&mpdu_desc_info,
&mac_id, quota);
rx_bufs_reaped[mac_id] += count;
continue;
goto next_entry;
}
count = dp_rx_frag_handle(soc,
@@ -1507,7 +1554,7 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
rx_bufs_reaped[mac_id] += count;
DP_STATS_INC(soc, rx.rx_frags, 1);
continue;
goto next_entry;
}
if (hal_rx_reo_is_pn_error(ring_desc)) {
@@ -1526,7 +1573,7 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
quota);
rx_bufs_reaped[mac_id] += count;
continue;
goto next_entry;
}
if (hal_rx_reo_is_2k_jump(ring_desc)) {
@@ -1548,7 +1595,7 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
HAL_REO_ERR_REGULAR_FRAME_2K_JUMP);
rx_bufs_reaped[mac_id] += count;
continue;
goto next_entry;
}
if (hal_rx_reo_is_oor_error(ring_desc)) {
@@ -1569,8 +1616,11 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
HAL_REO_ERR_REGULAR_FRAME_OOR);
rx_bufs_reaped[mac_id] += count;
continue;
goto next_entry;
}
next_entry:
dp_rx_link_cookie_invalidate(ring_desc);
hal_srng_dst_get_next(hal_soc, hal_ring_hdl);
}
done: