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 5E0BEA0032; Wed, 14 Sep 2022 05:04:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED67D4021D; Wed, 14 Sep 2022 05:04:30 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 799EE40151 for ; Wed, 14 Sep 2022 05:04:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663124669; x=1694660669; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=f6a4fIGCoe311cEUQm/R7ATyslX5undVYg0hpQIV0BQ=; b=YXbWqQRLMde9dh0FWAc7Ek2vIE5aSIEUyIV/X7gfKvzFlvnAf05Za/WH Gk7K22cZcQiCc8LhTbqa/7C+8UQmkwIQ/g4He4NICvQ7R4Sa2qIC57wlh aau2hEho2wecEzDxHfVyaB9yoOVIEGS7Zw2DQHu1E3L/2bDM2bTPfBEnf I9hH7IoUjZEFUPTjWz2C/7oUErNWaCvj7p7BIHVHyb+y9Dwhj0dkPJkxL +D0UgXTJMWxFyg/L6GgH1wHJ8Db2osshTLllbEwVF9ebOkVQL4bRxMiXE VFQClfegEA8EJOBzrJEUTy+KtcNr7PEWBy0+VDhau29WH6M5YiEkC2Hp+ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10469"; a="281352603" X-IronPort-AV: E=Sophos;i="5.93,313,1654585200"; d="scan'208";a="281352603" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2022 20:04:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,313,1654585200"; d="scan'208";a="945340738" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga005.fm.intel.com with ESMTP; 13 Sep 2022 20:04:27 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 13 Sep 2022 20:04:27 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 13 Sep 2022 20:04:27 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 13 Sep 2022 20:04:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tt5k+1cl5Dy9XPSfBPH7oCLIPcnPl0szEZmwJbsvVO3d/KPsafujjh7eQOj0mZUqNbAjDIH9AAaRtkubpRUDcEFuai8JIBXiucu0uTj1G1k38NI1BycC/5w4aUfWFCbYaqqE5+6Pug3FxO6sRtp4CzxyyEgjaKi9ohGE6O0M9Z5Kb/A4fMLITBifmKQiflg4oeaq0FzKreUKDusfJvkpt+A/deyjdzYZBKNU+gecVWQWv36hEUOO8V2ZUTVQzfDIBSQW0BZQCITVGxHJw7Q6LDIXXjkFQQgDBUOf484PysgKYkUEE7m01pt1YKHMWc/5IFjzSlrurEhNUiIH7j74uA== 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=exwdYGWSzMxOyWslObHD2NVkq0FISy9qbvMHt/mmK8g=; b=ESAUBJwhPdy2lumaYHMoRsIiE+YYYmLHFkIPivAc7ew6xk4WEoPYE3naDbMKAAHUy34VZ+OVpLNE487Nns+nKVWyN314UKLEvsmnZhoxSXqJzbn2QUfqdELQrm1A/YvwPMTCTzpKDZuxjXHl2kMNAyKwe0xP1SMGAOkaIEhgzrN5Ig4grzunYs+CgTYlXVdmm0c6HlwudQw9bVxKMm9/I6QFpxnW1kzAg03h5Fb0JC0RRkAQXLtqSvi1jsgmO+ckLX1MIZI9rzszCekj5kZpyqpa6pHjDpjd4sk6vf1fpwytI82kyaUPvY5aGnSruGmXi5OnDivQHjWG22G/RZkjLg== 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 DM6PR11MB3530.namprd11.prod.outlook.com (2603:10b6:5:72::19) by DM4PR11MB5519.namprd11.prod.outlook.com (2603:10b6:5:39e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.18; Wed, 14 Sep 2022 03:04:25 +0000 Received: from DM6PR11MB3530.namprd11.prod.outlook.com ([fe80::5c54:f535:6ab0:20ed]) by DM6PR11MB3530.namprd11.prod.outlook.com ([fe80::5c54:f535:6ab0:20ed%7]) with mapi id 15.20.5612.022; Wed, 14 Sep 2022 03:04:24 +0000 From: "Huang, Wei" To: "Xia, Chenbo" , "Pei, Andy" , "dev@dpdk.org" CC: "Xu, Rosen" , "Cao, Gang" , "maxime.coquelin@redhat.com" , Huang Wei Subject: RE: [PATCH v2 6/8] vdpa/ifc: support dynamic enable/disable queue Thread-Topic: [PATCH v2 6/8] vdpa/ifc: support dynamic enable/disable queue Thread-Index: AQHYw0db2q1Z4n8YaUSIRl+9PXTAEa3eO1CAgAAJqQA= Date: Wed, 14 Sep 2022 03:04:24 +0000 Message-ID: References: <1661229305-240952-2-git-send-email-andy.pei@intel.com> <1662616458-164613-1-git-send-email-andy.pei@intel.com> <1662616458-164613-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-reaction: no-action dlp-version: 11.6.500.17 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: DM6PR11MB3530:EE_|DM4PR11MB5519:EE_ x-ms-office365-filtering-correlation-id: f3f8fcf8-d1a3-45d4-c0a4-08da95fdd465 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /KYpPcHHzfHQUTelBf1BH63uIai2ZBUL0UcMjsHkaJ7O8Gah//LGNAtB7hP5pLO5s7iZgflOaGiFp4K0tBDKL7t5KtjiIxzrj14Ze20Deio+CQa6O86W5fN7em3hyuX+XprifA2Cp2Zn+aoMNZwjLYV1Q0q1BQ2KiakyNykBe8LXXmYnolKQOUzVuHe/yZbSWv+lo74yUa1C5y0N0VKE5XsZjGmKv7/5oyyeJJcbq7SvY2f0yRqFNpC8TOpvhX1BvnMIwNm5b4dbXvdFxQuzW+aYUQppSUJ+ZnoLrgDUBijPbcfATJ+EcEnwrJvsAH9U5KimqSoPaBGcQifE5d+QCKFWtcMdXlZFqN+ElK3ZzznAcnqDUxz3F21TszU73kuFiGDAApi7txg2zMdPgUumK7ZyqRsWENTbOKRSSg8wGwvtwgB6QyHRCOsSRl+2eN8o53q3EXnWJa+RZe9UZG+/J6S7a/Kzc9IyYlx3voB4POw5RbPv7m/i8xDrZwVsYQKJmJg2lzrftFYBwaSrmfVDIGvPpwayfIZHv0SQ9VI4jwl+K+eK/AkPtBDQgwzy2Vu1R7p1dXV7bC+870N3SAyvoO4DXkbxvd3AdMwbzVJ/qON8UusoSx9Eajk2cL7+as/w8ZFIpdU5rECRnGQjrfjb9ZaXowCEngwk97ZQrOGNUmvrR4K1oysX1ZcSwe75GIJ/EGgPKUbx7t9j8u98Ld0FmiJ8V9Txyg+w+1BDBno39Uha5eBd8htONulkvluMtRqA2aZ5GllFFzLZfgL3KyB4UC+oJ3nGO6X2SgpLvvMzKeY= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3530.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(376002)(396003)(136003)(39860400002)(346002)(451199015)(66476007)(6506007)(33656002)(38070700005)(8676002)(2906002)(55016003)(53546011)(86362001)(76116006)(186003)(54906003)(8936002)(83380400001)(110136005)(122000001)(7696005)(5660300002)(38100700002)(82960400001)(64756008)(66556008)(66446008)(316002)(66946007)(107886003)(41300700001)(26005)(71200400001)(9686003)(478600001)(52536014)(4326008)(309714004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/86yJAymhvr5leSzbNSWf5Kiz6Sj4Wfo418RwzPWT57ENw4ctBQGz9ZRd9/k?= =?us-ascii?Q?TK+XVvO+ASK3tXXbWSevkHMlwttJtn+X52cVO3DR0HGuvsnbk9IAdu3Huhgg?= =?us-ascii?Q?jYmkGFOVhJtQ3K0qJxhNvH53rfd9t4B7PQ1ly3OslqkLAZKyMuRlbQLQ6lM+?= =?us-ascii?Q?gWeS3UvNMPaaYXkYf4jkSvqO4lVQHRuRFCj9WLHk2RFATsJiBREYcNfwAFTc?= =?us-ascii?Q?6orgdqENtd6HVY11JLrIZ8qXo9A8T/pLZb8fdzeQUPV/CQ/EbrbOtzMmwPvN?= =?us-ascii?Q?/JtnmPGG8Umxq+Jdq2d8R14bqWtclsJstzLLOt0qN4XWzgHLifnoI9t3QnOY?= =?us-ascii?Q?c6vOrxp6CyMXeByFnpDauafeb5fik1nhbrcvS+Y3ojbgIze6C9vPkAK8HgTO?= =?us-ascii?Q?SaRJqklLOfNHe2bEFS0Wtc0hN9cLyQ9W62NV68ySl+M5lUg2xLhgSG8rIyxP?= =?us-ascii?Q?62o2PX5YUO5oqlfPa+3DuLib1w0ho70u9Rjoulr+tMhemf5Mh1ry2/6xTJIn?= =?us-ascii?Q?p8mXZKWIePcMa+hZEFOlwTtptcTCQbrW+JgGJGICbzFjko6jExTiw6UeggjB?= =?us-ascii?Q?dQh4NCNKZ+OAtFa1gSiw9861sA6gHeBo/sAGA8R4GQJTszn7jJXvy1N0EizY?= =?us-ascii?Q?rDZ5xybuHvrui4QI8uTuGhJ3gHVBvzXHw6Q+t0NbIMdO6MKco8obvpXimQI9?= =?us-ascii?Q?4xPCbuS6yU4iMXIYvFkHdRn1oLhkpss59SpS5O2ePGLJ/k3TQTkgezPfQW0D?= =?us-ascii?Q?ODGvfR1jV+TeeaWISytfqsvdvNeRIVuYAr6/O+Re+6IzZ0siNsL6e/3T1jW1?= =?us-ascii?Q?xEGaVgtB6U7+Cb3YksFxd5V0YhnImvns50jb+bafzk5tIeZil0kD4l/wA4bP?= =?us-ascii?Q?nT1SHWjB8+xCAd0jbDRZaUNY93tZxYGTP7Ib5kBMIK46zNdomGTWKVJo/xEH?= =?us-ascii?Q?zx1FhzS+Kj5qxn6ZjkXl2LlS+StrzuuPZA2wm1NJM0RicVK7xRu/chI/phlT?= =?us-ascii?Q?GAkT7pkGWYosn/gNUGgvQ3yNsCGou6q5voI5GxCFnSgUZ1SFMmZx/4iNwW3v?= =?us-ascii?Q?6MQcP3GgREvGVTTdo/kRMgUJmoNQGQG2TWCp0ggQd2Sml+fuVjOLCLmsIPQH?= =?us-ascii?Q?LMob+v8uZ+UEoQV4GehABy87D0iCHb18DDBrtApuqKW5HQfIF+EqRFnpSOQC?= =?us-ascii?Q?yBCeCiC88e89f5IWyAHesR/koHEKeeguMLnc52s/SXdRO5+UPWVCOoMIE+zt?= =?us-ascii?Q?Nrj13wPf0yJJ00O/YSJpAJhzIgjCpoBQYrTy/svoXgbQlDEW+Z/UKhDahG/K?= =?us-ascii?Q?UUb0kslDBNbgS8cWoO4K2kRg4+3q5UjAIJO+R2yUFFhuxt2wuiCZtzfjyZB5?= =?us-ascii?Q?biFnkc1eSPUDcVU0PuOMr23N/pwJH0MWlJPRRmxuIjBfZX6BQJkw6qdokPEO?= =?us-ascii?Q?wjSlTrmm5rmpm+BVtkrhyYAOgG4P+hjoXXdkB5H6ncMjhU0aHHGp+n4WBqj3?= =?us-ascii?Q?ejY2IboY+MtnRynEwASVPbwfy7kIWNdJCIcuZ9e8+SD77QCN+CTtZFpIJ6Aa?= =?us-ascii?Q?EjFpA0YzyjvKJYbLIL+rcDY5dtmihJp9NRY22eaN?= 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: DM6PR11MB3530.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3f8fcf8-d1a3-45d4-c0a4-08da95fdd465 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2022 03:04:24.8736 (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: osq/GUaZAnfgYsgTfegxvgXkwxg0cdF0TnV8HxJq6YDiOA5BfhDTu5Yps2Y0klhDx+oExbw/tEHYdlp9FIanFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5519 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 > -----Original Message----- > From: Xia, Chenbo > Sent: Wednesday, September 14, 2022 10:23 > To: Pei, Andy ; dev@dpdk.org > Cc: Xu, Rosen ; Huang, Wei ; Cao= , > Gang ; maxime.coquelin@redhat.com; Huang Wei > > Subject: RE: [PATCH v2 6/8] vdpa/ifc: support dynamic enable/disable queu= e >=20 > > -----Original Message----- > > From: Pei, Andy > > Sent: Thursday, September 8, 2022 1:54 PM > > To: dev@dpdk.org > > Cc: Xia, Chenbo ; Xu, Rosen > > ; Huang, Wei ; Cao, Gang > > ; maxime.coquelin@redhat.com; Huang Wei > > > > Subject: [PATCH v2 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. > > 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 | 101 > > ++++++++++++++++++++++++++++++++++++ > > drivers/vdpa/ifc/base/ifcvf.h | 6 +++ > > drivers/vdpa/ifc/base/ifcvf_osdep.h | 1 + > > drivers/vdpa/ifc/ifcvf_vdpa.c | 93 +++++++++++++++++++++++++++-= --- > > -- > > 4 files changed, 186 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/vdpa/ifc/base/ifcvf.c > > b/drivers/vdpa/ifc/base/ifcvf.c index 4875ea1..34f32f8 100644 > > --- a/drivers/vdpa/ifc/base/ifcvf.c > > +++ b/drivers/vdpa/ifc/base/ifcvf.c > > @@ -230,6 +230,107 @@ > > } > > } > > > > +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 (!hw || (i >=3D (int)hw->nr_vring)) > > + return -1; >=20 > Seems HW will always be not NULL As a external function, we should not assume the input argument is always v= alid. >=20 > > + > > + cfg =3D hw->common_cfg; > > + if (!cfg) { > > + ERROUT("common_cfg in HW is NULL.\n"); >=20 > I am thinking why you introduce this new log? Why not just use DRV_LOG th= at is > already defined? Because below type of log macros are already defined and used in original c= ode, I just follow its tradition. #define WARNINGOUT(S, args...) RTE_LOG(WARNING, PMD, S, ##args) #define DEBUGOUT(S, args...) RTE_LOG(DEBUG, PMD, S, ##args) #define ERROUT(S, args...) RTE_LOG(ERR, PMD, S, ##args)=20 >=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) { > > + ERROUT("queue %u, msix vec alloc failed\n", i); > > + 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); > > + } >=20 > So the register layout is different for blk and net? That's sure. >=20 > > + > > + 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 (!hw || (i >=3D (int)hw->nr_vring)) > > + return; > > + > > + cfg =3D hw->common_cfg; > > + if (!cfg) { > > + ERROUT("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); > > + else > > + ring_state =3D *(u32 *)(lm_cfg + > > + IFCVF_LM_RING_STATE_OFFSET + > > + (i / 2) * IFCVF_LM_CFG_SIZE + > > + (i % 2) * 4); > > + > > + if (hw->device_type =3D=3D IFCVF_BLK) > > + hw->vring[i].last_avail_idx =3D > > + (u16)(ring_state & IFCVF_16_BIT_MASK); > > + else > > + hw->vring[i].last_avail_idx =3D (u16)(ring_state >> 16); >=20 > Above two if-else should be combined. It's a good suggestion. >=20 > Thanks, > Chenbo >=20 > > + 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 c17bf2a..e67d4e8 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/base/ifcvf_osdep.h > > b/drivers/vdpa/ifc/base/ifcvf_osdep.h > > index 3d56769..4a1bfec 100644 > > --- a/drivers/vdpa/ifc/base/ifcvf_osdep.h > > +++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h > > @@ -16,6 +16,7 @@ > > > > #define WARNINGOUT(S, args...) RTE_LOG(WARNING, PMD, S, ##args) > > #define DEBUGOUT(S, args...) RTE_LOG(DEBUG, PMD, S, ##args) > > +#define ERROUT(S, args...) RTE_LOG(ERR, PMD, S, ##args) > > #define STATIC static > > > > #define msec_delay(x) rte_delay_us_sleep(1000 * (x)) > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c > > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 48f1a89..16fd0fd 100644 > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > > @@ -1288,13 +1288,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); @@ -1304,6 +1350,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); @@ - > 1311,27 > > +1360,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