DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Cc: jingjing.wu@intel.com, beilei.xing@intel.com,
	chenbo.xia@intel.com, xiuchun.lu@intel.com
Subject: [dpdk-dev] [PATCH v3 4/5] net/iavf_client: enable interrupt of Rx queue
Date: Thu,  7 Jan 2021 16:27:17 +0800	[thread overview]
Message-ID: <20210107082718.33748-5-jingjing.wu@intel.com> (raw)
In-Reply-To: <20210107082718.33748-1-jingjing.wu@intel.com>

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/iavf/iavf_client_ethdev.c | 29 +++++++++++++++++++++------
 drivers/net/iavf/iavf_ethdev.c        |  9 +++------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/net/iavf/iavf_client_ethdev.c b/drivers/net/iavf/iavf_client_ethdev.c
index 770a7a8200..27daaed0e8 100644
--- a/drivers/net/iavf/iavf_client_ethdev.c
+++ b/drivers/net/iavf/iavf_client_ethdev.c
@@ -59,6 +59,7 @@ iavf_client_vfio_user_setup(struct rte_eth_dev *dev, const char *path)
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
 	struct vfio_device *vfio_dev;
+	uint32_t max_fds, i;
 
 	vfio_dev = client_vfio_user_setup(path, dev->device->numa_node);
 	if (vfio_dev == NULL) {
@@ -87,11 +88,21 @@ iavf_client_vfio_user_setup(struct rte_eth_dev *dev, const char *path)
 		}
 
 	}
-
 	dev->intr_handle->fd = vfio_dev->irqfds[0];
 	dev->intr_handle->type = RTE_INTR_HANDLE_VDEV;
 	dev->intr_handle->max_intr = 1;
 
+	/* Assign rxq fds */
+	if (vfio_dev->nb_irqs > 1) {
+		max_fds = RTE_MIN((uint32_t)RTE_MAX_RXTX_INTR_VEC_ID,
+				  vfio_dev->nb_irqs - 1);
+		dev->intr_handle->nb_efd = max_fds;
+		for (i = 0; i < max_fds; ++i)
+			dev->intr_handle->efds[i] =
+				vfio_dev->irqfds[i + RTE_INTR_VEC_RXTX_OFFSET];
+		dev->intr_handle->efd_counter_size = 0;
+		dev->intr_handle->max_intr += max_fds;
+	}
 	return 0;
 }
 
@@ -108,8 +119,6 @@ avf_client_init_eth_ops(void)
 	iavf_client_eth_dev_ops.reta_query                 = NULL;
 	iavf_client_eth_dev_ops.rss_hash_update            = NULL;
 	iavf_client_eth_dev_ops.rss_hash_conf_get          = NULL;
-	iavf_client_eth_dev_ops.rx_queue_intr_enable       = NULL;
-	iavf_client_eth_dev_ops.rx_queue_intr_disable      = NULL;
 }
 
 #define IAVF_CLIENT_ALARM_INTERVAL 50000 /* us */
