From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id DA9721B109 for ; Thu, 27 Sep 2018 10:40:19 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id y3-v6so2813630wma.1 for ; Thu, 27 Sep 2018 01:40:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-transfer-encoding:mime-version; bh=gBpiiyytStPSqgFH7eMW2WpVInL1YtmGocU+qnzPP64=; b=tSdG1zlLGds/dv3fQvCdhhb7dKjMprnR6HW0njS61QI0B6iaQujn0BJkjX/EstFt+V LLq2FL++P144OYCrqkG93i3QTErnDucK+EErEjxkdvHGpNYKuccJa3g1pebWFUm7APfQ DKo6gs2Wvuj/VnH4PAK4yGNsFoAhh61J9JeKOJDiJAcPEzUR83sV1zxKSHlEBZ7s4U2r xbd+QzER2GY8yi1etGnCsyeppBLnd1aMBC9f74d763mIVQIdhZMYYwH735LVvVsmg6xx QFuCJF0EXIcE1q/VnJwJj2Yr18iHPms1QPTwF7jZUOv1sBro/J3a9NEUO36hgXIf86fF 34vg== X-Gm-Message-State: ABuFfoiTBxlMM0+Ev3zL5gpdeeAb+cvrlQOpe3eCqK/owoBqn5RFw9/9 dKk4Z96gnktvCue9Mkuh20CwUCvZ X-Google-Smtp-Source: ACcGV63k9e2PKF9fLsFzh8iMC8V/iKx3DU5frQV4WkQ4eUAl+AZQLTaMItPS/dMPt6HB46/cUTiwfA== X-Received: by 2002:a1c:e00a:: with SMTP id x10-v6mr6867619wmg.58.1538037619254; Thu, 27 Sep 2018 01:40:19 -0700 (PDT) Received: from localhost ([2a01:4b00:f419:6f00:8361:8946:ba2b:d556]) by smtp.gmail.com with ESMTPSA id y184-v6sm1474181wmg.17.2018.09.27.01.40.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Sep 2018 01:40:18 -0700 (PDT) Message-ID: <1538037616.8363.27.camel@debian.org> From: Luca Boccassi To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, 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 Date: Thu, 27 Sep 2018 09:40:16 +0100 In-Reply-To: <20180919125757.17938-1-bluca@debian.org> References: <20180816135032.28283-1-bluca@debian.org> <20180919125757.17938-1-bluca@debian.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 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 08:40:20 -0000 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. >=20 > Fixes: c1f86306a026 ("virtio: add new driver") > Cc: stable@dpdk.org >=20 > Signed-off-by: Brian Russell > Signed-off-by: Luca Boccassi > --- > =C2=A0drivers/net/virtio/virtio_ethdev.c | 26 +++++++++++++++----------- > =C2=A01 file changed, 15 insertions(+), 11 deletions(-) >=20 > 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) > =C2=A0 if (ret < 0) > =C2=A0 goto out; > =C2=A0 > - /* Setup interrupt callback=C2=A0=C2=A0*/ > - if (eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) > - rte_intr_callback_register(eth_dev->intr_handle, > - virtio_interrupt_handler, eth_dev); > - > =C2=A0 return 0; > =C2=A0 > =C2=A0out: > @@ -1709,11 +1704,6 @@ eth_virtio_dev_uninit(struct rte_eth_dev > *eth_dev) > =C2=A0 rte_free(eth_dev->data->mac_addrs); > =C2=A0 eth_dev->data->mac_addrs =3D NULL; > =C2=A0 > - /* reset interrupt callback=C2=A0=C2=A0*/ > - 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); > =C2=A0 if (eth_dev->device) > =C2=A0 rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev)); > =C2=A0 > @@ -1972,6 +1962,12 @@ virtio_dev_start(struct rte_eth_dev *dev) > =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0dev->data->dev_conf.intr_conf.rxq) { > =C2=A0 virtio_intr_disable(dev); > =C2=A0 > + /* Setup interrupt callback=C2=A0=C2=A0*/ > + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) > + rte_intr_callback_register(dev->intr_handle, > + =C2=A0=C2=A0=C2=A0virtio_interrupt_ > handler, > + =C2=A0=C2=A0=C2=A0dev); > + > =C2=A0 if (virtio_intr_enable(dev) < 0) { > =C2=A0 PMD_DRV_LOG(ERR, "interrupt enable failed"); > =C2=A0 return -EIO; > @@ -2081,9 +2077,17 @@ virtio_dev_stop(struct rte_eth_dev *dev) > =C2=A0 PMD_INIT_LOG(DEBUG, "stop"); > =C2=A0 > =C2=A0 rte_spinlock_lock(&hw->state_lock); > - if (intr_conf->lsc || intr_conf->rxq) > + if (intr_conf->lsc || intr_conf->rxq) { > =C2=A0 virtio_intr_disable(dev); > =C2=A0 > + /* Reset interrupt callback=C2=A0=C2=A0*/ > + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) { > + rte_intr_callback_unregister(dev- > >intr_handle, > + =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0virtio_interrup > t_handler, > + =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dev); > + } > + } > + > =C2=A0 hw->started =3D 0; > =C2=A0 memset(&link, 0, sizeof(link)); > =C2=A0 rte_eth_linkstatus_set(dev, &link); Hi, any chance the virtio and eal patches in this series could get a review? Thanks! --=20 Kind regards, Luca Boccassi