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 5997A427DB for ; Mon, 20 Mar 2023 08:55:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B206427F2; Mon, 20 Mar 2023 08:55:12 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 2C35F406BC; Mon, 20 Mar 2023 08:55:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679298909; x=1710834909; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=OoFoZncG5MqHnkPVbHu9t6ahLuuoDrs7y80LwUbbP9Y=; b=h4hirvJKkRYiG5oiTlJ0RPm6GKCM3guvoRf6aoGEWbQYzkPMwCYVEpye OsdoxIPSXFvZUUgmDPIGwo//NsfDUZtHFmprGWP+JGDX3WGIZk8ZuFbLx BGF06MxaAmWW4xDn59fqng1VZoTTPry/OSFl0dTA9XZJQneA5TL4RutLR 0E4nLIEOtrxAiPNEGXjr8SdiHYPGC+B/2T+3QC8o9SifuAyJmdnQTPBGL D0q20W77SgA2jSycr8I1wc//9uUjOrX2jnVpXAy3JWFOJtjq5H5PSrCHD ARcTwzP6/jfA29SlZQbx64VatZ4wOoxfK4Gl+YIgbdrLQqZzVfHqpzUB1 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="340957967" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="340957967" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2023 00:55:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="674264375" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="674264375" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga007.jf.intel.com with ESMTP; 20 Mar 2023 00:54:32 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 20 Mar 2023 00:54:32 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 20 Mar 2023 00:54:31 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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; Mon, 20 Mar 2023 00:54:31 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Mon, 20 Mar 2023 00:54:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=glcJO/1Ka+V8nIz5vAeGx1iNpGQsmKDCt5W1DAS8qEXh6EWkgStY4vHxNbAcjX+rCKw7NYS6//Xue2w89NLVgCUN7TmJGAxk06bcoo9hOlto+1wnm0sowRwm/JPgU2EoI6hKld7rZq/Qo1699P078PgTq/eJcwB5oDFAPfU816yNrWNhZlCtbhSPCfQHSpj3RZfKmV+0tycfDRMjFY7gqLDFswBmPYB64eVycwiway+fukSTd8qRYIlhz3NzN3xmd7M9nc6b2/6CIPy4ZOLT/wzcJJ6lToXy5poL4t+8VnMi0qA+YMr/4UtJwU/kXskIvtV7WHNuW0ZzAzyWgPeRqw== 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=BUcbDLdjo5jRUNxyQaws7vfHvpPo8UkQc5E+LZT7tiU=; b=EtagMBv7/aeW6kkL/XetkToBCuaut25/jHyysLrEWvl9MlcIGdEOrumDKlYlvxl/MDKd/0jpXR8OBIEk44OhpixkOniOAwWrAFxKtBPFkZz2uRMxHl2Vr1PEkVvVjRbeMdXtdGWWIMuVCrXOO5Svfpu+2fkzoTQSmG40EcqABEUziP1wAUrnzdbBIATZzXvynOaf4a8vXi5k9zo9sMtcEST+vYbs4FSoryDvA5wKnIa2//fh2Oo6eXkWiUIYJ2cSE8RJ3Tnsr4OnXt+lbIOJVN3fDvZSoZ/p7s9hcN6GGA0+jrYSVBdCvKatLNykyU17l9QWE1vcroVPlj6oiEEBHg== 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 DS7PR11MB6175.namprd11.prod.outlook.com (2603:10b6:8:99::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Mon, 20 Mar 2023 07:54:26 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::af70:de56:4a6f:b2cc]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::af70:de56:4a6f:b2cc%7]) with mapi id 15.20.6178.037; Mon, 20 Mar 2023 07:54:29 +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] bus/ifpga: add fpga bus cleanup Thread-Topic: [PATCH v1] bus/ifpga: add fpga bus cleanup Thread-Index: AQHZWHHnDBd4oBWNwU+8Xpef6sLPF68DQKWA Date: Mon, 20 Mar 2023 07:54:29 +0000 Message-ID: References: <20230316204434.360283-1-wei.huang@intel.com> In-Reply-To: <20230316204434.360283-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_|DS7PR11MB6175:EE_ x-ms-office365-filtering-correlation-id: 92b77652-44dc-4aab-6092-08db291855c9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Cgx/HkPNS2PVBeysnFH+mdJIC1IZ2pbtgihhqwIQY5bvqUOZfCyys6KseY4/FS+6QNrtu5TPE6QnFxcBO/Tyeb8iBs1akTzqn6Jmf1nL+MO7zLPzPIVFsihgezUikfl62WMO9WW1WK8hC8W1cZNLxYBUJmOh7eX8dMdULLmhZ4flEeDHvG2MGIFksReV6vFS8U2BSbyp0yRN2WpkjB2Uei4ta11P4btfEGiAKqg5BjklXc+ZsTdB+wAwQxWIMXAPSbnbBdBwRk9ruSprBhal5QKaxSPwHdv1Nz20erqKz8FO+JPL7sNQRBorP12152BvXQ3h0wrLBSdyj+HE0pR/exxXke2HrFWvYkbl3N4ziljH/ZHh607kEB/TY8ukam0ab3DetH3z+EVmYa/iA3oawkSMORKT377CLBrhykWgztPCT0uV8ueyaKKF3p5auaflYIoEVkapM96dHMUTQn450k54hhmjEq2P1RK2gUbXQQPPTgW1RNXAsQNmwd6MwDN4nw3udiTqi/IwPt2UcBr54o0SPxqjqewzr5Pc+azSVWkF9UzBcP4FQ9hWOZ/NnpClZBQFTprc/dqjkdgVr8SfMyXJfPU3jo1U53VzWa9pdMacCrY6EL+yZ1xYLxIFQfSohnNRx2dVRToCbf9Rsx2c59kinlQWyry4qZ/3Vov7tStn8hKrgKDcexPqgRQMtGG+ 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:(13230025)(346002)(396003)(39860400002)(136003)(366004)(376002)(451199018)(38070700005)(33656002)(316002)(66556008)(83380400001)(86362001)(9686003)(8936002)(41300700001)(186003)(6506007)(55016003)(2906002)(52536014)(53546011)(8676002)(4326008)(76116006)(66946007)(66446008)(64756008)(107886003)(66476007)(38100700002)(966005)(7696005)(82960400001)(71200400001)(122000001)(110136005)(54906003)(5660300002)(478600001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?6XYzVB2VXWtMFQOCADGLAGAhJsZWq8i4VLM48dNY5jUAVCXpDT6qJgKL8XIO?= =?us-ascii?Q?mO9LC7EDTqnieBeABlhosfd4dqQh85yuFOZ1chylDQovAzFpE2H8v6X5KyJJ?= =?us-ascii?Q?RFVy63iHEweYTLDzy3ZfKp4DZFZkNtBlJo+jyZzJfbjc81J7dfOv1uizUsz7?= =?us-ascii?Q?kbuZh8mx6CL10eSjpTrAYaZNmGQ6Vw6GFy0rukQ36SE4EmbKLJpFO0imD6GZ?= =?us-ascii?Q?0fWhQ7EA90PVVSneO2dn28FtKfyY7bfQIgpuoo6VMpafwQMb7eI5SPH02cLE?= =?us-ascii?Q?0y1FMHmSUE7qk0zSIldAN/D6EKlpxYWay4Q6WPbTRucU/BsRXhKYVSUeigKU?= =?us-ascii?Q?0eT93XCBvSgc6lbuizr2J90spbPSo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q?m30qRynK9rFBR9D6bX5wI/7F8brBAixCay1vOSyH0nQ+Hn4xRu2WMarlHSwA?= =?us-ascii?Q?YklLY+casx49IbUYe/85HWjnP15vfYyvMoXVR175ZjgHvoraTb0FDEw9lR8a?= =?us-ascii?Q?K98dB0y5rsHm9hpoH/3aTKM15eCfXwk/kPQLPC0NdcOmIvbdpRh3vrpuKUoz?= =?us-ascii?Q?AgeIXwnnKdgOVM43W4Je2/iJqz30/uj3QX2glCHsSlVRInCrGC04jTXlZmFN?= =?us-ascii?Q?9dQFJYpmPyyEHxnizxYKdQCWzbAJnZ/TwxLA+qhXjpN90Y9G3LW41SrU3g9w?= =?us-ascii?Q?ub69frw0uLOto5cZ+JgD2qxge3Hej3la/ftK/K6Xsf3w7WdTDfmJ5lZz/Pe+?= =?us-ascii?Q?J4z3CicHeqbZducPOgKbu80k/nm6RyDGzVhnOPs7Bqzf?= 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: 92b77652-44dc-4aab-6092-08db291855c9 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Mar 2023 07:54:29.7647 (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: P6xykpxnr7ToKkr5rEQ966WkkSrcd5mdEszXbmBIwC0Nsg/R1MRR3jISd5PPjuKEmxs+MFEBMv6wVG2UnpBevA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB6175 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: Huang, Wei > Sent: Friday, March 17, 2023 4:45 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] bus/ifpga: add fpga bus cleanup >=20 > In this patch, cleanup method is implemented for FPGA bus which will be c= alled > during eal_bus_cleanup(). >=20 > Signed-off-by: Wei Huang > --- > drivers/bus/ifpga/ifpga_bus.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) >=20 > diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.= c index > 07e316b..ffb0c61 100644 > --- a/drivers/bus/ifpga/ifpga_bus.c > +++ b/drivers/bus/ifpga/ifpga_bus.c > @@ -360,6 +360,41 @@ struct rte_afu_device * > return ret; > } >=20 > +/* > + * Cleanup the content of the Intel FPGA bus, and call the remove() > +function > + * for all registered devices. > + */ > +static int > +ifpga_cleanup(void) > +{ > + struct rte_afu_device *afu_dev, *tmp_dev; > + int error =3D 0; > + > + RTE_TAILQ_FOREACH_SAFE(afu_dev, &ifpga_afu_dev_list, next, tmp_dev) { > + struct rte_afu_driver *drv =3D afu_dev->driver; > + int ret =3D 0; > + > + if (drv =3D=3D NULL || drv->remove =3D=3D NULL) > + goto free; > + > + ret =3D drv->remove(afu_dev); > + if (ret < 0) { > + rte_errno =3D errno; > + error =3D -1; > + } > + afu_dev->driver =3D NULL; > + afu_dev->device.driver =3D NULL; > + > +free: > + TAILQ_REMOVE(&ifpga_afu_dev_list, afu_dev, next); > + rte_devargs_remove(afu_dev->device.devargs); > + rte_intr_instance_free(afu_dev->intr_handle); > + free(afu_dev); > + } > + > + return error; > +} > + > static int > ifpga_plug(struct rte_device *dev) > { > @@ -470,6 +505,7 @@ struct rte_afu_device * static struct rte_bus rte_if= pga_bus =3D > { > .scan =3D ifpga_scan, > .probe =3D ifpga_probe, > + .cleanup =3D ifpga_cleanup, > .find_device =3D ifpga_find_device, > .plug =3D ifpga_plug, > .unplug =3D ifpga_unplug, > -- > 1.8.3.1 This patch is based on EAL cleanup devices for shutdown. https://github.com/DPDK/dpdk/commit/1cab1a40ea9b858821aaf4655486e31ca1b5245= 6 It looks good for me, Acked-by: Tianfei Zhang