浏览代码

qcacmn: Update UIO info for DP data rings

Update UIO info for DP data rings.

Change-Id: I0c6e8c8e59aefb373dc024d91eb1379ed7564f31
CRs-Fixed: 3623839
Himanshu Batra 2 年之前
父节点
当前提交
3efaabd704

+ 24 - 0
dp/inc/cdp_txrx_cmn.h

@@ -3376,4 +3376,28 @@ QDF_STATUS cdp_mlo_dev_ctxt_detach(ol_txrx_soc_handle soc,
 	return QDF_STATUS_SUCCESS;
 }
 #endif /* WLAN_FEATURE_11BE_MLO */
+
+#ifdef WLAN_SUPPORT_DPDK
+/*
+ * cdp_dpdk_get_ring_info - get dp ring info for dpdk
+ * @soc: soc handle
+ * @uio_info: pointer to fill dp ring info
+ *
+ * Return: none
+ */
+static inline void cdp_dpdk_get_ring_info(ol_txrx_soc_handle soc,
+					  qdf_uio_info_t *uio_info)
+{
+	if (!soc) {
+		dp_cdp_debug("Invalid Instance");
+		return;
+	}
+
+	if (!soc->ops->cmn_drv_ops ||
+	    !soc->ops->cmn_drv_ops->dpdk_get_ring_info)
+		return;
+
+	soc->ops->cmn_drv_ops->dpdk_get_ring_info(soc, uio_info);
+}
+#endif
 #endif /* _CDP_TXRX_CMN_H_ */

+ 4 - 0
dp/inc/cdp_txrx_ops.h

@@ -745,6 +745,10 @@ struct cdp_cmn_ops {
 				     uint64_t *value);
 	void (*txrx_get_tqm_offset)(struct cdp_soc_t *soc_hdl, uint64_t *value);
 	uint64_t (*get_fst_cmem_base)(struct cdp_soc_t *soc_hdl, uint64_t size);
+#ifdef WLAN_SUPPORT_DPDK
+	void (*dpdk_get_ring_info)(struct cdp_soc_t *soc_hdl,
+				   qdf_uio_info_t *uio_info);
+#endif
 };
 
 struct cdp_ctrl_ops {

+ 167 - 0
dp/wifi3.0/dp_main.c

@@ -12185,6 +12185,166 @@ update_tx_ilp:
 }
 #endif
 
