* [dpdk-stable] [PATCH 17.11] net/virtio: register/unregister intr handler on start/stop
@ 2018-12-03 10:27 Luca Boccassi
2018-12-05 19:06 ` Yongseok Koh
0 siblings, 1 reply; 2+ messages in thread
From: Luca Boccassi @ 2018-12-03 10:27 UTC (permalink / raw)
To: stable; +Cc: yskoh
[ 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>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-stable] [PATCH 17.11] net/virtio: register/unregister intr handler on start/stop
2018-12-03 10:27 [dpdk-stable] [PATCH 17.11] net/virtio: register/unregister intr handler on start/stop Luca Boccassi
@ 2018-12-05 19:06 ` Yongseok Koh
0 siblings, 0 replies; 2+ messages in thread
From: Yongseok Koh @ 2018-12-05 19:06 UTC (permalink / raw)
To: Luca Boccassi; +Cc: stable
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-05 19:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 10:27 [dpdk-stable] [PATCH 17.11] net/virtio: register/unregister intr handler on start/stop Luca Boccassi
2018-12-05 19:06 ` Yongseok Koh
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).