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 9B4C641EBD; Fri, 17 Mar 2023 15:55:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 404A942F98; Fri, 17 Mar 2023 15:55:52 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2063.outbound.protection.outlook.com [40.107.94.63]) by mails.dpdk.org (Postfix) with ESMTP id 58DA240395 for ; Fri, 17 Mar 2023 15:55:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U2ilqM9PvMTgtyWlPdR/pzLET/HRbysJwVQNHryCI/T53TA8Rvo1/dJfbNdvAOcM7W3ImAeEs/rjnptdyJoZFMfagGV162YMl9NWSw4zoJJTUIiW6Z27TCGy0BKNJvc6ZsxLWG0XViJ8El6ik4QARhA+NaJOa4Uo5HDOAtdFenBzzRmWqcAJAONls8KIbDGQ1coqh5/6vNIDHUH0ITGsMO/v2PYNDGB40fiDEFKCUWFPaUGzPJ5D68VBcFsD6yfECFz6BZmB13VljgNkrPTMr6UZkBQmylC7sX8GXYYM7ZIBCxIZGw85o7q6PXVB6gWP5yYzPgRjo61LV0XeaeagPA== 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=PqO1doD5JrAIfykGLFC0VKFFQh5DXhpFi2SKjb0Na3k=; b=DAfZYO/e6MlRPOFTs2pq3d3FB10uwXs/D/uiMQC46bI4LUhS2pMmFRp5ekiv+eBjGB8AHTBK8c5hr3KxM+xsX3DUCt34QUu0hC6WEhTmvgVb3iW0ZgMFFch/QIgNJiSv958BN4p3BWr6Skc478N4AoxCLHWRGW/VlMeQEXcG/o2okM3N0YXrzRjzbEcKoTl/4q9KLkqrGdH+a+WMc7VIKn3UVAoGBMHLo05/lgg80D7A7mfklhkx9KxDXoDDqFe/evWW74ONB8VgZmlqR8IfzUyx2iewhvm2jlzbu/LAnd36yRtZ+/TH/TLKNRQULqidko5ZjXLE/VH2Z+QdyxtrHQ== 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=PqO1doD5JrAIfykGLFC0VKFFQh5DXhpFi2SKjb0Na3k=; b=t0faWuu/f6a4kkXPjRrer52wH9/U6QmZcJWgl1fY6X09upxGyoHxQSFKQwRVAHOrwMn6cK0+z4+aHXngmMEgtZYjix95q4fKafDew0NTrf8sGhFmr0n1v/Osvh5VI/eviopHbtr0O+zBLnJGfuuboSuRfAYNYlx5IrCXoHC3obJOglO8MAS80TrdvbRtxYH/CXSgGrhTHrhRrqkRGD5DpGHO0JG2GFerS+qpABA6r0NfbhzhAFy8lYSzLVJdQe0PLnaZ8oOIlHr+ypPhYKIrZ0bveYVPGdLBR9OIgpAUUTkfW8dDYeTUVWj7LeeWyK7+w7Ci47iY/U9eGjhBSxmhOQ== Received: from MN2PR05CA0049.namprd05.prod.outlook.com (2603:10b6:208:236::18) by MN2PR12MB4142.namprd12.prod.outlook.com (2603:10b6:208:1dd::19) 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 14:55:48 +0000 Received: from BL02EPF0000EE3F.namprd05.prod.outlook.com (2603:10b6:208:236:cafe::d0) by MN2PR05CA0049.outlook.office365.com (2603:10b6:208:236::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.10 via Frontend Transport; Fri, 17 Mar 2023 14:55:48 +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 BL02EPF0000EE3F.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Fri, 17 Mar 2023 14:55:47 +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 07:55:45 -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 07:55:43 -0700 From: Xueming Li To: Parav Pandit , David Marchand , Kevin Laatz , "Bruce Richardson" CC: Subject: [PATCH] bus/auxiliary: support cleanup callback Date: Fri, 17 Mar 2023 22:55:21 +0800 Message-ID: <20230317145521.3742-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 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: BL02EPF0000EE3F:EE_|MN2PR12MB4142:EE_ X-MS-Office365-Filtering-Correlation-Id: 209486d4-9cdf-47ed-2f43-08db26f7b189 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fhgcTPTg5NMznB8reaknKNg/s4+rLyMDNbtTuzMC5PgyMIa6m+tt1Hewb75UCj6YJP1O2fmYBBcsYeRHPzbypP5vzeXWMaN86WOjIHi2xYL23ZDUZgL8xVcBX7votPREkKibv+8K2KhrmzWFaE0jMHCjuHmO1yIAs5/dU0x4qXhu07YDr1cbLz/+24Zsq5Pjg6v3CLhNgfDIDW1GvIsNBulkKxT5E6osBtTjw/+3OLPB+weQidIbDzmemljNzbSpAYL4g8vC/REjKiDOhXqzgg3xwQmQfsONptoGkbb7YvEQWk8Zb1Pzuzn0JCFhwPe9824QfQZQFONBDZeNhWccEo4tqqcUFlOF6sDrAfO9c5IsNO/fz9YJMxvElPX3UrJG1xadxYsPjR5ugpO6JmwOrwTziqWhLSBJjgftOreIWYS9fEJM5+qiXz1wq40qcQIfwppN+vhj+CS1xQ5kInKCCJYE8+h+ClJxfjZ7Q8FNAy6a/srbL0qxpzSGKf0gYGbD/WdbJUpiSIrnaxEoWR8dzpU6Z76upFrXv/G6liU400ssOPIwuAM+gUj8D25QFERrmFephD5wwSzeHPKMgG4+/Q1eZGAQoNMxTNycOQc76Zjyvk29ngt8hIzyif7isL/uLT//nBHecr76/ItQm3VEa0nHfWxjLmA7aOVIlDrDbzHf/66ioRtiAtGWpxMike+mMzatpyKamf9pkiNgWJBNiN3vKJJw6synWGalqLMUzSHZ3T8d4Jvz0yZjqrlpB7sG 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)(136003)(346002)(39860400002)(376002)(396003)(451199018)(40470700004)(46966006)(36840700001)(36756003)(41300700001)(8676002)(8936002)(2906002)(4326008)(36860700001)(1076003)(7636003)(82740400003)(55016003)(40480700001)(2616005)(26005)(336012)(82310400005)(186003)(16526019)(5660300002)(356005)(110136005)(6286002)(40460700003)(316002)(47076005)(478600001)(6666004)(7696005)(86362001)(70586007)(70206006)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2023 14:55:47.8361 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 209486d4-9cdf-47ed-2f43-08db26f7b189 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: BL02EPF0000EE3F.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4142 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c index ff1369353a..19bf523660 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,26 @@ 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) { + struct rte_auxiliary_driver *drv = dev->driver; + int ret = 0; + + 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 +427,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