qcacmn: introduce few target specific hal functions

make hal_rx_msdu_end_sa_idx_get and hal_rx_dump_msdu_end_tlv
routines target specific as qca6390 implementation differs
a bit. add target specific functions for qca6290 and qca8074

Change-Id: Ie05b91d965bae3642e3264620c6d8427ad368044
diff --git a/dp/wifi3.0/dp_rx.h b/dp/wifi3.0/dp_rx.h
index df239f8..040cc77 100644
--- a/dp/wifi3.0/dp_rx.h
+++ b/dp/wifi3.0/dp_rx.h
@@ -420,7 +420,7 @@
 	/*
 	 * Get the AST entry from HW SA index and mark it as active
 	 */
-	sa_idx = hal_rx_msdu_end_sa_idx_get(rx_tlv_hdr);
+	sa_idx = hal_rx_msdu_end_sa_idx_get(soc->hal_soc, rx_tlv_hdr);
 
 	qdf_spin_lock_bh(&soc->ast_lock);
 	ast = soc->ast_table[sa_idx];
diff --git a/dp/wifi3.0/dp_rx_err.c b/dp/wifi3.0/dp_rx_err.c
index f005950..2515025 100644
--- a/dp/wifi3.0/dp_rx_err.c
+++ b/dp/wifi3.0/dp_rx_err.c
@@ -107,7 +107,7 @@
 	 */
 	qdf_spin_lock_bh(&soc->ast_lock);
 	if (hal_rx_msdu_end_sa_is_valid_get(rx_tlv_hdr)) {
-		sa_idx = hal_rx_msdu_end_sa_idx_get(rx_tlv_hdr);
+		sa_idx = hal_rx_msdu_end_sa_idx_get(soc->hal_soc, rx_tlv_hdr);
 
 		if ((sa_idx < 0) ||
 				(sa_idx >= (WLAN_UMAC_PSOC_MAX_PEERS * 2))) {
diff --git a/dp/wifi3.0/hal_rx.h b/dp/wifi3.0/hal_rx.h
index ccbde50..166d53c 100644
--- a/dp/wifi3.0/hal_rx.h
+++ b/dp/wifi3.0/hal_rx.h
@@ -1030,13 +1030,7 @@
 	return l3_header_padding;
 }
 
-#define HAL_RX_MSDU_END_SA_IDX_GET(_rx_msdu_end)	\
-	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
-		RX_MSDU_END_13_SA_IDX_OFFSET)),	\
-		RX_MSDU_END_13_SA_IDX_MASK,		\
-		RX_MSDU_END_13_SA_IDX_LSB))
-
- /**
+/**
  * hal_rx_msdu_end_sa_idx_get(): API to get the
  * sa_idx from rx_msdu_end TLV
  *
@@ -1044,15 +1038,9 @@
  * Return: sa_idx (SA AST index)
  */
 static inline uint16_t
-hal_rx_msdu_end_sa_idx_get(uint8_t *buf)
+hal_rx_msdu_end_sa_idx_get(struct hal_soc *hal_soc, uint8_t *buf)
 {
-	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;
-	uint16_t sa_idx;
-
-	sa_idx = HAL_RX_MSDU_END_SA_IDX_GET(msdu_end);
-
-	return sa_idx;
+	return hal_soc->ops->hal_rx_msdu_end_sa_idx_get(buf);
 }
 
 #define HAL_RX_MSDU_END_SA_IS_VALID_GET(_rx_msdu_end)	\
@@ -2711,103 +2699,11 @@
  *
  * Return: void
  */
