qcacmn: Add hal macros for fisa assist

Add 6490 chip specific HAL macros to extract FISA assist from TLV header.

Change-Id: I269431b2708f07b10e7e02715d8940fea27a66f6
CRs-Fixed: 2599917
diff --git a/hal/wifi3.0/hal_internal.h b/hal/wifi3.0/hal_internal.h
index 794d050..d2ec603 100644
--- a/hal/wifi3.0/hal_internal.h
+++ b/hal/wifi3.0/hal_internal.h
@@ -464,6 +464,12 @@
 	void (*hal_rx_get_rtt_info)(void *rx_tlv, void *ppdu_info_handle);
 	void (*hal_rx_msdu_packet_metadata_get)(uint8_t *buf,
 						void *msdu_pkt_metadata);
+	uint16_t (*hal_rx_get_fisa_cumulative_l4_checksum)(uint8_t *buf);
+	uint16_t (*hal_rx_get_fisa_cumulative_ip_length)(uint8_t *buf);
+	bool (*hal_rx_get_udp_proto)(uint8_t *buf);
+	bool (*hal_rx_get_fisa_flow_agg_continuation)(uint8_t *buf);
+	uint8_t (*hal_rx_get_fisa_flow_agg_count)(uint8_t *buf);
+	bool (*hal_rx_get_fisa_timeout)(uint8_t *buf);
 };
 
 /**
diff --git a/hal/wifi3.0/hal_rx.h b/hal/wifi3.0/hal_rx.h
index 6131e23..c239b7a 100644
--- a/hal/wifi3.0/hal_rx.h
+++ b/hal/wifi3.0/hal_rx.h
@@ -995,6 +995,14 @@
 		RX_MSDU_START_2_TCP_PROTO_MASK, \
 		RX_MSDU_START_2_TCP_PROTO_LSB))
 
+#define HAL_RX_TLV_GET_UDP_PROTO(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_start_tlv.rx_msdu_start), \
+			 RX_MSDU_START_2_UDP_PROTO_OFFSET)), \
+		RX_MSDU_START_2_UDP_PROTO_MASK, \
+		RX_MSDU_START_2_UDP_PROTO_LSB))
+
 #define HAL_RX_TLV_GET_IPV6(buf) \
 	(_HAL_MS( \
 		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
@@ -3461,4 +3469,151 @@
 
 	return hal_soc->ops->hal_rx_msdu_packet_metadata_get(buf, msdu_md);
 }
+
+/**
+ * hal_rx_get_fisa_cumulative_l4_checksum: API to get cumulative_l4_checksum
+ * from rx_msdu_end TLV
+ * @buf: pointer to the start of RX PKT TLV headers
+ *
+ * Return: cumulative_l4_checksum
+ */
+static inline uint16_t
+hal_rx_get_fisa_cumulative_l4_checksum(hal_soc_handle_t hal_soc_hdl,
+				       uint8_t *buf)
+{
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	if (!hal_soc || !hal_soc->ops) {
+		hal_err("hal handle is NULL");
+		QDF_BUG(0);
+		return 0;
+	}
+
+	if (!hal_soc->ops->hal_rx_get_fisa_cumulative_l4_checksum)
+		return 0;
+
+	return hal_soc->ops->hal_rx_get_fisa_cumulative_l4_checksum(buf);
+}
+
+/**
+ * hal_rx_get_fisa_cumulative_ip_length: API to get cumulative_ip_length
+ * from rx_msdu_end TLV
+ * @buf: pointer to the start of RX PKT TLV headers
+ *
+ * Return: cumulative_ip_length
+ */
+static inline uint16_t
+hal_rx_get_fisa_cumulative_ip_length(hal_soc_handle_t hal_soc_hdl,
+				     uint8_t *buf)
+{
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	if (!hal_soc || !hal_soc->ops) {
+		hal_err("hal handle is NULL");
+		QDF_BUG(0);
+		return 0;
+	}
+
+	if (hal_soc->ops->hal_rx_get_fisa_cumulative_ip_length)
+		return hal_soc->ops->hal_rx_get_fisa_cumulative_ip_length(buf);
+
+	return 0;
+}
+
+/**
+ * hal_rx_get_udp_proto: API to get UDP proto field
+ * from rx_msdu_start TLV
+ * @buf: pointer to the start of RX PKT TLV headers
+ *
+ * Return: UDP proto field value
+ */
+static inline bool
+hal_rx_get_udp_proto(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
+{
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	if (!hal_soc || !hal_soc->ops) {
+		hal_err("hal handle is NULL");
+		QDF_BUG(0);
+		return 0;
+	}
+
+	if (hal_soc->ops->hal_rx_get_udp_proto)
+		return hal_soc->ops->hal_rx_get_udp_proto(buf);
+
+	return 0;
+}
+
+/**
+ * hal_rx_get_fisa_flow_agg_continuation: API to get fisa flow_agg_continuation
+ * from rx_msdu_end TLV
+ * @buf: pointer to the start of RX PKT TLV headers
+ *
+ * Return: flow_agg_continuation bit field value
+ */
+static inline bool
+hal_rx_get_fisa_flow_agg_continuation(hal_soc_handle_t hal_soc_hdl,
+				      uint8_t *buf)
+{
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	if (!hal_soc || !hal_soc->ops) {
+		hal_err("hal handle is NULL");
+		QDF_BUG(0);
+		return 0;
+	}
+
+	if (hal_soc->ops->hal_rx_get_fisa_flow_agg_continuation)
+		return hal_soc->ops->hal_rx_get_fisa_flow_agg_continuation(buf);
+
+	return 0;
+}
+
+/**
+ * hal_rx_get_fisa_flow_agg_count: API to get fisa flow_agg count from
+ * rx_msdu_end TLV
+ * @buf: pointer to the start of RX PKT TLV headers
+ *
+ * Return: flow_agg count value
+ */
+static inline uint8_t
+hal_rx_get_fisa_flow_agg_count(hal_soc_handle_t hal_soc_hdl,
+			       uint8_t *buf)
+{
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	if (!hal_soc || !hal_soc->ops) {
+		hal_err("hal handle is NULL");
+		QDF_BUG(0);
+		return 0;
+	}
+
+	if (hal_soc->ops->hal_rx_get_fisa_flow_agg_count)
+		return hal_soc->ops->hal_rx_get_fisa_flow_agg_count(buf);
+
+	return 0;
+}
+
+/**
+ * hal_rx_get_fisa_timeout: API to get fisa time out from rx_msdu_end TLV
+ * @buf: pointer to the start of RX PKT TLV headers
+ *
+ * Return: fisa flow_agg timeout bit value
+ */
+static inline bool
+hal_rx_get_fisa_timeout(hal_soc_handle_t hal_soc_hdl, uint8_t *buf)
+{
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	if (!hal_soc || !hal_soc->ops) {
+		hal_err("hal handle is NULL");
+		QDF_BUG(0);
+		return 0;
+	}
+
+	if (hal_soc->ops->hal_rx_get_fisa_timeout)
+		return hal_soc->ops->hal_rx_get_fisa_timeout(buf);
+
+	return 0;
+}
 #endif /* _HAL_RX_H */
diff --git a/hal/wifi3.0/qca6290/hal_6290.c b/hal/wifi3.0/qca6290/hal_6290.c
index 4c61757..822a7a9 100644
--- a/hal/wifi3.0/qca6290/hal_6290.c
+++ b/hal/wifi3.0/qca6290/hal_6290.c
@@ -1081,6 +1081,12 @@
 	NULL,
 	/* rx - msdu end fast path info fields */
 	hal_rx_msdu_packet_metadata_get_generic,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
 };
 
 struct hal_hw_srng_config hw_srng_table_6290[] = {
diff --git a/hal/wifi3.0/qca6390/hal_6390.c b/hal/wifi3.0/qca6390/hal_6390.c
index 8dc7ca0..4e52c19 100644
--- a/hal/wifi3.0/qca6390/hal_6390.c
+++ b/hal/wifi3.0/qca6390/hal_6390.c
@@ -1077,6 +1077,12 @@
 	NULL,
 	/* rx - msdu end fast path info fields */
 	hal_rx_msdu_packet_metadata_get_generic,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
 };
 
 struct hal_hw_srng_config hw_srng_table_6390[] = {
diff --git a/hal/wifi3.0/qca6490/hal_6490.c b/hal/wifi3.0/qca6490/hal_6490.c
index 08523c9..36a8bd3 100644
--- a/hal/wifi3.0/qca6490/hal_6490.c
+++ b/hal/wifi3.0/qca6490/hal_6490.c
@@ -316,7 +316,7 @@
 	struct rx_msdu_end *msdu_end = (struct rx_msdu_end *)msduend;
 
 	QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
-		  "rx_msdu_end tlv (1/2) - "
+		  "rx_msdu_end tlv (1/3) - "
 		  "rxpcu_mpdu_filter_in_category: %x "
 		  "sw_frame_group_id: %x "
 		  "phy_ppdu_id: %x "
@@ -363,7 +363,7 @@
 		  msdu_end->amsdu_parser_error);
 
 	QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
