Browse Source

qcacmn: Add hal_rx_get_rx_fragment_number API

Implement hal_rx_get_rx_fragment_number
based on the chipset as the macro
HAL_RX_MPDU_GET_SEQUENCE_NUMBER is
chipset specific.

Change-Id: I967190fa3a55d45f46760f58eab5007bf5fa908f
CRs-Fixed: 2522133
Venkata Sharath Chandra Manchala 5 years ago
parent
commit
d1b7e4c326

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

@@ -2337,4 +2337,5 @@ void hal_tx_update_tidmap_prty_generic(struct hal_soc *soc, uint8_t value)
 	HAL_REG_WRITE(soc, addr,
 		      (value & HWIO_TCL_R0_TID_MAP_PRTY_RMSK));
 }
+
 #endif /* _HAL_GENERIC_API_H_ */

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

@@ -380,6 +380,7 @@ struct hal_hw_txrx_ops {
 	void (*hal_tx_update_pcp_tid_map)(struct hal_soc *hal_soc, uint8_t pcp,
 					  uint8_t id);
 	void (*hal_tx_set_tidmap_prty)(struct hal_soc *hal_soc, uint8_t prio);
+	uint8_t (*hal_rx_get_rx_fragment_number)(uint8_t *buf);
 };
 
 /**

+ 4 - 11
hal/wifi3.0/hal_rx.h

@@ -2853,17 +2853,10 @@ uint16_t hal_rx_get_rx_sequence(uint8_t *buf)
  * Returns: rx fragment number
  */
 static inline
-uint8_t hal_rx_get_rx_fragment_number(uint8_t *buf)
+uint8_t hal_rx_get_rx_fragment_number(struct hal_soc *hal_soc,
+				      uint8_t *buf)
 {
-	struct rx_pkt_tlvs *pkt_tlvs = hal_rx_get_pkt_tlvs(buf);
-	struct rx_mpdu_info *rx_mpdu_info = hal_rx_get_mpdu_info(pkt_tlvs);
-	uint8_t frag_number = 0;
-
-	frag_number = HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info) &
-		DOT11_SEQ_FRAG_MASK;
-
-	/* Return first 4 bits as fragment number */
-	return frag_number;
+	return hal_soc->ops->hal_rx_get_rx_fragment_number(buf);
 }
 
 #define HAL_RX_MPDU_GET_FRAME_CONTROL_FIELD(_rx_mpdu_info)	\
@@ -3088,7 +3081,7 @@ int hal_rx_chain_msdu_links(struct hal_soc *hal_soc, qdf_nbuf_t msdu,
 	if (num_msdus < HAL_RX_NUM_MSDU_DESC) {
 		/* mark first and last MSDUs */
 		rx_desc_info = qdf_nbuf_data(msdu);
-		fragno = hal_rx_get_rx_fragment_number(rx_desc_info);
+		fragno = hal_rx_get_rx_fragment_number(hal_soc, rx_desc_info);
 		more_frag = hal_rx_get_rx_more_frag_bit(rx_desc_info);
 
 		/* TODO: create skb->fragslist[] */

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

@@ -110,6 +110,23 @@
 #include <hal_generic_api.h>
 #include <hal_wbm.h>
 
+/**
+ * hal_rx_get_rx_fragment_number_6290(): Function to retrieve rx fragment number
+ *
+ * @nbuf: Network buffer
+ * Returns: rx fragment number
+ */
+static
+uint8_t hal_rx_get_rx_fragment_number_6290(uint8_t *buf)
+{
+	struct rx_pkt_tlvs *pkt_tlvs = hal_rx_get_pkt_tlvs(buf);
+	struct rx_mpdu_info *rx_mpdu_info = hal_rx_get_mpdu_info(pkt_tlvs);
+
+	/* Return first 4 bits as fragment number */
+	return (HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info) &
+		DOT11_SEQ_FRAG_MASK);
+}
+
 struct hal_hw_txrx_ops qca6290_hal_hw_txrx_ops = {
 	/* init and setup */
 	hal_srng_dst_hw_init_generic,
@@ -151,6 +168,7 @@ struct hal_hw_txrx_ops qca6290_hal_hw_txrx_ops = {
 	hal_tx_set_pcp_tid_map_generic,
 	hal_tx_update_pcp_tid_generic,
 	hal_tx_update_tidmap_prty_generic,
+	hal_rx_get_rx_fragment_number_6290,
 };
 
 struct hal_hw_srng_config hw_srng_table_6290[] = {
@@ -602,3 +620,4 @@ void hal_qca6290_attach(struct hal_soc *hal_soc)
 	hal_soc->hal_hw_reg_offset = hal_hw_reg_offset_qca6290;
 	hal_soc->ops = &qca6290_hal_hw_txrx_ops;
 }
+

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

@@ -35,6 +35,12 @@
 #include "hal_api_mon.h"
 #include "phyrx_other_receive_info_ru_details.h"
 
+#define HAL_RX_MPDU_GET_SEQUENCE_NUMBER(_rx_mpdu_info)	\
+	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_OFFSET)),	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_MASK,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_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),\

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