+#ifdef WLAN_SUPPORT_DPDK
+static char *tcl_ring_name[] = {
+	"tcl_data_ring1",
+	"tcl_data_ring2",
+	"tcl_data_ring3",
+	"tcl_data_ring4",
+	"tcl_data_ring5",
+};
+
+static char *tcl_comp_ring_name[] = {
+	"tcl_comp_ring1",
+	"tcl_comp_ring2",
+	"tcl_comp_ring3",
+	"tcl_comp_ring4",
+	"tcl_comp_ring5",
+};
+
+static char *reo_dest_ring_name[] = {
+	"reo_dest_ring1",
+	"reo_dest_ring2",
+	"reo_dest_ring3",
+	"reo_dest_ring4",
+	"reo_dest_ring5",
+	"reo_dest_ring6",
+	"reo_dest_ring7",
+	"reo_dest_ring8",
+};
+
+static void dp_dpdk_get_ring_info(struct cdp_soc_t *soc_hdl,
+				  qdf_uio_info_t *uio_info)
+{
+	struct dp_soc *soc = (struct dp_soc *)soc_hdl;
+	struct hal_soc *hal_soc = (struct hal_soc *)soc->hal_soc;
+	struct hal_srng *hal_srng;
+	uint8_t idx = 1, i;
+
+	/* WBM Desc Release Ring */
+	hal_srng = (struct hal_srng *)
+			soc->tcl_data_ring[0].hal_srng;
+
+	hal_srng = (struct hal_srng *)
+			soc->wbm_desc_rel_ring.hal_srng;
+	uio_info->mem[idx].name = "wbm_desc_rel_ring";
+	uio_info->mem[idx].addr = (unsigned long)hal_srng->ring_base_paddr;
+	uio_info->mem[idx].size =
+			(hal_srng->num_entries * hal_srng->entry_size) << 2;
+	uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+	idx++;
+
+	/* WBM Idle Link Ring */
+	hal_srng = (struct hal_srng *)
+			soc->wbm_idle_link_ring.hal_srng;
+	uio_info->mem[idx].name = "wbm_idle_link_ring";
+	uio_info->mem[idx].addr = (unsigned long)hal_srng->ring_base_paddr;
+	uio_info->mem[idx].size =
+			(hal_srng->num_entries * hal_srng->entry_size) << 2;
+	uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+	idx++;
+
+	/* TCL Data Rings */
+	for (i = 0; i < soc->num_tcl_data_rings; i++) {
+		hal_srng = (struct hal_srng *)
+					soc->tcl_data_ring[i].hal_srng;
+		uio_info->mem[idx].name = tcl_ring_name[i];
+		uio_info->mem[idx].addr =
+			(unsigned long)hal_srng->ring_base_paddr;
+		uio_info->mem[idx].size =
+			(hal_srng->num_entries * hal_srng->entry_size) << 2;
+		uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+		idx++;
+	}
+
+	/* TCL Completion Rings */
+	for (i = 0; i < soc->num_tcl_data_rings; i++) {
+		hal_srng = (struct hal_srng *)
+					soc->tx_comp_ring[i].hal_srng;
+		uio_info->mem[idx].name = tcl_comp_ring_name[i];
+		uio_info->mem[idx].addr =
+			(unsigned long)hal_srng->ring_base_paddr;
+		uio_info->mem[idx].size =
+			(hal_srng->num_entries * hal_srng->entry_size) << 2;
+		uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+		idx++;
+	}
+
+	/* Reo Dest Rings */
+	for (i = 0; i < soc->num_reo_dest_rings; i++) {
+		hal_srng = (struct hal_srng *)
+					soc->reo_dest_ring[i].hal_srng;
+		uio_info->mem[idx].name = reo_dest_ring_name[i];
+		uio_info->mem[idx].addr =
+			(unsigned long)hal_srng->ring_base_paddr;
+		uio_info->mem[idx].size =
+			(hal_srng->num_entries * hal_srng->entry_size) << 2;
+		uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+		idx++;
+	}
+
+	/* RXDMA Refill Ring */
+	hal_srng = (struct hal_srng *)
+			soc->rx_refill_buf_ring[0].hal_srng;
+	uio_info->mem[idx].name = "rxdma_buf_ring";
+	uio_info->mem[idx].addr = (unsigned long)hal_srng->ring_base_paddr;
+	uio_info->mem[idx].size =
+		(hal_srng->num_entries * hal_srng->entry_size) << 2;
+	uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+	idx++;
+
+	/* REO Exception Ring */
+	hal_srng = (struct hal_srng *)
+			soc->reo_exception_ring.hal_srng;
+	uio_info->mem[idx].name = "reo_exception_ring";
+	uio_info->mem[idx].addr =
+		(unsigned long)hal_srng->ring_base_paddr;
+	uio_info->mem[idx].size =
+		(hal_srng->num_entries * hal_srng->entry_size) << 2;
+	uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+	idx++;
+
+	/* RX Release Ring */
+	hal_srng = (struct hal_srng *)
+			soc->rx_rel_ring.hal_srng;
+	uio_info->mem[idx].name = "rx_release_ring";
+	uio_info->mem[idx].addr = (unsigned long)hal_srng->ring_base_paddr;
+	uio_info->mem[idx].size =
+		(hal_srng->num_entries * hal_srng->entry_size) << 2;
+	uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+	idx++;
+
+	/* Reo Reinject Ring */
+	hal_srng = (struct hal_srng *)
+			soc->reo_reinject_ring.hal_srng;
+	uio_info->mem[idx].name = "reo_reinject_ring";
+	uio_info->mem[idx].addr =
+		(unsigned long)hal_srng->ring_base_paddr;
+	uio_info->mem[idx].size =
+		(hal_srng->num_entries * hal_srng->entry_size) << 2;
+	uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+	idx++;
+
+	/* Shadow Write Pointer for LMAC Ring */
+	uio_info->mem[idx].name = "lmac_shadow_wrptr";
+        uio_info->mem[idx].addr =
+		(unsigned long)hal_soc->shadow_wrptr_mem_paddr;
+	uio_info->mem[idx].size =
+		sizeof(*(hal_soc->shadow_wrptr_mem_vaddr)) * HAL_MAX_LMAC_RINGS;
+	uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+	idx++;
+
+	/* Shadow Write Pointer for LMAC Ring */
+	uio_info->mem[idx].name = "lmac_shadow_rdptr";
+        uio_info->mem[idx].addr =
+		(unsigned long)hal_soc->shadow_rdptr_mem_paddr;
+	uio_info->mem[idx].size =
+		sizeof(*(hal_soc->shadow_rdptr_mem_vaddr)) * HAL_SRNG_ID_MAX;
+	uio_info->mem[idx].memtype = UIO_MEM_PHYS;
+
+}
+#endif
+
 static struct cdp_cmn_ops dp_ops_cmn = {
 	.txrx_soc_attach_target = dp_soc_attach_target_wifi3,
 	.txrx_vdev_attach = dp_vdev_attach_wifi3,
@@ -12321,6 +12481,9 @@ static struct cdp_cmn_ops dp_ops_cmn = {
 #ifdef WLAN_SUPPORT_RX_FISA
 	.get_fst_cmem_base = dp_rx_fisa_get_cmem_base,
 #endif
+#ifdef WLAN_SUPPORT_DPDK
+	.dpdk_get_ring_info = dp_dpdk_get_ring_info,
+#endif
 };
 
 static struct cdp_ctrl_ops dp_ops_ctrl = {
@@ -14375,6 +14538,10 @@ static QDF_STATUS dp_pdev_init(struct cdp_soc_t *txrx_soc,
 		dp_soc_reset_intr_mask(soc);
 	}
 
+	/* Reset the ring interrupt mask if DPDK is enabled */
+	if (wlan_cfg_get_dp_soc_dpdk_cfg(soc->ctrl_psoc)) {
+		dp_soc_reset_dpdk_intr_mask(soc);
+	}
 	/* Reset the cpu ring map if radio is NSS offloaded */
 	dp_soc_reset_ipa_vlan_intr_mask(soc);
 

+ 13 - 0
dp/wifi3.0/dp_rings.h

@@ -863,4 +863,17 @@ dp_srng_configure_nf_interrupt_thresholds(struct dp_soc *soc,
 {
 }
 #endif
+
+#ifdef WLAN_SUPPORT_DPDK
+/*
+ * dp_soc_reset_dpdk_intr_mask() - reset interrupt mask
+ * @dp_soc - DP Soc handle
+ *
+ * Return: Return void
+ */
+void dp_soc_reset_dpdk_intr_mask(struct dp_soc *soc);
+#else
+static inline void dp_soc_reset_dpdk_intr_mask(struct dp_soc *soc)
+{ }
+#endif
 #endif /* _DP_RINGS_H_ */

+ 119 - 0
dp/wifi3.0/dp_rings_main.c

@@ -4258,3 +4258,122 @@ void dp_pdev_set_default_reo(struct dp_pdev *pdev)
 	}
 }
 
+#ifdef WLAN_SUPPORT_DPDK
+void dp_soc_reset_dpdk_intr_mask(struct dp_soc *soc)
+{
+	uint8_t j;
+	uint8_t *grp_mask = NULL;
+	int group_number, mask, num_ring;
+
+	/* number of tx ring */
+	num_ring = soc->num_tcl_data_rings;
+
+	/*
+	 * group mask for tx completion  ring.
+	 */
+	grp_mask =  &soc->wlan_cfg_ctx->int_tx_ring_mask[0];
+
+	for (j = 0; j < WLAN_CFG_NUM_TCL_DATA_RINGS; j++) {
+		/*
+		 * Group number corresponding to tx offloaded ring.
+		 */
+		group_number = dp_srng_find_ring_in_mask(j, grp_mask);
+		if (group_number < 0) {
+			dp_init_debug("%pK: ring not part of any group; ring_type: %d, ring_num %d",
+				      soc, WBM2SW_RELEASE, j);
+			continue;
+		}
+
+		mask = wlan_cfg_get_tx_ring_mask(soc->wlan_cfg_ctx,
+						 group_number);
+
+		/* reset the tx mask for offloaded ring */
+		mask &= (~(1 << j));
+
+		/*
+		 * reset the interrupt mask for offloaded ring.
+		 */
+		wlan_cfg_set_tx_ring_mask(soc->wlan_cfg_ctx,
+					  group_number, mask);
+	}
+
+	/* number of rx rings */
+	num_ring = soc->num_reo_dest_rings;
+
+	/*
+	 * group mask for reo destination ring.
+	 */
+	grp_mask = &soc->wlan_cfg_ctx->int_rx_ring_mask[0];
+
+	for (j = 0; j < WLAN_CFG_NUM_REO_DEST_RING; j++) {
+		/*
+		 * Group number corresponding to rx offloaded ring.
+		 */
+		group_number = dp_srng_find_ring_in_mask(j, grp_mask);
+		if (group_number < 0) {
+			dp_init_debug("%pK: ring not part of any group; ring_type: %d,ring_num %d",
+				      soc, REO_DST, j);
+			continue;
+		}
+
+		mask =  wlan_cfg_get_rx_ring_mask(soc->wlan_cfg_ctx,
+						  group_number);
+
+		/* reset the interrupt mask for offloaded ring */
+		mask &= (~(1 << j));
+
+		/*
+		 * set the interrupt mask to zero for rx offloaded radio.
+		 */
+		wlan_cfg_set_rx_ring_mask(soc->wlan_cfg_ctx,
+					  group_number, mask);
+	}
+
+	/*
+	 * group mask for Rx buffer refill ring
+	 */
+	grp_mask = &soc->wlan_cfg_ctx->int_host2rxdma_ring_mask[0];
+
+	for (j = 0; j < MAX_PDEV_CNT; j++) {
+		int lmac_id = wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j);
+
+		/*
+		 * Group number corresponding to rx offloaded ring.
+		 */
+		group_number = dp_srng_find_ring_in_mask(lmac_id, grp_mask);
+		if (group_number < 0) {
+			dp_init_debug("%pK: ring not part of any group; ring_type: %d,ring_num %d",
+				      soc, REO_DST, lmac_id);
+			continue;
+		}
+
+		/* set the interrupt mask for offloaded ring */
+		mask =  wlan_cfg_get_host2rxdma_ring_mask(soc->wlan_cfg_ctx,
+							  group_number);
+		mask &= (~(1 << lmac_id));
+
+		/*
+		 * set the interrupt mask to zero for rx offloaded radio.
+		 */
+		wlan_cfg_set_host2rxdma_ring_mask(soc->wlan_cfg_ctx,
+						  group_number, mask);
+	}
+
+	grp_mask = &soc->wlan_cfg_ctx->int_rx_err_ring_mask[0];
+
+	for (j = 0; j < num_ring; j++) {
+		/*
+		 * Group number corresponding to rx err ring.
+		 */
+		group_number = dp_srng_find_ring_in_mask(j, grp_mask);
+		if (group_number < 0) {
+			dp_init_debug("%pK: ring not part of any group; ring_type: %d,ring_num %d",
+				      soc, REO_EXCEPTION, j);
+			continue;
+		}
+
+		wlan_cfg_set_rx_err_ring_mask(soc->wlan_cfg_ctx,
+					      group_number, 0);
+	}
+}
+#endif

