[dpdk-dev] [PATCH v3] net/virtio: fix rxq intr config fails using vfio-pci

Yang, Zhiyong zhiyong.yang at intel.com
Thu Nov 9 05:01:44 CET 2017



> -----Original Message-----
> From: Tan, Jianfeng
> Sent: Thursday, November 9, 2017 11:47 AM
> To: Yang, Zhiyong <zhiyong.yang at intel.com>; dev at dpdk.org
> Cc: yliu at fridaylinux.org
> Subject: Re: [PATCH v3] net/virtio: fix rxq intr config fails using vfio-pci
> 
> 
> 
> On 11/9/2017 11:18 AM, Zhiyong Yang wrote:
> > When running l3fwd-power to test virtio rxq interrupt using vfio pci
> > noiommu mode, startup fails. In the function virtio_read_caps, the
> > code if (flags & PCI_MSIX_ENABLE) intends to double check if vfio msix
> > is enabled or not. However, it is not enable at that time. So use_msix
> > is assigned to "0", not "1", which causes the failure of configuring
> > rxq intr in l3fwd-power.
> > This patch adds the function "vtpci_msix_detect" to detect the status
> > of msix when interrupt changes happen.
> > In the meanwhile, virtio_intr_enable/disable are introduced to wrap
> > rte_intr_enable/disable to enhance the ability to detect msix. Only
> > supporting and enabling msix can assign "VIRTIO_MSIX_ENABLED(2)" to
> > use_msix.
> 
> Above sentence seems not correct. As we can assign VIRTIO_MSIX_NONE,
> VIRTIO_MSIX_DISABLED, VIRTIO_MSIX_ENABLED to use_msix to indicate three
> different msix status.
> 

Right, I just want to say, supporting and enabling msix are true, use_misx can be assigned to 2.

> 
> >
> > Fixes: cb482cb3a305 ("net/virtio: fix MAC address read")
> > Signed-off-by: Zhiyong Yang <zhiyong.yang at intel.com>
> > ---
> >
> > Changes in v3:
> > Simply the code according to jianfeng's comments.
> >
> > Changes in v2:
> > Add the capability to detect msix if virtio intr changes.
> >
> >   drivers/net/virtio/virtio_ethdev.c | 46 ++++++++++++++++++++++++++++++--
> ----
> >   drivers/net/virtio/virtio_pci.c    | 48
> ++++++++++++++++++++++++++++++++++++--
> >   drivers/net/virtio/virtio_pci.h    |  6 +++++
> >   3 files changed, 91 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/net/virtio/virtio_ethdev.c
> > b/drivers/net/virtio/virtio_ethdev.c
> > index d2576d5e0..87ac2bee6 100644
> > --- a/drivers/net/virtio/virtio_ethdev.c
> > +++ b/drivers/net/virtio/virtio_ethdev.c
> > @@ -97,6 +97,9 @@ static void virtio_mac_addr_remove(struct rte_eth_dev
> *dev, uint32_t index);
> >   static void virtio_mac_addr_set(struct rte_eth_dev *dev,
> >   				struct ether_addr *mac_addr);
> >
> > +static int virtio_intr_enable(struct rte_eth_dev *dev); static int
> > +virtio_intr_disable(struct rte_eth_dev *dev);
> > +
> >   static int virtio_dev_queue_stats_mapping_set(
> >   	struct rte_eth_dev *eth_dev,
> >   	uint16_t queue_id,
> > @@ -618,7 +621,7 @@ virtio_dev_close(struct rte_eth_dev *dev)
> >   		virtio_queues_unbind_intr(dev);
> >
> >   	if (intr_conf->lsc || intr_conf->rxq) {
> > -		rte_intr_disable(dev->intr_handle);
> > +		virtio_intr_disable(dev);
> >   		rte_intr_efd_disable(dev->intr_handle);
> >   		rte_free(dev->intr_handle->intr_vec);
> >   		dev->intr_handle->intr_vec = NULL; @@ -1160,6 +1163,34 @@
> > virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
> >   }
> >
> >   static int
> > +virtio_intr_enable(struct rte_eth_dev *dev) {
> > +	struct virtio_hw *hw = dev->data->dev_private;
> > +
> > +	if (rte_intr_enable(dev->intr_handle) < 0)
> > +		return -1;
> > +
> > +	if (!hw->virtio_user_dev)
> > +		hw->use_msix = vtpci_msix_detect(RTE_ETH_DEV_TO_PCI(dev));
> 
> Maybe we can check hw->use_msix as an additional check; if it does not equal
> VIRTIO_MSIX_ENABLE, returns -1.
>  
>From my understanding, it is unnecessary. 
Functionality of virtio_intr_enable  should be generic.
Igb_uio or other can use it. it should be no harm to others.
 we add msix detect here in order to just get use_msix status. 

Thanks
Zhiyong 


More information about the dev mailing list