[dpdk-dev] [PATCH v2 04/24] virtio: Add support for Link State interrupt

Stephen Hemminger stephen at networkplumber.org
Tue Jan 27 11:00:06 CET 2015


On Tue, 27 Jan 2015 09:04:07 +0000
"Xie, Huawei" <huawei.xie at intel.com> wrote:

> > -----Original Message-----
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ouyang Changchun
> > Sent: Tuesday, January 27, 2015 10:36 AM
> > To: dev at dpdk.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 <stephen at networkplumber.org>
> > Signed-off-by: Changchun Ouyang <changchun.ouyang at intel.com>
> > ---
> >  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 = param;
> > +	struct virtio_hw *hw =
> > +		VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +	uint8_t isr;
> > +
> > +	/* Read interrupt status which clears interrupt */
> > +	isr = vtpci_isr(hw);
> > +	PMD_DRV_LOG(INFO, "interrupt status = %#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?

The UIO framework handles IRQ's via posix thread that is reading
fd, then calling this code. Therefore it is always single threaded.



More information about the dev mailing list