@@ -227,11 +236,12 @@ iavf_client_dev_close(struct rte_eth_dev *dev)
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct rte_intr_handle *intr_handle = dev->intr_handle;
 
 	if (adapter->intr_mode) {
 		iavf_disable_irq0(hw);
 		/* unregister callback func from eal lib */
-		rte_intr_callback_unregister(dev->intr_handle,
+		rte_intr_callback_unregister(intr_handle,
 					     iavf_client_event_handler, dev);
 	} else {
 		rte_eal_alarm_cancel(iavf_client_dev_alarm_handler, dev);
@@ -240,8 +250,15 @@ iavf_client_dev_close(struct rte_eth_dev *dev)
 	if (!adapter->stopped) {
 		iavf_stop_queues(dev);
 
-		if (dev->intr_handle) {
-			rte_free(dev->intr_handle);
+		if (intr_handle) {
+			/* Disable the interrupt for Rx */
+			rte_intr_efd_disable(intr_handle);
+			/* Rx interrupt vector mapping free */
+			if (intr_handle->intr_vec) {
+				rte_free(intr_handle->intr_vec);
+				intr_handle->intr_vec = NULL;
+			}
+			rte_free(intr_handle);
 			dev->intr_handle = NULL;
 		}
 
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index bc07ecbed7..06395f852b 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1368,11 +1368,10 @@ iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
 	uint16_t msix_intr;
 
-	msix_intr = pci_dev->intr_handle.intr_vec[queue_id];
+	msix_intr = dev->intr_handle->intr_vec[queue_id];
 	if (msix_intr == IAVF_MISC_VEC_ID) {
 		PMD_DRV_LOG(INFO, "MISC is also enabled for control");
 		IAVF_WRITE_REG(hw, IAVF_VFINT_DYN_CTL01,
@@ -1387,10 +1386,9 @@ iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 			       IAVF_VFINT_DYN_CTL01_CLEARPBA_MASK |
 			       IAVF_VFINT_DYN_CTLN1_ITR_INDX_MASK);
 	}
-
 	IAVF_WRITE_FLUSH(hw);
 
-	rte_intr_ack(&pci_dev->intr_handle);
+	rte_intr_ack(dev->intr_handle);
 
 	return 0;
 }
@@ -1398,11 +1396,10 @@ iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 static int
 iavf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint16_t msix_intr;
 
-	msix_intr = pci_dev->intr_handle.intr_vec[queue_id];
+	msix_intr = dev->intr_handle->intr_vec[queue_id];
 	if (msix_intr == IAVF_MISC_VEC_ID) {
 		PMD_DRV_LOG(ERR, "MISC is used for control, cannot disable it");
 		return -EIO;
-- 
2.21.1


  parent reply	other threads:[~2021-01-07  8:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-19 14:38 [dpdk-dev] [PATCH v1 0/2] introduce new iavf driver on vfio-user client Jingjing Wu
2020-12-19 14:38 ` [dpdk-dev] [PATCH v1 1/2] common/iavf: emulated pci interfaces " Jingjing Wu
2020-12-19 14:38 ` [dpdk-dev] [PATCH v1 2/2] net/iavf: introduce iavf driver " Jingjing Wu
2020-12-22  8:14   ` Xia, Chenbo
2021-01-07  7:45 ` [dpdk-dev] [PATCH v2 0/4] introduce new " Jingjing Wu
2021-01-07  7:45   ` [dpdk-dev] [PATCH v2 1/4] net/iavf_client: introduce " Jingjing Wu
2021-01-07  7:45   ` [dpdk-dev] [PATCH v2 2/4] net/iavf_client: enable interrupt on control queue Jingjing Wu
2021-01-07  7:45   ` [dpdk-dev] [PATCH v2 3/4] net/iavf_client: enable interrupt of " Jingjing Wu
2021-01-07  7:45   ` [dpdk-dev] [PATCH v2 4/4] net/iavf: fix vector mapping with queue Jingjing Wu
2021-01-07  8:27   ` [dpdk-dev] [PATCH v3 0/5] introduce new iavf driver on vfio-user client Jingjing Wu
2021-01-07  8:27     ` [dpdk-dev] [PATCH v3 1/5] common/iavf: emulated pci interfaces " Jingjing Wu
2021-01-07  8:27     ` [dpdk-dev] [PATCH v3 2/5] net/iavf_client: introduce iavf driver " Jingjing Wu
2021-01-07  8:27     ` [dpdk-dev] [PATCH v3 3/5] net/iavf_client: enable interrupt on control queue Jingjing Wu
2021-01-07  8:27     ` Jingjing Wu [this message]
2021-01-07  8:27     ` [dpdk-dev] [PATCH v3 5/5] net/iavf: fix vector mapping with queue Jingjing Wu
2021-01-12  6:10       ` Xing, Beilei
2021-01-12  6:45         ` Wu, Jingjing
2021-01-14 10:24       ` Xie, WeiX

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=20210107082718.33748-5-jingjing.wu@intel.com \
    --to=jingjing.wu@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=xiuchun.lu@intel.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).