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 B039EA034C for ; Tue, 8 Nov 2022 02:46:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D1E73410EA; Tue, 8 Nov 2022 02:46:46 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 358594003C; Tue, 8 Nov 2022 02:46:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667872003; x=1699408003; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=XNsbeXpIPL5Vk1HAu20/51aXnQMsxsmr3YuF4mhFO64=; b=Y+NJZm80YqPLRU/pI9trYDA/4nHwNSOuVkUjZYEcfKq802rmhQE2ZWke sgan/qFR+ZuIuPqFb8zgt+E3WXwT7/iB4PmgFtU+mURoqrxYUj4x9FjWh 2rnsp01/32SsTq6gwfwbrxi4sa/B77UU+5jIoXXg9OBhevOyDJyt0HJMX wZsIC5Qf57XEfeWTRKoph1zbuhHvk10zu62vqkeLRlmJSHqp/nwN7yGXz NuwRn5s5e5vyTGbrH49Uk5XbamCYWCnO8nZ7LaE6Y+frSBrzzhjPuv/wf Ykn0rgzM4him+ifJHxe1irioVxKt9IJCqG+v5lLhpTwVjWg8mtbw6aF3Q Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="290962342" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="290962342" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 17:46:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="881309725" X-IronPort-AV: E=Sophos;i="5.96,145,1665471600"; d="scan'208";a="881309725" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga006.fm.intel.com with ESMTP; 07 Nov 2022 17:46:41 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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; Mon, 7 Nov 2022 17:46:41 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 7 Nov 2022 17:46:41 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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 via Frontend Transport; Mon, 7 Nov 2022 17:46:41 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.176) 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; Mon, 7 Nov 2022 17:46:40 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=APYMwXx48LvqSnqZSj72QWjui9Mxkum4SYqyheFsG2mYUUSuWL3CmMM3SWLwrgN8daCnbn7nVUq2mMp4w6MNkX1+1KazDw58S9qer5Aqz/4XheaTFRiUTlLU8xDYDwT8dctgM48wm8x7GqC7ZA1sbS6r8reTcE8vdWqOWK9aztmeJaPQtCB8rL93tli44ALYvWTUDjs29Tpid7eVhGjsoZD+MBoLrPQA8XAIIN4h7Uuz/e+nnLEx6AoBFzNDSvBxHr7OyvOJ2/Ypz5gH4nEl6l7VQyBYzRM/O6UhQBLbSJqCOJ43kp/yw8wYcnl8i7CktX4Zyc1tTWNRUa5xXejNmQ== 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=dwfEtTnPtWbUT+f2JVcGWrJBQQT1bYglNVhFmpwviZ4=; b=GMYD0TZUWnKOzdEFUa1CWbrGe13vJwaDgmKg410qz8ybhtdJLHsUdqMVpVhesKb+OXe3AhmhZlnMfKkNK9rBlN9XDkKHHICFFWXPDDIePp7RAWE2GnYc91Z9nmmG1XHXQa0IkHET4F20nH9ZEmcitRZatsu2bhs/ILYYlXc2f49FAEvGQpOBnUyulIlSrvoXC6D0I8OgPGCYiZx/zewSzA0WogBeoJwUM1KEk4IZYD2/d6cthjouqAL7YXvW8TyyVDEfUDWmjZipZPP3exOFlsRunSlhZoR35Ie79V/sU55rTc8a4F7A4QhVwh1NYP/jFjb5IXCSihPFOOg8NIXdUA== 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 SN7PR11MB7565.namprd11.prod.outlook.com (2603:10b6:806:344::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.26; Tue, 8 Nov 2022 01:46:37 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::3c6a:7a7c:129d:aecb]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::3c6a:7a7c:129d:aecb%4]) with mapi id 15.20.5791.026; Tue, 8 Nov 2022 01:46:37 +0000 From: "Xia, Chenbo" To: Taekyung Kim , "dev@dpdk.org" CC: "stable@dpdk.org" , "maxime.coquelin@redhat.com" , "Wang, Xiao W" Subject: RE: [PATCH v3] vdpa/ifc: fix update_datapath error handling Thread-Topic: [PATCH v3] vdpa/ifc: fix update_datapath error handling Thread-Index: AQHY8odmMbp1E9gIAk2goLguQTrE0640Qp2A Date: Tue, 8 Nov 2022 01:46:37 +0000 Message-ID: References: <20221107053411.98653-1-kim.tae.kyung@navercorp.com> <20221107085943.116357-1-kim.tae.kyung@navercorp.com> In-Reply-To: <20221107085943.116357-1-kim.tae.kyung@navercorp.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-traffictypediagnostic: SN6PR11MB3504:EE_|SN7PR11MB7565:EE_ x-ms-office365-filtering-correlation-id: 0bba5971-6cc6-496b-0e9f-08dac12b1335 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UfcMijsPPI06so4/krN6F7y2F0QZJJxE2Wm1i0WYIBqHzt1ZHAQPM7KUleQbu7I9UbKtGjvBhvsbppApmAPAIMkW/1EqUIQhZ+5AHlz75JlkRQdRjoFgGObU685uHeBNLq3pwoOcLTWp8bT0k3uZt1Cm5xYM6MjZuCP9qXVdQSAh0q/ksIIe4KDetylZH/RmlhHACBctnsOMH1XKvE9zJkd+rIDxcn13zujP2KwatsTfypCXHWkrkUvEfpVLquxnpYCATcuEtxr1H6+G5/u2hZh9I1bLC3Em0wSpriqx0fa+9/fWK1M17Qhi66iE2KXW4vKYAXEZr93PSyrMW5vSGk6TASmL1LvRI5ZTOSJTJTi0scbHdMbxNazgd/8bB6dO6ZxKLK3/609q//tqG910V7kw0EBR62nwbUTwJnKvcIK2+hfbkd2Cw/Qumnaakc1CEIKVwGuUgXlfpCFDIJZfo8dOdaIQrCa/FP0lykN3iUMLZF8FdU1ld+uL3aEZb54V5Hk5qNY0B8lhGGq/nKqTANMkr4CyNRaYE64ttkHW13MLFTNoGS9KRECLGU2C53YElqLzM9hzHW+0j3slXSvF37eFQG5PuPszSdDzqqNZyLLtH3SUFs1NPz3FPJ9hBn1HlHu81u/fIF3z/rqSdZ8MTXms/7k1rfBMzr5iwTn8rZ9qDse7JnfYFK1rXPCJGGjUEu7HcvMMBFgrgnP/sS8/L8fJAK4hk2BmQcGAq9JWIzJxLeQKJbjxgtuPtO9jwj2+QM303HsrmacGARHIdqxZXA== 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:(13230022)(39860400002)(136003)(346002)(396003)(376002)(366004)(451199015)(38100700002)(107886003)(9686003)(186003)(53546011)(26005)(7696005)(6506007)(122000001)(83380400001)(2906002)(15650500001)(55016003)(478600001)(316002)(110136005)(52536014)(71200400001)(41300700001)(5660300002)(8936002)(54906003)(76116006)(66476007)(66556008)(64756008)(66946007)(4326008)(8676002)(66446008)(33656002)(38070700005)(86362001)(82960400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?YnmVDGCx2uH//m59gyr6wyicc5KCnlqmIAMJp/SV32HqC3Q7x3gks5IQtLMC?= =?us-ascii?Q?9MBWK6lAae29gSGR2/PaJlOGMrUy8CTBICcS77YLaClKyd4RjDuCnt6FlEML?= =?us-ascii?Q?55Zocxp8I9h6SbGvi19OCO/0mUe3QOzeWJy278css5QaN/Kp4OaSOGufd8/p?= =?us-ascii?Q?2CGNxJdSe+SbBVo9SCLgmtK4qOdCW+4EVarJu9amkL0WJe12dwwkWl+Kb14A?= =?us-ascii?Q?tLv2c/QQRgpRKflfLJ0uhYN+CdW0B66MRa5WfwMBx6FHQ5j5DWC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5bjcZzpPSEGbpfFuaYHviJfbTL2Y?= =?us-ascii?Q?FF4Tx311QuEcbHV4yQoMlQbcF3PHqNuIc2WkdZGkqaDOAv85CNuMzIa3NZIi?= =?us-ascii?Q?wefQsZgAegH8jXRdf7NPzBkFLomOs42mqSlxpTsCpkX2C93w4B5VurDR+IBm?= =?us-ascii?Q?3ajjqKL1vNrAP4AupE7AvjnoYwZSZf1RTwJyhjunTcmJQw2TlHQI2ox4X1i/?= =?us-ascii?Q?mLjs7yHdixwHeMYpQRTv/O0mq2fr3BQ1ozxsryY0qn0Ti5+vx8/efvn9ZFd4?= =?us-ascii?Q?IBzdjSYyRjaiDUYUITxuMePqvrv1wLyB/qAICLW28iPatW7fjlJE4VWr9hdL?= =?us-ascii?Q?1oWS/2Fm95XMAehEwnIaHqW/Bo0bV1tHJo7ctzNs6IY6seGSds/1fYifKhY0?= =?us-ascii?Q?7ZaZqDVNZjVMwZ1quo2Ku2dHIYvpnmD2wc4i57Dw?= 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: 0bba5971-6cc6-496b-0e9f-08dac12b1335 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Nov 2022 01:46:37.5876 (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: D34MrkXhB/6dZ84zp4vDzYC7pzpsdkLdI/ng5RPHTqd9XQ7oS/lLAgS/IfDqtxPq5U+UqB/DyYlnzEC0gNyrbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB7565 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org > -----Original Message----- > From: Taekyung Kim > Sent: Monday, November 7, 2022 5:00 PM > To: dev@dpdk.org > Cc: stable@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo > ; Wang, Xiao W ; > kim.tae.kyung@navercorp.com > Subject: [PATCH v3] vdpa/ifc: fix update_datapath error handling >=20 > Stop and return the error code when update_datapath fails. > update_datapath prepares resources for the vdpa device. > The driver should not perform any further actions > if update_datapath returns an error. >=20 > Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver") > Cc: stable@dpdk.org >=20 > Signed-off-by: Taekyung Kim > --- > v3: > * Fix coding style >=20 > v2: > * Revert the prepared resources before returning an error > * Rebase to 22.11 rc2 > * Add fixes and cc for backport >=20 > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 26 ++++++++++++++++++++++---- > 1 file changed, 22 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.= c > index 8dfd49336e..0396d49122 100644 > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c > @@ -1098,7 +1098,12 @@ ifcvf_dev_config(int vid) > internal =3D list->internal; > internal->vid =3D vid; > rte_atomic32_set(&internal->dev_attached, 1); > - update_datapath(internal); > + if (update_datapath(internal) < 0) { > + DRV_LOG(ERR, "failed to update datapath for vDPA device %s", > + vdev->device->name); > + rte_atomic32_set(&internal->dev_attached, 0); > + return -1; > + } >=20 > hw =3D &internal->hw; > for (i =3D 0; i < hw->nr_vring; i++) { > @@ -1146,7 +1151,12 @@ ifcvf_dev_close(int vid) > internal->sw_fallback_running =3D false; > } else { > rte_atomic32_set(&internal->dev_attached, 0); > - update_datapath(internal); > + if (update_datapath(internal) < 0) { > + DRV_LOG(ERR, "failed to update datapath for vDPA > device %s", > + vdev->device->name); > + internal->configured =3D 0; > + return -1; > + } > } >=20 > internal->configured =3D 0; > @@ -1752,7 +1762,14 @@ ifcvf_pci_probe(struct rte_pci_driver *pci_drv > __rte_unused, > } >=20 > rte_atomic32_set(&internal->started, 1); > - update_datapath(internal); > + if (update_datapath(internal) < 0) { > + DRV_LOG(ERR, "failed to update datapath %s", pci_dev->name); > + rte_atomic32_set(&internal->started, 0); > + pthread_mutex_lock(&internal_list_lock); > + TAILQ_REMOVE(&internal_list, list, next); > + pthread_mutex_unlock(&internal_list_lock); > + goto error; > + } >=20 > rte_kvargs_free(kvlist); > return 0; > @@ -1781,7 +1798,8 @@ ifcvf_pci_remove(struct rte_pci_device *pci_dev) >=20 > internal =3D list->internal; > rte_atomic32_set(&internal->started, 0); > - update_datapath(internal); > + if (update_datapath(internal) < 0) > + DRV_LOG(ERR, "failed to update datapath %s", pci_dev->name); >=20 > rte_pci_unmap_device(internal->pdev); > rte_vfio_container_destroy(internal->vfio_container_fd); > -- > 2.34.1 Reviewed-by: Chenbo Xia