From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 133D71B126 for ; Thu, 27 Sep 2018 12:51:49 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20EE230832CD; Thu, 27 Sep 2018 10:51:48 +0000 (UTC) Received: from [10.36.112.65] (ovpn-112-65.ams2.redhat.com [10.36.112.65]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09A98308BE75; Thu, 27 Sep 2018 10:51:44 +0000 (UTC) To: Luca Boccassi , dev@dpdk.org Cc: tiwei.bie@intel.com, yongwang@vmware.com, 3chas3@gmail.com, bruce.richardson@intel.com, jianfeng.tan@intel.com, anatoly.burakov@intel.com, llouis@vmware.com, brussell@vyatta.att-mail.com References: <20180816135032.28283-1-bluca@debian.org> <20180919125757.17938-1-bluca@debian.org> <1538037616.8363.27.camel@debian.org> From: Maxime Coquelin Message-ID: Date: Thu, 27 Sep 2018 12:51:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1538037616.8363.27.camel@debian.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 27 Sep 2018 10:51:48 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH v2 1/3] net/virtio: register/unregister intr handler on start/stop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 10:51:49 -0000 On 09/27/2018 10:40 AM, Luca Boccassi wrote: > On Wed, 2018-09-19 at 13:57 +0100, Luca Boccassi wrote: >> 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") >> Cc: stable@dpdk.org >> >> Signed-off-by: Brian Russell >> Signed-off-by: Luca Boccassi >> --- >>  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 b81df0a99f..adc6a30a32 100644 >> --- a/drivers/net/virtio/virtio_ethdev.c >> +++ b/drivers/net/virtio/virtio_ethdev.c >> @@ -1679,11 +1679,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: >> @@ -1709,11 +1704,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_han >> dler, >> - eth_dev); >>   if (eth_dev->device) >>   rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev)); >> >> @@ -1972,6 +1962,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; >> @@ -2081,9 +2077,17 @@ virtio_dev_stop(struct rte_eth_dev *dev) >>   PMD_INIT_LOG(DEBUG, "stop"); >> >>   rte_spinlock_lock(&hw->state_lock); >> - 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_interrup >> t_handler, >> +      dev); >> + } >> + } >> + >>   hw->started = 0; >>   memset(&link, 0, sizeof(link)); >>   rte_eth_linkstatus_set(dev, &link); > > Hi, any chance the virtio and eal patches in this series could get a > review? Thanks! > Hi, Sorry, I missed it because not delegated to me in patchwork. Looking at it now! Regards, Maxime