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 453B742A47; Wed, 3 May 2023 07:19:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C6FBC41144; Wed, 3 May 2023 07:19:42 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id CB859410FC; Wed, 3 May 2023 07:19:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683091181; x=1714627181; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Re1Au4Ta4o+iT95syfj/Y22TQfNXBw2mw7DtqHHvrdM=; b=WCs7bhv6POxnVFg06XUpjDRkSvCeznbuqBnq5B61CbWxqC8e5wJHQDkk P88Gz8V1LQ9cMKmIq7AwZspHdQQ1mKOUc6oX9KqX5B4Mt8/XHAW8UtVy+ rWM77EhrnJUXpayzDRVw4GMpJDFLGcb6AXzgtfAgXqeLN8nVphgGsEBV5 5dMmlKoQRBUltW+CidQCtXjqb22aUbLDDKAlNpHrdCHrElo4wDrff2vKH j3z7Wd0bmJuALKJZMPNmvXfACvHheffFn187oQ3QS8uaQISzUqyjmt5qG UN6I0+P5nxXlFV5EwOrXzD5ewXIO0pFk+jlmpv4qOBGCk7ODrPS5INc/l Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10698"; a="350646214" X-IronPort-AV: E=Sophos;i="5.99,246,1677571200"; d="scan'208";a="350646214" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2023 22:19:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10698"; a="1026365693" X-IronPort-AV: E=Sophos;i="5.99,246,1677571200"; d="scan'208";a="1026365693" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga005.fm.intel.com with ESMTP; 02 May 2023 22:19:39 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 2 May 2023 22:19:39 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.2507.23 via Frontend Transport; Tue, 2 May 2023 22:19:39 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.173) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Tue, 2 May 2023 22:19:39 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QtdyufUQ49AdtkXQ9jUVwd2Dh1fkQiVdZVpiKI4fUanJ1PFXnenRfTWsSedH/AtHSCpGemIKaND+sVN3AdtfWBIJ+2Z/g2CUjGHQl3KzqAPhiF/dcuo7Wjwqw8V+7wVb0e4GwxwiArEF2D9BTRou87klkShJ8N5Y73wkjYSsW/h5NF/FWgmsNYpzwSUJyvTWHE3VQV/mLvfEPflI1LcTx41iJDo9MSD1H8GzXcW2XGqa9Jm9u0WloiihhUeHf5u4gDnKGXd6pYSyMk3LQzGoQ51MrVXfZ5Zh2L/TaggXdq7vzSv4pcG6ZFmcY8Xt86XcPE+e34LWak8RcWvIUIpFKA== 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=5mNTIrV4zxkEQUxI5fK1gOeMCCc6wBUKG4cp5a6tXCA=; b=N1jDVBAEw0fIbP7WFvH+h9FkaZSjhtEbCExr71qdWGoyK4oNr3UvNkYPdtDNGmIFvI0Wt8dfn8jYud57M1u/W+TR4EQg9iZoDuj4TTgFYPhhQ9rjQoFOkeBeT23fkZ1lDchNUuWLisPbAE50NgyLtuGuw+rZPfhTQhI7bgYz6NWa9HrmqsDjacC6mBalUTlaMxF2mj1WAKgbZPj0qRBdB3aFSkaZzTRVnzVTR1gjQmgKVY6k7sNiVTMLTycmxlDdXogSRwO5tqaCaDcCp170GkcGk7dxW0XNOuzv/lUfv31/wV8SJri8Vs/T+eJa71H4Fm3+AUJRgMgTnrX+XKoyJw== 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 DM6PR11MB4252.namprd11.prod.outlook.com (2603:10b6:5:201::26) by SA1PR11MB6758.namprd11.prod.outlook.com (2603:10b6:806:25d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.30; Wed, 3 May 2023 05:19:36 +0000 Received: from DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::4bf5:e490:dd69:956b]) by DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::4bf5:e490:dd69:956b%3]) with mapi id 15.20.6363.022; Wed, 3 May 2023 05:19:36 +0000 From: "Xu, Rosen" To: "Huang, Wei" , "dev@dpdk.org" , "thomas@monjalon.net" , "david.marchand@redhat.com" CC: "stable@dpdk.org" , "Zhang, Tianfei" , "Zhang, Qi Z" Subject: RE: [PATCH v1] raw/ifpga: check afu device before unplug Thread-Topic: [PATCH v1] raw/ifpga: check afu device before unplug Thread-Index: AQHZYFWNAhtBLqlwp02nUnZXeL7MYa9IPPiA Date: Wed, 3 May 2023 05:19:36 +0000 Message-ID: References: <20230326214134.782428-1-wei.huang@intel.com> In-Reply-To: <20230326214134.782428-1-wei.huang@intel.com> Accept-Language: en-US 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: DM6PR11MB4252:EE_|SA1PR11MB6758:EE_ x-ms-office365-filtering-correlation-id: c5b82d16-90aa-4268-9b92-08db4b95fcce x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8MW/egG7yAx+MPqXuo2NE38t1HE9Lg4WK3jbKXke2UQ8GJyUHCf0xRCsNy6rX2NeXJa3pNRmtzAqYsyWYjT3iCMr2TM76LpYFiAIKZVxMPoJDJuNNzHmiQg+YRKBqUCCvW6MZmkiigC7CkUGB8N2HYpuZ8QwKoSf6ITR0EFZbAXCVtPBRJ/XJHs59s2jJOHtKIzeUzB9X0Q+XG3/nLi7aI6+ZvY6V2zeeREvdYoZ8jdbVNBZ1sUBxWc0sgqZ9KcBvdAfX8e07yxDK7Alaby5cZYVEh+0PNpSlO5XG4AyZgdYNhUSuNnfZ2ogjA669ZbcCYL+8yh7rk4/dlYfEJOkZvsbT7B91Ko3CeDooAMhr9My+hf7o5ycpKKpgddnEdeBww3nCRmRTvBOySkcCJ65wUTwdDG2sgzM4QtKl0p2bsP1z5iQvRrhEBoxep413iHR9t3i2RY7Y3bxeoA7aPfsJ7GnR83JILyYna5bGwBbo/fq8VkqUz/Mw9pxiSxIFVWIGSegWmHbspY3xPTzYDy/yWxkDB491UcSfnU82PbZa6sTeiOHcGs9AV1GPaMXvQWk2Nu/mbTpccn5lvZIarUtWbET0NDtXRN+MpUuG/t+l13i+LGSqsNCF/nCtoemh1/7 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4252.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(376002)(346002)(39860400002)(396003)(366004)(136003)(451199021)(66556008)(66946007)(76116006)(64756008)(66476007)(4326008)(66446008)(186003)(316002)(82960400001)(478600001)(107886003)(7696005)(110136005)(33656002)(71200400001)(54906003)(86362001)(55016003)(6506007)(2906002)(9686003)(38100700002)(53546011)(38070700005)(52536014)(83380400001)(8676002)(5660300002)(122000001)(8936002)(41300700001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pxBJzpkbSa3kxwg5sUD425PVE7yOf2E7v5q0rwJjadKXrQn0Clg4ETefIlKC?= =?us-ascii?Q?+ycDfC6XftgSj2mbIWwHgNfYLIl5f4N7zCiHjiCPZtuONypAuZtsJy1SI8mK?= =?us-ascii?Q?bwynAU4Fe446N/AIwCT90uRqIJvpmH49Z9BD9wSHUSc57uTQl+wQ4hF5Qpqb?= =?us-ascii?Q?cBPnbnFOuUzxPoorosL7ZR6SxPBnZJh8ClEUM3WbpSo2uLyFkVa2MXEYctux?= =?us-ascii?Q?mR6DlA9GY1Bcj2Wt0pjKFf2MqSnWWfS+PpY0BbmPxZoNBFbukjmT5BGdog2j?= =?us-ascii?Q?X9SBaCjwaPqrKcfH0blBDPtd5AXd5noPqhRIceGY2fjhJ3oErtIEKf5MHm8s?= =?us-ascii?Q?0IubBa0vD1bkuBHRYM7oY6kZ+Q9Gw8vplC11rPxFqKoHdxcD7Ly+3MW412NL?= =?us-ascii?Q?90ZmbHUM03q3cNu558RmPXOq93KqkYaKCBwrfIZCKIl4MaAIiY/wXDeqF6jB?= =?us-ascii?Q?fKhyLGFzpBNoM6JygAvpcdpb7YjVtc1vaVLQMqoLV5/Z1QKFaI+T2osu+Dop?= =?us-ascii?Q?HxH0OQdHeM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4wHy3EkldDE7X?= =?us-ascii?Q?bcUzxgItJTYRIjzW05ED9GVaYJuPXgkTTd4YwZK/AsFy2pGGs+XISukvyoe7?= =?us-ascii?Q?6QMe6oYkBIO8F6H9hwyWgQc4SxFoatPQyiwAeDhX2fj3nviagBnELySu6w?= =?us-ascii?Q?=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: DM6PR11MB4252.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5b82d16-90aa-4268-9b92-08db4b95fcce X-MS-Exchange-CrossTenant-originalarrivaltime: 03 May 2023 05:19:36.6502 (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: txXWjI4E/7wZZ8j8NlFYOE8mEAK+d4mYzgeYbhpS5RG90BbVyMmTVVGH4M+0wMtzYlbdNFgVLdxKmlEIzkdIWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB6758 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, > -----Original Message----- > From: Huang, Wei > Sent: Monday, March 27, 2023 5:42 AM > To: dev@dpdk.org; thomas@monjalon.net; david.marchand@redhat.com > Cc: stable@dpdk.org; Xu, Rosen ; Zhang, Tianfei > ; Zhang, Qi Z ; Huang, Wei > > Subject: [PATCH v1] raw/ifpga: check afu device before unplug >=20 > AFU device may be already unplugged in IFPGA bus cleanup process, unplug > AFU device only when it exists. >=20 > Signed-off-by: Wei Huang > --- > drivers/raw/ifpga/ifpga_rawdev.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/raw/ifpga/ifpga_rawdev.c > b/drivers/raw/ifpga/ifpga_rawdev.c > index 1020adc..0d43c87 100644 > --- a/drivers/raw/ifpga/ifpga_rawdev.c > +++ b/drivers/raw/ifpga/ifpga_rawdev.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include >=20 > #include "base/opae_hw_api.h" > #include "base/opae_ifpga_hw_api.h" > @@ -1832,12 +1833,19 @@ static int ifpga_rawdev_get_string_arg(const > char *key __rte_unused, > return ret; > } >=20 > +static int cmp_dev_name(const struct rte_device *dev, const void > +*_name) { > + const char *name =3D _name; > + return strcmp(dev->name, name); > +} > + > static int > ifpga_cfg_remove(struct rte_vdev_device *vdev) { > struct rte_rawdev *rawdev =3D NULL; > struct ifpga_rawdev *ifpga_dev; > struct ifpga_vdev_args args; > + struct rte_bus *bus; > char dev_name[RTE_RAWDEV_NAME_MAX_LEN]; > const char *vdev_name =3D NULL; > char *tmp_vdev =3D NULL; > @@ -1864,7 +1872,13 @@ static int ifpga_rawdev_get_string_arg(const char > *key __rte_unused, >=20 > snprintf(dev_name, RTE_RAWDEV_NAME_MAX_LEN, "%d|%s", > args.port, args.bdf); > - ret =3D rte_eal_hotplug_remove(RTE_STR(IFPGA_BUS_NAME), > dev_name); > + bus =3D rte_bus_find_by_name(RTE_STR(IFPGA_BUS_NAME)); > + if (bus) { > + if (bus->find_device(NULL, cmp_dev_name, dev_name)) { > + ret =3D > rte_eal_hotplug_remove(RTE_STR(IFPGA_BUS_NAME), > + dev_name); > + } > + } >=20 > for (i =3D 0; i < IFPGA_MAX_VDEV; i++) { > tmp_vdev =3D ifpga_dev->vdev_name[i]; > -- > 1.8.3.1 Reviewed-by: Rosen Xu