From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EC31EA0547; Wed, 12 Oct 2022 13:00:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CAC5543000; Wed, 12 Oct 2022 13:00:14 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 0FF8942D6E for ; Wed, 12 Oct 2022 13:00:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665572413; x=1697108413; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=cIp7rp5USL0b4aj4IAB+JFb1i5JhULfyuthzlgQi3BQ=; b=I413yNoaT9jY/rPLN5TKruh1nTkEE6r6LF7WyQb40XtKx1RWpNSesx1j In1vviyPA9UVb0JE6tXqQXKRVtxok6OWij/Gm8Allm6Fwak2hs7MBOIO8 YoW1NIWqpjWonRbvamgUrcs3rnzMBtaXPIGUW3IzdHIs2hF9DmalCs9YA 4jMogdQHOiGuaa+6Xx2tlZd8v2ZkSTCwUPsCbLdRk6ev+aW5kLYKM2IfF o1U8upt+Edtik6DTryXZlpG62DALN5veJmGxhx1g8/Wb7V+wUH5UkkqtX AA3oOYIuma7usDNOfEEpvSh33itWiWiGGHFZjPIvcDwW8PipfXHk6QxeZ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="306391401" X-IronPort-AV: E=Sophos;i="5.95,179,1661842800"; d="scan'208";a="306391401" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 04:00:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="871869698" X-IronPort-AV: E=Sophos;i="5.95,179,1661842800"; d="scan'208";a="871869698" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga006.fm.intel.com with ESMTP; 12 Oct 2022 04:00:11 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 12 Oct 2022 04:00:11 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 12 Oct 2022 04:00:10 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 12 Oct 2022 04:00:10 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 12 Oct 2022 04:00:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a5toaDM8Ok+ZpLCX+aFOEXwJw7ahrYbXSX9I8qzIDIov+9JBB9DWzXr8R7T4fGySsZrNyRzlb2xxSwldK9JujjioW7roxQ2bkO5vSIdDGy1OwCRTpa2SlPXHtDnR7ajFRWi7pUxOGce739hqFUkiTv7Zcd5n2HEkTcmcO8ibJBvMeWM06HwFagSeuQqU4VEk9BVbOF7YO7BtuzcXZqHU+ys/PyxQlQriXzeymTuavSyVVYQnsgmHNCeoZy6cnSylI8Rxid1FSZeQV+O9hKezEH8ILRVPx2RHJgulH9zQxa77YthDo8rNKTkAAd4sA6s+0LXRYWYzMlobsXqjbVI31Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o5f6SUC+g+ycErJGsoUdB6I9CL4YUA7wG1EoiOQofQw=; b=gJ69hkzqwMp2ZMZz4VGZpMnUEGjtESODbCFhyooWAd4Y8mlQNjCaE6SoSTMAfE5O8Fb7nLIPiqGYvtVRKvex7JbpxOU0QgfVqFnbfcgGVBQud4bzinOvJ9qT3cuJO+SHrshzreoV2wMDt8bsJoHhjMGCqkcHrqVjgQRTXNmQOTjbWWqbpxSVeU5P6fAB4VgQDVSEdirzWWanD1W8IdWA0uqguxIZGithMqxJVIMsbfjph3kBj/DCHnAqyKYkMfZAnGBcE9olrBH7D4YSw8m2snM+zaIx4SqPrdpS94bpgkFBj/xOU6ta+k1WrqTSVNGLVGwP7kleqIBToLSLSrZ4kA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM5PR11MB1739.namprd11.prod.outlook.com (2603:10b6:3:111::22) by DM4PR11MB6503.namprd11.prod.outlook.com (2603:10b6:8:8c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.41; Wed, 12 Oct 2022 11:00:07 +0000 Received: from DM5PR11MB1739.namprd11.prod.outlook.com ([fe80::b8d7:6a95:bf26:e4ef]) by DM5PR11MB1739.namprd11.prod.outlook.com ([fe80::b8d7:6a95:bf26:e4ef%12]) with mapi id 15.20.5709.021; Wed, 12 Oct 2022 11:00:07 +0000 From: "Pei, Andy" To: "Xia, Chenbo" , "dev@dpdk.org" CC: "Xu, Rosen" , "Huang, Wei" , "Cao, Gang" , "maxime.coquelin@redhat.com" Subject: RE: [PATCH v3 6/8] vdpa/ifc: support dynamic enable/disable queue Thread-Topic: [PATCH v3 6/8] vdpa/ifc: support dynamic enable/disable queue Thread-Index: AQHYyZPuQTJqMbvZWECb7Z+oG9bAra4KkyIQgAAs1UA= Date: Wed, 12 Oct 2022 11:00:07 +0000 Message-ID: References: <1661229305-240952-2-git-send-email-andy.pei@intel.com> <1663308990-621-1-git-send-email-andy.pei@intel.com> <1663308990-621-7-git-send-email-andy.pei@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.6.500.17 dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM5PR11MB1739:EE_|DM4PR11MB6503:EE_ x-ms-office365-filtering-correlation-id: 95157516-3167-452e-444f-08daac40ec95 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WhDOIZjGOhMIq51uI2ld+ZKTUZFrQxSkf+FCQkLZ0InVZ8tzqI7OttFICFOz3A+mAVWdZqU43mjIIt9kcVn/ec+yGcJA3jsHtvVVdX2DeZw9gKLTknw29fup61IeOhixDCtIvAwbt3nQSyU+Vn24PP2PFJnUO5YWcl8+cL6PF8uC4497G9XNAqApLYS6mjGKYAkct/pCjX2iYzRCfM2dC6ipWHtOn9vEwOvrcQkI+e0YW40bNL9qR9iSt2WxPVbmPWgk6hA1NARJq4eBWNXJMhniEXBdJ8NTA+Aq+rhsl4gV9yTU1S3pXzPBSi+/WIYTluAdAsyVkJscABbnCo3yhtj8lYvCZj7nqCFiWqti+T/kBDjJnaUd+3idRQHqdsPIT4iR2/qwRPBQ8rTcAbytZbwFXFwvzzTzAgyyvxLm4KE+UdA4BktNnqPTLbaiYul4lxgerZUCyEOrI7zwO43Y6Re8+M3e0VbX3DJphQ+xxU59J9ISG1+xlZ/SwUidjzrKksdKWYSiZG7hy4NgGzsi6pghxDGuT9yen9L1w20VQr4pDeHJbkhttc1xBp9gaNlHDfZ9/xtzd8Y1h7bbBKPblPrq9crRZj5zjXFLZD6XxRtXZSus9AYRLopVpc8fkzlfLw+rf2+kvPx3b7n1M0PMBD2Hd35ThoylM5gmCrkpKWZ5y7Ck9o306bJK5wHc0F3gmEjTMDMlBAO7sF2mOCZoLI43oP6CpOTJEL4FSeDaS0WPx96wVr4UVqREpnQRZHx21eylS4+Xf/vRMmGfaWmw2vO6ODwNjyIyDLaFHeolMxQ= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR11MB1739.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(346002)(366004)(136003)(396003)(39860400002)(376002)(451199015)(33656002)(55016003)(53546011)(41300700001)(7696005)(26005)(6506007)(9686003)(76116006)(66946007)(66556008)(66476007)(66446008)(64756008)(478600001)(8676002)(4326008)(82960400001)(122000001)(38100700002)(71200400001)(86362001)(38070700005)(52536014)(8936002)(5660300002)(83380400001)(54906003)(186003)(2906002)(316002)(110136005)(309714004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?cTlv6Hqt9/Tq/Jllm+LmacEsxjx1H9+GE9QUFVv4YBaCrwJoQk5Osg5jQgQx?= =?us-ascii?Q?ZFS70BHo79jaSuclUsnKEFiF5ABo1pwUaPDeqtsHCrHZ1Z48YmP0Sj6BoMcx?= =?us-ascii?Q?Qnh4yrohwQ/7WF5a4l4sWAZWXaDdu0Dde6qIRYOhISC9AnJP4AoUWCZxFD+K?= =?us-ascii?Q?pCJu9PnQ44XRUN2jMQ6wfTMXsiqA+X3o6ghqmZzmWMFCZuPx3h4o6VP/TDai?= =?us-ascii?Q?mGDF8wCUsI7G2trIv0dHHXP0M35rBx25dZ0XfcgKW6gdUsvyA/5hZvyJQZB2?= =?us-ascii?Q?Xo4zzLta7aH/DjePUJ26WgJ1e+hOG9/ViChQJh3m1FyoH/SQDQK1KoQ09OCY?= =?us-ascii?Q?fuJyusVevxiLfQheb8aX0/s1s4D7UyIfgZ5YaIp1dyMtdDZBDOk0SAk0HzdO?= =?us-ascii?Q?OTLFd1fQQxGRhwejld4SQVQo8erEmB1tGobrCg1h5MI/6kfPQQ/+xnysCmij?= =?us-ascii?Q?R6SqMgOd2Aiy+2pwe0+m/UHxlfqhP+IdPg7iRG6iEXPuQuuShDQ3PK+gI5Xd?= =?us-ascii?Q?hHaJaZWxufJHHbZV0MVhZqAiQk6gXvfu60J3TT9Pfn2JO6FPzIeHoAbmCkri?= =?us-ascii?Q?PhwG57fMB1tqYKog2CtydgBzxHM5dDyz8SSDIpR4T3bWhM4zlWT+QQ5CHROO?= =?us-ascii?Q?mIvsQf7dTC11OGkHJJAaLWp8du/Vo1oGQWiO6DcoRRr0m33ojOHjv7brGkD+?= =?us-ascii?Q?0DKBWkwq/CTBLO6AXO21fpJQcRwd5ZRGv1Hy6losIct3PT1Bd8lOFDuc/UYR?= =?us-ascii?Q?sCoXv4eixvBN/87NV4Wafioe8M9M/Xv44HU4ZDJmooGxnDfqU1FLCCHEmKkS?= =?us-ascii?Q?Ah8zaD0MkeLrV4/bId1wUPheLW/oPT01rmKAGqt76ACtaadyIDtMWdeLa6Fo?= =?us-ascii?Q?uLgHahCwH3a2bjUoWEQ9IBIdohGslD+Ac2IwfruxCVq/wX0f94YPCr98LaET?= =?us-ascii?Q?HSvbXd0dbC88zGXINxyzzoJQohQ2w5LQDslkllQM4SSXat0d2gLP4Vqr3grZ?= =?us-ascii?Q?fZWrIkCTqNjCyYygc0nt65wfkt01RDegz2BUbHlG7KC2ZcUnnZgjB/dwaWHO?= =?us-ascii?Q?iyWhLhxhcrbVuwCizpK60dSZWyrusbcZ88fKL92NmGEpHwmtxPJ6FYMYjKXz?= =?us-ascii?Q?3YuSUV8DcwxHuS58RfJCDzR1WEOdhAUUrHHjeIreZ/v+7a0GXqBYoUmt9mHk?= =?us-ascii?Q?quvVRoVgZPd1PSzDkHeFUF04IpDtx9mtV0kEH7DMCs2h2cHPmr4k1GGfyChg?= =?us-ascii?Q?0+87ycq1K3yoNSJweXNZ1JqpqOguJqXm5rwn0fs2rQdsFaUxuhQsjEB5HCoz?= =?us-ascii?Q?A25tmp31YyR8PY7wOgwhtQKkbyzlliRLba9v+jaVizYDBspKNDue2VugoUuu?= =?us-ascii?Q?WBJ7CGkY/5RHRetKo0iL/fd8tIPBIuKHv0+fM6KdrPiqFPizGbCLKPsJ3bEC?= =?us-ascii?Q?tRW94B84rHSFNKDxAyWM5TeD/ec/dxQbQCfWFas1wLstFOGmiCbevkcZlwgj?= =?us-ascii?Q?Ue4ZIWd3Q37oZU07R2Y4eB8jDes+4N1REuKurhWw/Fr2u+J1Co12NjeVaSEa?= =?us-ascii?Q?tZRn6MK7yUxghGYSEPs=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1739.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95157516-3167-452e-444f-08daac40ec95 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2022 11:00:07.2811 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: JqkLqbJxFpUIklU/WxmCowVfdTyDxj190oXcwH+Z/MoMJigzcd2NrUEfj/ENIKt8IS+R0M7IMRBLYyyfZyuenw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6503 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Chenbo, Thanks for your reply. My reply is inline. > -----Original Message----- > From: Xia, Chenbo > Sent: Wednesday, October 12, 2022 4:20 PM > To: Pei, Andy ; dev@dpdk.org > Cc: Xu, Rosen ; Huang, Wei ; > Cao, Gang ; maxime.coquelin@redhat.com > Subject: RE: [PATCH v3 6/8] vdpa/ifc: support dynamic enable/disable queu= e >=20 > > -----Original Message----- > > From: Pei, Andy > > Sent: Friday, September 16, 2022 2:16 PM > > To: dev@dpdk.org > > Cc: Xia, Chenbo ; Xu, Rosen > > ; Huang, Wei ; Cao, Gang > > ; maxime.coquelin@redhat.com > > Subject: [PATCH v3 6/8] vdpa/ifc: support dynamic enable/disable queue > > > > From: Huang Wei > > > > Support dynamic enable or disable queue. > > For front end, like QEMU, user can use ethtool to configurate queue. >=20 > configure >=20 Fix in next version. > > For example, "ethtool -L eth0 combined 3" to enable 3 queues pairs. > > > > Signed-off-by: Huang Wei > > Signed-off-by: Andy Pei > > --- > > drivers/vdpa/ifc/base/ifcvf.c | 99 > > +++++++++++++++++++++++++++++++++++++++++++ > > drivers/vdpa/ifc/base/ifcvf.h | 6 +++ drivers/vdpa/ifc/ifcvf_vdpa.c > > | 93 +++++++++++++++++++++++++++++++++----- > > -- > > 3 files changed, 183 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/vdpa/ifc/base/ifcvf.c > > b/drivers/vdpa/ifc/base/ifcvf.c index 619b034..792d258 100644 > > --- a/drivers/vdpa/ifc/base/ifcvf.c > > +++ b/drivers/vdpa/ifc/base/ifcvf.c > > @@ -227,6 +227,105 @@ > > } > > } > > > > +int > > +ifcvf_enable_vring_hw(struct ifcvf_hw *hw, int i) { > > + struct ifcvf_pci_common_cfg *cfg; > > + u8 *lm_cfg; > > + u16 notify_off; > > + int msix_vector; > > + > > + if (i >=3D (int)hw->nr_vring) > > + return -1; > > + > > + cfg =3D hw->common_cfg; > > + if (!cfg) { > > + WARNINGOUT("common_cfg in HW is NULL.\n"); >=20 > This should be error log >=20 > > + return -1; > > + } > > + > > + ifcvf_enable_multiqueue(hw); > > + > > + IFCVF_WRITE_REG16(i, &cfg->queue_select); > > + msix_vector =3D IFCVF_READ_REG16(&cfg->queue_msix_vector); > > + if (msix_vector !=3D (i + 1)) { > > + IFCVF_WRITE_REG16(i + 1, &cfg->queue_msix_vector); > > + msix_vector =3D IFCVF_READ_REG16(&cfg- > >queue_msix_vector); > > + if (msix_vector =3D=3D IFCVF_MSI_NO_VECTOR) { > > + WARNINGOUT("queue %u, msix vec alloc failed\n", i); >=20 > Ditto. And %u -> %d >=20 > Same for the function ifcvf_disable_vring_hw. >=20 I will use=20 RTE_LOG(ERR, PMD, "common_cfg in HW is NULL.\n"); > Thanks, > Chenbo >=20 > > + return -1; > > + } > > + } > > + > > + io_write64_twopart(hw->vring[i].desc, &cfg->queue_desc_lo, > > + &cfg->queue_desc_hi); > > + io_write64_twopart(hw->vring[i].avail, &cfg->queue_avail_lo, > > + &cfg->queue_avail_hi); > > + io_write64_twopart(hw->vring[i].used, &cfg->queue_used_lo, > > + &cfg->queue_used_hi); > > + IFCVF_WRITE_REG16(hw->vring[i].size, &cfg->queue_size); > > + > > + lm_cfg =3D hw->lm_cfg; > > + if (lm_cfg) { > > + if (hw->device_type =3D=3D IFCVF_BLK) > > + *(u32 *)(lm_cfg + IFCVF_LM_RING_STATE_OFFSET + > > + i * IFCVF_LM_CFG_SIZE) =3D > > + (u32)hw->vring[i].last_avail_idx | > > + ((u32)hw->vring[i].last_used_idx << 16); > > + else > > + *(u32 *)(lm_cfg + IFCVF_LM_RING_STATE_OFFSET + > > + (i / 2) * IFCVF_LM_CFG_SIZE + > > + (i % 2) * 4) =3D > > + (u32)hw->vring[i].last_avail_idx | > > + ((u32)hw->vring[i].last_used_idx << 16); > > + } > > + > > + notify_off =3D IFCVF_READ_REG16(&cfg->queue_notify_off); > > + hw->notify_addr[i] =3D (void *)((u8 *)hw->notify_base + > > + notify_off * hw->notify_off_multiplier); > > + IFCVF_WRITE_REG16(1, &cfg->queue_enable); > > + > > + return 0; > > +} > > + > > +void > > +ifcvf_disable_vring_hw(struct ifcvf_hw *hw, int i) { > > + struct ifcvf_pci_common_cfg *cfg; > > + u32 ring_state; > > + u8 *lm_cfg; > > + > > + if (i >=3D (int)hw->nr_vring) > > + return; > > + > > + cfg =3D hw->common_cfg; > > + if (!cfg) { > > + WARNINGOUT("common_cfg in HW is NULL.\n"); > > + return; > > + } > > + > > + IFCVF_WRITE_REG16(i, &cfg->queue_select); > > + IFCVF_WRITE_REG16(0, &cfg->queue_enable); > > + > > + lm_cfg =3D hw->lm_cfg; > > + if (lm_cfg) { > > + if (hw->device_type =3D=3D IFCVF_BLK) { > > + ring_state =3D *(u32 *)(lm_cfg + > > + IFCVF_LM_RING_STATE_OFFSET + > > + i * IFCVF_LM_CFG_SIZE); > > + hw->vring[i].last_avail_idx =3D > > + (u16)(ring_state & IFCVF_16_BIT_MASK); > > + } else { > > + ring_state =3D *(u32 *)(lm_cfg + > > + IFCVF_LM_RING_STATE_OFFSET + > > + (i / 2) * IFCVF_LM_CFG_SIZE + > > + (i % 2) * 4); > > + hw->vring[i].last_avail_idx =3D (u16)(ring_state >> 16); > > + } > > + hw->vring[i].last_used_idx =3D (u16)(ring_state >> 16); > > + } > > +} > > + > > STATIC int > > ifcvf_hw_enable(struct ifcvf_hw *hw) > > { > > diff --git a/drivers/vdpa/ifc/base/ifcvf.h > > b/drivers/vdpa/ifc/base/ifcvf.h index 1e133c0..3726da7 100644 > > --- a/drivers/vdpa/ifc/base/ifcvf.h > > +++ b/drivers/vdpa/ifc/base/ifcvf.h > > @@ -164,6 +164,12 @@ struct ifcvf_hw { ifcvf_get_features(struct > > ifcvf_hw *hw); > > > > int > > +ifcvf_enable_vring_hw(struct ifcvf_hw *hw, int i); > > + > > +void > > +ifcvf_disable_vring_hw(struct ifcvf_hw *hw, int i); > > + > > +int > > ifcvf_start_hw(struct ifcvf_hw *hw); > > > > void > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c > > b/drivers/vdpa/ifc/ifcvf_vdpa.c index b00afdb..32bc1c9 100644 > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > > @@ -1282,13 +1282,59 @@ struct rte_vdpa_dev_info { } > > > > static int > > +ifcvf_config_vring(struct ifcvf_internal *internal, int vring) { > > + struct ifcvf_hw *hw =3D &internal->hw; > > + int vid =3D internal->vid; > > + struct rte_vhost_vring vq; > > + uint64_t gpa; > > + > > + if (hw->vring[vring].enable) { > > + rte_vhost_get_vhost_vring(vid, vring, &vq); > > + gpa =3D hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.desc); > > + if (gpa =3D=3D 0) { > > + DRV_LOG(ERR, "Fail to get GPA for descriptor ring."); > > + return -1; > > + } > > + hw->vring[vring].desc =3D gpa; > > + > > + gpa =3D hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.avail); > > + if (gpa =3D=3D 0) { > > + DRV_LOG(ERR, "Fail to get GPA for available ring."); > > + return -1; > > + } > > + hw->vring[vring].avail =3D gpa; > > + > > + gpa =3D hva_to_gpa(vid, (uint64_t)(uintptr_t)vq.used); > > + if (gpa =3D=3D 0) { > > + DRV_LOG(ERR, "Fail to get GPA for used ring."); > > + return -1; > > + } > > + hw->vring[vring].used =3D gpa; > > + > > + hw->vring[vring].size =3D vq.size; > > + rte_vhost_get_vring_base(vid, vring, > > + &hw->vring[vring].last_avail_idx, > > + &hw->vring[vring].last_used_idx); > > + ifcvf_enable_vring_hw(&internal->hw, vring); > > + } else { > > + ifcvf_disable_vring_hw(&internal->hw, vring); > > + rte_vhost_set_vring_base(vid, vring, > > + hw->vring[vring].last_avail_idx, > > + hw->vring[vring].last_used_idx); > > + } > > + > > + return 0; > > +} > > + > > +static int > > ifcvf_set_vring_state(int vid, int vring, int state) { > > struct rte_vdpa_device *vdev; > > struct internal_list *list; > > struct ifcvf_internal *internal; > > struct ifcvf_hw *hw; > > - struct ifcvf_pci_common_cfg *cfg; > > + bool enable =3D !!state; > > int ret =3D 0; > > > > vdev =3D rte_vhost_get_vdpa_device(vid); @@ -1298,6 +1344,9 @@ > struct > > rte_vdpa_dev_info { > > return -1; > > } > > > > + DRV_LOG(INFO, "%s queue %d of vDPA device %s", > > + enable ? "enable" : "disable", vring, vdev->device->name); > > + > > internal =3D list->internal; > > if (vring < 0 || vring >=3D internal->max_queues * 2) { > > DRV_LOG(ERR, "Vring index %d not correct", vring); @@ - > 1305,27 > > +1354,41 @@ struct rte_vdpa_dev_info { > > } > > > > hw =3D &internal->hw; > > + hw->vring[vring].enable =3D enable; > > + > > if (!internal->configured) > > - goto exit; > > + return 0; > > > > - cfg =3D hw->common_cfg; > > - IFCVF_WRITE_REG16(vring, &cfg->queue_select); > > - IFCVF_WRITE_REG16(!!state, &cfg->queue_enable); > > + unset_notify_relay(internal); > > > > - if (!state && hw->vring[vring].enable) { > > - ret =3D vdpa_disable_vfio_intr(internal); > > - if (ret) > > - return ret; > > + ret =3D vdpa_enable_vfio_intr(internal, false); > > + if (ret) { > > + DRV_LOG(ERR, "failed to set vfio interrupt of vDPA > device %s", > > + vdev->device->name); > > + return ret; > > } > > > > - if (state && !hw->vring[vring].enable) { > > - ret =3D vdpa_enable_vfio_intr(internal, false); > > - if (ret) > > - return ret; > > + ret =3D ifcvf_config_vring(internal, vring); > > + if (ret) { > > + DRV_LOG(ERR, "failed to configure queue %d of vDPA > device %s", > > + vring, vdev->device->name); > > + return ret; > > + } > > + > > + ret =3D setup_notify_relay(internal); > > + if (ret) { > > + DRV_LOG(ERR, "failed to setup notify relay of vDPA > device %s", > > + vdev->device->name); > > + return ret; > > + } > > + > > + ret =3D rte_vhost_host_notifier_ctrl(vid, vring, enable); > > + if (ret) { > > + DRV_LOG(ERR, "vDPA device %s queue %d host notifier ctrl > fail", > > + vdev->device->name, vring); > > + return ret; > > } > > > > -exit: > > - hw->vring[vring].enable =3D !!state; > > return 0; > > } > > > > -- > > 1.8.3.1