@@ -110,6 +110,23 @@
 #include <hal_generic_api.h>
 #include <hal_wbm.h>
 
+/**
+ * hal_rx_get_rx_fragment_number_6390(): Function to retrieve rx fragment number
+ *
+ * @nbuf: Network buffer
+ * Returns: rx fragment number
+ */
+static
+uint8_t hal_rx_get_rx_fragment_number_6390(uint8_t *buf)
+{
+	struct rx_pkt_tlvs *pkt_tlvs = hal_rx_get_pkt_tlvs(buf);
+	struct rx_mpdu_info *rx_mpdu_info = hal_rx_get_mpdu_info(pkt_tlvs);
+
+	/* Return first 4 bits as fragment number */
+	return (HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info) &
+		DOT11_SEQ_FRAG_MASK);
+}
+
 struct hal_hw_txrx_ops qca6390_hal_hw_txrx_ops = {
 	/* init and setup */
 	hal_srng_dst_hw_init_generic,
@@ -151,6 +168,7 @@ struct hal_hw_txrx_ops qca6390_hal_hw_txrx_ops = {
 	hal_tx_set_pcp_tid_map_generic,
 	hal_tx_update_pcp_tid_generic,
 	hal_tx_update_tidmap_prty_generic,
+	hal_rx_get_rx_fragment_number_6390,
 };
 
 struct hal_hw_srng_config hw_srng_table_6390[] = {
@@ -606,3 +624,4 @@ void hal_qca6390_attach(struct hal_soc *hal_soc)
 	hal_soc->hal_hw_reg_offset = hal_hw_reg_offset_qca6390;
 	hal_soc->ops = &qca6390_hal_hw_txrx_ops;
 }
+

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

@@ -35,6 +35,12 @@
 #include "hal_api_mon.h"
 #include "phyrx_other_receive_info_ru_details.h"
 
+#define HAL_RX_MPDU_GET_SEQUENCE_NUMBER(_rx_mpdu_info)	\
+	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_OFFSET)),	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_MASK,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_LSB))
+
 #define HAL_RX_MSDU_START_MIMO_SS_BITMAP(_rx_msdu_start)\
 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_msdu_start),\
 	RX_MSDU_START_5_MIMO_SS_BITMAP_OFFSET)),	\

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

@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * hal_rx_get_rx_fragment_number_6490(): Function to retrieve rx fragment number
+ *
+ * @nbuf: Network buffer
+ * Returns: rx fragment number
+ */
+static
+uint8_t hal_rx_get_rx_fragment_number_6490(uint8_t *buf)
+{
+	struct rx_pkt_tlvs *pkt_tlvs = hal_rx_get_pkt_tlvs(buf);
+	struct rx_mpdu_info *rx_mpdu_info = hal_rx_get_mpdu_info(pkt_tlvs);
+
+	/* Return first 4 bits as fragment number */
+	return (HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info) &
+		DOT11_SEQ_FRAG_MASK);
+}
+
+struct hal_hw_txrx_ops qca6490_hal_hw_txrx_ops = {
+	/* rx */
+	hal_rx_get_rx_fragment_number_6490,
+};

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

@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define HAL_RX_MPDU_GET_SEQUENCE_NUMBER(_rx_mpdu_info)	\
+	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
+		RX_MPDU_INFO_11_MPDU_SEQUENCE_NUMBER_OFFSET)),	\
+		RX_MPDU_INFO_11_MPDU_SEQUENCE_NUMBER_MASK,	\
+		RX_MPDU_INFO_11_MPDU_SEQUENCE_NUMBER_LSB))

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

@@ -105,6 +105,24 @@
 #include <hal_wbm.h>
 
 