-		  "rx_msdu_end tlv (2/2)- "
+		  "rx_msdu_end tlv (2/3)- "
 		  "sa_is_valid: %x "
 		  "da_is_valid: %x "
 		  "da_is_mcbc: %x "
@@ -412,6 +412,18 @@
 		  msdu_end->fse_metadata,
 		  msdu_end->cce_metadata,
 		  msdu_end->sa_sw_peer_id);
+	QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
+		  "rx_msdu_end tlv (3/3)"
+		  "aggregation_count %x "
+		  "flow_aggregation_continuation %x "
+		  "fisa_timeout %x "
+		  "cumulative_l4_checksum %x "
+		  "cumulative_ip_length %x",
+		  msdu_end->aggregation_count,
+		  msdu_end->flow_aggregation_continuation,
+		  msdu_end->fisa_timeout,
+		  msdu_end->cumulative_l4_checksum,
+		  msdu_end->cumulative_ip_length);
 }
 
 /*
@@ -1259,6 +1271,30 @@
 }
 
 /**
+ * hal_rx_msdu_get_flow_params_6490: API to get flow index, flow index invalid
+ * and flow index timeout from rx_msdu_end TLV
+ * @buf: pointer to the start of RX PKT TLV headers
+ * @flow_invalid: pointer to return value of flow_idx_valid
+ * @flow_timeout: pointer to return value of flow_idx_timeout
+ * @flow_index: pointer to return value of flow_idx
+ *
+ * Return: none
+ */
+static inline void
+hal_rx_msdu_get_flow_params_6490(uint8_t *buf,
+				 bool *flow_invalid,
+				 bool *flow_timeout,
+				 uint32_t *flow_index)
+{
+	struct rx_pkt_tlvs *pkt_tlvs = (struct rx_pkt_tlvs *)buf;
+	struct rx_msdu_end *msdu_end = &pkt_tlvs->msdu_end_tlv.rx_msdu_end;
+
+	*flow_invalid = HAL_RX_MSDU_END_FLOW_IDX_INVALID_GET(msdu_end);
+	*flow_timeout = HAL_RX_MSDU_END_FLOW_IDX_TIMEOUT_GET(msdu_end);
+	*flow_index = HAL_RX_MSDU_END_FLOW_IDX_GET(msdu_end);
+}
+
+/**
  * hal_rx_tlv_get_tcp_chksum_6490() - API to get tcp checksum
  * @buf: rx_tlv_hdr
  *
@@ -1298,6 +1334,81 @@
 	return addr;
 }
 
+/**
+ * hal_rx_get_fisa_cumulative_l4_checksum_6490() - Retrieve cumulative
+ *                                                 checksum
+ * @buf: buffer pointer
+ *
+ * Return: cumulative checksum
+ */
+static inline
+uint16_t hal_rx_get_fisa_cumulative_l4_checksum_6490(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_FISA_CUMULATIVE_L4_CHECKSUM(buf);
+}
+
+/**
+ * hal_rx_get_fisa_cumulative_ip_length_6490() - Retrieve cumulative
+ *                                               ip length
+ * @buf: buffer pointer
+ *
+ * Return: cumulative length
+ */
+static inline
+uint16_t hal_rx_get_fisa_cumulative_ip_length_6490(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_FISA_CUMULATIVE_IP_LENGTH(buf);
+}
+
+/**
+ * hal_rx_get_udp_proto_6490() - Retrieve udp proto value
+ * @buf: buffer
+ *
+ * Return: udp proto bit
+ */
+static inline
+bool hal_rx_get_udp_proto_6490(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_UDP_PROTO(buf);
+}
+
+/**
+ * hal_rx_get_flow_agg_continuation_6490() - retrieve flow agg
+ *                                           continuation
+ * @buf: buffer
+ *
+ * Return: flow agg
+ */
+static inline
+bool hal_rx_get_flow_agg_continuation_6490(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_FLOW_AGGR_CONT(buf);
+}
+
+/**
+ * hal_rx_get_flow_agg_count_6490()- Retrieve flow agg count
+ * @buf: buffer
+ *
+ * Return: flow agg count
+ */
+static inline
+uint8_t hal_rx_get_flow_agg_count_6490(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_FLOW_AGGR_COUNT(buf);
+}
+
+/**
+ * hal_rx_get_fisa_timeout_6490() - Retrieve fisa timeout
+ * @buf: buffer
+ *
+ * Return: fisa timeout
+ */
+static inline
+bool hal_rx_get_fisa_timeout_6490(uint8_t *buf)
+{
+	return HAL_RX_TLV_GET_FISA_TIMEOUT(buf);
+}
+
 struct hal_hw_txrx_ops qca6490_hal_hw_txrx_ops = {
 	/* init and setup */
 	hal_srng_dst_hw_init_generic,
@@ -1383,13 +1494,19 @@
 	hal_rx_msdu_flow_idx_timeout_6490,
 	hal_rx_msdu_fse_metadata_get_6490,
 	hal_rx_msdu_cce_metadata_get_6490,
-	NULL,
+	hal_rx_msdu_get_flow_params_6490,
 	hal_rx_tlv_get_tcp_chksum_6490,
 	hal_rx_get_rx_sequence_6490,
 	NULL,
 	NULL,
 	/* rx - msdu end fast path info fields */
 	hal_rx_msdu_packet_metadata_get_generic,
+	hal_rx_get_fisa_cumulative_l4_checksum_6490,
+	hal_rx_get_fisa_cumulative_ip_length_6490,
+	hal_rx_get_udp_proto_6490,
+	hal_rx_get_flow_agg_continuation_6490,
+	hal_rx_get_flow_agg_count_6490,
+	hal_rx_get_fisa_timeout_6490,
 };
 
 struct hal_hw_srng_config hw_srng_table_6490[] = {
diff --git a/hal/wifi3.0/qca6490/hal_6490_rx.h b/hal/wifi3.0/qca6490/hal_6490_rx.h
index d1f31b6..bd2ac82 100644
--- a/hal/wifi3.0/qca6490/hal_6490_rx.h
+++ b/hal/wifi3.0/qca6490/hal_6490_rx.h
@@ -363,4 +363,43 @@
 		RX_MSDU_END_11_DA_IDX_OR_SW_PEER_ID_MASK,	\
 		RX_MSDU_END_11_DA_IDX_OR_SW_PEER_ID_LSB))
 
