Quellcode durchsuchen

qcacmn: Create monitor mode spinlock and add null check

Due to changes in datapath init/deinit path, mon_lock spinlock was not
getting created. Create mon_lock spinlock during
dp_rx_pdev_mon_cmn_desc_pool_init.

Add null check to validate rx_tlv_header before calling
hal_rx_mpdu_start_tlv_tag_valid.

Change-Id: I41c781de29f2c8c05ec1bfa90f9c8f742f2539bf
CRs-Fixed: 2693687
Saket Jha vor 5 Jahren
Ursprung
Commit
d30eab103c

+ 3 - 3
dp/wifi3.0/dp_rx_mon_dest.c

@@ -1226,7 +1226,6 @@ dp_rx_pdev_mon_buf_desc_pool_init(struct dp_pdev *pdev, uint32_t mac_id)
 	pdev->mon_last_linkdesc_paddr = 0;
 
 	pdev->mon_last_buf_cookie = DP_RX_DESC_COOKIE_MAX + 1;
-	qdf_spinlock_create(&pdev->mon_lock);
 
 	/* Attach full monitor mode resources */
 	dp_full_mon_attach(pdev);
@@ -1260,7 +1259,6 @@ dp_rx_pdev_mon_buf_desc_pool_deinit(struct dp_pdev *pdev, uint32_t mac_id)
 	dp_debug("Mon RX Desc buf Pool[%d] deinit", pdev_id);
 
 	dp_rx_desc_pool_deinit(soc, rx_desc_pool);
-	qdf_spinlock_destroy(&pdev->mon_lock);
 
 	/* Detach full monitor mode resources */
 	dp_full_mon_detach(pdev);
@@ -1274,6 +1272,7 @@ dp_rx_pdev_mon_cmn_desc_pool_deinit(struct dp_pdev *pdev, int mac_id)
 	int mac_for_pdev = dp_get_lmac_id_for_pdev_id(soc, mac_id, pdev_id);
 
 	dp_rx_pdev_mon_status_desc_pool_deinit(pdev, mac_for_pdev);
+
 	if (!soc->wlan_cfg_ctx->rxdma1_enable)
 		return;
 
@@ -1433,9 +1432,9 @@ void
 dp_rx_pdev_mon_desc_pool_init(struct dp_pdev *pdev)
 {
 	int mac_id;
-
 	for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++)
 		dp_rx_pdev_mon_cmn_desc_pool_init(pdev, mac_id);
+	qdf_spinlock_create(&pdev->mon_lock);
 }
 
 void
@@ -1445,6 +1444,7 @@ dp_rx_pdev_mon_desc_pool_deinit(struct dp_pdev *pdev)
 
 	for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++)
 		dp_rx_pdev_mon_cmn_desc_pool_deinit(pdev, mac_id);
+	qdf_spinlock_destroy(&pdev->mon_lock);
 }
 
 void dp_rx_pdev_mon_desc_pool_free(struct dp_pdev *pdev)

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

