From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id CEE761B292 for ; Thu, 9 Nov 2017 05:02:02 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2017 20:02:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,367,1505804400"; d="scan'208";a="147748870" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 08 Nov 2017 20:02:00 -0800 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 8 Nov 2017 20:01:48 -0800 Received: from bgsmsx153.gar.corp.intel.com (10.224.23.4) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 8 Nov 2017 20:01:48 -0800 Received: from bgsmsx101.gar.corp.intel.com ([169.254.1.245]) by BGSMSX153.gar.corp.intel.com ([10.224.23.4]) with mapi id 14.03.0319.002; Thu, 9 Nov 2017 09:31:45 +0530 From: "Yang, Zhiyong" To: "Tan, Jianfeng" , "dev@dpdk.org" CC: "yliu@fridaylinux.org" Thread-Topic: [PATCH v3] net/virtio: fix rxq intr config fails using vfio-pci Thread-Index: AQHTWQl+kZSb9mzHZ0ug7C5MevWBa6MLDKCAgABdFeA= Date: Thu, 9 Nov 2017 04:01:44 +0000 Message-ID: References: <20171108110348.38548-1-zhiyong.yang@intel.com> <20171109031818.31040-1-zhiyong.yang@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.223.10.10] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3] net/virtio: fix rxq intr config fails using vfio-pci 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, 09 Nov 2017 04:02:03 -0000 > -----Original Message----- > From: Tan, Jianfeng > Sent: Thursday, November 9, 2017 11:47 AM > To: Yang, Zhiyong ; dev@dpdk.org > Cc: yliu@fridaylinux.org > Subject: Re: [PATCH v3] net/virtio: fix rxq intr config fails using vfio-= pci >=20 >=20 >=20 > 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. >=20 > 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. >=20 Right, I just want to say, supporting and enabling msix are true, use_misx = can be assigned to 2. >=20 > > > > Fixes: cb482cb3a305 ("net/virtio: fix MAC address read") > > Signed-off-by: Zhiyong Yang > > --- > > > > 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 =3D NULL; @@ -1160,6 +1163,34 @@ > > virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int o= n) > > } > > > > static int > > +virtio_intr_enable(struct rte_eth_dev *dev) { > > + struct virtio_hw *hw =3D dev->data->dev_private; > > + > > + if (rte_intr_enable(dev->intr_handle) < 0) > > + return -1; > > + > > + if (!hw->virtio_user_dev) > > + hw->use_msix =3D vtpci_msix_detect(RTE_ETH_DEV_TO_PCI(dev)); >=20 > Maybe we can check hw->use_msix as an additional check; if it does not eq= ual > VIRTIO_MSIX_ENABLE, returns -1. > =20 >>From my understanding, it is unnecessary.=20 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.=20 Thanks Zhiyong=20