From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1AF7DA2EEB for ; Thu, 12 Sep 2019 09:41:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8F8501DFEC; Thu, 12 Sep 2019 09:41:27 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2F5161D419 for ; Thu, 12 Sep 2019 09:41:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2019 00:41:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,489,1559545200"; d="scan'208";a="360380296" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga005.jf.intel.com with ESMTP; 12 Sep 2019 00:41:22 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 12 Sep 2019 00:41:22 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 12 Sep 2019 00:41:22 -0700 Received: from shsmsx106.ccr.corp.intel.com ([169.254.10.86]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.53]) with mapi id 14.03.0439.000; Thu, 12 Sep 2019 15:41:20 +0800 From: "Wang, Xiao W" To: "Pei, Andy" , "dev@dpdk.org" CC: "Xu, Rosen" , "Ye, Xiaolong" , "Bie, Tiwei" , "Liang, Cunming" Thread-Topic: [PATCH 4/4] net/ifcvf: enable mutliqueue support Thread-Index: AQHVZGPhmTCojAMJvkCLIYpzVnXSkacnr3+A Date: Thu, 12 Sep 2019 07:41:19 +0000 Message-ID: References: <1567740051-367172-1-git-send-email-andy.pei@intel.com> <1567740051-367172-4-git-send-email-andy.pei@intel.com> In-Reply-To: <1567740051-367172-4-git-send-email-andy.pei@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDFkMjc4MzktNDYxNi00MGZkLTlkYTktNGVlZDQ5OWVlYTU1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiMGJjSXNvVVM5cUh4bDRCQ0poWXorb2p3cVNnREJJK29RR2NDdUQ3U2VRQTJaN1JDU1RDQ01yUHFlNDJScFRuMCJ9 dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 4/4] net/ifcvf: enable mutliqueue support 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Andy, > -----Original Message----- > From: Pei, Andy > Sent: Friday, September 6, 2019 11:21 AM > To: dev@dpdk.org > Cc: Xu, Rosen ; Ye, Xiaolong ; > Bie, Tiwei ; Wang, Xiao W > Subject: [PATCH 4/4] net/ifcvf: enable mutliqueue support >=20 > Enable mutliqueue support for ifcvf devices by setting the mutliqueue > configuration space. >=20 > Signed-off-by: Xiaolong Ye > Signed-off-by: Andy Pei > --- > drivers/net/ifc/base/ifcvf.c | 8 ++++++++ > drivers/net/ifc/base/ifcvf.h | 5 ++++- > drivers/net/ifc/ifcvf_vdpa.c | 31 +++++++++++++++++++++++++++++-- > 3 files changed, 41 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/net/ifc/base/ifcvf.c b/drivers/net/ifc/base/ifcvf.c > index 6462281..ac09537 100644 > --- a/drivers/net/ifc/base/ifcvf.c > +++ b/drivers/net/ifc/base/ifcvf.c > @@ -310,6 +310,14 @@ > *(u32 *)(lm_cfg + IFCVF_LM_LOGGING_CTRL) =3D IFCVF_LM_DISABLE; > } >=20 > +void ifcvf_enable_multiqueue(struct ifcvf_hw *hw, u16 nr_queue_pair) > +{ > + u8 *mq_cfg; > + > + mq_cfg =3D hw->mq_cfg; > + *(u32 *)mq_cfg =3D nr_queue_pair; > +} > + > void > ifcvf_notify_queue(struct ifcvf_hw *hw, u16 qid) > { > diff --git a/drivers/net/ifc/base/ifcvf.h b/drivers/net/ifc/base/ifcvf.h > index a4cb1a4..3eb0bf3 100644 > --- a/drivers/net/ifc/base/ifcvf.h > +++ b/drivers/net/ifc/base/ifcvf.h > @@ -12,7 +12,7 @@ > #define IFCVF_SUBSYS_VENDOR_ID 0x8086 > #define IFCVF_SUBSYS_DEVICE_ID 0x001A >=20 > -#define IFCVF_MAX_QUEUES 1 > +#define IFCVF_MAX_QUEUES 32 The IFC supports flexible queue resource allocation among VFs, a VF may hav= e at most 32 queue pair allocated, but the actual number depends on user's allocation policy. You can just get this number from a register in virtio d= evice config capability. BRs, Xiao > #define VIRTIO_F_IOMMU_PLATFORM 33 >=20 > /* Common configuration */ > @@ -153,6 +153,9 @@ struct ifcvf_hw { > ifcvf_disable_logging(struct ifcvf_hw *hw); >=20 > void > +ifcvf_enable_multiqueue(struct ifcvf_hw *hw, u16 nr_queue_pair); > + > +void > ifcvf_notify_queue(struct ifcvf_hw *hw, u16 qid); >=20 > u8 > diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c > index 8de9ef1..be71f92 100644 > --- a/drivers/net/ifc/ifcvf_vdpa.c > +++ b/drivers/net/ifc/ifcvf_vdpa.c > @@ -994,6 +994,31 @@ struct internal_list { > } >=20 > static int > +ifcvf_set_vring_state(int vid) > +{ > + int did, nr_active_vring, nr_queue_pair; > + struct internal_list *list; > + > + nr_active_vring =3D rte_vhost_get_active_vring_num(vid); > + if (nr_active_vring =3D=3D 0) { > + DRV_LOG(ERR, "No enabled vring"); > + return -1; > + } > + nr_queue_pair =3D (nr_active_vring + 1) / 2; > + > + did =3D rte_vhost_get_vdpa_device_id(vid); > + list =3D find_internal_resource_by_did(did); > + if (list =3D=3D NULL) { > + DRV_LOG(ERR, "Invalid device id: %d", did); > + return -1; > + } > + > + ifcvf_enable_multiqueue(&list->internal->hw, nr_queue_pair); > + > + return 0; > +} > + > +static int > ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size= ) > { > int did; > @@ -1062,7 +1087,9 @@ struct internal_list { > 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ | \ > 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | \ > 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | \ > - 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) > + 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD | \ > + 1ULL << VHOST_USER_PROTOCOL_F_MQ) > + > static int > ifcvf_get_protocol_features(int did __rte_unused, uint64_t *features) > { > @@ -1076,7 +1103,7 @@ struct internal_list { > .get_protocol_features =3D ifcvf_get_protocol_features, > .dev_conf =3D ifcvf_dev_config, > .dev_close =3D ifcvf_dev_close, > - .set_vring_state =3D NULL, > + .set_vring_state =3D ifcvf_set_vring_state, > .set_features =3D ifcvf_set_features, > .migration_done =3D NULL, > .get_vfio_group_fd =3D ifcvf_get_vfio_group_fd, > -- > 1.8.3.1