@@ -3670,7 +3670,10 @@ hal_rx_mpdu_start_tlv_tag_valid(hal_soc_handle_t hal_soc_hdl,
 {
 	struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
 
-	return hal->ops->hal_rx_mpdu_start_tlv_tag_valid(rx_tlv_hdr);
+	if (hal->ops->hal_rx_mpdu_start_tlv_tag_valid)
+		return hal->ops->hal_rx_mpdu_start_tlv_tag_valid(rx_tlv_hdr);
+
+	return 0;
 }
 
 /**

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

@@ -975,6 +975,24 @@ uint16_t hal_rx_get_rx_sequence_6390(uint8_t *buf)
 	return HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info);
 }
 
+/**
+ * hal_rx_mpdu_start_tlv_tag_valid_6390 () - API to check if RX_MPDU_START
+ * tlv tag is valid
+ *
+ *@rx_tlv_hdr: start address of rx_pkt_tlvs
+ *
+ * Return: true if RX_MPDU_START is valied, else false.
+ */
+static uint8_t hal_rx_mpdu_start_tlv_tag_valid_6390(void *rx_tlv_hdr)
+{
+	struct rx_pkt_tlvs *rx_desc = (struct rx_pkt_tlvs *)rx_tlv_hdr;
+	uint32_t tlv_tag;
+
+	tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(&rx_desc->mpdu_start_tlv);
+
+	return tlv_tag == WIFIRX_MPDU_START_E ? true : false;
+}
+
 /**
  * hal_get_window_address_6390(): Function to get hp/tp address
  * @hal_soc: Pointer to hal_soc
@@ -1126,7 +1144,7 @@ struct hal_hw_txrx_ops qca6390_hal_hw_txrx_ops = {
 	NULL,
 	NULL,
 	NULL,
-	NULL,
+	hal_rx_mpdu_start_tlv_tag_valid_6390,
 	NULL,
 	NULL,
 

+ 19 - 1
hal/wifi3.0/qca6490/hal_6490.c

@@ -1411,6 +1411,24 @@ bool hal_rx_get_fisa_timeout_6490(uint8_t *buf)
 	return HAL_RX_TLV_GET_FISA_TIMEOUT(buf);
 }
 
+/**
+ * hal_rx_mpdu_start_tlv_tag_valid_6490 () - API to check if RX_MPDU_START
+ * tlv tag is valid
+ *
+ *@rx_tlv_hdr: start address of rx_pkt_tlvs
+ *
+ * Return: true if RX_MPDU_START is valied, else false.
+ */
+static uint8_t hal_rx_mpdu_start_tlv_tag_valid_6490(void *rx_tlv_hdr)
+{
+	struct rx_pkt_tlvs *rx_desc = (struct rx_pkt_tlvs *)rx_tlv_hdr;
+	uint32_t tlv_tag;
+
+	tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(&rx_desc->mpdu_start_tlv);
+
+	return tlv_tag == WIFIRX_MPDU_START_E ? true : false;
+}
+
 /**
  * hal_reo_set_err_dst_remap_6490(): Function to set REO error destination
  *				     ring remap register
@@ -1553,7 +1571,7 @@ struct hal_hw_txrx_ops qca6490_hal_hw_txrx_ops = {
 	hal_rx_get_flow_agg_continuation_6490,
 	hal_rx_get_flow_agg_count_6490,
 	hal_rx_get_fisa_timeout_6490,
-	NULL,
+	hal_rx_mpdu_start_tlv_tag_valid_6490,
 	NULL,
 	NULL,
 

+ 19 - 1
hal/wifi3.0/qca6750/hal_6750.c

@@ -1435,6 +1435,24 @@ bool hal_rx_get_fisa_timeout_6750(uint8_t *buf)
 	return HAL_RX_TLV_GET_FISA_TIMEOUT(buf);
 }
 
+/**
+ * hal_rx_mpdu_start_tlv_tag_valid_6750 () - API to check if RX_MPDU_START
+ * tlv tag is valid
+ *
+ *@rx_tlv_hdr: start address of rx_pkt_tlvs
+ *
+ * Return: true if RX_MPDU_START is valied, else false.
+ */
+static uint8_t hal_rx_mpdu_start_tlv_tag_valid_6750(void *rx_tlv_hdr)
+{
+	struct rx_pkt_tlvs *rx_desc = (struct rx_pkt_tlvs *)rx_tlv_hdr;
+	uint32_t tlv_tag;
+
+	tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(&rx_desc->mpdu_start_tlv);
+
+	return tlv_tag == WIFIRX_MPDU_START_E ? true : false;
+}
+
 /**
  * hal_reo_set_err_dst_remap_6750(): Function to set REO error destination
  *				     ring remap register
@@ -1577,7 +1595,7 @@ struct hal_hw_txrx_ops qca6750_hal_hw_txrx_ops = {
 	hal_rx_get_flow_agg_continuation_6750,
 	hal_rx_get_flow_agg_count_6750,
 	hal_rx_get_fisa_timeout_6750,
-	NULL,
+	hal_rx_mpdu_start_tlv_tag_valid_6750,
 	NULL,
 	NULL,