Pārlūkot izejas kodu

qcacmn: Add hal_rx_tlv_get_tcp_chksum API

Implement hal_rx_tlv_get_tcp_chksum API
to retrieve tcp_udp_checksum value
based on the chipset.

Change-Id: Ifab970f10af06f8c0cdbd14d57cb66b49bae1648
CRs-Fixed: 2522133
Venkata Sharath Chandra Manchala 5 gadi atpakaļ
vecāks
revīzija
5c5d409000

+ 7 - 4
dp/wifi3.0/dp_rx.c

@@ -917,16 +917,18 @@ void dp_rx_process_invalid_peer_wrapper(struct dp_soc *soc,
 #ifdef RECEIVE_OFFLOAD
 /**
  * dp_rx_print_offload_info() - Print offload info from RX TLV
+ * @soc: dp soc handle
  * @rx_tlv: RX TLV for which offload information is to be printed
  *
  * Return: None
  */
-static void dp_rx_print_offload_info(uint8_t *rx_tlv)
+static void dp_rx_print_offload_info(struct dp_soc *soc, uint8_t *rx_tlv)
 {
 	dp_verbose_debug("----------------------RX DESC LRO/GRO----------------------");
 	dp_verbose_debug("lro_eligible 0x%x", HAL_RX_TLV_GET_LRO_ELIGIBLE(rx_tlv));
 	dp_verbose_debug("pure_ack 0x%x", HAL_RX_TLV_GET_TCP_PURE_ACK(rx_tlv));
-	dp_verbose_debug("chksum 0x%x", HAL_RX_TLV_GET_TCP_CHKSUM(rx_tlv));
+	dp_verbose_debug("chksum 0x%x", hal_rx_tlv_get_tcp_chksum(soc->hal_soc,
+								  rx_tlv));
 	dp_verbose_debug("TCP seq num 0x%x", HAL_RX_TLV_GET_TCP_SEQ(rx_tlv));
 	dp_verbose_debug("TCP ack num 0x%x", HAL_RX_TLV_GET_TCP_ACK(rx_tlv));
 	dp_verbose_debug("TCP window 0x%x", HAL_RX_TLV_GET_TCP_WIN(rx_tlv));
@@ -963,7 +965,8 @@ void dp_rx_fill_gro_info(struct dp_soc *soc, uint8_t *rx_tlv,
 	QDF_NBUF_CB_RX_TCP_PURE_ACK(msdu) =
 			HAL_RX_TLV_GET_TCP_PURE_ACK(rx_tlv);
 	QDF_NBUF_CB_RX_TCP_CHKSUM(msdu) =
-			 HAL_RX_TLV_GET_TCP_CHKSUM(rx_tlv);
+			hal_rx_tlv_get_tcp_chksum(soc->hal_soc,
+						  rx_tlv);
 	QDF_NBUF_CB_RX_TCP_SEQ_NUM(msdu) =
 			 HAL_RX_TLV_GET_TCP_SEQ(rx_tlv);
 	QDF_NBUF_CB_RX_TCP_ACK_NUM(msdu) =
@@ -979,7 +982,7 @@ void dp_rx_fill_gro_info(struct dp_soc *soc, uint8_t *rx_tlv,
 	QDF_NBUF_CB_RX_FLOW_ID(msdu) =
 			 HAL_RX_TLV_GET_FLOW_ID_TOEPLITZ(rx_tlv);
 
-	dp_rx_print_offload_info(rx_tlv);
+	dp_rx_print_offload_info(soc, rx_tlv);
 }
 #else
 static void dp_rx_fill_gro_info(struct dp_soc *soc, uint8_t *rx_tlv,

+ 1 - 0
hal/wifi3.0/hal_internal.h

@@ -448,6 +448,7 @@ struct hal_hw_txrx_ops {
 					  bool *flow_invalid,
 					  bool *flow_timeout,
 					  uint32_t *flow_index);
+	uint16_t (*hal_rx_tlv_get_tcp_chksum)(uint8_t *buf);
 };
 
 /**

+ 9 - 8
hal/wifi3.0/hal_rx.h

@@ -917,14 +917,6 @@ hal_rx_mpdu_peer_meta_data_set(uint8_t *buf, uint32_t peer_mdata)
 		RX_MSDU_END_9_LRO_ELIGIBLE_MASK, \
 		RX_MSDU_END_9_LRO_ELIGIBLE_LSB))
 
-#define HAL_RX_TLV_GET_TCP_CHKSUM(buf) \
-	(_HAL_MS( \
-		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
-			 msdu_end_tlv.rx_msdu_end), \
-			 RX_MSDU_END_1_TCP_UDP_CHKSUM_OFFSET)), \
-		RX_MSDU_END_1_TCP_UDP_CHKSUM_MASK, \
-		RX_MSDU_END_1_TCP_UDP_CHKSUM_LSB))
-
 #define HAL_RX_TLV_GET_TCP_ACK(buf) \
 	(_HAL_MS( \
 		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
@@ -3406,4 +3398,13 @@ hal_rx_msdu_get_flow_params(hal_soc_handle_t hal_soc_hdl,
 						    flow_timeout,
 						    flow_index);
 }
+
+static inline
+uint16_t hal_rx_tlv_get_tcp_chksum(hal_soc_handle_t hal_soc_hdl,
+				   uint8_t *buf)
+{
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	return hal_soc->ops->hal_rx_tlv_get_tcp_chksum(buf);
+}
 #endif /* _HAL_RX_H */

+ 13 - 0
hal/wifi3.0/qca6290/hal_6290.c

@@ -950,6 +950,18 @@ hal_rx_msdu_get_flow_params_6290(uint8_t *buf,
 	*flow_index = HAL_RX_MSDU_END_FLOW_IDX_GET(msdu_end);
 }
 
+/**
+ * hal_rx_tlv_get_tcp_chksum_6290() - API to get tcp checksum
+ * @buf: rx_tlv_hdr
+ *
+ * Return: tcp checksum
+ */
+static uint16_t
+hal_rx_tlv_get_tcp_chksum_6290(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_TCP_CHKSUM(buf);
+}
+
 struct hal_hw_txrx_ops qca6290_hal_hw_txrx_ops = {
 	/* init and setup */
 	hal_srng_dst_hw_init_generic,
@@ -1033,6 +1045,7 @@ struct hal_hw_txrx_ops qca6290_hal_hw_txrx_ops = {
 	hal_rx_msdu_fse_metadata_get_6290,
 	hal_rx_msdu_cce_metadata_get_6290,
 	hal_rx_msdu_get_flow_params_6290,
+	hal_rx_tlv_get_tcp_chksum_6290,
 };
 
 struct hal_hw_srng_config hw_srng_table_6290[] = {

+ 8 - 0
hal/wifi3.0/qca6290/hal_6290_rx.h

@@ -324,6 +324,14 @@ UNIFIED_RX_MSDU_DETAILS_2_RX_MSDU_DESC_INFO_RX_MSDU_DESC_INFO_DETAILS_OFFSET))
 		RX_MSDU_END_16_CCE_METADATA_MASK,	\
 		RX_MSDU_END_16_CCE_METADATA_LSB))
 
+#define HAL_RX_TLV_GET_TCP_CHKSUM(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+			 RX_MSDU_END_1_TCP_UDP_CHKSUM_OFFSET)), \
+		RX_MSDU_END_1_TCP_UDP_CHKSUM_MASK, \
+		RX_MSDU_END_1_TCP_UDP_CHKSUM_LSB))
+
 #if defined(QCA_WIFI_QCA6290_11AX)
 #define HAL_RX_MSDU_START_MIMO_SS_BITMAP(_rx_msdu_start)\
 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_msdu_start),\

