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 A9EF9A00BE; Mon, 25 Apr 2022 14:58:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53B8941109; Mon, 25 Apr 2022 14:58:13 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 3D6CC40E78 for ; Mon, 25 Apr 2022 14:58:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650891491; x=1682427491; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=n13oKRwTepjlxu7IweZpsPNgOuklUmmDxDn6aW3P2EU=; b=QyymxdjNVbhdL21dF6BVp8cGbgGyddV1Qc/s7nngrAvrP4kIYM26iwlp qF4LStahG/dE7C+Cyowt3uj6imFw2fnTEfCFgwik8zzT613Wr/VsYEPXj v7iP2DClW67RgofK9/wBTuyTjHX8DiwLyeSukQ/iAPgJPPFwMjI9ckq1+ hdaOU6oV5mxArInzT2v9fjNJyvO3suejqL/GwzGOfdLjOSQ8sI2W1WA8t 3ocHQ07suWcO1lv6SPGtsk7fUYfI+zh5SPCOsCtpxdnGmK/6yESZyFg/Y ptp/uK9CQuMUnMyiN+XF3NH0JrGsc9ze7exN0+QyN/zmR0YYoCb0og83L g==; X-IronPort-AV: E=McAfee;i="6400,9594,10327"; a="245163737" X-IronPort-AV: E=Sophos;i="5.90,288,1643702400"; d="scan'208";a="245163737" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2022 05:58:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,288,1643702400"; d="scan'208";a="807038614" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga006.fm.intel.com with ESMTP; 25 Apr 2022 05:58:10 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 25 Apr 2022 05:58:09 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 25 Apr 2022 05:58:09 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.43) 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.2308.27; Mon, 25 Apr 2022 05:58:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PAFVBWQA0xPsQOVo1+Bt8IGjghEujJea00QpNGCuCE5a3r1b9Wf19T8UXGDZdg+9ClsIiYT0MhPCP7+Oo3YATrgD+nNDZq3DcfsePFgvY7oD4AkpL/HsfYRVHS6GVpU6Lf8zzNMU3Qmom9eteJtQaCP63ZvFiM/umXzJadgqRPgzZbabZ+MgVHcI0WVKV9dRAcG1B+cStRJoJmPOlEQUPyxyFv1GakfXIkNXpE1eLIIIAOAHradJjFeBs0l3h0wYCN037+zCXshxYKVvrpIKKVTFMCdT0IBSI9bXiH4IRBB3RvH+h15yAmFz7HO5y4V+YXfaS1N0Z6J1BAQl8ZrNGg== 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=w4L+Qerz4EGPXtvNue3PtThyuYVUMIZ66J4E9AcDO5c=; b=CpbO4Z/UyfdnvBdUTw512alyIkhCIrLHGEreqUFIYYAycPe2uWoRd2qK0ZqQhadzMCybXI136RApTcFNIlZVi7xwOQVB7o2wiPveYHMN6z2xuEJ5u3GfFKoUopYrSgOwUFnMPM+HeVaXwcGDzTVRj2syeXpNev/vKskrQWzYT5shWkSUo+R/4RSwtStmZ1wdb7RwxwwomI8G+hloXtSWR7K5noosorzDszMwsGTVCaqdCMclq8vs1Lwczrr5xAb0IthpcVyTWIOTMr5mlwM6Ch7dBvxRfcfAfAUMErwJ1VbX6eOcFBCt2yNwro7RnZUkCO0oyYatdubMcKf1G79zdQ== 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 SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) by MWHPR11MB1247.namprd11.prod.outlook.com (2603:10b6:300:2a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Mon, 25 Apr 2022 12:58:08 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::4d1d:6453:f00c:cf8a]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::4d1d:6453:f00c:cf8a%6]) with mapi id 15.20.5186.020; Mon, 25 Apr 2022 12:58:07 +0000 From: "Xia, Chenbo" To: "Pei, Andy" , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "Cao, Gang" , "Liu, Changpeng" Subject: RE: [PATCH v6 05/16] vdpa/ifc: add vDPA interrupt for blk device Thread-Topic: [PATCH v6 05/16] vdpa/ifc: add vDPA interrupt for blk device Thread-Index: AQHYVWD45fSFrFWmnkuemacxYKjQO60AnCYQ Date: Mon, 25 Apr 2022 12:58:07 +0000 Message-ID: References: <1643093258-47258-2-git-send-email-andy.pei@intel.com> <1650530034-59744-1-git-send-email-andy.pei@intel.com> <1650530034-59744-6-git-send-email-andy.pei@intel.com> In-Reply-To: <1650530034-59744-6-git-send-email-andy.pei@intel.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: aee4d0e1-6d89-4fb2-c23e-08da26bb3eaa x-ms-traffictypediagnostic: MWHPR11MB1247:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5cGQxEj8QrIvHR/5X1Q8KfraYDgv8OutGeUSWXakQ81I6U1hnWIQ/dD8H7FWK5w3YJZMuoobxn4xm1fr2Goax7Fe+OxrProD/BN9BjcVIf/PnmRFmyEMIxjO/CNOPHPC1bzPCD9T76eebHfCx1s/ABki9z7NoIw/T5mjCo4NLDhGEqxP7bpOKngljt+8o2/KFuwJFBLdzChpTTY5lDeCAvZ/LVhLnwVd0k95j1akiCfYi0zuzXYvslS7wKeGVy/d3ogtWjeanOsUJ+jvaeLlCdyTvlaVUvGB6H1lTqGu2J59KICofoda9fkatcxx5LKigPDzwq2uRJiAMOvMEEw2589XWOga5yDmzi/IO3Sf8U0FTZg5iTJdsDPZRM7Uzg8rLJmDtJDzC+/tfRmnjiiIv6i2q2NXRWsPVRLJ9tOO02kmedR69/YV0KoQ3c+DnHkmLCXUtVaS9vRyazzqqrRJPBWQaO6Ob1Yqy64tYpWCcppTsNke7D4rI8zE0KWRe3Cj06nuYhpUPBN2jKU5DbRZiizGlCEgXc4Ug/dGvjR3TEg/uRSeHkCf29i9c/FMD34T2Fz3FocAKTNoldLO2jdgQ57DfjMGEAMuqq+k5KiUUJzCeP64Flm7W2V86+Syg79CLaqP0hjquA81YKjMNWf9FEmjylmo2sJT0hgw6ljp1izWGHiOAvul/m6XtceTUW/9izU5Ej0kPEtF38X1df9X7A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3504.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(110136005)(71200400001)(107886003)(6506007)(54906003)(66476007)(9686003)(7696005)(2906002)(33656002)(38100700002)(122000001)(38070700005)(55016003)(8676002)(53546011)(76116006)(316002)(4326008)(66556008)(64756008)(86362001)(66946007)(82960400001)(83380400001)(26005)(186003)(508600001)(5660300002)(8936002)(66446008)(52536014); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?j9NgyG3icTR7jGKDXqO48xxutkArAiicSZBRCpJyb7WNrO1eCuYL32IrZi6V?= =?us-ascii?Q?ax/WEH7pFpl4l54CZaajXZFClB4R3mA2Yd/FD5Ctyd3XuHBee9zgGxNLenQj?= =?us-ascii?Q?Wety6QLnkZYkiW1o7OWiedcVaSuBr43oozxuh69S29G3D0KflL8848k/w3LJ?= =?us-ascii?Q?BXCsg23dlBfkxNZxA6fnGUZPk8Nj0nHCTOTBCY6Q+kvedIYhdCY1i65oniRP?= =?us-ascii?Q?lmvElOEvkUjmIYATH6c7PgvOG9sOvwMG4TL8tIaIf4MHU8wmWR1fxAaUBAM4?= =?us-ascii?Q?bxKnA4lZ5+ef6a2/l3Zvu+eHT68eRvaZq6AEF7UXtBChObNzUkDA5nEsBf2O?= =?us-ascii?Q?eBGKcFXD3ncOHjQ7Vd1uC1aCxmQu7S/MvRdsaUeIEjfQ/Ot2Mld4gEOoRkJ5?= =?us-ascii?Q?nBxTsqlZNk7Ty3r2ePUw60c0iRHBWZmKs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4cUtRUdZYO8sZhwGzyNLCyMYl95suz904y79xDH5QBjZq6RSsksxh?= =?us-ascii?Q?m1P+oFU4W5vG3uX/HTy5haCcEUCUiJUpnFLM5Xn0wQp3FJBC0wgiqUOzCyLC?= =?us-ascii?Q?uBFqko5kX8Uol8TfmaikMpvUT6vYznmEfJRXLXOWgRQ/B7eciQhJSXPv90pa?= =?us-ascii?Q?4El+YF0mwS4l7CcWcTBV3jl8xtNQ1KNzwD+s/5tIyJFJy0sDP2s2BM9Oug+Y?= =?us-ascii?Q?/5AG49s9L3P6Vn1koRsA8fUPLbsUtMBqXI6rAJtC9Fqk1WNBaL3ugM6Tvour?= =?us-ascii?Q?fNkNmqdqbN21kQW1LlSBEWLO0QFyvSTv/97ktyqPCkZKVPNeJViy0VglJHVi?= =?us-ascii?Q?utnRtectGdJ6hms3YKblQfheHBE5mx2Eyva6JjcrXNqCquaS2/UbXX56wkyt?= =?us-ascii?Q?HyO0tBnnAQ=3D=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: SN6PR11MB3504.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aee4d0e1-6d89-4fb2-c23e-08da26bb3eaa X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2022 12:58:07.8152 (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: UMhXRcgCvvyxpUA52ZBuWW2mSyrmqcnfUO0r8ifd6dgA4EjkOe05z3DHWTnz1UGDSEDshAqvwea02k0FK8tXNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1247 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 Andy, > -----Original Message----- > From: Pei, Andy > Sent: Thursday, April 21, 2022 4:34 PM > To: dev@dpdk.org > Cc: Xia, Chenbo ; maxime.coquelin@redhat.com; Cao, > Gang ; Liu, Changpeng > Subject: [PATCH v6 05/16] vdpa/ifc: add vDPA interrupt for blk device >=20 > For the block device type, we have to relay > the commands on all queues. It's a bit short... although I can understand, please add some background on current implementation for others to easily understand. >=20 > Signed-off-by: Andy Pei > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 46 ++++++++++++++++++++++++++++++++-----= - > ----- > 1 file changed, 35 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.= c > index 8ee041f..8d104b7 100644 > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > @@ -370,24 +370,48 @@ struct rte_vdpa_dev_info { > irq_set->index =3D VFIO_PCI_MSIX_IRQ_INDEX; > irq_set->start =3D 0; > fd_ptr =3D (int *)&irq_set->data; > + /* The first interrupt is for the configure space change > notification */ > fd_ptr[RTE_INTR_VEC_ZERO_OFFSET] =3D > rte_intr_fd_get(internal->pdev->intr_handle); >=20 > for (i =3D 0; i < nr_vring; i++) > internal->intr_fd[i] =3D -1; >=20 > - for (i =3D 0; i < nr_vring; i++) { > - rte_vhost_get_vhost_vring(internal->vid, i, &vring); > - fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D vring.callfd; > - if ((i & 1) =3D=3D 0 && m_rx =3D=3D true) { > - fd =3D eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); > - if (fd < 0) { > - DRV_LOG(ERR, "can't setup eventfd: %s", > - strerror(errno)); > - return -1; > + if (internal->device_type =3D=3D IFCVF_NET) { > + for (i =3D 0; i < nr_vring; i++) { > + rte_vhost_get_vhost_vring(internal->vid, i, &vring); > + fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D vring.callfd; > + if ((i & 1) =3D=3D 0 && m_rx =3D=3D true) { > + /* For the net we only need to relay rx queue, > + * which will change the mem of VM. > + */ > + fd =3D eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); > + if (fd < 0) { > + DRV_LOG(ERR, "can't setup eventfd: %s", > + strerror(errno)); > + return -1; > + } > + internal->intr_fd[i] =3D fd; > + fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D fd; > + } > + } > + } else if (internal->device_type =3D=3D IFCVF_BLK) { > + for (i =3D 0; i < nr_vring; i++) { > + rte_vhost_get_vhost_vring(internal->vid, i, &vring); > + fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D vring.callfd; > + if (m_rx =3D=3D true) { > + /* For the blk we need to relay all the read cmd > + * of each queue > + */ > + fd =3D eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); > + if (fd < 0) { > + DRV_LOG(ERR, "can't setup eventfd: %s", > + strerror(errno)); > + return -1; > + } > + internal->intr_fd[i] =3D fd; > + fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D fd; Many duplicated code here for blk and net. What if we use this condition to= know creating eventfd or not: if (m_rx =3D=3D true && (is_blk_dev || (i & 1) =3D=3D 0)) { /* create eventfd and save now */ } Thanks, Chenbo > } > - internal->intr_fd[i] =3D fd; > - fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D fd; > } > } >=20 > -- > 1.8.3.1