Selaa lähdekoodia

qcacmn: Fix wbm release descriptor settings

Set BM_ACTION, RELEASE_SOURCE and BUFFER_OR_DESC_TYPE fields in WBM release
ring descriptor in hal_rx_msdu_link_desc_set function.
Added HAL API to retrieve RXDMA push reason and error code from REO entrance
descriptor.

Change-Id: I64209d9ebb332136fae43a55b39e0f0d242315fb
CRs-Fixed: 2062922
Karunakar Dasineni 7 vuotta sitten
vanhempi
sitoutus
f40efac097
2 muutettua tiedostoa jossa 85 lisäystä ja 39 poistoa
  1. 79 36
      dp/wifi3.0/hal_rx.h
  2. 6 3
      hal/wifi3.0/hal_internal.h

+ 79 - 36
dp/wifi3.0/hal_rx.h

@@ -1806,6 +1806,47 @@ enum hal_rxdma_error_code {
 	HAL_RXDMA_ERR_FLUSH_REQUEST
 };
 
+/**
+ * HW BM action settings in WBM release ring
+ */
+#define HAL_BM_ACTION_PUT_IN_IDLE_LIST 0
+
+/**
+ * enum hal_rx_wbm_error_source: Indicates which module initiated the
+ * release of this buffer or descriptor
+ *
+ * @ HAL_RX_WBM_ERR_SRC_TQM : TQM released this buffer or descriptor
+ * @ HAL_RX_WBM_ERR_SRC_RXDMA: RXDMA released this buffer or descriptor
+ * @ HAL_RX_WBM_ERR_SRC_REO: REO released this buffer or descriptor
+ * @ HAL_RX_WBM_ERR_SRC_FW: FW released this buffer or descriptor
+ * @ HAL_RX_WBM_ERR_SRC_SW: SW released this buffer or descriptor
+ */
+enum hal_rx_wbm_error_source {
+	HAL_RX_WBM_ERR_SRC_TQM = 0,
+	HAL_RX_WBM_ERR_SRC_RXDMA,
+	HAL_RX_WBM_ERR_SRC_REO,
+	HAL_RX_WBM_ERR_SRC_FW,
+	HAL_RX_WBM_ERR_SRC_SW,
+};
+
+/**
+ * enum hal_rx_wbm_buf_type: Indicates that type of buffer or descriptor
+ * released
+ *
+ * @ HAL_RX_WBM_ERR_SRC_TQM : TQM released this buffer or descriptor
+ * @ HAL_RX_WBM_ERR_SRC_RXDMA: RXDMA released this buffer or descriptor
+ * @ HAL_RX_WBM_ERR_SRC_REO: REO released this buffer or descriptor
+ * @ HAL_RX_WBM_ERR_SRC_FW: FW released this buffer or descriptor
+ * @ HAL_RX_WBM_ERR_SRC_SW: SW released this buffer or descriptor
+ */
+enum hal_rx_wbm_buf_type {
+	HAL_RX_WBM_BUF_TYPE_REL_BUF = 0,
+	HAL_RX_WBM_BUF_TYPE_MSDU_LINK_DESC,
+	HAL_RX_WBM_BUF_TYPE_MPDU_LINK_DESC,
+	HAL_RX_WBM_BUF_TYPE_MSDU_EXT_DESC,
+	HAL_RX_WBM_BUF_TYPE_Q_EXT_DESC,
+};
+
 #define HAL_RX_REO_ERROR_GET(reo_desc) (((*(((uint32_t *) reo_desc)+ \
 		(REO_DESTINATION_RING_7_REO_ERROR_CODE_OFFSET >> 2))) & \
 		REO_DESTINATION_RING_7_REO_ERROR_CODE_MASK) >> \
@@ -1870,6 +1911,12 @@ static inline void hal_rx_msdu_link_desc_set(struct hal_soc *soc,
 	/* Structure copy !!! */
 	wbm_rel_srng->released_buff_or_desc_addr_info =
 				*((struct buffer_addr_info *)buf_addr_info);
+	HAL_DESC_SET_FIELD(src_srng_desc, WBM_RELEASE_RING_2,
+		RELEASE_SOURCE_MODULE, HAL_RX_WBM_ERR_SRC_SW);
+	HAL_DESC_SET_FIELD(src_srng_desc, WBM_RELEASE_RING_2, BM_ACTION,
+		HAL_BM_ACTION_PUT_IN_IDLE_LIST);
+	HAL_DESC_SET_FIELD(src_srng_desc, WBM_RELEASE_RING_2,
+		BUFFER_OR_DESC_TYPE, HAL_RX_WBM_BUF_TYPE_MSDU_LINK_DESC);
 }
 
 /*
@@ -1926,47 +1973,11 @@ uint8_t hal_rx_ret_buf_manager_get(void *ring_desc)
  * RX WBM ERROR APIS
  ******************************************************************************/
 
