DPDK patches and discussions
 help / color / mirror / Atom feed
From: Aman Kumar <aman.kumar@vvdntech.in>
To: dev@dpdk.org
Cc: maxime.coquelin@redhat.com, david.marchand@redhat.com,
	aman.kumar@vvdntech.in
Subject: [RFC PATCH 26/29] net/qdma: add datapath burst API for VF
Date: Wed,  6 Jul 2022 13:22:16 +0530	[thread overview]
Message-ID: <20220706075219.517046-27-aman.kumar@vvdntech.in> (raw)
In-Reply-To: <20220706075219.517046-1-aman.kumar@vvdntech.in>

this patch implements routine for dev_start and
dev_stop PMD ops and adds support for RX/TX
datapath burst APIs for VF.

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

diff --git a/drivers/net/qdma/qdma_vf_ethdev.c b/drivers/net/qdma/qdma_vf_ethdev.c
index 5a54c00893..cbae4c9716 100644
--- a/drivers/net/qdma/qdma_vf_ethdev.c
+++ b/drivers/net/qdma/qdma_vf_ethdev.c
@@ -334,6 +334,39 @@ static int qdma_queue_context_invalidate(struct rte_eth_dev *dev, uint32_t qid,
 	return rv;
 }
 
+static int qdma_vf_dev_start(struct rte_eth_dev *dev)
+{
+	struct qdma_tx_queue *txq;
+	struct qdma_rx_queue *rxq;
+	uint32_t qid;
+	int err;
+
+	PMD_DRV_LOG(INFO, "qdma_dev_start: Starting\n");
+	/* prepare descriptor rings for operation */
+	for (qid = 0; qid < dev->data->nb_tx_queues; qid++) {
+		txq = (struct qdma_tx_queue *)dev->data->tx_queues[qid];
+
+		/* Deferred Queues should not start with dev_start */
+		if (!txq->tx_deferred_start) {
+			err = qdma_vf_dev_tx_queue_start(dev, qid);
+			if (err != 0)
+				return err;
+		}
+	}
+
+	for (qid = 0; qid < dev->data->nb_rx_queues; qid++) {
+		rxq = (struct qdma_rx_queue *)dev->data->rx_queues[qid];
+
+		/* Deferred Queues should not start with dev_start */
+		if (!rxq->rx_deferred_start) {
+			err = qdma_vf_dev_rx_queue_start(dev, qid);
+			if (err != 0)
+				return err;
+		}
+	}
+	return 0;
+}
+
 static int qdma_vf_dev_link_update(struct rte_eth_dev *dev,
 					__rte_unused int wait_to_complete)
 {
@@ -361,6 +394,24 @@ static int qdma_vf_dev_infos_get(__rte_unused struct rte_eth_dev *dev,
 	return 0;
 }
 
+static int qdma_vf_dev_stop(struct rte_eth_dev *dev)
+{
+	uint32_t qid;
+#ifdef RTE_LIBRTE_QDMA_DEBUG_DRIVER
+	struct qdma_pci_dev *qdma_dev = dev->data->dev_private;
+
+	PMD_DRV_LOG(INFO, "VF-%d(DEVFN) Stop H2C & C2H queues",
+			qdma_dev->func_id);
+#endif
+	/* reset driver's internal queue structures to default values */
+	for (qid = 0; qid < dev->data->nb_tx_queues; qid++)
+		qdma_vf_dev_tx_queue_stop(dev, qid);
+	for (qid = 0; qid < dev->data->nb_rx_queues; qid++)
+		qdma_vf_dev_rx_queue_stop(dev, qid);
+
+	return 0;
+}
+
 int qdma_vf_dev_close(struct rte_eth_dev *dev)
 {
 	struct qdma_pci_dev *qdma_dev = dev->data->dev_private;
@@ -371,6 +422,9 @@ int qdma_vf_dev_close(struct rte_eth_dev *dev)
 
 	PMD_DRV_LOG(INFO, "Closing all queues\n");
 
+	if (dev->data->dev_started)
+		qdma_vf_dev_stop(dev);
+
 	/* iterate over rx queues */
 	for (qid = 0; qid < dev->data->nb_rx_queues; ++qid) {
 		rxq = dev->data->rx_queues[qid];
@@ -729,6 +783,8 @@ int qdma_vf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qid)
 static struct eth_dev_ops qdma_vf_eth_dev_ops = {
 	.dev_configure        = qdma_vf_dev_configure,
 	.dev_infos_get        = qdma_vf_dev_infos_get,
+	.dev_start            = qdma_vf_dev_start,
+	.dev_stop             = qdma_vf_dev_stop,
 	.dev_close            = qdma_vf_dev_close,
 	.dev_reset            = qdma_vf_dev_reset,
 	.link_update          = qdma_vf_dev_link_update,
@@ -811,6 +867,8 @@ static int eth_qdma_vf_dev_init(struct rte_eth_dev *dev)
 	dma_priv->h2c_bypass_mode = 0;
 
 	dev->dev_ops = &qdma_vf_eth_dev_ops;
+	dev->rx_pkt_burst = &qdma_recv_pkts;
+	dev->tx_pkt_burst = &qdma_xmit_pkts;
 
 	dma_priv->config_bar_idx = DEFAULT_VF_CONFIG_BAR;
 	dma_priv->bypass_bar_idx = BAR_ID_INVALID;
@@ -913,6 +971,9 @@ static int eth_qdma_vf_dev_uninit(struct rte_eth_dev *dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -EPERM;
 
+	if (qdma_dev->dev_configured)
+		qdma_vf_dev_close(dev);
+
 	qdma_ethdev_offline(dev);
 
 	if (qdma_dev->reset_state != RESET_STATE_RECV_PF_RESET_REQ)
-- 
2.36.1


  parent reply	other threads:[~2022-07-06  7:59 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06  7:51 [RFC PATCH 00/29] cover letter for net/qdma PMD Aman Kumar
2022-07-06  7:51 ` [RFC PATCH 01/29] net/qdma: add net PMD template Aman Kumar
2022-07-06  7:51 ` [RFC PATCH 02/29] maintainers: add maintainer for net/qdma PMD Aman Kumar
2022-07-06  7:51 ` [RFC PATCH 03/29] net/meson.build: add support to compile net qdma Aman Kumar
2022-07-06  7:51 ` [RFC PATCH 04/29] net/qdma: add logging support Aman Kumar
2022-07-06 15:27   ` Stephen Hemminger
2022-07-07  2:32     ` Aman Kumar
2022-07-06  7:51 ` [RFC PATCH 05/29] net/qdma: add device init and uninit functions Aman Kumar
2022-07-06 15:35   ` Stephen Hemminger
2022-07-07  2:41     ` Aman Kumar
2022-07-06  7:51 ` [RFC PATCH 06/29] net/qdma: add qdma access library Aman Kumar
2022-07-06  7:51 ` [RFC PATCH 07/29] net/qdma: add supported qdma version Aman Kumar
2022-07-06  7:51 ` [RFC PATCH 08/29] net/qdma: qdma hardware initialization Aman Kumar
2022-07-06  7:51 ` [RFC PATCH 09/29] net/qdma: define device modes and data structure Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 10/29] net/qdma: add net PMD ops template Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 11/29] net/qdma: add configure close and reset ethdev ops Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 12/29] net/qdma: add routine for Rx queue initialization Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 13/29] net/qdma: add callback support for Rx queue count Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 14/29] net/qdma: add routine for Tx queue initialization Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 15/29] net/qdma: add queue cleanup PMD ops Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 16/29] net/qdma: add start and stop apis Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 17/29] net/qdma: add Tx burst API Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 18/29] net/qdma: add Tx queue reclaim routine Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 19/29] net/qdma: add callback function for Tx desc status Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 20/29] net/qdma: add Rx burst API Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 21/29] net/qdma: add mailbox communication library Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 22/29] net/qdma: mbox API adaptation in Rx/Tx init Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 23/29] net/qdma: add support for VF interfaces Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 24/29] net/qdma: add Rx/Tx queue setup routine for VF devices Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 25/29] net/qdma: add basic PMD ops for VF Aman Kumar
2022-07-06  7:52 ` Aman Kumar [this message]
2022-07-06  7:52 ` [RFC PATCH 27/29] net/qdma: add device specific APIs for export Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 28/29] net/qdma: add additional debug APIs Aman Kumar
2022-07-06  7:52 ` [RFC PATCH 29/29] net/qdma: add stats PMD ops for PF and VF Aman Kumar
2022-07-07  6:57 ` [RFC PATCH 00/29] cover letter for net/qdma PMD Thomas Monjalon
2022-07-07 13:55   ` Aman Kumar
2022-07-07 14:15     ` Thomas Monjalon
2022-07-07 14:19       ` Hemant Agrawal
2022-07-18 18:15         ` aman.kumar
2022-07-19 12:12           ` Thomas Monjalon
2022-07-19 17:22             ` aman.kumar
2023-07-02 23:36               ` Stephen Hemminger
2023-07-03  9:15                 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220706075219.517046-27-aman.kumar@vvdntech.in \
    --to=aman.kumar@vvdntech.in \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).