-static inline void hal_rx_dump_msdu_end_tlv(struct rx_msdu_end *msdu_end,
-							uint8_t dbg_level)
+static inline void hal_rx_dump_msdu_end_tlv(struct hal_soc *hal_soc,
+					    struct rx_msdu_end *msdu_end,
+					    uint8_t dbg_level)
 {
-	QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
-			"rx_msdu_end tlv - "
-			"rxpcu_mpdu_filter_in_category: %d "
-			"sw_frame_group_id: %d "
-			"phy_ppdu_id: %d "
-			"ip_hdr_chksum: %d "
-			"tcp_udp_chksum: %d "
-			"key_id_octet: %d "
-			"cce_super_rule: %d "
-			"cce_classify_not_done_truncat: %d "
-			"cce_classify_not_done_cce_dis: %d "
-			"ext_wapi_pn_63_48: %d "
-			"ext_wapi_pn_95_64: %d "
-			"ext_wapi_pn_127_96: %d "
-			"reported_mpdu_length: %d "
-			"first_msdu: %d "
-			"last_msdu: %d "
-			"sa_idx_timeout: %d "
-			"da_idx_timeout: %d "
-			"msdu_limit_error: %d "
-			"flow_idx_timeout: %d "
-			"flow_idx_invalid: %d "
-			"wifi_parser_error: %d "
-			"amsdu_parser_error: %d "
-			"sa_is_valid: %d "
-			"da_is_valid: %d "
-			"da_is_mcbc: %d "
-			"l3_header_padding: %d "
-			"ipv6_options_crc: %d "
-			"tcp_seq_number: %d "
-			"tcp_ack_number: %d "
-			"tcp_flag: %d "
-			"lro_eligible: %d "
-			"window_size: %d "
-			"da_offset: %d "
-			"sa_offset: %d "
-			"da_offset_valid: %d "
-			"sa_offset_valid: %d "
-			"rule_indication_31_0: %d "
-			"rule_indication_63_32: %d "
-			"sa_idx: %d "
-			"da_idx: %d "
-			"msdu_drop: %d "
-			"reo_destination_indication: %d "
-			"flow_idx: %d "
-			"fse_metadata: %d "
-			"cce_metadata: %d "
-			"sa_sw_peer_id: %d ",
-			msdu_end->rxpcu_mpdu_filter_in_category,
-			msdu_end->sw_frame_group_id,
-			msdu_end->phy_ppdu_id,
-			msdu_end->ip_hdr_chksum,
-			msdu_end->tcp_udp_chksum,
-			msdu_end->key_id_octet,
-			msdu_end->cce_super_rule,
-			msdu_end->cce_classify_not_done_truncate,
-			msdu_end->cce_classify_not_done_cce_dis,
-			msdu_end->ext_wapi_pn_63_48,
-			msdu_end->ext_wapi_pn_95_64,
-			msdu_end->ext_wapi_pn_127_96,
-			msdu_end->reported_mpdu_length,
-			msdu_end->first_msdu,
-			msdu_end->last_msdu,
-			msdu_end->sa_idx_timeout,
-			msdu_end->da_idx_timeout,
-			msdu_end->msdu_limit_error,
-			msdu_end->flow_idx_timeout,
-			msdu_end->flow_idx_invalid,
-			msdu_end->wifi_parser_error,
-			msdu_end->amsdu_parser_error,
-			msdu_end->sa_is_valid,
-			msdu_end->da_is_valid,
-			msdu_end->da_is_mcbc,
-			msdu_end->l3_header_padding,
-			msdu_end->ipv6_options_crc,
-			msdu_end->tcp_seq_number,
-			msdu_end->tcp_ack_number,
-			msdu_end->tcp_flag,
-			msdu_end->lro_eligible,
-			msdu_end->window_size,
-			msdu_end->da_offset,
-			msdu_end->sa_offset,
-			msdu_end->da_offset_valid,
-			msdu_end->sa_offset_valid,
-			msdu_end->rule_indication_31_0,
-			msdu_end->rule_indication_63_32,
-			msdu_end->sa_idx,
-			msdu_end->da_idx,
-			msdu_end->msdu_drop,
-			msdu_end->reo_destination_indication,
-			msdu_end->flow_idx,
-			msdu_end->fse_metadata,
-			msdu_end->cce_metadata,
-			msdu_end->sa_sw_peer_id);
+	hal_soc->ops->hal_rx_dump_msdu_end_tlv(msdu_end, dbg_level);
 }
 
 /**
@@ -3496,7 +3392,7 @@
 	hal_rx_dump_mpdu_start_tlv(mpdu_start, dbg_level);
 	hal_rx_dump_msdu_start_tlv(hal_soc, msdu_start, dbg_level);
 	hal_rx_dump_mpdu_end_tlv(mpdu_end, dbg_level);
-	hal_rx_dump_msdu_end_tlv(msdu_end, dbg_level);
+	hal_rx_dump_msdu_end_tlv(hal_soc, msdu_end, dbg_level);
 	hal_rx_dump_pkt_hdr_tlv(pkt_hdr_tlv, dbg_level);
 }
 
diff --git a/hal/wifi3.0/hal_internal.h b/hal/wifi3.0/hal_internal.h
index c8ae3ef..acf4038 100644
--- a/hal/wifi3.0/hal_internal.h
+++ b/hal/wifi3.0/hal_internal.h
@@ -290,9 +290,12 @@
 	void (*hal_rx_proc_phyrx_other_receive_info_tlv)(void *rx_tlv_hdr,
 							void *ppdu_info_handle);
 	void (*hal_rx_dump_msdu_start_tlv)(void *msdu_start, uint8_t dbg_level);
+	void (*hal_rx_dump_msdu_end_tlv)(void *msdu_end,
+					 uint8_t dbg_level);
 	uint32_t (*hal_get_link_desc_size)(void);
 	uint32_t (*hal_rx_mpdu_start_tid_get)(uint8_t *buf);
 	uint32_t (*hal_rx_msdu_start_reception_type_get)(uint8_t *buf);
+	uint16_t (*hal_rx_msdu_end_sa_idx_get)(uint8_t *buf);
 };
 
 /**
diff --git a/hal/wifi3.0/qca6290/hal_6290_rx.h b/hal/wifi3.0/qca6290/hal_6290_rx.h
index 1628c66..2c3c7f7 100644
--- a/hal/wifi3.0/qca6290/hal_6290_rx.h
+++ b/hal/wifi3.0/qca6290/hal_6290_rx.h
@@ -296,6 +296,117 @@
 
 qdf_export_symbol(hal_rx_dump_msdu_start_tlv_6290);
 
+/**
+ * hal_rx_dump_msdu_end_tlv_6290: dump RX msdu_end TLV in structured
+ *			     human readable format.
+ * @ msdu_end: pointer the msdu_end TLV in pkt.
+ * @ dbg_level: log level.
+ *
+ * Return: void
+ */
+void hal_rx_dump_msdu_end_tlv_6290(void *msduend,
+				   uint8_t dbg_level)
+{
+	struct rx_msdu_end *msdu_end = (struct rx_msdu_end *)msduend;
+
+	QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
+			"rx_msdu_end tlv - "
+			"rxpcu_mpdu_filter_in_category: %d "
+			"sw_frame_group_id: %d "
+			"phy_ppdu_id: %d "
+			"ip_hdr_chksum: %d "
+			"tcp_udp_chksum: %d "
+			"key_id_octet: %d "
+			"cce_super_rule: %d "
+			"cce_classify_not_done_truncat: %d "
+			"cce_classify_not_done_cce_dis: %d "
+			"ext_wapi_pn_63_48: %d "
+			"ext_wapi_pn_95_64: %d "
+			"ext_wapi_pn_127_96: %d "
+			"reported_mpdu_length: %d "
+			"first_msdu: %d "
+			"last_msdu: %d "
+			"sa_idx_timeout: %d "
+			"da_idx_timeout: %d "
+			"msdu_limit_error: %d "
+			"flow_idx_timeout: %d "
+			"flow_idx_invalid: %d "
+			"wifi_parser_error: %d "
+			"amsdu_parser_error: %d "
+			"sa_is_valid: %d "
+			"da_is_valid: %d "
+			"da_is_mcbc: %d "
+			"l3_header_padding: %d "
+			"ipv6_options_crc: %d "
+			"tcp_seq_number: %d "
+			"tcp_ack_number: %d "
+			"tcp_flag: %d "
+			"lro_eligible: %d "
+			"window_size: %d "
+			"da_offset: %d "
+			"sa_offset: %d "
+			"da_offset_valid: %d "
+			"sa_offset_valid: %d "
+			"rule_indication_31_0: %d "
+			"rule_indication_63_32: %d "
+			"sa_idx: %d "
+			"da_idx: %d "
+			"msdu_drop: %d "
+			"reo_destination_indication: %d "
+			"flow_idx: %d "
+			"fse_metadata: %d "
+			"cce_metadata: %d "
+			"sa_sw_peer_id: %d ",
+			msdu_end->rxpcu_mpdu_filter_in_category,
+			msdu_end->sw_frame_group_id,
+			msdu_end->phy_ppdu_id,
+			msdu_end->ip_hdr_chksum,
+			msdu_end->tcp_udp_chksum,
+			msdu_end->key_id_octet,
+			msdu_end->cce_super_rule,
+			msdu_end->cce_classify_not_done_truncate,
+			msdu_end->cce_classify_not_done_cce_dis,
+			msdu_end->ext_wapi_pn_63_48,
+			msdu_end->ext_wapi_pn_95_64,
+			msdu_end->ext_wapi_pn_127_96,
+			msdu_end->reported_mpdu_length,
+			msdu_end->first_msdu,
+			msdu_end->last_msdu,
+			msdu_end->sa_idx_timeout,
+			msdu_end->da_idx_timeout,
+			msdu_end->msdu_limit_error,
+			msdu_end->flow_idx_timeout,
+			msdu_end->flow_idx_invalid,
+			msdu_end->wifi_parser_error,
+			msdu_end->amsdu_parser_error,
+			msdu_end->sa_is_valid,
+			msdu_end->da_is_valid,
+			msdu_end->da_is_mcbc,
+			msdu_end->l3_header_padding,
+			msdu_end->ipv6_options_crc,
+			msdu_end->tcp_seq_number,
+			msdu_end->tcp_ack_number,
+			msdu_end->tcp_flag,
+			msdu_end->lro_eligible,
+			msdu_end->window_size,
+			msdu_end->da_offset,
+			msdu_end->sa_offset,
+			msdu_end->da_offset_valid,
+			msdu_end->sa_offset_valid,
+			msdu_end->rule_indication_31_0,
+			msdu_end->rule_indication_63_32,
+			msdu_end->sa_idx,
+			msdu_end->da_idx,
+			msdu_end->msdu_drop,
+			msdu_end->reo_destination_indication,
+			msdu_end->flow_idx,
+			msdu_end->fse_metadata,
+			msdu_end->cce_metadata,
+			msdu_end->sa_sw_peer_id);
+}
+
+qdf_export_symbol(hal_rx_dump_msdu_end_tlv_6290);
+
 /*
  * Get tid from RX_MPDU_START
  */
