From beaff57e55fac1ab15d4848aa9001c1fdb0a541f Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Tue, 6 Apr 2021 15:39:25 +0530 Subject: [PATCH] qcacmn: Reset the inv bit in ring desc cookie for jumbo pkts When a msdu scattered across multiple nbufs is received in REO2SW ring and the remaining nbufs are not yet available in the ring, loop in dp_rx_process is exited without resetting the invalid bit in the ring desc cookie. This will result in an incorrect assertion failure when the same entry is processed the next time. Fix is to reset the invalid bit in ring desc cookie when the loop is exited in the above msdu scattered scenario. Change-Id: Ie5cfa1fb8ea1db4b7a0a4837545ecbfdfbb8719a CRs-Fixed: 2916296 --- dp/wifi3.0/dp_rx.c | 2 ++ dp/wifi3.0/dp_rx.h | 18 ++++++++++++++++++ hal/wifi3.0/hal_rx.h | 13 +++++++++++++ 3 files changed, 33 insertions(+) diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index 55392cb356d6..4889b6c76d44 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -2459,6 +2459,8 @@ more_data: soc, rx.msdu_scatter_wait_break, 1); + dp_rx_cookie_reset_invalid_bit( + ring_desc); break; } is_prev_msdu_last = false; diff --git a/dp/wifi3.0/dp_rx.h b/dp/wifi3.0/dp_rx.h index fa52e7c69f9a..822f1b9ed902 100644 --- a/dp/wifi3.0/dp_rx.h +++ b/dp/wifi3.0/dp_rx.h @@ -563,12 +563,30 @@ dp_rx_cookie_check_and_invalidate(hal_ring_desc_t ring_desc) HAL_RX_REO_BUF_COOKIE_INVALID_SET(ring_desc); return QDF_STATUS_SUCCESS; } + +/** + * dp_rx_cookie_reset_invalid_bit() - Reset the invalid bit of the cookie + * field in ring descriptor + * @ring_desc: ring descriptor + * + * Return: None + */ +static inline void +dp_rx_cookie_reset_invalid_bit(hal_ring_desc_t ring_desc) +{ + HAL_RX_REO_BUF_COOKIE_INVALID_RESET(ring_desc); +} #else static inline QDF_STATUS dp_rx_cookie_check_and_invalidate(hal_ring_desc_t ring_desc) { return QDF_STATUS_SUCCESS; } + +static inline void +dp_rx_cookie_reset_invalid_bit(hal_ring_desc_t ring_desc) +{ +} #endif QDF_STATUS dp_rx_desc_pool_is_allocated(struct rx_desc_pool *rx_desc_pool); diff --git a/hal/wifi3.0/hal_rx.h b/hal/wifi3.0/hal_rx.h index 3392c2a7f0c4..c319c0bd2fa2 100644 --- a/hal/wifi3.0/hal_rx.h +++ b/hal/wifi3.0/hal_rx.h @@ -287,6 +287,14 @@ enum hal_rx_ret_buf_manager { (BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET >> 2))) |= \ HAL_RX_COOKIE_INVALID_MASK) +/* + * macro to reset the invalid bit for sw cookie + */ +#define HAL_RX_BUF_COOKIE_INVALID_RESET(buff_addr_info) \ + ((*(((unsigned int *)buff_addr_info) + \ + (BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET >> 2))) &= \ + ~HAL_RX_COOKIE_INVALID_MASK) + /* * macro to set the cookie into the rxdma ring entry */ @@ -390,6 +398,11 @@ enum hal_rx_ret_buf_manager { (((struct reo_destination_ring *) \ reo_desc)->buf_or_link_desc_addr_info))) +#define HAL_RX_REO_BUF_COOKIE_INVALID_RESET(reo_desc) \ + (HAL_RX_BUF_COOKIE_INVALID_RESET(& \ + (((struct reo_destination_ring *) \ + reo_desc)->buf_or_link_desc_addr_info))) + #define HAL_RX_MPDU_SEQUENCE_NUMBER_GET(mpdu_info_ptr) \ ((mpdu_info_ptr \ [RX_MPDU_DESC_INFO_0_MPDU_SEQUENCE_NUMBER_OFFSET >> 2] & \