-/**
- * enum hal_rx_wbm_error_source: Indicates which module initiated the
- * release of this buffer or descriptor
- *
- * @ HAL_RX_WBM_ERR_SRC_TQM : TQM released this buffer or descriptor
- * @ HAL_RX_WBM_ERR_SRC_RXDMA: RXDMA released this buffer or descriptor
- * @ HAL_RX_WBM_ERR_SRC_REO: REO released this buffer or descriptor
- * @ HAL_RX_WBM_ERR_SRC_FW: FW released this buffer or descriptor
- * @ HAL_RX_WBM_ERR_SRC_SW: SW released this buffer or descriptor
- */
-enum hal_rx_wbm_error_source {
-	HAL_RX_WBM_ERR_SRC_TQM = 0,
-	HAL_RX_WBM_ERR_SRC_RXDMA,
-	HAL_RX_WBM_ERR_SRC_REO,
-	HAL_RX_WBM_ERR_SRC_FW,
-	HAL_RX_WBM_ERR_SRC_SW,
-};
-
 #define HAL_RX_WBM_ERR_SRC_GET(wbm_desc) (((*(((uint32_t *) wbm_desc)+ \
 		(WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_OFFSET >> 2))) & \
 		WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_MASK) >> \
 		WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_LSB)
 
-/**
- * enum hal_rx_wbm_buf_type: Indicates that type of buffer or descriptor
- * released
- *
- * @ HAL_RX_WBM_ERR_SRC_TQM : TQM released this buffer or descriptor
- * @ HAL_RX_WBM_ERR_SRC_RXDMA: RXDMA released this buffer or descriptor
- * @ HAL_RX_WBM_ERR_SRC_REO: REO released this buffer or descriptor
- * @ HAL_RX_WBM_ERR_SRC_FW: FW released this buffer or descriptor
- * @ HAL_RX_WBM_ERR_SRC_SW: SW released this buffer or descriptor
- */
-enum hal_rx_wbm_buf_type {
-	HAL_RX_WBM_BUF_TYPE_REL_BUF = 0,
-	HAL_RX_WBM_BUF_TYPE_MSDU_LINK_DESC,
-	HAL_RX_WBM_BUF_TYPE_MPDU_LINK_DESC,
-	HAL_RX_WBM_BUF_TYPE_MSDU_EXT_DESC,
-	HAL_RX_WBM_BUF_TYPE_Q_EXT_DESC,
-};
-
 #define HAL_RX_WBM_BUF_TYPE_GET(wbm_desc) (((*(((uint32_t *) wbm_desc)+ \
 		(WBM_RELEASE_RING_2_BUFFER_OR_DESC_TYPE_OFFSET >> 2))) & \
 		WBM_RELEASE_RING_2_BUFFER_OR_DESC_TYPE_MASK) >> \
@@ -3031,4 +3042,36 @@ uint16_t hal_rx_get_desc_len(void)
 	return sizeof(struct rx_pkt_tlvs);
 }
 
+/*
+ * hal_rx_reo_ent_rxdma_push_reason_get(): Retrieves RXDMA push reason from
+ *	reo_entrance_ring descriptor
+ *
+ * @reo_ent_desc: reo_entrance_ring descriptor
+ * Returns: value of rxdma_push_reason
+ */
+static inline
+uint8_t hal_rx_reo_ent_rxdma_push_reason_get(void *reo_ent_desc)
+{
+	return _HAL_MS((*_OFFSET_TO_WORD_PTR(reo_ent_desc,
+		REO_ENTRANCE_RING_6_RXDMA_PUSH_REASON_OFFSET)),
+		REO_ENTRANCE_RING_6_RXDMA_PUSH_REASON_MASK,
+		REO_ENTRANCE_RING_6_RXDMA_PUSH_REASON_LSB);
+}
+
+/*
+ * hal_rx_reo_ent_rxdma_error_code_get(): Retrieves RXDMA error code from
+ *	reo_entrance_ring descriptor
+ *
+ * @reo_ent_desc: reo_entrance_ring descriptor
+ * Returns: value of rxdma_error_code
+ */
+static inline
+uint8_t hal_rx_reo_ent_rxdma_error_code_get(void *reo_ent_desc)
+{
+	return _HAL_MS((*_OFFSET_TO_WORD_PTR(reo_ent_desc,
+		REO_ENTRANCE_RING_6_RXDMA_ERROR_CODE_OFFSET)),
+		REO_ENTRANCE_RING_6_RXDMA_ERROR_CODE_MASK,
+		REO_ENTRANCE_RING_6_RXDMA_ERROR_CODE_LSB);
+}
+
 #endif /* _HAL_RX_H */

+ 6 - 3
hal/wifi3.0/hal_internal.h

@@ -354,9 +354,12 @@ struct hal_soc {
 
 #define HAL_DEFAULT_REO_TIMEOUT_MS 40 /* milliseconds */
 
-#define HAL_DESC_SET_FIELD(_desc, _word, _fld, _value) \
-	((_desc)[(_word ## _ ## _fld ## _OFFSET) >> 2] |= \
-		((_value) << _word ## _ ## _fld ## _LSB))
+#define HAL_DESC_SET_FIELD(_desc, _word, _fld, _value) do { \
+	((uint32_t *)(_desc))[(_word ## _ ## _fld ## _OFFSET) >> 2] &= \
+		~(_word ## _ ## _fld ## _MASK); \
+	((uint32_t *)(_desc))[(_word ## _ ## _fld ## _OFFSET) >> 2] |= \
+		((_value) << _word ## _ ## _fld ## _LSB); \
+} while (0)
 
 #define HAL_SM(_reg, _fld, _val) \
 	(((_val) << (_reg ## _ ## _fld ## _SHFT)) & \