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 8331146532 for ; Tue, 8 Apr 2025 10:03:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7CF594027F; Tue, 8 Apr 2025 10:03:20 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2048.outbound.protection.outlook.com [40.107.93.48]) by mails.dpdk.org (Postfix) with ESMTP id 5E40340E4D for ; Tue, 8 Apr 2025 10:03:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uYCqKnSyV5Rezu/U/+poYOirr9hwZV4ckzldU5ajk+c1YZAB9pFw/2/UBE5KBpOJ8xyU8xG8AdxS9GzEclZVP8Ft29renbAPQO7i52XbUvDfiqF610oouzUvYgLl8Gw62IENYs/3be8MsADHIJLNLfovq2bmrNZhJRF314cofDdH26Gqp6kpVqv7lY6wSpLnVEkOwRO5J7BBk1iDsNYgTy6YXZ5TDiwv2VuBkAAsEoFZajjsPvl52ljoiotObUylgO71ZQ9LQnHylaeDF8XYyR2azMV1TCmG45cDxrVMCsH+p2N8oA4yoa6PaA5obY6yvDBos3pR/9KyfcLhTsGWvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=8V7gCFsfZm3ohGg2+H0xNhi/1x4LVCCa3zNegqcetsc=; b=e41hUpreT33rzUjusyGy0i5Pnv+kUkKNE5F6NjsPGCeU6JCvuJFh/mWfk3hb6UbaRpw5+p54dUZD/XZE/42cAp9J9P9eX4saryRPCLRpfO1ux9sUcSJ6Y0nTZSdpQupgUStHW7poW91yg4bxrnIKfXAk9y3EaSqZnIL+SQ/Pezvkjr5i63SbUGVS2rpfaVlVewkOtKF4BhPXbfa8T0qn0Ss0vWpS2zeboRWOwNhvLl6ytvRxXiWT1uZPWhQeOdO7xe3ALAoRxS2c3mWo40Y183N3uwttSMkAzx8kJvrx9e/Z9LF69QBiDTUBCwgfMJRcdF3x3ZvojBbN6Ucr1Fu+Kg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.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 (0) 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=8V7gCFsfZm3ohGg2+H0xNhi/1x4LVCCa3zNegqcetsc=; b=Xb/IPu1MRVlJiJStMrCePSNypIZLVxURQPeqT0gEdYPDVffJQHflS7tuwSb7rIrMeoLgiCNvGDKE9+bWVOl4qixqQ5vGWcOMxranwFdAIl2T8i9+L7xmZfFeD1T3HYMn60OguN9+WCPBvd7g/SHwgq2YnsS1DZaPSWgHJ/tqt79sg0BBRpdypeTX530znC09AtNVBb4JQcTCcEE9ISWAf+fJm6frlwcLHyHap+xrfMI+qCuEH+UEFIDFWdcWoUTMroL3vgtwf8FelbK36rXbWxbuAmjWrVc8HnLr3KevLRYd4v2TOZo0dpAvpOSoIH+klKUFVQb9tO1OA1dNpsgl9w== Received: from DM6PR08CA0036.namprd08.prod.outlook.com (2603:10b6:5:80::49) by MN0PR12MB6029.namprd12.prod.outlook.com (2603:10b6:208:3cf::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.29; Tue, 8 Apr 2025 08:03:08 +0000 Received: from DS3PEPF000099DE.namprd04.prod.outlook.com (2603:10b6:5:80:cafe::6) by DM6PR08CA0036.outlook.office365.com (2603:10b6:5:80::49) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.35 via Frontend Transport; Tue, 8 Apr 2025 08:03:07 +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 DS3PEPF000099DE.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.22 via Frontend Transport; Tue, 8 Apr 2025 08:03:07 +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.1544.4; Tue, 8 Apr 2025 01:02:54 -0700 Received: from nvidia.com (10.126.231.35) 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.1544.14; Tue, 8 Apr 2025 01:02:46 -0700 From: Xueming Li To: Anatoly Burakov CC: Xueming Li , Bruce Richardson , dpdk stable Subject: patch 'net/ixgbe: fix crashes in secondary processes' has been queued to stable release 23.11.4 Date: Tue, 8 Apr 2025 16:01:41 +0800 Message-ID: <20250408080214.371154-3-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250408080214.371154-1-xuemingl@nvidia.com> References: <20250218123523.36836-1-xuemingl@nvidia.com> <20250408080214.371154-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] 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: DS3PEPF000099DE:EE_|MN0PR12MB6029:EE_ X-MS-Office365-Filtering-Correlation-Id: 277394ab-a131-4b48-5762-08dd7673cc59 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|376014|36860700013|13003099007|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?skd6x9kZ/pIQip26YfWPYZc4ePyamkMJAgYGdfBF/NWlsGWBUcDYx1dcyZ9P?= =?us-ascii?Q?nAIztfnY/8fYo2awoTskePlmR81KrwqDJ0IGOdP0Fyqd1Bhtdb9Nsj1O1tSZ?= =?us-ascii?Q?NoiprXehcQx1hpp0bMqiyESy3xYVaT3eVuaQUt3Wjdfn7fQLC5Z7AcpjTpjV?= =?us-ascii?Q?SpqM+jqiARApv6K6SQPY+56T9PMvlG339wFSNbxjosPmWFNxUWIcCEHKqmu1?= =?us-ascii?Q?S+LOgz5CJXwwooMBYYGNgxOIJiy5aI7qkRjkfN/jYXmfseN6C7dQaneWOv32?= =?us-ascii?Q?AJNdlc9fbtX/6fp+vDIJ6gFaAJWNF4rKocUhCADe0tnr3J+V7uvQ21DBtYgq?= =?us-ascii?Q?l+iKiM2baAjyXgZmqonN3aFhgSw5gRdwFM3RhR2B/HTfHbmWGQEElBqtlScO?= =?us-ascii?Q?mVfwDZi5eml0j8kuwTeTp6EfGI+7aO919SM23DLbBKqqqcGLx0ao6rlUgWfY?= =?us-ascii?Q?RaxKVT37MkyZsGKboahJ26363cq0RCn+E0Lb13kTjUsrm70fVx1MPa7HfuSx?= =?us-ascii?Q?jFYFWMgAMSHtHGDROB51DvEtWHlahNuw7FTpCkZS5tDM7UWIk/lnboheFwHn?= =?us-ascii?Q?nyyEGNcoPsZbCb31FvehSQQoCsgXcpbjILj3XsypOK3y4i8UJDep3K31+pc4?= =?us-ascii?Q?MQd9VNmxzoU1GrvQ6t827I1rdce7vJTbkUPud27B2obC5PmBupXGQuXsx7Wj?= =?us-ascii?Q?UoAJ5PqnWGY5h1zSpN9+dP1dxntUjslo0TNZghpe+TmDYIMQrXO1yVgTF9Uy?= =?us-ascii?Q?zqMPmTiWNLuzaYD47mw3YRjSa/g0JzSso3R/s4D63hOlhAi7w41ms+7iM4xh?= =?us-ascii?Q?v/HJ+GTJH+jveNTRvUWkbESESrZf5pu2gviPpUMxJzyq5ChnumzhUUvQ1K1v?= =?us-ascii?Q?krs3zcNqR5RVzF5Vp6OTWy4Yfbi1mpbcwn5O00FPdNjIYKBdco7K4Zj3aX2p?= =?us-ascii?Q?H6U0ctMosn8/XuwBS4q6PpiWHMNrKyQozeFiXwgPw+kGfzw76mrP+c87VVyn?= =?us-ascii?Q?YB0MT6bBXwMdxucB3giHqXaErKpo+G3fuV3/Oir2DugNYhtXCgm5EQJpIQaI?= =?us-ascii?Q?B3ZgUh6GCJI/ubJh7G5LoOKZEjFaZsN8XwEhRNltgk+oufyJsbno9vwKmn/y?= =?us-ascii?Q?wpyKF89QNEQfhGZbXxAScwwIGFvYQqhoh8eVGI7gBvvEYuoVYeZxMUMVFyA3?= =?us-ascii?Q?ChkoIbJBk71P7IJXY+89ESgt/lt8WizfzcfG9mDfB02p4GncJWGOBGUn3bk2?= =?us-ascii?Q?IcmnFXhHqxOAFkWm5paVEKmOMVqumeHuqN1i1G/HxVIW2gLx+VuowLBfZAU4?= =?us-ascii?Q?OeQUlK7owdTxd3AkKMY7VWYdLRtc1AaW2bxqUXftZe4kyuDUfWkQkx5tbr0v?= =?us-ascii?Q?JwJE0rziae1YIdE6x1j5XxE98AKypysKESB/6p/hzNvxXCDvbYL8dXJETLbK?= =?us-ascii?Q?+w0IxC+eCXO0qDOiTMlksxvdaFRiT99GsZc7v3GOFZlEhT0ed4EloHJy7ehT?= =?us-ascii?Q?PQXWIOh2SEvUMFE=3D?= 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:(13230040)(1800799024)(82310400026)(376014)(36860700013)(13003099007)(7053199007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2025 08:03:07.6796 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 277394ab-a131-4b48-5762-08dd7673cc59 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: DS3PEPF000099DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6029 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 Hi, FYI, your patch has been queued to stable release 23.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/10/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=3adf29498e49d1be5bda18d84ef334b68f89bd23 Thanks. Xueming Li --- >From 3adf29498e49d1be5bda18d84ef334b68f89bd23 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Mon, 17 Feb 2025 13:54:08 +0000 Subject: [PATCH] net/ixgbe: fix crashes in secondary processes Cc: Xueming Li [ upstream commit c092ecb6d1d4cc27eebbcaf43c2ad35c4cfed4e1 ] Currently, the architecture of IXGBE base driver is such that it uses function pointers internally. These are not guaranteed to be valid in secondary processes, which can lead to crashes. This patch prevents IXGBE ethdev driver from calling into these functions. Bugzilla ID: 1575 Fixes: af75078fece3 ("first public release") Signed-off-by: Anatoly Burakov Acked-by: Bruce Richardson --- doc/guides/nics/ixgbe.rst | 14 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 242 +++++++++++++++++++++++++++++++ 2 files changed, 256 insertions(+) diff --git a/doc/guides/nics/ixgbe.rst b/doc/guides/nics/ixgbe.rst index 14573b542e..e32eff6244 100644 --- a/doc/guides/nics/ixgbe.rst +++ b/doc/guides/nics/ixgbe.rst @@ -459,3 +459,17 @@ show bypass config Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC:: testpmd> show bypass config (port_id) + + +Secondary Process Support +------------------------- + +IXGBE Physical Function Driver +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Control plane operations are currently not supported in secondary processes. + +IXGBE Virtual Function Driver +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Control plane operations are currently not supported in secondary processes. diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index f4ec485d69..b915b4c090 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2622,6 +2622,14 @@ ixgbe_dev_start(struct rte_eth_dev *dev) struct ixgbe_macsec_setting *macsec_setting = IXGBE_DEV_PRIVATE_TO_MACSEC_SETTING(dev->data->dev_private); + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + PMD_INIT_FUNC_TRACE(); /* Stop the link setup handler before resetting the HW. */ @@ -2910,6 +2918,14 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + ixgbe_dev_wait_setup_link_complete(dev, 0); /* disable interrupts */ @@ -2972,6 +2988,15 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (hw->mac.type == ixgbe_mac_82599EB) { #ifdef RTE_LIBRTE_IXGBE_BYPASS if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) { @@ -3003,6 +3028,15 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (hw->mac.type == ixgbe_mac_82599EB) { #ifdef RTE_LIBRTE_IXGBE_BYPASS if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) { @@ -3865,6 +3899,14 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) struct ixgbe_nvm_version nvm_ver; int ret; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + ixgbe_get_oem_prod_version(hw, &nvm_ver); if (nvm_ver.oem_valid) { snprintf(fw_version, fw_size, "%x.%x.%x", @@ -4765,6 +4807,14 @@ ixgbe_dev_led_on(struct rte_eth_dev *dev) { struct ixgbe_hw *hw; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); return ixgbe_led_on(hw, 0) == IXGBE_SUCCESS ? 0 : -ENOTSUP; } @@ -4774,6 +4824,14 @@ ixgbe_dev_led_off(struct rte_eth_dev *dev) { struct ixgbe_hw *hw; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); return ixgbe_led_off(hw, 0) == IXGBE_SUCCESS ? 0 : -ENOTSUP; } @@ -4847,6 +4905,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) ixgbe_fc_full }; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + PMD_INIT_FUNC_TRACE(); hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -5052,6 +5118,14 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p ixgbe_fc_full }; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + PMD_INIT_FUNC_TRACE(); ixgbe_dcb_unpack_map_cee(dcb_config, IXGBE_DCB_RX_CONFIG, map); @@ -5200,6 +5274,14 @@ ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t enable_addr = 1; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + return ixgbe_set_rar(hw, index, mac_addr->addr_bytes, pool, enable_addr); } @@ -5209,6 +5291,14 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return; + ixgbe_clear_rar(hw, index); } @@ -5217,6 +5307,14 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + ixgbe_remove_rar(dev, 0); ixgbe_add_rar(dev, addr, 0, pci_dev->max_vfs); @@ -5376,6 +5474,14 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) int err, mask = 0; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + PMD_INIT_FUNC_TRACE(); /* Stop the link setup handler before resetting the HW. */ @@ -5479,6 +5585,14 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = pci_dev->intr_handle; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (hw->adapter_stopped) return 0; @@ -5594,6 +5708,14 @@ ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) uint32_t vid_bit = 0; int ret = 0; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + PMD_INIT_FUNC_TRACE(); /* vind is not used in VF driver, set to 0, check ixgbe_set_vfta_vf */ @@ -5822,6 +5944,10 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t vec = IXGBE_MISC_VEC_ID; + /* device interrupts are only subscribed to in primary processes */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (rte_intr_allow_others(intr_handle)) vec = IXGBE_RX_VEC_START; intr->mask |= (1 << vec); @@ -5844,6 +5970,10 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) struct rte_intr_handle *intr_handle = pci_dev->intr_handle; uint32_t vec = IXGBE_MISC_VEC_ID; + /* device interrupts are only subscribed to in primary processes */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (rte_intr_allow_others(intr_handle)) vec = IXGBE_RX_VEC_START; intr->mask &= ~(1 << vec); @@ -5864,6 +5994,10 @@ ixgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) struct ixgbe_interrupt *intr = IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); + /* device interrupts are only subscribed to in primary processes */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (queue_id < 16) { ixgbe_disable_intr(hw); intr->mask |= (1 << queue_id); @@ -5891,6 +6025,10 @@ ixgbe_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) struct ixgbe_interrupt *intr = IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); + /* device interrupts are only subscribed to in primary processes */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (queue_id < 16) { ixgbe_disable_intr(hw); intr->mask &= ~(1 << queue_id); @@ -6168,6 +6306,14 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); int diag; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + /* * On a 82599 VF, adding again the same MAC addr is not an idempotent * operation. Trap this case to avoid exhausting the [very limited] @@ -6194,6 +6340,14 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) uint32_t i; int diag; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return; + /* * The IXGBE_VF_SET_MACVLAN command of the ixgbe-pf driver does * not support the deletion of a given MAC address. @@ -6234,6 +6388,14 @@ ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + hw->mac.ops.set_rar(hw, 0, (void *)addr, 0, 0); return 0; @@ -6420,6 +6582,14 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) uint32_t max_frame = mtu + IXGBE_ETH_OVERHEAD; struct rte_eth_dev_data *dev_data = dev->data; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (mtu < RTE_ETHER_MIN_MTU || max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN) @@ -6711,6 +6881,14 @@ ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, struct ixgbe_hw *hw; u8 *mc_addr_list; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); mc_addr_list = (u8 *)mc_addr_set; return ixgbe_update_mc_addr_list(hw, mc_addr_list, nb_mc_addr, @@ -7118,6 +7296,14 @@ ixgbe_get_eeprom(struct rte_eth_dev *dev, uint16_t *data = in_eeprom->data; int first, length; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + first = in_eeprom->offset >> 1; length = in_eeprom->length >> 1; if ((first > hw->eeprom.word_size) || @@ -7138,6 +7324,14 @@ ixgbe_set_eeprom(struct rte_eth_dev *dev, uint16_t *data = in_eeprom->data; int first, length; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + first = in_eeprom->offset >> 1; length = in_eeprom->length >> 1; if ((first > hw->eeprom.word_size) || @@ -7158,6 +7352,14 @@ ixgbe_get_module_info(struct rte_eth_dev *dev, uint8_t sff8472_rev, addr_mode; bool page_swap = false; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + /* Check whether we support SFF-8472 or not */ status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_SFF_8472_COMP, @@ -7203,6 +7405,14 @@ ixgbe_get_module_eeprom(struct rte_eth_dev *dev, uint8_t *data = info->data; uint32_t i = 0; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + for (i = info->offset; i < info->offset + info->length; i++) { if (i < RTE_ETH_MODULE_SFF_8079_LEN) status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte); @@ -7794,6 +8004,14 @@ ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev) struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); int ret; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + switch (hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC)) { case IXGBE_SUCCESS: ret = 0; @@ -7816,6 +8034,14 @@ ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) int mode = IXGBEVF_XCAST_MODE_NONE; int ret; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (dev->data->all_multicast) mode = IXGBEVF_XCAST_MODE_ALLMULTI; @@ -7841,6 +8067,14 @@ ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev) int ret; int mode = IXGBEVF_XCAST_MODE_ALLMULTI; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (dev->data->promiscuous) return 0; @@ -7865,6 +8099,14 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev) struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); int ret; + /* + * This function calls into the base driver, which in turn will use + * function pointers, which are not guaranteed to be valid in secondary + * processes, so avoid using this function in secondary processes. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + if (dev->data->promiscuous) return 0; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-04-08 15:39:06.508068193 +0800 +++ 0017-net-ixgbe-fix-crashes-in-secondary-processes.patch 2025-04-08 15:39:05.906436588 +0800 @@ -1 +1 @@ -From c092ecb6d1d4cc27eebbcaf43c2ad35c4cfed4e1 Mon Sep 17 00:00:00 2001 +From 3adf29498e49d1be5bda18d84ef334b68f89bd23 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit c092ecb6d1d4cc27eebbcaf43c2ad35c4cfed4e1 ] @@ -13 +15,0 @@ -Cc: stable@dpdk.org @@ -18,2 +20,2 @@ - doc/guides/nics/ixgbe.rst | 14 ++ - drivers/net/intel/ixgbe/ixgbe_ethdev.c | 242 +++++++++++++++++++++++++ + doc/guides/nics/ixgbe.rst | 14 ++ + drivers/net/ixgbe/ixgbe_ethdev.c | 242 +++++++++++++++++++++++++++++++ @@ -23 +25 @@ -index c5c6a6c34b..8dcde7ae1c 100644 +index 14573b542e..e32eff6244 100644 @@ -44,5 +46,5 @@ -diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c -index 6cb25778cc..b80d5894f8 100644 ---- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c -+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c -@@ -2630,6 +2630,14 @@ ixgbe_dev_start(struct rte_eth_dev *dev) +diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c +index f4ec485d69..b915b4c090 100644 +--- a/drivers/net/ixgbe/ixgbe_ethdev.c ++++ b/drivers/net/ixgbe/ixgbe_ethdev.c +@@ -2622,6 +2622,14 @@ ixgbe_dev_start(struct rte_eth_dev *dev) @@ -63 +65 @@ -@@ -2918,6 +2926,14 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) +@@ -2910,6 +2918,14 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) @@ -78 +80 @@ -@@ -2980,6 +2996,15 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev) +@@ -2972,6 +2988,15 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev) @@ -94 +96 @@ -@@ -3011,6 +3036,15 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev) +@@ -3003,6 +3028,15 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev) @@ -110 +112 @@ -@@ -3879,6 +3913,14 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) +@@ -3865,6 +3899,14 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) @@ -125 +127 @@ -@@ -4789,6 +4831,14 @@ ixgbe_dev_led_on(struct rte_eth_dev *dev) +@@ -4765,6 +4807,14 @@ ixgbe_dev_led_on(struct rte_eth_dev *dev) @@ -140 +142 @@ -@@ -4798,6 +4848,14 @@ ixgbe_dev_led_off(struct rte_eth_dev *dev) +@@ -4774,6 +4824,14 @@ ixgbe_dev_led_off(struct rte_eth_dev *dev) @@ -155 +157 @@ -@@ -4871,6 +4929,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -4847,6 +4905,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -170 +172 @@ -@@ -5076,6 +5142,14 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p +@@ -5052,6 +5118,14 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p @@ -185 +187 @@ -@@ -5224,6 +5298,14 @@ ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, +@@ -5200,6 +5274,14 @@ ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, @@ -200 +202 @@ -@@ -5233,6 +5315,14 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) +@@ -5209,6 +5291,14 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) @@ -215 +217 @@ -@@ -5241,6 +5331,14 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) +@@ -5217,6 +5307,14 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) @@ -230 +232 @@ -@@ -5400,6 +5498,14 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) +@@ -5376,6 +5474,14 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) @@ -245 +247 @@ -@@ -5503,6 +5609,14 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) +@@ -5479,6 +5585,14 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) @@ -260 +262 @@ -@@ -5618,6 +5732,14 @@ ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) +@@ -5594,6 +5708,14 @@ ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) @@ -275 +277 @@ -@@ -5846,6 +5968,10 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5822,6 +5944,10 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -286 +288 @@ -@@ -5868,6 +5994,10 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5844,6 +5970,10 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -297 +299 @@ -@@ -5888,6 +6018,10 @@ ixgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5864,6 +5994,10 @@ ixgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -308 +310 @@ -@@ -5915,6 +6049,10 @@ ixgbe_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5891,6 +6025,10 @@ ixgbe_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -319 +321 @@ -@@ -6194,6 +6332,14 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, +@@ -6168,6 +6306,14 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, @@ -334 +336 @@ -@@ -6220,6 +6366,14 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) +@@ -6194,6 +6340,14 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) @@ -349 +351 @@ -@@ -6260,6 +6414,14 @@ ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, +@@ -6234,6 +6388,14 @@ ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, @@ -364 +366 @@ -@@ -6446,6 +6608,14 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) +@@ -6420,6 +6582,14 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) @@ -379 +381 @@ -@@ -6737,6 +6907,14 @@ ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, +@@ -6711,6 +6881,14 @@ ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, @@ -394 +396 @@ -@@ -7157,6 +7335,14 @@ ixgbe_get_eeprom(struct rte_eth_dev *dev, +@@ -7118,6 +7296,14 @@ ixgbe_get_eeprom(struct rte_eth_dev *dev, @@ -409 +411 @@ -@@ -7177,6 +7363,14 @@ ixgbe_set_eeprom(struct rte_eth_dev *dev, +@@ -7138,6 +7324,14 @@ ixgbe_set_eeprom(struct rte_eth_dev *dev, @@ -424 +426 @@ -@@ -7197,6 +7391,14 @@ ixgbe_get_module_info(struct rte_eth_dev *dev, +@@ -7158,6 +7352,14 @@ ixgbe_get_module_info(struct rte_eth_dev *dev, @@ -439 +441 @@ -@@ -7242,6 +7444,14 @@ ixgbe_get_module_eeprom(struct rte_eth_dev *dev, +@@ -7203,6 +7405,14 @@ ixgbe_get_module_eeprom(struct rte_eth_dev *dev, @@ -454 +456 @@ -@@ -7837,6 +8047,14 @@ ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev) +@@ -7794,6 +8004,14 @@ ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev) @@ -469 +471 @@ -@@ -7859,6 +8077,14 @@ ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) +@@ -7816,6 +8034,14 @@ ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) @@ -484 +486 @@ -@@ -7884,6 +8110,14 @@ ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev) +@@ -7841,6 +8067,14 @@ ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev) @@ -499 +501 @@ -@@ -7908,6 +8142,14 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev) +@@ -7865,6 +8099,14 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)