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 4414A42850; Thu, 30 Mar 2023 11:06:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9401541138; Thu, 30 Mar 2023 11:06:27 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id B560140E25; Thu, 30 Mar 2023 11:06:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680167186; x=1711703186; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=SrCXohiKvCaejxxqpyUWeTH8JcFGl+6ObuKeXO1QWa8=; b=FUVGBlX5RHjc/0+jFu3m4FJ5BCgy5a3pwF6jaQTqLw4OaRAIG6+I2g0/ DVveonndRtjYytmkB8c5HG4wnE1MlKr4v4gySapFQJ9dX3j6CV+AU0bSc KixqXI10rPlFLSmE4RZq7rF5UfioTsXLx/cydys+GJpQmb1IrTevuiDuD xqISMkevKvSOeE9Al7b9K9mxnIJSnyxi79KNzbEXtpB2IcNZL9MGeGGgU p3zixqv/sAXVZUDAURJjD9Q4yjt5veMBdeMFrPAO8dp7ta+iGIAarlvma e3ZchDKgXxKb52YKljADx6iqwcESZ3r4LvQM1v0xEkITdoV+0IvDXBeIg Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="329608166" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="329608166" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2023 02:06:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="1014358214" X-IronPort-AV: E=Sophos;i="5.98,303,1673942400"; d="scan'208";a="1014358214" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga005.fm.intel.com with ESMTP; 30 Mar 2023 02:06:20 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 30 Mar 2023 02:06:17 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 30 Mar 2023 02:06:17 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Thu, 30 Mar 2023 02:06:17 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.176) 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.2507.21; Thu, 30 Mar 2023 02:06:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mWZfQs9MfIwBtUbklBsT2BB6EOaaKreWSMj/uNDBvUKhuWm3oQ42VhWCOS5MOZBFZAflBfAZH+jUX2GpfvX+tWTi4JSmub70YrfjxbTT0E8qlMLDR7M4dIlxisKell6Ir7JCUBmc4CWbcZWdWPOJbehjWLw3KeSpuhrYiL7X6F64c0nMNIb+VFU8cBtEDrNWE1oIJjatJHKkhShe0edPsy7GcdhlUTu/vKH9hzQFafzR+dTQd7ZEUe7LU8jsWrDr+OdU44Zk4xlmI0GK9bqDX8cOKPgmVPwkZOxJkq+0AXNXfZ1fzdHfBAgqUwuXLrA8F6smow98X7g8Cu6nR2lsTw== 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=ZvVxlK1wl+KqHbsfNV/KV2xwZJkTMmPAjk4GBCInhy4=; b=GJJFY7OePxpiyervJ/4fqadIAC+r16oh0KvIKLk1xTEeICvyE4r0Ji4U68NhaP6NQsd9jaK2IsJbYvgZnwxZENQZ3cATQEJtY02QcTk3Ake6Xibke6v6X/jLAYxPLtSR3MvP23TBb8MyiEC0IM+FLtwPa0HgD9trVRWku8c3Yh7e17Kv4D5bt6VceZ+qyRP7EKv3+11CYLIGWtFLuP6Sz4Pdi5AN49jREjaXI+uPdFPSMoZKOQMm3BHJrFsI/n5oADsqdMdJbdqm3Q+sUnf4e86izO2VYVVO7/eTUHdpQsx6HPdBUr4Dvz+mUoT79t6EHdbF64M7ZfZ2IW4y20/lFA== 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 BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by DS7PR11MB7949.namprd11.prod.outlook.com (2603:10b6:8:eb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.33; Thu, 30 Mar 2023 09:06:10 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::2ac6:e032:8994:2e12]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::2ac6:e032:8994:2e12%4]) with mapi id 15.20.6254.022; Thu, 30 Mar 2023 09:06:10 +0000 From: "Zhang, Tianfei" To: "Huang, Wei" , "dev@dpdk.org" , "thomas@monjalon.net" , "david.marchand@redhat.com" CC: "stable@dpdk.org" , "Xu, Rosen" , "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: AQHZYFWNHdW7QcUvHU6lcPYSi7Ln6a8TDK4g Date: Thu, 30 Mar 2023 09:06:10 +0000 Message-ID: References: <20230326214134.782428-1-wei.huang@intel.com> In-Reply-To: <20230326214134.782428-1-wei.huang@intel.com> Accept-Language: zh-CN, 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: BN9PR11MB5483:EE_|DS7PR11MB7949:EE_ x-ms-office365-filtering-correlation-id: 9a730407-7ea5-42eb-496b-08db30fe0110 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: C3/RAHpHmCw2/wPrwKLxh2T9ejCmyVYi/V3dtPo71yLtsn/HUCTzK/MxIMyNGgiRAlk9WyT2kefWxQSr28tElT/UBThV1QOFXLQ/QhMHJ1BeVj3zJCmTr+D0JEUNPQWPsa0gD2DsFy97p5WP6CgyfJLr5tflyzcIs7SwIqDDqCVK0TuflAgU/geAxfoIwA7ftUFWLa4wOgAmigwM4wHMVYxN4b/PCUAWBLcmUk7m4OBn6oMRR8uydjey3NotD0R3KckoVHfxhKnekbjLmmgntjsDrUGNdTRJ306nhZnFKZfrsy+UqZHDIXe//8NaxysDYnP5/Q/AZE7msFjgXPa3We9a9tdgriZk/Kv+2YT21P5isrfZt0xvMX+EHBMr/9jrzBPV0SSjucSotqo+hxx8yWJhTvisbiLLXNh7WqyENjXTcGmnrj9P6nvjlAgQdUZChX1MxkYbRgPaudoqv9KIHtcsPqfVi+xgGC7vBGbvNWJjw4NXYkoatNOzij+5XAoKnbdEv5BvlxTvS+FxiaxyPQ4DzzdkNjlk/una49xmXhpAALjbnB3ktCgYjLIAhprLpG6n8aro5/RmbVMWf3zI/2Ga1GU6pu4th1+qYp+ywnkmts+XXOFuvU4JoLvt9LW4 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN9PR11MB5483.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(376002)(136003)(396003)(346002)(366004)(451199021)(7696005)(107886003)(53546011)(6506007)(316002)(478600001)(54906003)(110136005)(71200400001)(9686003)(76116006)(186003)(66476007)(66556008)(64756008)(66946007)(8676002)(66446008)(83380400001)(41300700001)(122000001)(8936002)(4326008)(5660300002)(52536014)(2906002)(38100700002)(38070700005)(82960400001)(86362001)(55016003)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VEYuSNlD+a7zOF9euhCXtruWtzzKJWxuiskC48NjWcYk91YvZ+AB5clKxqFY?= =?us-ascii?Q?Ed/i71gK57oKWIU2rfVEulV2MaVJfvOr/69+9RpPd46iTyhoS39zkj6Vzn1r?= =?us-ascii?Q?qmXciM584YpFr+oc+MngQ3Qr+4ZTWTiR0kZW+Bs7MDA/9bz8Uyyspgu576c4?= =?us-ascii?Q?bpPrgruvZC6XHsVXJb+dUA+QxRGuu9WgmYPQOLT6RYjUHt9pvkN6Jwp3/8xq?= =?us-ascii?Q?K942KoFYyk7pS7CCBZXf+y9wvxGs3/JxLhwbsA4NlwT6w1Ae5oomxJ47I/aY?= =?us-ascii?Q?M8DpHioSluB7mX7GtZUXgqjpNTUGdEgrfQ68Nd3xtKIow43MUinNXoWVPf3u?= =?us-ascii?Q?dZvBZFoB85SMBopzHr4kmtPqgAGLsyQN9yO6q9/6LUzoj4ef+qSx5tYbAWvS?= =?us-ascii?Q?qATKQDlqbKG2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?= =?us-ascii?Q?ZckJHBCyrJqgr6nu2BWu9qWrSnvTRAXq/zY1eIlXwK1OWJ5yE5bUpuU1L8CA?= =?us-ascii?Q?dihqQLCE7QsJHQvriTPksOcdRjeeuPBxQ7GuuYRyN30f/30LX+gSHWYWXsbD?= =?us-ascii?Q?R6ZmrxYNlat/1bKk0exMR1UlrNsYycRdKMbhFX0aKZenYpfOYqNJVUUGWLzD?= =?us-ascii?Q?loSE7F3+WMJA/dO7htSJ10aZ9petAtAoYoasSWLUeakAYFXYnFKalMg4KXBK?= =?us-ascii?Q?HVobY/SCx32x/YqywGTzrp6QSNvGHKhYhhlfTo5G2xE8RtZCZxDZ8eC+Gph9?= =?us-ascii?Q?+jWN0qT5EHTqJPZ6lCpsz7eSy43l80mGLJjjGfEGobZg?= 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: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a730407-7ea5-42eb-496b-08db30fe0110 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Mar 2023 09:06:10.0623 (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: v2PNFSWRudowqKhCIjlOT6UGr62mSFMHSHQ/5m/m+y5/AXALCHnYQQn//4H9z0Bt1PD8xveLVcs2jbqvaFyInw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB7949 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 > -----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_r= awdev.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 It looks good for me. Acked-by: Tianfei Zhang