+ 13 - 0
hal/wifi3.0/qca6390/hal_6390.c

@@ -946,6 +946,18 @@ hal_rx_msdu_get_flow_params_6390(uint8_t *buf,
 	*flow_index = HAL_RX_MSDU_END_FLOW_IDX_GET(msdu_end);
 }
 
+/**
+ * hal_rx_tlv_get_tcp_chksum_6390() - API to get tcp checksum
+ * @buf: rx_tlv_hdr
+ *
+ * Return: tcp checksum
+ */
+static uint16_t
+hal_rx_tlv_get_tcp_chksum_6390(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_TCP_CHKSUM(buf);
+}
+
 struct hal_hw_txrx_ops qca6390_hal_hw_txrx_ops = {
 	/* init and setup */
 	hal_srng_dst_hw_init_generic,
@@ -1029,6 +1041,7 @@ struct hal_hw_txrx_ops qca6390_hal_hw_txrx_ops = {
 	hal_rx_msdu_fse_metadata_get_6390,
 	hal_rx_msdu_cce_metadata_get_6390,
 	hal_rx_msdu_get_flow_params_6390,
+	hal_rx_tlv_get_tcp_chksum_6390,
 };
 
 struct hal_hw_srng_config hw_srng_table_6390[] = {

+ 8 - 0
hal/wifi3.0/qca6390/hal_6390_rx.h

@@ -329,6 +329,14 @@ UNIFIED_RX_MSDU_DETAILS_2_RX_MSDU_DESC_INFO_RX_MSDU_DESC_INFO_DETAILS_OFFSET))
 		RX_MSDU_END_16_CCE_METADATA_OFFSET)),	\
 		RX_MSDU_END_16_CCE_METADATA_MASK,	\
 		RX_MSDU_END_16_CCE_METADATA_LSB))