+ 19 - 0
qdf/inc/qdf_platform.h

@@ -368,4 +368,23 @@ void qdf_register_get_bus_reg_dump(qdf_bus_reg_dump callback);
  * Return: none
  */
 void qdf_get_bus_reg_dump(struct device *dev, uint8_t *buf, uint32_t len);
+
+#ifdef WLAN_SUPPORT_DPDK
+/**
+ * qdf_uio_register_device() - register dev to UIO dev
+ * @parent: parent device to be registered with UIO dev
+ * @info: UIO device capabilities
+ *
+ * Return: zero on success or a negative error code
+ */
+int qdf_uio_register_device(struct device *parent, qdf_uio_info_t *info);
+
+/**
+ * qdf_uio_unregister_device - unregister a UIO device
+ * @info: UIO device capabilities
+ *
+ * Return: none
+ */
+void qdf_uio_unregister_device(qdf_uio_info_t *info);
+#endif
 #endif /*_QDF_PLATFORM_H*/

+ 7 - 0
qdf/linux/src/i_qdf_types.h

@@ -65,6 +65,9 @@
 #ifdef IPA_OFFLOAD
 #include <linux/ipa.h>
 #endif
+#ifdef WLAN_SUPPORT_DPDK
+#include <linux/uio_driver.h>
+#endif
 
 #define __qdf_must_check __must_check
 
