From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ouyang, Changchun" Subject: Re: [PATCH v2 04/24] virtio: Add support for Link State interrupt Date: Wed, 28 Jan 2015 03:03:32 +0000 Message-ID: References: <1421298930-15210-1-git-send-email-changchun.ouyang@intel.com> <1422326164-13697-1-git-send-email-changchun.ouyang@intel.com> <1422326164-13697-5-git-send-email-changchun.ouyang@intel.com> <20150127100006.007fbf8c@uryu.home.lan> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev-VfR2kkLFssw@public.gmane.org" To: Stephen Hemminger , "Xie, Huawei" Return-path: In-Reply-To: <20150127100006.007fbf8c-CA4OZQ/Yy2Lykuyl+CZolw@public.gmane.org> Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Hi Stephen, > -----Original Message----- > From: Stephen Hemminger [mailto:stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org] > Sent: Tuesday, January 27, 2015 6:00 PM > To: Xie, Huawei > Cc: Ouyang, Changchun; dev-VfR2kkLFssw@public.gmane.org > Subject: Re: [dpdk-dev] [PATCH v2 04/24] virtio: Add support for Link Sta= te > interrupt >=20 > On Tue, 27 Jan 2015 09:04:07 +0000 > "Xie, Huawei" wrote: >=20 > > > -----Original Message----- > > > From: dev [mailto:dev-bounces-VfR2kkLFssw@public.gmane.org] On Behalf Of Ouyang > > > Changchun > > > Sent: Tuesday, January 27, 2015 10:36 AM > > > To: dev-VfR2kkLFssw@public.gmane.org > > > Subject: [dpdk-dev] [PATCH v2 04/24] virtio: Add support for Link > > > State interrupt > > > > > > Virtio has link state interrupt which can be used. > > > > > > Signed-off-by: Stephen Hemminger > > > Signed-off-by: Changchun Ouyang > > > --- > > > lib/librte_pmd_virtio/virtio_ethdev.c | 78 > > > +++++++++++++++++++++++++++------ > > > -- > > > lib/librte_pmd_virtio/virtio_pci.c | 22 ++++++++++ > > > lib/librte_pmd_virtio/virtio_pci.h | 4 ++ > > > 3 files changed, 86 insertions(+), 18 deletions(-) > > > > > > diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c > > > b/lib/librte_pmd_virtio/virtio_ethdev.c > > > index 5df3b54..ef87ff8 100644 > > > --- a/lib/librte_pmd_virtio/virtio_ethdev.c > > > +++ b/lib/librte_pmd_virtio/virtio_ethdev.c > > > @@ -845,6 +845,34 @@ static int virtio_resource_init(struct > > > rte_pci_device *pci_dev __rte_unused) #endif > > > > > > /* > > > + * Process Virtio Config changed interrupt and call the callback > > > + * if link state changed. > > > + */ > > > +static void > > > +virtio_interrupt_handler(__rte_unused struct rte_intr_handle *handle= , > > > + void *param) > > > +{ > > > + struct rte_eth_dev *dev =3D param; > > > + struct virtio_hw *hw =3D > > > + VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > > + uint8_t isr; > > > + > > > + /* Read interrupt status which clears interrupt */ > > > + isr =3D vtpci_isr(hw); > > > + PMD_DRV_LOG(INFO, "interrupt status =3D %#x", isr); > > > + > > > + if (rte_intr_enable(&dev->pci_dev->intr_handle) < 0) > > > + PMD_DRV_LOG(ERR, "interrupt enable failed"); > > > + > > > > Is it better to put rte_intr_enable after we have handled the interrupt= . > > Is there the possibility of interrupt reentrant in uio intr framework? >=20 > The UIO framework handles IRQ's via posix thread that is reading fd, then > calling this code. Therefore it is always single threaded. Even if it is under UIO framework, and always single threaded,=20 How about move rte_intr_enable after the virtio_dev_link_update() and _rte_= eth_dev_callback_process is called. This make it more like interrupt handler in linux kernel. What do you think of it? Thanks Changchun