+
+#define HAL_RX_TLV_GET_TCP_CHKSUM(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+			 RX_MSDU_END_1_TCP_UDP_CHKSUM_OFFSET)), \
+		RX_MSDU_END_1_TCP_UDP_CHKSUM_MASK, \
+		RX_MSDU_END_1_TCP_UDP_CHKSUM_LSB))
 /*
  * hal_rx_msdu_start_nss_get_6390(): API to get the NSS
  * Interval from rx_msdu_start

+ 13 - 0
hal/wifi3.0/qca6490/hal_6490.c

@@ -796,6 +796,18 @@ hal_rx_msdu_cce_metadata_get_6490(uint8_t *buf)
 	return HAL_RX_MSDU_END_CCE_METADATA_GET(msdu_end);
 }
 
+/**
+ * hal_rx_tlv_get_tcp_chksum_6490() - API to get tcp checksum
+ * @buf: rx_tlv_hdr
+ *
+ * Return: tcp checksum
+ */
+static uint16_t
+hal_rx_tlv_get_tcp_chksum_6490(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_TCP_CHKSUM(buf);
+}
+
 struct hal_hw_txrx_ops qca6490_hal_hw_txrx_ops = {
 	/* tx */
 	hal_tx_desc_set_mesh_en_6490,
@@ -841,4 +853,5 @@ struct hal_hw_txrx_ops qca6490_hal_hw_txrx_ops = {
 	hal_rx_msdu_fse_metadata_get_6490,
 	hal_rx_msdu_cce_metadata_get_6490,
 	NULL,
+	hal_rx_tlv_get_tcp_chksum_6490,
 };

+ 8 - 0
hal/wifi3.0/qca6490/hal_6490_rx.h

@@ -314,3 +314,11 @@ RX_MSDU_DETAILS_2_RX_MSDU_DESC_INFO_DETAILS_RESERVED_0A_OFFSET))
 		RX_MSDU_END_14_CCE_METADATA_OFFSET)),	\
 		RX_MSDU_END_14_CCE_METADATA_MASK,	\
 		RX_MSDU_END_14_CCE_METADATA_LSB))
+
+#define HAL_RX_TLV_GET_TCP_CHKSUM(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+			 RX_MSDU_END_10_TCP_UDP_CHKSUM_OFFSET)), \
+		RX_MSDU_END_10_TCP_UDP_CHKSUM_MASK, \
+		RX_MSDU_END_10_TCP_UDP_CHKSUM_LSB))

+ 13 - 0
hal/wifi3.0/qca8074v1/hal_8074v1.c

@@ -946,6 +946,18 @@ hal_rx_msdu_get_flow_params_8074v1(uint8_t *buf,
 	*flow_index = HAL_RX_MSDU_END_FLOW_IDX_GET(msdu_end);
 }
 
+/**
+ * hal_rx_tlv_get_tcp_chksum_8074v1() - API to get tcp checksum
+ * @buf: rx_tlv_hdr
+ *
+ * Return: tcp checksum
+ */
+static uint16_t
+hal_rx_tlv_get_tcp_chksum_8074v1(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_TCP_CHKSUM(buf);
+}
+
 struct hal_hw_txrx_ops qca8074_hal_hw_txrx_ops = {
 
 	/* init and setup */
@@ -1030,6 +1042,7 @@ struct hal_hw_txrx_ops qca8074_hal_hw_txrx_ops = {
 	hal_rx_msdu_fse_metadata_get_8074v1,
 	hal_rx_msdu_cce_metadata_get_8074v1,
 	hal_rx_msdu_get_flow_params_8074v1,
+	hal_rx_tlv_get_tcp_chksum_8074v1,
 };
 
 struct hal_hw_srng_config hw_srng_table_8074[] = {

+ 8 - 0
hal/wifi3.0/qca8074v1/hal_8074v1_rx.h

@@ -313,6 +313,14 @@ UNIFIED_RX_MSDU_DETAILS_2_RX_MSDU_DESC_INFO_RX_MSDU_DESC_INFO_DETAILS_OFFSET))
 		RX_MSDU_END_16_CCE_METADATA_MASK,	\
 		RX_MSDU_END_16_CCE_METADATA_LSB))
 
