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 5B220A052B; Tue, 28 Jul 2020 11:05:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3CB241BFF5; Tue, 28 Jul 2020 11:05:50 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id A1F501BFF4 for ; Tue, 28 Jul 2020 11:05:48 +0200 (CEST) IronPort-SDR: Af6YIw+KUeYQPKq4+vVMQHKoFymrpksFSqfOAAJzQToMKZpA+cEXzgKzyBpvH5sEXXpQqRmnh+ r7F80vKo+Fow== X-IronPort-AV: E=McAfee;i="6000,8403,9695"; a="169287844" X-IronPort-AV: E=Sophos;i="5.75,405,1589266800"; d="scan'208";a="169287844" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2020 02:05:47 -0700 IronPort-SDR: hWGo8UcadXk+dYEsueEtQ4/tzcULuPngg1u8jiSF1WiOFBj1Yc0mSHsV/xO4buMhXW2XJJpUep SXe1irEzH9tA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,405,1589266800"; d="scan'208";a="328281521" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by FMSMGA003.fm.intel.com with ESMTP; 28 Jul 2020 02:05:47 -0700 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX605.amr.corp.intel.com (10.22.229.18) 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 02:05:46 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by orsmsx605.amr.corp.intel.com (10.22.229.18) 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 02:05:46 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.171) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Jul 2020 02:05:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YlUUlyEE63TnBOO6BvbgQjrzD1on0ULNqQKN5UpGARpg6PGYURbIjZpx94jglhHTKpA1qtgxWqKeo1BcDx+ssm3yxuDoFOLmYH7Qelk3v51/EPIDO+ggjlGQZB2VaP8VxVdj8x/0USmp//NGLal3iUZQ/A6ieHJuQVV3nBcsXVeHEW73r+g9dX4hvPlOiKneGp+ryR27ueDZK4ZdcRh3wprRGW7W8IyH44sFUZlI1wjoltXJfWob/XYUVdOJllp/cCrdmRRjA+q9iQVBuIERaVXxIxhutFU5RO9sAcmDV4maiQC9Abuu9pCp5Btpvb5Gy6nC5RndEN6BXyBGYv5vPA== 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=uyj6u91952NMVfBV78WxkAbST+5tdqaSZGqwybKpBLw=; b=ZpTRIQNWWKHSUDyeTvmNtQSxBCU2XDbvFJJwteEBEnb9vV4hm+PMVaXKhT73d6u/s6V9Eup2K0ksDta4ogHWVC8HK2u/GzxdEULoLtzR7ghLfEmm7be+73hVsEdJtuASORRhkRru0L74z9BuPYKcaLsJVEkOvvvPw0upsm/JZ28K/fbTjWCZBoIhy/p46V8WH3eVunWeCLaMenhYmymyE3WkB09lpjqsSh/j1RRpAbLuHGEJAnNaffzhRbFJjHypRJvSsV75V/YWX7h64Q1zsc+y6m1UFE5Jo4rKTZ8/88T+DtJebHksjSsZc4XuZ45ZzZrjTN4Kv5wkCr2l6zwZYQ== 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=uyj6u91952NMVfBV78WxkAbST+5tdqaSZGqwybKpBLw=; b=rszTh4gioj0C2BxN+c03EL7qChwNqLYGU0ZyUZHqB9joLGWB2iDvbj23E6tACsn20x09grRsljnr3Ym8LpeA4J8ol3nHI6VSiWCdHVD6NzRCNCVvQ+VpwYPCHh8XvCSaKwJYLDU695AoTbRyw5citpazNhWymGJVDhK9j1wsfnE= Received: from BYAPR11MB2901.namprd11.prod.outlook.com (2603:10b6:a03:91::23) by BYAPR11MB2808.namprd11.prod.outlook.com (2603:10b6:a02:c8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21; Tue, 28 Jul 2020 09:05:37 +0000 Received: from BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::6552:92f9:74a5:412]) by BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::6552:92f9:74a5:412%4]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 09:05:37 +0000 From: "Xu, Rosen" To: "Xia, Chenbo" , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "Yigit, Ferruh" , "Wang, Xiao W" Thread-Topic: [PATCH v2] vdpa/ifc: fix vring update after device config Thread-Index: AQHWZKHzcpiejpSFSkSg6vueXZl0GKkcsyxQ Date: Tue, 28 Jul 2020 09:05:37 +0000 Message-ID: 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: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmFhY2ViM2QtZTNhZC00NmEwLWI5NWQtOGQ2YzhiOWU0OWVjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiU1EyNTQzUjFBSjdrSzlKeCswdFBiNXdxWjQ1RldsOTd2N1FQQnpSdTdzSDFacmRWOWV1eEZpYk1sSGVHNlU2VSJ9 x-ctpclassification: CTP_NT 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.198.147.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 013b3a77-6217-4e85-d24b-08d832d564c7 x-ms-traffictypediagnostic: BYAPR11MB2808: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lbBoXj8iecJC9inau4FBPFhz/RW41dr39DUnBvn5ydkUI0l4YnexAC50SVJhgiGzxuupAZFEcRs9ryxOqJm30YKJU4Z2aBt4uZEyT7kyuje1n2LjbeVLYhaGqipxWgFA005JXZTFOQUYNvmWDIIu7GVhiBDWfKE0+58xXACblW6q86+/LHtMfEGeCKGF+RcHFZT4I92TZjG5BLCqYLt1awc+Off3dpOZ4x69K+C5KFEm5MvaHY5KWgW2rTGjZnIb6S094Fwt/3tiVLo0mwzXPyXUOZwf76Im+m8vKp1oYD/xdJr0EAAV2INfwKuwb3jY9rFoB2bQG6SBhgXwymVjtu6SzG6kquOKgIgOSiZcF0A47jPJsfBtMTDVbyIrqWgt x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB2901.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(396003)(376002)(136003)(346002)(55016002)(316002)(52536014)(478600001)(4326008)(107886003)(2906002)(8936002)(8676002)(76116006)(83380400001)(9686003)(54906003)(110136005)(66476007)(33656002)(66946007)(15650500001)(5660300002)(26005)(186003)(7696005)(64756008)(66446008)(6506007)(53546011)(71200400001)(86362001)(66556008)(309714004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: RhKZWWdlf1AlY4y8+tFjBq2fT/6udd8MiioOYssHhvcpTvjIwrHUlWpZaSoI96CEMpAmfCoRZntNkxSUsRdBrN0rekqzsyV6mR6vexR3VoS5bC1orMCJI8T/graHkrjvhnA70OmEE5d+jwy4eTWjbNb+LnZcRWoROXCf6UUR5O9Ie6vwOso+z3P9zSb9jpowfvWK9fVIqyxqjfMcSMq5YJnT4cuf1vZxLC+AY6Uwv8aDgwgkYOiEPQklMZGc+JXqGnSeWf7J8UwXHMkP37iaa3hN06hXlM4qL6fZdrhUrBQ7iNGHYE+sx11bkdmgIpmYhY/exx9EgbyMaRcqxLpMsx4ltGL3/THZt6PP+NaIdMkHOjwJIr6bO/Mu7LxLnHhNvX9OJHw4WG/NrKUns1tOcEeg+bxzyLnVbUdyunlr5yJO5riR8UMhRrFlOyuuNnEwPWf0R2qrCU9MSULNbb+O0fhpyxvrQZNemDmwN34hBIfmkvlCiivJq2Is5mmjATa/ 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: BYAPR11MB2901.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 013b3a77-6217-4e85-d24b-08d832d564c7 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jul 2020 09:05:37.1156 (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: ocS7S/g5D3+f6wHdt7RhlS7v1uMX+MMCarnK48gmklXtl0nvHO0q9dOV1ecHa1443sFkcgageqsUatKjHl09tQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2808 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, > -----Original Message----- > From: Xia, Chenbo > Sent: Tuesday, July 28, 2020 22:32 > To: dev@dpdk.org > Cc: maxime.coquelin@redhat.com; Yigit, Ferruh ; > Wang, Xiao W ; Xu, Rosen > 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 firs= t 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 upd= ate > 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 > Signed-off-by: Chenbo Xia > Acked-by: Wang Xiao W > --- > 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: Rosen Xu