[RFC,24/29] net/qdma: add Rx/Tx queue setup routine for VF devices

Message ID 20220706075219.517046-25-aman.kumar@vvdntech.in (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series cover letter for net/qdma PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Aman Kumar July 6, 2022, 7:52 a.m. UTC
  Rx/Tx queue initialization routine for VFs is same
as that of phys function. define separate ops structure
for VF devices.

Signed-off-by: Aman Kumar <aman.kumar@vvdntech.in>
---
 drivers/net/qdma/qdma_vf_ethdev.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/qdma/qdma_vf_ethdev.c b/drivers/net/qdma/qdma_vf_ethdev.c
index ca3d21b688..28d34560c1 100644
--- a/drivers/net/qdma/qdma_vf_ethdev.c
+++ b/drivers/net/qdma/qdma_vf_ethdev.c
@@ -94,6 +94,13 @@  static int qdma_ethdev_offline(struct rte_eth_dev *dev)
 	return rv;
 }
 
+static struct eth_dev_ops qdma_vf_eth_dev_ops = {
+	.rx_queue_setup       = qdma_dev_rx_queue_setup,
+	.tx_queue_setup       = qdma_dev_tx_queue_setup,
+	.rx_queue_release     = qdma_dev_rx_queue_release,
+	.tx_queue_release     = qdma_dev_tx_queue_release,
+};
+
 /**
  * DPDK callback to register a PCI device.
  *
@@ -129,8 +136,10 @@  static int eth_qdma_vf_dev_init(struct rte_eth_dev *dev)
 	/* for secondary processes, we don't initialise any further as primary
 	 * has already done this work.
 	 */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		dev->dev_ops = &qdma_vf_eth_dev_ops;
 		return 0;
+	}
 
 	if (once) {
 		RTE_LOG(INFO, PMD, "QDMA PMD VERSION: %s\n", QDMA_PMD_VERSION);
@@ -160,6 +169,8 @@  static int eth_qdma_vf_dev_init(struct rte_eth_dev *dev)
 	dma_priv->c2h_bypass_mode = RTE_PMD_QDMA_RX_BYPASS_NONE;
 	dma_priv->h2c_bypass_mode = 0;
 
+	dev->dev_ops = &qdma_vf_eth_dev_ops;
+
 	dma_priv->config_bar_idx = DEFAULT_VF_CONFIG_BAR;
 	dma_priv->bypass_bar_idx = BAR_ID_INVALID;
 	dma_priv->user_bar_idx = BAR_ID_INVALID;