@@ -346,3 +457,27 @@
 
 qdf_export_symbol(hal_rx_msdu_start_reception_type_get_6290);
 
+#define HAL_RX_MSDU_END_DA_IDX_GET(_rx_msdu_end)	\
+	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
+		RX_MSDU_END_13_DA_IDX_OFFSET)),		\
+		RX_MSDU_END_13_DA_IDX_MASK,		\
+		RX_MSDU_END_13_DA_IDX_LSB))
+
+/**
+ * hal_rx_msdu_end_da_idx_get_6290: API to get da_idx
+ * from rx_msdu_end TLV
+ *
+ * @ buf: pointer to the start of RX PKT TLV headers
+ * Return: da index
+ */
+uint16_t hal_rx_msdu_end_da_idx_get_6290(uint8_t *buf)
+{
+	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;
+	uint16_t da_idx;
+
+	da_idx = HAL_RX_MSDU_END_DA_IDX_GET(msdu_end);
+
+	return da_idx;
+}
+
diff --git a/hal/wifi3.0/qca6290/hal_6290_srng.c b/hal/wifi3.0/qca6290/hal_6290_srng.c
index eee73f5..17506d9 100644
--- a/hal/wifi3.0/qca6290/hal_6290_srng.c
+++ b/hal/wifi3.0/qca6290/hal_6290_srng.c
@@ -55,9 +55,11 @@
 	hal_rx_get_tlv_6290,
 	hal_rx_proc_phyrx_other_receive_info_tlv_6290,
 	hal_rx_dump_msdu_start_tlv_6290,