@@ -365,6 +368,10 @@ enum __qdf_net_wireless_evcode {
 #endif
 #define __qdf_inline             inline
 
+#if defined(WLAN_SUPPORT_DPDK) && defined(__KERNEL__)
+typedef struct uio_info qdf_uio_info_t;
+#endif
+
 /*
  * 1. GNU C/C++ Compiler
  *

+ 16 - 0
qdf/src/qdf_platform.c

@@ -253,3 +253,19 @@ void qdf_get_bus_reg_dump(struct device *dev, uint8_t *buf, uint32_t len)
 }
 
 qdf_export_symbol(qdf_get_bus_reg_dump);
+
+#ifdef WLAN_SUPPORT_DPDK
+int qdf_uio_register_device(struct device *parent, qdf_uio_info_t *info)
+{
+	return uio_register_device(parent, (struct uio_info *)info);
+}
+
+qdf_export_symbol(qdf_uio_register_device);
+
+void qdf_uio_unregister_device(qdf_uio_info_t *info)
+{
+	uio_unregister_device(info);
+}
+
+qdf_export_symbol(qdf_uio_unregister_device);
+#endif

+ 12 - 0
wlan_cfg/wlan_cfg.c

@@ -5916,3 +5916,15 @@ bool wlan_cfg_get_ast_indication_disable(struct wlan_cfg_dp_soc_ctxt *cfg)
 {
 	return cfg->fw_ast_indication_disable;
 }
+
+#ifdef WLAN_SUPPORT_DPDK
+int wlan_cfg_get_dp_soc_dpdk_cfg(struct cdp_ctrl_objmgr_psoc *psoc)
+{
+	return cfg_get(psoc, CFG_DPDK_WIFI);
+}
+#else
+int wlan_cfg_get_dp_soc_dpdk_cfg(struct cdp_ctrl_objmgr_psoc *psoc)
+{
+	return 0;
+}
+#endif

+ 8 - 0
wlan_cfg/wlan_cfg.h

@@ -2737,4 +2737,12 @@ void wlan_cfg_set_ast_indication_disable(struct wlan_cfg_dp_soc_ctxt *cfg,
  * Return: true or false
  */
 bool wlan_cfg_get_ast_indication_disable(struct wlan_cfg_dp_soc_ctxt *cfg);
+
+/**
+ * wlan_cfg_get_dp_soc_dpdk_cfg - Return soc dpdk config
+ * @psoc: psoc object
+ *
+ * Return: dpdk_cfg
+ */
+int wlan_cfg_get_dp_soc_dpdk_cfg(struct cdp_ctrl_objmgr_psoc *psoc);
 #endif /*__WLAN_CFG_H*/