DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Charles (Chas) Williams" <ciwillia@brocade.com>
To: <dev@dpdk.org>
Cc: <yliu@fridaylinux.org>, <maxime.coquelin@redhat.com>,
	Brian Russell <brussell@brocade.com>
Subject: [dpdk-dev] [PATCH 2/2] net/virtio: register/unregister intr handler on start/stop
Date: Mon, 17 Jul 2017 19:05:23 -0400	[thread overview]
Message-ID: <1500332723-10812-3-git-send-email-ciwillia@brocade.com> (raw)
In-Reply-To: <1500332723-10812-1-git-send-email-ciwillia@brocade.com>

From: Brian Russell <brussell@brocade.com>

Register and unregister the virtio interrupt handler when the device is
started and stopped.

Signed-off-by: Brian Russell <brussell@brocade.com>
---
 drivers/net/virtio/virtio_ethdev.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index eff0545..103e778 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1581,11 +1581,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 	if (ret < 0)
 		return ret;
 
-	/* Setup interrupt callback  */
-	if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
-		rte_intr_callback_register(eth_dev->intr_handle,
-			virtio_interrupt_handler, eth_dev);
-
 	return 0;
 }
 
@@ -1607,11 +1602,6 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
 	rte_free(eth_dev->data->mac_addrs);
 	eth_dev->data->mac_addrs = NULL;
 
-	/* reset interrupt callback  */
-	if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
-		rte_intr_callback_unregister(eth_dev->intr_handle,
-						virtio_interrupt_handler,
-						eth_dev);
 	if (eth_dev->device)
 		rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
 
@@ -1730,6 +1720,12 @@ virtio_dev_start(struct rte_eth_dev *dev)
 	    dev->data->dev_conf.intr_conf.rxq) {
 		rte_intr_disable(dev->intr_handle);
 
+		/* Setup interrupt callback  */
+		if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
+			rte_intr_callback_register(dev->intr_handle,
+						   virtio_interrupt_handler,
+						   dev);
+
 		if (rte_intr_enable(dev->intr_handle) < 0) {
 			PMD_DRV_LOG(ERR, "interrupt enable failed");
 			return -EIO;
@@ -1834,9 +1830,17 @@ virtio_dev_stop(struct rte_eth_dev *dev)
 		return;
 	hw->started = false;
 
-	if (intr_conf->lsc || intr_conf->rxq)
+	if (intr_conf->lsc || intr_conf->rxq) {
 		rte_intr_disable(dev->intr_handle);
 
+		/* Reset interrupt callback  */
+		if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
+			rte_intr_callback_unregister(dev->intr_handle,
+						     virtio_interrupt_handler,
+						     dev);
+		}
+	}
+
 	memset(&link, 0, sizeof(link));
 	virtio_dev_atomic_write_link_status(dev, &link);
 }
-- 
2.1.4

  parent reply	other threads:[~2017-07-17 23:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 23:05 [dpdk-dev] [PATCH 0/2] Some small changes to net/virtio Charles (Chas) Williams
2017-07-17 23:05 ` [dpdk-dev] [PATCH 1/2] net/virtio: do not re-enter clean up routines Charles (Chas) Williams
2018-11-01 14:45   ` Luca Boccassi
2018-11-02  9:57     ` Maxime Coquelin
2018-11-02 11:03       ` Maxime Coquelin
2018-11-02 11:14         ` Luca Boccassi
2018-11-02 14:33     ` Ferruh Yigit
2018-11-02 15:19       ` Chas Williams
2018-11-02 16:48         ` Maxime Coquelin
2018-11-02 17:17           ` Ferruh Yigit
2017-07-17 23:05 ` Charles (Chas) Williams [this message]
2017-07-18 11:50 ` [dpdk-dev] [PATCH 0/2] Some small changes to net/virtio Ferruh Yigit
2017-07-18 11:52   ` Charles (Chas) Williams
2018-08-15 13:51     ` Luca Boccassi
2018-08-27 13:41       ` Ferruh Yigit
2018-08-27 13:48         ` Ferruh Yigit
2018-08-27 14:52           ` Gavin Hu

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=1500332723-10812-3-git-send-email-ciwillia@brocade.com \
    --to=ciwillia@brocade.com \
    --cc=brussell@brocade.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=yliu@fridaylinux.org \
    /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).