From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <dev-bounces@dpdk.org> Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91CC1A052B; Tue, 28 Jul 2020 10:24:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6B0BF1C0B3; Tue, 28 Jul 2020 10:24:26 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id A003B1C0AC for <dev@dpdk.org>; Tue, 28 Jul 2020 10:24:24 +0200 (CEST) IronPort-SDR: hP6A1UfozBwTDKtNsfB5Wei+j9Cg4PyobZMzTSBBzEozHQgig1woFAJDBZ8QWmP1xJtuKiQsxy iOuVE7tAk0HQ== X-IronPort-AV: E=McAfee;i="6000,8403,9695"; a="212694152" X-IronPort-AV: E=Sophos;i="5.75,405,1589266800"; d="scan'208";a="212694152" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2020 01:24:23 -0700 IronPort-SDR: djTtkwvH8NdnaqWBfAAcDq9Q15pniR72si7aczRaMLs4BGlTg0Oey9408CGN6dJVhrKwK/PeII e9s/USD1jC+w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,405,1589266800"; d="scan'208";a="320306370" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP; 28 Jul 2020 01:24:23 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 28 Jul 2020 01:24:22 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 28 Jul 2020 01:24:22 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.56) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Jul 2020 01:24:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SlHvbbwn9J6OUt8FgoA1oqWOnaZyeHApmj8IWMGDjZrw5R4g9nXhEjtm3MSBV53P+VvBu32zhq43PUE/V4bcVB+njOm5erEXMeST/J41UroRonq1CrpXPMmzTo1OAE5TFBPymTzyCDkiOXV6G0w6amxq5p4Xo7AYZNWMdHx7z9PeLB9+9lg5bU0NBgI6bIhHdtJcP1bmU7HVTlmDA2aBYbSnARPUu5wTS1tzq02TH+722LwAjd5jE7HH5cGO9ao0HlcBwFl2Sbdv8S6QQ4MlXYol2F3Vds611Gd+zTqG/fjkiqaNgj93urSvt9XW37jOlvMFy89ilu3kwkNEvrgdMg== 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-SenderADCheck; bh=Ik+fOc1NTZUeACPrboByNtB4oXcMsi2u85p9oiG60nY=; b=n3dyHglb2W/At79uj1gnvcrwsNf+nT0oIsmOJqnp+cUTxDWqs6rLWUVPTCV817BVsCywOIBoj6c8uwomX9WO35GTQy6PTMYbRYcCDx8WPOlGuH5NH19SNxJZOxosVDzZgo+QRU9qI23waz9oxvLuV+A5snBdG6QxtWHFTmNsMdxD5xO5y7LVOlunfgEv6uXgHMm16woK0tlRlWWIcKzREUfulvosZkQcfXWogU7oWrkfxH/xLapft1f/JO9eSG34EvClSB77OURNw/sST8niQZP2sUu1uNgjcXaj8gZ/WzrGFpCCpLgKeDG6jZgESyYeZYENa4M+KUO1LXMhn4BFHQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ik+fOc1NTZUeACPrboByNtB4oXcMsi2u85p9oiG60nY=; b=lEYPDPaDQEWOg+hVpLVg3PP0C0bhZ1hpZMoIZ6HICR96TB6Y5EtZY+TAMmkLHvXrJIoI3WYSGWiCicV/S8lAzzFeEa/uQl6/Df5dKlQ+/aEef8T2CyJUuBLBE3IL6ra5x8335juPkGqjRV6mU0R3GPsKZICyZiABPTJP1R39PtY= Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by BN7PR11MB2532.namprd11.prod.outlook.com (2603:10b6:406:b0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Tue, 28 Jul 2020 08:24:16 +0000 Received: from BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::dd0f:7f49:bc5f:2fde]) by BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::dd0f:7f49:bc5f:2fde%5]) with mapi id 15.20.3216.033; Tue, 28 Jul 2020 08:24:16 +0000 From: "Wang, Xiao W" <xiao.w.wang@intel.com> To: "Xia, Chenbo" <chenbo.xia@intel.com>, "dev@dpdk.org" <dev@dpdk.org> CC: "maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>, "Yigit, Ferruh" <ferruh.yigit@intel.com>, "Xu, Rosen" <rosen.xu@intel.com> Thread-Topic: [PATCH v2] vdpa/ifc: fix vring update after device config Thread-Index: AQHWZKHzZEhRePEt6kGUUckacZUkR6kcp2mw Date: Tue, 28 Jul 2020 08:24:16 +0000 Message-ID: <BN8PR11MB37958C24B360F8E472AF044FB8730@BN8PR11MB3795.namprd11.prod.outlook.com> References: <20200724170906.13843-1-chenbo.xia@intel.com> <20200728143224.99949-1-chenbo.xia@intel.com> In-Reply-To: <20200728143224.99949-1-chenbo.xia@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.45] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a8e59a1f-d34e-4e1b-4f67-08d832cf9e23 x-ms-traffictypediagnostic: BN7PR11MB2532: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: <BN7PR11MB2532D51966A0FF38251005F9B8730@BN7PR11MB2532.namprd11.prod.outlook.com> x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Jy2P0ihTDlFULktzGv27KOAztM7dQR3q36HsEuhcomN4+JhpOllCWbkA2TZm4eArJnGhUKEc/nMTjMIYhK2Rjw3LvVOpmqILzivvQS9sZCKmY8sgTyDXjKGGsHlJEsZdbETV15Gwawo0f+NdmzNJVablRt1QAtEJeaFFS4zaYq1jgu+A+QSCAEkxOiCwwWKTwHSA3AHGCzr+H1/f94Sp/UW5g4Y/NrRZc6sDK05AOyaLNxCHUxzkZaQ04d7AkOn3WpSum8j/1ktwCFcXgjiNr9og3tDw2F9TR0dYi7HmScB6ekrPweXsiZY38Ls4C6OooPi2zpp9ASzG23A9gDoZpgYoVxxdsRMT8SQv6Z1J0bVD3gYIkfKQLLgHn5Dj7mQ7 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(346002)(376002)(366004)(136003)(396003)(2906002)(316002)(8936002)(478600001)(55016002)(66556008)(66446008)(9686003)(26005)(7696005)(107886003)(64756008)(76116006)(186003)(8676002)(66476007)(4326008)(6506007)(54906003)(33656002)(15650500001)(53546011)(66946007)(5660300002)(86362001)(83380400001)(52536014)(71200400001)(110136005)(309714004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: lqjbtNe4ciKXAfygqpIDL5Z2J9UfxDkzfvtviUOwu9QC/QKpwv0kPRuD3a1AzqXmTCx77suJNCroDKv7gkSWWKt7rIvfNji2ECHvU0+Up81tFqJXVuwN4+wTR08iMQ9bqjUypziLdUvNUAyeiUkZ0s80OsWKdRmv1/kVzkV2GQWQoYBQsCXzGieUdD9cRdneURAfpPHyjaP2pQs+dIi93wRH5HMgLryel2dbVFjdmUrX2Y+4Lylu48n8cvLVnOkfy6zgS8RQ5KaLQGCxLdE2dEqYelP8q7ERAkzKXhtGyXPmoMSJNWRKVZ9MmUDy/61PIWVTzAp3Wduyb8m/C4oNZlbZ24vmdPfKavL8uOks3Nxg/gAlqKMNsKXidAVms0qAfVIFysETSf49X7+ONyrv0HppxYsWd1vkrkvFM7dn92h/oX8RKHRQxyM0LArR3wQL/0k6Ds5Yt6yYBMxtvAZPlUy8IsgIW11ZwMJDM0paKYn7KEJMfxcPduKwsy0O/U5d Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3795.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8e59a1f-d34e-4e1b-4f67-08d832cf9e23 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jul 2020 08:24:16.4279 (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: muUy636EK73TPXRsO+ZG3lliVY7OQi37Rb0pyBG+Ljimjv3ev4BSVj91v6iWY2gfyJU73+Hjwvoq5T7EB6QVzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2532 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] vdpa/ifc: fix vring update after device config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> Hi, > -----Original Message----- > From: Xia, Chenbo <chenbo.xia@intel.com> > Sent: Tuesday, July 28, 2020 10:32 PM > To: dev@dpdk.org > Cc: maxime.coquelin@redhat.com; Yigit, Ferruh <ferruh.yigit@intel.com>; > Wang, Xiao W <xiao.w.wang@intel.com>; Xu, Rosen <rosen.xu@intel.com> > Subject: [PATCH v2] vdpa/ifc: fix vring update after device config >=20 > The device ready state in vhost lib is now defined as the state > that first queue pair is ready. And kick/callfd may be updated > by QEMU when ifc device is configured. >=20 > Although now ifc driver only supports one queue pair, it still > has to update callfd when working with QEMU. This patch fixes > this vring update problem by implementing the set_vring_state > callback. >=20 > Fixes: a3f8150eac6d (net/ifcvf: add ifcvf vDPA driver) >=20 > Suggested-by: Maxime Coquelin <maxime.coquelin@redhat.com> > Signed-off-by: Chenbo Xia <chenbo.xia@intel.com> > Acked-by: Wang Xiao W <xiao.w.wang@intel.com> > --- > drivers/vdpa/ifc/base/ifcvf.h | 1 + > drivers/vdpa/ifc/ifcvf_vdpa.c | 54 ++++++++++++++++++++++++++++++++++- > 2 files changed, 54 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/vdpa/ifc/base/ifcvf.h b/drivers/vdpa/ifc/base/ifcvf.= h > index eb04a9406..a288ce57d 100644 > --- a/drivers/vdpa/ifc/base/ifcvf.h > +++ b/drivers/vdpa/ifc/base/ifcvf.h > @@ -115,6 +115,7 @@ struct vring_info { > u16 size; > u16 last_avail_idx; > u16 last_used_idx; > + bool enable; > }; >=20 > struct ifcvf_hw { > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.= c > index a757d45ec..6a1b44bc7 100644 > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > @@ -49,6 +49,7 @@ static const char * const ifcvf_valid_arguments[] =3D { > struct ifcvf_internal { > struct rte_pci_device *pdev; > struct ifcvf_hw hw; > + int configured; > int vfio_container_fd; > int vfio_group_fd; > int vfio_dev_fd; > @@ -897,6 +898,7 @@ ifcvf_dev_config(int vid) > DRV_LOG(NOTICE, "vDPA (%s): software relay is used.", > vdev->device->name); >=20 > + internal->configured =3D 1; > return 0; > } >=20 > @@ -935,6 +937,7 @@ ifcvf_dev_close(int vid) > update_datapath(internal); > } >=20 > + internal->configured =3D 0; > return 0; > } >=20 > @@ -1084,13 +1087,61 @@ ifcvf_get_protocol_features(struct > rte_vdpa_device *vdev, uint64_t *features) > return 0; > } >=20 > +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; > + int ret =3D 0; > + > + vdev =3D rte_vhost_get_vdpa_device(vid); > + list =3D find_internal_resource_by_vdev(vdev); > + if (list =3D=3D NULL) { > + DRV_LOG(ERR, "Invalid vDPA device: %p", vdev); > + return -1; > + } > + > + internal =3D list->internal; > + if (vring < 0 || vring >=3D internal->max_queues * 2) { > + DRV_LOG(ERR, "Vring index %d not correct", vring); > + return -1; > + } > + > + hw =3D &internal->hw; > + if (!internal->configured) > + goto exit; > + > + cfg =3D hw->common_cfg; > + IFCVF_WRITE_REG16(vring, &cfg->queue_select); > + IFCVF_WRITE_REG16(!!state, &cfg->queue_enable); > + > + if (!state && hw->vring[vring].enable) { > + ret =3D vdpa_disable_vfio_intr(internal); > + if (ret) > + return ret; > + } > + > + if (state && !hw->vring[vring].enable) { > + ret =3D vdpa_enable_vfio_intr(internal, 0); > + if (ret) > + return ret; > + } > + > +exit: > + hw->vring[vring].enable =3D !!state; > + return 0; > +} > + > static struct rte_vdpa_dev_ops ifcvf_ops =3D { > .get_queue_num =3D ifcvf_get_queue_num, > .get_features =3D ifcvf_get_vdpa_features, > .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, > @@ -1170,6 +1221,7 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > __rte_unused, > goto error; > } >=20 > + internal->configured =3D 0; > internal->max_queues =3D IFCVF_MAX_QUEUES; > features =3D ifcvf_get_features(&internal->hw); > internal->features =3D (features & > -- > 2.17.1 Acked-by: Xiao Wang <xiao.w.wang@intel.com> BRs, Xiao