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 473BA41EBE; Fri, 17 Mar 2023 16:25:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1487042F98; Fri, 17 Mar 2023 16:25:17 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2082.outbound.protection.outlook.com [40.107.100.82]) by mails.dpdk.org (Postfix) with ESMTP id CAB8E40395 for ; Fri, 17 Mar 2023 16:25:15 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SQkWffToj2P3rNxDHx2o3WJaVRJ2UHBcUyogKG4t9wFy3WwkOKUA7X2R4nL5BhmQtMB3NQdn0Uo5PUVQfP7eykYHqValuwrA7ZHpZ3BySGDGdW96VboaSWWjPnuECw7dOGyrkAtSP3//ZzBHkeFPcZdPogkQt0JXnSlj+N7UJ4j6z0BPtzmTBn9xwus02VsgGBhkz6CejvRAS4dIXwoj4KBDohuT8KqoBQtMZ4T+HaAGAUQJW60sWAhbHd1MZQy+u8C6JvRcVri8uNeAz3Xvn60jY7mPnWPDzmpozm9icHWqZNj6uFzAfixnnvOU8ibsll+GTAExxcyPe1OuJCCgqg== 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=ZzOh1O49ISui4QS6d8Zk6MZNgSWAp8TiYyEMHcZ+60I=; b=e6XWfaW/HpzIsleQlcdlxbuy0UZAV3HOTtxV6H3tFYu2nLM0T3X7H23Ymmiyvi/cwiUKoh3tv/a8XMFOpFtVEozIcRI9JT0IuwxOknlWKAFqcAOgcvz1ITlnD3vFOpfCqjwQD9YW5BWqzKSJQt8yEpNgIo3U9sndPpPZBj6c0PwdMAkc4wnaPHbcuDSGGFGCmYLxRCq+wNg7fwsex7H3pt+8Bykactbzd4oaEmRNs4PEl2DpPNMboyQs4eScwgSu3uDJ681QtLsmMRrS7cFMDYO5quouCgRm/a0qSox6mp6TO830/tPe/18gROODNqZuwUuiPDcLzVSRsw75zsxF3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZzOh1O49ISui4QS6d8Zk6MZNgSWAp8TiYyEMHcZ+60I=; b=Ph0+sysHWVFUxnBKuT5ZQAeBqAbVBuQtlPL6IV4H8yV+pvSoIubfzP1rHj7Q3ZwQ7hGS3KxfJF0kymP133ijSJd6IuDAQw18r/vqSTgT0RrcVwnYzO/0cdkqVn4s2hH0HLr+oHf2pdY0L8cDklh1k+FCPvhWWdPi6HktAPsm2hdQk/Z0mT/bFHJSIW5LyMb5WAK40kaP3lSHaYsoR12+LUlcFyjq+FUitlpbDIJyVs/XyEtz7tnJ24uyQGgFCvCTeWHtkOC6/cAHGb7c0LnSY/0JdICmfBYALcjR3nwzvQyxMLnSQHDyU9TdYBn4xGrIYC12i3WCjn+dPUIf0h2gMQ== Received: from MW3PR06CA0005.namprd06.prod.outlook.com (2603:10b6:303:2a::10) by DM4PR12MB6040.namprd12.prod.outlook.com (2603:10b6:8:af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.35; Fri, 17 Mar 2023 15:25:14 +0000 Received: from CO1NAM11FT094.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::43) by MW3PR06CA0005.outlook.office365.com (2603:10b6:303:2a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.30 via Frontend Transport; Fri, 17 Mar 2023 15:25:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT094.mail.protection.outlook.com (10.13.174.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6199.20 via Frontend Transport; Fri, 17 Mar 2023 15:25:13 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 17 Mar 2023 08:25:04 -0700 Received: from nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 17 Mar 2023 08:25:02 -0700 From: Xueming Li To: Parav Pandit , David Marchand , Kevin Laatz , "Bruce Richardson" CC: , Subject: [PATCH v2] bus/auxiliary: support cleanup callback Date: Fri, 17 Mar 2023 23:24:47 +0800 Message-ID: <20230317152447.4570-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317145521.3742-1-xuemingl@nvidia.com> References: <20230317145521.3742-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT094:EE_|DM4PR12MB6040:EE_ X-MS-Office365-Filtering-Correlation-Id: 725a4d64-a0be-4ae4-6218-08db26fbce0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JY3wfKQgKm4Y8ERJS6AgfN6glH4XA4MkYRHRYlOU8U/k9K1vsWaUoWTIsVxwtYa5G36vCqiDqCQsSSFMJfdPfN7wR4sYFJV7BrpHmdlaumeF3k2nRB6xQlzWz6lqps8+88Ov0l0l+QqTWDRmw4BkSUmVnpv34Z8bUldh66zw3Jjm+vDtQghlCJ81RpSKYN0eNa+lVq7DQCpGGOSYebb39jKzKnCcU3FXcC/OdSSIBOGpFfQBa14gYtQvHJqwJ1lsRVkhmbRJ4oq8pCFBuViY1x/kKGCKttgBv8U0y65GovsPcuJ/u5Xh4c3tnvzZFEFvszcP3KqttV8OH4ogir6vTJfUQFqMep41Zt/vUSAWBblobo2KvnHV7moz5JAHRgTIy393fBMVdi0lLCOBQqe/ooO0/IrOsX6YXzpGJDSx2InfvbfS5fMxyuGmFPqXFexfzrVphsJikNUbaCplDRVsYzq7qYcpvEis4yFA+91WUe+tMOldcamCcbGoo8ySPk0DJQoPXaICPse0s6miabQ9B+muVX2sTXY2EMxrQGH8QqpG7X0D7h5h8MRTTAbUNZhp7a2Imu1xiRbBbh/u5qZjCub+QMjbOU1BZu+BbAC7y5Ilv7RtQ1ZbyzRWygzC2yoOAHFsW7ebL9BcJaBL1wVcEZ2V/DXwn4eXjrPYN0BwEMsIubT1AJE7npxSTIHOgjZFTiyoY90Nd1tzDU6B/4jF+RIdJ5GCeMWyHWKOj0xU3SMRLQWH9V6UVp7R7jjiAMIe X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(396003)(346002)(136003)(376002)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(41300700001)(478600001)(40460700003)(70586007)(26005)(356005)(8936002)(316002)(70206006)(110136005)(86362001)(54906003)(8676002)(82740400003)(4326008)(1076003)(82310400005)(186003)(36756003)(16526019)(6666004)(6286002)(36860700001)(107886003)(55016003)(5660300002)(40480700001)(47076005)(7636003)(7696005)(336012)(426003)(2906002)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2023 15:25:13.7059 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 725a4d64-a0be-4ae4-6218-08db26fbce0c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT094.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6040 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 The bus cleanup callback is used to sunset all devices on bus gracefully. This patch supports the callback by unplug all devices on auxiliary bus. Signed-off-by: Xueming Li --- drivers/bus/auxiliary/auxiliary_common.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c index ff1369353a..a66cc85d86 100644 --- a/drivers/bus/auxiliary/auxiliary_common.c +++ b/drivers/bus/auxiliary/auxiliary_common.c @@ -236,6 +236,7 @@ auxiliary_probe(void) return (probed && probed == failed) ? -1 : 0; } + static int auxiliary_parse(const char *name, void *addr) { @@ -337,6 +338,25 @@ auxiliary_unplug(struct rte_device *dev) return ret; } +static int +auxiliary_cleanup(void) +{ + struct rte_auxiliary_device *dev, *tmp_dev; + int error = 0; + + RTE_TAILQ_FOREACH_SAFE(dev, &auxiliary_bus.device_list, next, tmp_dev) { + int ret; + + ret = auxiliary_unplug(&dev->device); + if (ret < 0) { + rte_errno = errno; + error = -1; + } + } + + return error; +} + static int auxiliary_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len) { @@ -406,6 +426,7 @@ struct rte_auxiliary_bus auxiliary_bus = { .bus = { .scan = auxiliary_scan, .probe = auxiliary_probe, + .cleanup = auxiliary_cleanup, .find_device = auxiliary_find_device, .plug = auxiliary_plug, .unplug = auxiliary_unplug, -- 2.25.1