DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Yang, Zhiyong" <zhiyong.yang@intel.com>
To: "Tan, Jianfeng" <jianfeng.tan@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "yliu@fridaylinux.org" <yliu@fridaylinux.org>
Subject: Re: [dpdk-dev] [PATCH v3] net/virtio: fix rxq intr config fails using vfio-pci
Date: Thu, 9 Nov 2017 04:01:44 +0000	[thread overview]
Message-ID: <E182254E98A5DA4EB1E657AC7CB9BD2A8B003820@BGSMSX101.gar.corp.intel.com> (raw)
In-Reply-To: <d51e0306-4a4a-d5d0-55f7-e1ce56673fda@intel.com>



> -----Original Message-----
> From: Tan, Jianfeng
> Sent: Thursday, November 9, 2017 11:47 AM
> To: Yang, Zhiyong <zhiyong.yang@intel.com>; dev@dpdk.org
> Cc: yliu@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@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 

  reply	other threads:[~2017-11-09  4:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31  9:44 [dpdk-dev] [PATCH] net/virtio: fix use_msix get the wrong value Zhiyong Yang
2017-11-01 15:40 ` Yuanhan Liu
2017-11-02  1:46   ` Yang, Zhiyong
2017-11-02  3:36 ` Tan, Jianfeng
2017-11-08 11:03 ` [dpdk-dev] [PATCH v2] net/virtio: fix rxq intr config fails using vfio-pci Zhiyong Yang
2017-11-08 13:52   ` Tan, Jianfeng
2017-11-09  1:28     ` Yang, Zhiyong
2017-11-09  2:11     ` Yang, Zhiyong
2017-11-09  3:31       ` Tan, Jianfeng
2017-11-09  3:18   ` [dpdk-dev] [PATCH v3] " Zhiyong Yang
2017-11-09  3:47     ` Tan, Jianfeng
2017-11-09  4:01       ` Yang, Zhiyong [this message]
2017-11-09  4:40         ` Tan, Jianfeng
2017-11-09  4:46     ` [dpdk-dev] [PATCH v4] " Zhiyong Yang
2017-11-09  6:51       ` Tan, Jianfeng
2017-11-09  8:18       ` Maxime Coquelin
2017-11-09  8:55       ` [dpdk-dev] [PATCH v5] " Zhiyong Yang
2017-11-09  9:08         ` Maxime Coquelin
2017-11-09  9:16           ` Yang, Zhiyong
2017-11-09  9:21         ` [dpdk-dev] [PATCH v6] " Zhiyong Yang
2017-11-11 14:34           ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E182254E98A5DA4EB1E657AC7CB9BD2A8B003820@BGSMSX101.gar.corp.intel.com \
    --to=zhiyong.yang@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=yliu@fridaylinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).