From: Yongseok Koh <yskoh@mellanox.com>
To: Luca Boccassi <bluca@debian.org>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-stable] [PATCH 17.11] net/virtio: register/unregister intr handler on start/stop
Date: Wed, 5 Dec 2018 19:06:24 +0000 [thread overview]
Message-ID: <6D306155-D1B1-4795-907E-C2E4D02B3E75@mellanox.com> (raw)
In-Reply-To: <20181203102754.17543-1-bluca@debian.org>
> On Dec 3, 2018, at 2:27 AM, Luca Boccassi <bluca@debian.org> wrote:
>
> [ backported from upstream commit f9b0d1902caf893493b5e07763ecf817c34fc75c ]
>
> Register and unregister the virtio interrupt handler when the device is
> started and stopped. This allows a virtio device to be hotplugged or
> unplugged.
>
> Fixes: c1f86306a026 ("virtio: add new driver")
>
> Signed-off-by: Brian Russell <brussell@brocade.com>
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
Applied to stable/17.11
Thanks,
Yongseok
> Adjusted context for 17.11, no functional changes.
>
> 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 4da1ba32e..6eece5bcf 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1622,11 +1622,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
> if (ret < 0)
> goto out;
>
> - /* 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;
>
> out:
> @@ -1652,11 +1647,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));
>
> @@ -1833,6 +1823,12 @@ virtio_dev_start(struct rte_eth_dev *dev)
> dev->data->dev_conf.intr_conf.rxq) {
> virtio_intr_disable(dev);
>
> + /* 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 (virtio_intr_enable(dev) < 0) {
> PMD_DRV_LOG(ERR, "interrupt enable failed");
> return -EIO;
> @@ -1947,9 +1943,17 @@ virtio_dev_stop(struct rte_eth_dev *dev)
>
> PMD_INIT_LOG(DEBUG, "stop");
>
> - if (intr_conf->lsc || intr_conf->rxq)
> + if (intr_conf->lsc || intr_conf->rxq) {
> virtio_intr_disable(dev);
>
> + /* Reset interrupt callback */
> + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
> + rte_intr_callback_unregister(dev->intr_handle,
> + virtio_interrupt_handler,
> + dev);
> + }
> + }
> +
> hw->started = 0;
> memset(&link, 0, sizeof(link));
> virtio_dev_atomic_write_link_status(dev, &link);
> --
> 2.19.2
>
prev parent reply other threads:[~2018-12-05 19:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 10:27 Luca Boccassi
2018-12-05 19:06 ` Yongseok Koh [this message]
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=6D306155-D1B1-4795-907E-C2E4D02B3E75@mellanox.com \
--to=yskoh@mellanox.com \
--cc=bluca@debian.org \
--cc=stable@dpdk.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).