+/**
+ * hal_rx_get_rx_fragment_number_8074v1(): Function to retrieve
+ *                                         rx fragment number
+ *
+ * @nbuf: Network buffer
+ * Returns: rx fragment number
+ */
+static
+uint8_t hal_rx_get_rx_fragment_number_8074v1(uint8_t *buf)
+{
+	struct rx_pkt_tlvs *pkt_tlvs = hal_rx_get_pkt_tlvs(buf);
+	struct rx_mpdu_info *rx_mpdu_info = hal_rx_get_mpdu_info(pkt_tlvs);
+
+	/* Return first 4 bits as fragment number */
+	return (HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info) &
+		DOT11_SEQ_FRAG_MASK);
+}
+
 struct hal_hw_txrx_ops qca8074_hal_hw_txrx_ops = {
 
 	/* init and setup */
@@ -147,6 +165,7 @@ struct hal_hw_txrx_ops qca8074_hal_hw_txrx_ops = {
 	hal_tx_set_pcp_tid_map_generic,
 	hal_tx_update_pcp_tid_generic,
 	hal_tx_update_tidmap_prty_generic,
+	hal_rx_get_rx_fragment_number_8074v1,
 };
 
 struct hal_hw_srng_config hw_srng_table_8074[] = {
@@ -601,3 +620,4 @@ void hal_qca8074_attach(struct hal_soc *hal_soc)
 	hal_soc->hal_hw_reg_offset = hal_hw_reg_offset_qca8074;
 	hal_soc->ops = &qca8074_hal_hw_txrx_ops;
 }
+

+ 6 - 1
hal/wifi3.0/qca8074v1/hal_8074v1_rx.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -24,6 +24,11 @@
 #include "dp_types.h"
 #include "hal_api_mon.h"
 
+#define HAL_RX_MPDU_GET_SEQUENCE_NUMBER(_rx_mpdu_info)	\
+	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_OFFSET)),	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_MASK,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_LSB))
 /*
  * hal_rx_msdu_start_nss_get_8074(): API to get the NSS
  * Interval from rx_msdu_start

+ 18 - 2
hal/wifi3.0/qca8074v2/hal_8074v2.c

@@ -105,6 +105,23 @@
 #include <hal_generic_api.h>
 #include <hal_wbm.h>
 
+/**
+ * hal_rx_get_rx_fragment_number_8074v2(): Function to retrieve
+ *                                         rx fragment number
+ *
+ * @nbuf: Network buffer
+ * Returns: rx fragment number
+ */
+static
+uint8_t hal_rx_get_rx_fragment_number_8074v2(uint8_t *buf)
+{
+	struct rx_pkt_tlvs *pkt_tlvs = hal_rx_get_pkt_tlvs(buf);
+	struct rx_mpdu_info *rx_mpdu_info = hal_rx_get_mpdu_info(pkt_tlvs);
+
+	/* Return first 4 bits as fragment number */
+	return HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info) &
+		DOT11_SEQ_FRAG_MASK;
+}
 struct hal_hw_txrx_ops qca8074v2_hal_hw_txrx_ops = {
 
 	/* init and setup */
@@ -147,6 +164,7 @@ struct hal_hw_txrx_ops qca8074v2_hal_hw_txrx_ops = {
 	hal_tx_set_pcp_tid_map_generic,
 	hal_tx_update_pcp_tid_generic,
 	hal_tx_update_tidmap_prty_generic,
+	hal_rx_get_rx_fragment_number_8074v2,
 };
 
 struct hal_hw_srng_config hw_srng_table_8074v2[] = {
@@ -604,5 +622,3 @@ void hal_qca8074v2_attach(struct hal_soc *hal_soc)
 	hal_soc->ops = &qca8074v2_hal_hw_txrx_ops;
 }
 
-
-

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

@@ -27,6 +27,12 @@
 #include "phyrx_other_receive_info_su_evm_details.h"
 #endif
 
+#define HAL_RX_MPDU_GET_SEQUENCE_NUMBER(_rx_mpdu_info)	\
+	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_OFFSET)),	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_MASK,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_LSB))
+
 #define HAL_RX_MSDU_START_MIMO_SS_BITMAP(_rx_msdu_start)\
 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_msdu_start),\
 	RX_MSDU_START_5_MIMO_SS_BITMAP_OFFSET)),	\

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

@@ -109,6 +109,28 @@
 #include <hal_generic_api.h>
 #include <hal_wbm.h>
 
+#define HAL_RX_MPDU_GET_SEQUENCE_NUMBER(_rx_mpdu_info)	\
+	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_OFFSET)),	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_MASK,	\
+		RX_MPDU_INFO_2_MPDU_SEQUENCE_NUMBER_LSB))
+
+/**
+ * hal_rx_get_rx_fragment_number_9000(): Function to retrieve rx fragment number
+ *
+ * @nbuf: Network buffer
+ * Returns: rx fragment number
+ */
+static
+uint8_t hal_rx_get_rx_fragment_number_9000(uint8_t *buf)
+{
+	struct rx_pkt_tlvs *pkt_tlvs = hal_rx_get_pkt_tlvs(buf);
+	struct rx_mpdu_info *rx_mpdu_info = hal_rx_get_mpdu_info(pkt_tlvs);
+
+	/* Return first 4 bits as fragment number */
+	return (HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info) &
+		DOT11_SEQ_FRAG_MASK);
+}
 struct hal_hw_txrx_ops qcn9000_hal_hw_txrx_ops = {
 
 	/* init and setup */
@@ -151,6 +173,7 @@ struct hal_hw_txrx_ops qcn9000_hal_hw_txrx_ops = {
 	hal_tx_set_pcp_tid_map_generic,
 	hal_tx_update_pcp_tid_generic,
 	hal_tx_update_tidmap_prty_generic,
+	hal_rx_get_rx_fragment_number_9000,
 };
 
 struct hal_hw_srng_config hw_srng_table_9000[] = {
@@ -608,3 +631,4 @@ void hal_qcn9000_attach(struct hal_soc *hal_soc)
 	hal_soc->hal_hw_reg_offset = hal_hw_reg_offset_qcn9000;
 	hal_soc->ops = &qcn9000_hal_hw_txrx_ops;
 }
+