+#define HAL_RX_TLV_GET_TCP_CHKSUM(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+			 RX_MSDU_END_1_TCP_UDP_CHKSUM_OFFSET)), \
+		RX_MSDU_END_1_TCP_UDP_CHKSUM_MASK, \
+		RX_MSDU_END_1_TCP_UDP_CHKSUM_LSB))
+
 /*
  * hal_rx_msdu_start_nss_get_8074(): API to get the NSS
  * Interval from rx_msdu_start

+ 13 - 0
hal/wifi3.0/qca8074v2/hal_8074v2.c

@@ -943,6 +943,18 @@ hal_rx_msdu_get_flow_params_8074v2(uint8_t *buf,
 	*flow_index = HAL_RX_MSDU_END_FLOW_IDX_GET(msdu_end);
 }
 
+/**
+ * hal_rx_tlv_get_tcp_chksum_8074v2() - API to get tcp checksum
+ * @buf: rx_tlv_hdr
+ *
+ * Return: tcp checksum
+ */
+static uint16_t
+hal_rx_tlv_get_tcp_chksum_8074v2(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_TCP_CHKSUM(buf);
+}
+
 struct hal_hw_txrx_ops qca8074v2_hal_hw_txrx_ops = {
 
 	/* init and setup */
@@ -1028,6 +1040,7 @@ struct hal_hw_txrx_ops qca8074v2_hal_hw_txrx_ops = {
 	hal_rx_msdu_fse_metadata_get_8074v2,
 	hal_rx_msdu_cce_metadata_get_8074v2,
 	hal_rx_msdu_get_flow_params_8074v2,
+	hal_rx_tlv_get_tcp_chksum_8074v2,
 };
 
 struct hal_hw_srng_config hw_srng_table_8074v2[] = {

+ 8 - 0
hal/wifi3.0/qca8074v2/hal_8074v2_rx.h

@@ -322,6 +322,14 @@ UNIFIED_RX_MSDU_DETAILS_2_RX_MSDU_DESC_INFO_RX_MSDU_DESC_INFO_DETAILS_OFFSET))
 		RX_MSDU_END_16_CCE_METADATA_MASK,	\
 		RX_MSDU_END_16_CCE_METADATA_LSB))
 
+#define HAL_RX_TLV_GET_TCP_CHKSUM(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+			 RX_MSDU_END_1_TCP_UDP_CHKSUM_OFFSET)), \
+		RX_MSDU_END_1_TCP_UDP_CHKSUM_MASK, \
+		RX_MSDU_END_1_TCP_UDP_CHKSUM_LSB))
+
 /*
  * hal_rx_msdu_start_nss_get_8074v2(): API to get the NSS
  * Interval from rx_msdu_start

+ 13 - 0
hal/wifi3.0/qcn9000/hal_9000.c

@@ -952,6 +952,18 @@ hal_rx_msdu_get_flow_params_9000(uint8_t *buf,
 	*flow_index = HAL_RX_MSDU_END_FLOW_IDX_GET(msdu_end);
 }
 
+/**
+ * hal_rx_tlv_get_tcp_chksum_9000() - API to get tcp checksum
+ * @buf: rx_tlv_hdr
+ *
+ * Return: tcp checksum
+ */
+static uint16_t
+hal_rx_tlv_get_tcp_chksum_9000(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_TCP_CHKSUM(buf);
+}
+
 struct hal_hw_txrx_ops qcn9000_hal_hw_txrx_ops = {
 
 	/* init and setup */
@@ -1037,6 +1049,7 @@ struct hal_hw_txrx_ops qcn9000_hal_hw_txrx_ops = {
 	hal_rx_msdu_fse_metadata_get_9000,
 	hal_rx_msdu_cce_metadata_get_9000,
 	hal_rx_msdu_get_flow_params_9000,
+	hal_rx_tlv_get_tcp_chksum_9000,
 };
 
 struct hal_hw_srng_config hw_srng_table_9000[] = {