+	hal_rx_dump_msdu_end_tlv_6290,
 	hal_get_link_desc_size_6290,
 	hal_rx_mpdu_start_tid_get_6290,
 	hal_rx_msdu_start_reception_type_get_6290,
+	hal_rx_msdu_end_da_idx_get_6290,
 };
 
 struct hal_hw_srng_config hw_srng_table_6290[] = {
diff --git a/hal/wifi3.0/qca8074/hal_8074_rx.h b/hal/wifi3.0/qca8074/hal_8074_rx.h
index e244411..b16407e 100644
--- a/hal/wifi3.0/qca8074/hal_8074_rx.h
+++ b/hal/wifi3.0/qca8074/hal_8074_rx.h
@@ -158,7 +158,7 @@
  * Return: void
  */
 void hal_rx_dump_msdu_start_tlv_8074(void *msdustart,
-							uint8_t dbg_level)
+				     uint8_t dbg_level)
 {
 	struct rx_msdu_start *msdu_start = (struct rx_msdu_start *)msdustart;
 
@@ -230,6 +230,117 @@
 
 qdf_export_symbol(hal_rx_dump_msdu_start_tlv_8074);
 
+/**
+ * hal_rx_dump_msdu_end_tlv_8074: dump RX msdu_end TLV in structured
+ *			     human readable format.
+ * @ msdu_end: pointer the msdu_end TLV in pkt.
+ * @ dbg_level: log level.
+ *
+ * Return: void
+ */
+void hal_rx_dump_msdu_end_tlv_8074(void *msduend,
+				   uint8_t dbg_level)
+{
+	struct rx_msdu_end *msdu_end = (struct rx_msdu_end *)msduend;
+
+	QDF_TRACE(QDF_MODULE_ID_DP, dbg_level,
+			"rx_msdu_end tlv - "
+			"rxpcu_mpdu_filter_in_category: %d "
+			"sw_frame_group_id: %d "
+			"phy_ppdu_id: %d "
+			"ip_hdr_chksum: %d "
+			"tcp_udp_chksum: %d "
+			"key_id_octet: %d "
+			"cce_super_rule: %d "
+			"cce_classify_not_done_truncat: %d "
+			"cce_classify_not_done_cce_dis: %d "
+			"ext_wapi_pn_63_48: %d "
+			"ext_wapi_pn_95_64: %d "
+			"ext_wapi_pn_127_96: %d "
+			"reported_mpdu_length: %d "
+			"first_msdu: %d "
+			"last_msdu: %d "
+			"sa_idx_timeout: %d "
+			"da_idx_timeout: %d "
+			"msdu_limit_error: %d "
+			"flow_idx_timeout: %d "
+			"flow_idx_invalid: %d "
+			"wifi_parser_error: %d "
+			"amsdu_parser_error: %d "
+			"sa_is_valid: %d "
+			"da_is_valid: %d "
+			"da_is_mcbc: %d "
+			"l3_header_padding: %d "
+			"ipv6_options_crc: %d "
+			"tcp_seq_number: %d "
+			"tcp_ack_number: %d "
+			"tcp_flag: %d "
+			"lro_eligible: %d "
+			"window_size: %d "
+			"da_offset: %d "
+			"sa_offset: %d "
+			"da_offset_valid: %d "
+			"sa_offset_valid: %d "
+			"rule_indication_31_0: %d "
+			"rule_indication_63_32: %d "
+			"sa_idx: %d "
+			"da_idx: %d "
+			"msdu_drop: %d "
+			"reo_destination_indication: %d "
+			"flow_idx: %d "
+			"fse_metadata: %d "
+			"cce_metadata: %d "
+			"sa_sw_peer_id: %d ",
+			msdu_end->rxpcu_mpdu_filter_in_category,
+			msdu_end->sw_frame_group_id,
+			msdu_end->phy_ppdu_id,
+			msdu_end->ip_hdr_chksum,
+			msdu_end->tcp_udp_chksum,
+			msdu_end->key_id_octet,
+			msdu_end->cce_super_rule,
+			msdu_end->cce_classify_not_done_truncate,
+			msdu_end->cce_classify_not_done_cce_dis,
+			msdu_end->ext_wapi_pn_63_48,
+			msdu_end->ext_wapi_pn_95_64,
+			msdu_end->ext_wapi_pn_127_96,
+			msdu_end->reported_mpdu_length,
+			msdu_end->first_msdu,
+			msdu_end->last_msdu,
+			msdu_end->sa_idx_timeout,
+			msdu_end->da_idx_timeout,
+			msdu_end->msdu_limit_error,
+			msdu_end->flow_idx_timeout,
+			msdu_end->flow_idx_invalid,
+			msdu_end->wifi_parser_error,
+			msdu_end->amsdu_parser_error,
+			msdu_end->sa_is_valid,
+			msdu_end->da_is_valid,
+			msdu_end->da_is_mcbc,
+			msdu_end->l3_header_padding,
+			msdu_end->ipv6_options_crc,
+			msdu_end->tcp_seq_number,
+			msdu_end->tcp_ack_number,
+			msdu_end->tcp_flag,
+			msdu_end->lro_eligible,
+			msdu_end->window_size,
+			msdu_end->da_offset,
+			msdu_end->sa_offset,
+			msdu_end->da_offset_valid,
+			msdu_end->sa_offset_valid,
+			msdu_end->rule_indication_31_0,
+			msdu_end->rule_indication_63_32,
+			msdu_end->sa_idx,
+			msdu_end->da_idx,
+			msdu_end->msdu_drop,
+			msdu_end->reo_destination_indication,
+			msdu_end->flow_idx,
+			msdu_end->fse_metadata,
+			msdu_end->cce_metadata,
+			msdu_end->sa_sw_peer_id);
+}
+
+qdf_export_symbol(hal_rx_dump_msdu_end_tlv_8074);
+
 /*
  * Get tid from RX_MPDU_START
  */
@@ -280,3 +391,26 @@
 
 qdf_export_symbol(hal_rx_msdu_start_reception_type_get_8074);
 
+#define HAL_RX_MSDU_END_DA_IDX_GET(_rx_msdu_end)	\
+	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
+		RX_MSDU_END_13_DA_IDX_OFFSET)),		\
+		RX_MSDU_END_13_DA_IDX_MASK,		\
+		RX_MSDU_END_13_DA_IDX_LSB))
+
+ /**
+ * hal_rx_msdu_end_da_idx_get_8074: API to get da_idx
+ * from rx_msdu_end TLV
+ *
+ * @ buf: pointer to the start of RX PKT TLV headers
+ * Return: da index
+ */
+uint16_t hal_rx_msdu_end_da_idx_get_8074(uint8_t *buf)
+{
+	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;
+	uint16_t da_idx;
+
+	da_idx = HAL_RX_MSDU_END_DA_IDX_GET(msdu_end);
+
+	return da_idx;
+}
diff --git a/hal/wifi3.0/qca8074/hal_8074_srng.c b/hal/wifi3.0/qca8074/hal_8074_srng.c
index d42f76d..5ad439d 100644
--- a/hal/wifi3.0/qca8074/hal_8074_srng.c
+++ b/hal/wifi3.0/qca8074/hal_8074_srng.c
@@ -49,9 +49,11 @@
 	hal_rx_get_tlv_8074,
 	hal_rx_proc_phyrx_other_receive_info_tlv_8074,
 	hal_rx_dump_msdu_start_tlv_8074,
+	hal_rx_dump_msdu_end_tlv_8074,
 	hal_get_link_desc_size_8074,
 	hal_rx_mpdu_start_tid_get_8074,
 	hal_rx_msdu_start_reception_type_get_8074,
+	hal_rx_msdu_end_da_idx_get_8074,
 };
 
 struct hal_hw_srng_config hw_srng_table_8074[] = {