+#define HAL_RX_TLV_GET_FLOW_AGGR_CONT(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+		RX_MSDU_END_17_FLOW_AGGREGATION_CONTINUATION_OFFSET)),	\
+		RX_MSDU_END_17_FLOW_AGGREGATION_CONTINUATION_MASK,	\
+		RX_MSDU_END_17_FLOW_AGGREGATION_CONTINUATION_LSB))
+
+#define HAL_RX_TLV_GET_FLOW_AGGR_COUNT(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+		RX_MSDU_END_17_AGGREGATION_COUNT_OFFSET)),	\
+		RX_MSDU_END_17_AGGREGATION_COUNT_MASK,	\
+		RX_MSDU_END_17_AGGREGATION_COUNT_LSB))
+
+#define HAL_RX_TLV_GET_FISA_TIMEOUT(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+		RX_MSDU_END_17_FISA_TIMEOUT_OFFSET)),	\
+		RX_MSDU_END_17_FISA_TIMEOUT_MASK,	\
+		RX_MSDU_END_17_FISA_TIMEOUT_LSB))
+
+#define HAL_RX_TLV_GET_FISA_CUMULATIVE_L4_CHECKSUM(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+		RX_MSDU_END_18_CUMULATIVE_L4_CHECKSUM_OFFSET)),	\
+		RX_MSDU_END_18_CUMULATIVE_L4_CHECKSUM_MASK,	\
+		RX_MSDU_END_18_CUMULATIVE_L4_CHECKSUM_LSB))
+
+#define HAL_RX_TLV_GET_FISA_CUMULATIVE_IP_LENGTH(buf) \
+	(_HAL_MS( \
+		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
+			 msdu_end_tlv.rx_msdu_end), \
+		RX_MSDU_END_18_CUMULATIVE_IP_LENGTH_OFFSET)),	\
+		RX_MSDU_END_18_CUMULATIVE_IP_LENGTH_MASK,	\
+		RX_MSDU_END_18_CUMULATIVE_IP_LENGTH_LSB))
 #endif
diff --git a/hal/wifi3.0/qca8074v1/hal_8074v1.c b/hal/wifi3.0/qca8074v1/hal_8074v1.c
index 35c2fa9..8e26a29 100644
--- a/hal/wifi3.0/qca8074v1/hal_8074v1.c
+++ b/hal/wifi3.0/qca8074v1/hal_8074v1.c
@@ -1077,6 +1077,12 @@
 	NULL,
 	/* rx - msdu fast path info fields */
 	hal_rx_msdu_packet_metadata_get_generic,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
 };
 
 struct hal_hw_srng_config hw_srng_table_8074[] = {
diff --git a/hal/wifi3.0/qca8074v2/hal_8074v2.c b/hal/wifi3.0/qca8074v2/hal_8074v2.c
index 44142b3..b19d1dd 100644
--- a/hal/wifi3.0/qca8074v2/hal_8074v2.c
+++ b/hal/wifi3.0/qca8074v2/hal_8074v2.c
@@ -1082,6 +1082,12 @@
 #endif
 	/* rx - msdu fast path info fields */
 	hal_rx_msdu_packet_metadata_get_generic,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
 };
 
 struct hal_hw_srng_config hw_srng_table_8074v2[] = {
diff --git a/hal/wifi3.0/qcn9000/hal_9000.c b/hal/wifi3.0/qcn9000/hal_9000.c
index 300468b..cca448d 100644
--- a/hal/wifi3.0/qcn9000/hal_9000.c
+++ b/hal/wifi3.0/qcn9000/hal_9000.c
@@ -1460,6 +1460,12 @@
 	NULL,
 	/* rx - msdu fast path info fields */
 	hal_rx_msdu_packet_metadata_get_9000,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
 };
 
 struct hal_hw_srng_config hw_srng_table_9000[] = {