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 7FBEA46364 for ; Fri, 7 Mar 2025 13:25:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 763934029E; Fri, 7 Mar 2025 13:25:12 +0100 (CET) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mails.dpdk.org (Postfix) with ESMTP id 8301240E40 for ; Fri, 7 Mar 2025 13:25:11 +0100 (CET) Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3912baafc58so1152213f8f.1 for ; Fri, 07 Mar 2025 04:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741350311; x=1741955111; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M5VuG0MYqJJ4xhcOEFxyln0IkBlbg1TxSkSKc2ElV48=; b=NcQU0QC0JatuRcCLCx5YFFEMJ8TwCf2cemnvHmP/QkKs7adyW2o6695Vaeu1mpLQ1m 0MT9avyIZTAZio0OX8k0G6fXgw8O3kLltRfv3NZAmtavsoT2/Obp5qOr2MZCt2OBFNyd tYEbCAOHlUellKkT2j7FrEH8CrtU8FbZO+q7Igw1e48uV6RjwTCw49SWPwN6BkbTAC+l EYV0mGN41cUECPwiH8NJ7VAjGggg9V8sWKW8Ug9TjB0g4hW9LakSxzV30WrH0fLoz3iM RIzvx6mUMCHlD+7z7CmDOJ6BzuCHH1cl0JVLXoS/YFeCLVqL/xxKotFbXIlTxoLDDvbd r91g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741350311; x=1741955111; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M5VuG0MYqJJ4xhcOEFxyln0IkBlbg1TxSkSKc2ElV48=; b=hcn04puqAARMjGG1Z0/OVNT1HgIfQz1JXQzkJl4s9IEcdxsC2vd3/bXBtALgrPsd4w CcNOSUqcH0wGTEkZoQ/W1IfAGd/4fYV4M+ohinAJHwlWAICFA9Pr/No7TI3VpDrtVuCr E5dtxIdS2mFGMh1kTm+4COgQiX6HgZhgFzBuSobUHgPVU4Pgk9LgpbCT5brz5//uyGrS AYqiYtISJ2heynIk4cXM3oljpwvU6BOVmYQLzJYNv0r0GU7OoE9GyMwqQtXtFW2qu9Lq vSoXZmLWgwyJW3aF/RhCN3FwsGmE6SxZ72HNOfuzCHDijAPE0Wd9Cy9zTJ5Iwm9liW2n 91kQ== X-Forwarded-Encrypted: i=1; AJvYcCWqc2eLRWgqixSfv24jtdiqSTQwfIrSA+RO9zXeEnBJJlzUiRrJnTKONe7bNdjsJLb4kJneQ0s=@dpdk.org X-Gm-Message-State: AOJu0YxbmwkEnTJu0zcxGrKBtQEJUJ5xX8hoxm0JSfp8thcSARAf+O8P TpIypPdKNscCg4EebteN54w4XkVTZV2k0FFZAIZyMMj1dGZjZEv85JMBHHzp X-Gm-Gg: ASbGncs0h1VfUtCqodhiQI8/h4nCL5VuJVDv4a3/TD5Z0cHcYZ2d1LvSy6u1tIgFh+m D02hZkUKf682K/mwC/FJcXrb8wXy6S7TFRAUpyQSBQwEW0U4RH1bA1ltYCy9clfbzo9OjtoA+bi YTG/esfc1r2Aj+6jEPNpmw62l9Nchch9ztyeph+PZY3c0ILucL1sklLi0C/Bi2BApx1/9Cnii/9 ljn/p88mUySUrT0JG7qzDeTSfbhH1qVrmLy5Rkh7+RBLlmq6CmGR+pkfJCWJYwKRpnm0q1KnhTm 6BgwvZgCsqlhKdWCcPayJhx0LgTmRVfbLiuYBIY2i0+8TQee+Vg= X-Google-Smtp-Source: AGHT+IHo66ihEAVpv3ycOgSQTIWG4/K72BglFTEFuJ7g8Ct5pmI6RhBcQi3TBd70SiXosN6IU+FG8Q== X-Received: by 2002:a5d:6d8c:0:b0:390:dfa1:3448 with SMTP id ffacd0b85a97d-39132dbb23emr2539572f8f.43.1741350310961; Fri, 07 Mar 2025 04:25:10 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:ff31:f049:bd38:f7cf]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3912c0e2eecsm5156476f8f.79.2025.03.07.04.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 04:25:10 -0800 (PST) From: luca.boccassi@gmail.com To: Anatoly Burakov Cc: Bruce Richardson , dpdk stable Subject: patch 'net/ixgbe: fix crashes in secondary processes' has been queued to stable release 22.11.8 Date: Fri, 7 Mar 2025 12:24:13 +0000 Message-ID: <20250307122431.1415551-14-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250307122431.1415551-1-luca.boccassi@gmail.com> References: <20250217170456.1068278-79-luca.boccassi@gmail.com> <20250307122431.1415551-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22.11.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/09/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://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/4ce53784b3b30f8f48f798cdb6cf8bb578206638 Thanks. Luca Boccassi --- >From 4ce53784b3b30f8f48f798cdb6cf8bb578206638 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 [ 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 a3a19a0f49..f8eedb4c7f 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 99986aa1d4..c1211c2e59 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2621,6 +2621,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. */ @@ -2909,6 +2917,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 */ @@ -2971,6 +2987,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) { @@ -3002,6 +3027,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) { @@ -3864,6 +3898,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", @@ -4762,6 +4804,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; } @@ -4771,6 +4821,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; } @@ -4844,6 +4902,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); @@ -5049,6 +5115,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); @@ -5197,6 +5271,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); } @@ -5206,6 +5288,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); } @@ -5214,6 +5304,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); @@ -5373,6 +5471,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. */ @@ -5476,6 +5582,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; @@ -5591,6 +5705,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 */ @@ -5819,6 +5941,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); @@ -5841,6 +5967,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); @@ -5861,6 +5991,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); @@ -5888,6 +6022,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); @@ -6164,6 +6302,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] @@ -6190,6 +6336,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. @@ -6230,6 +6384,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; @@ -6416,6 +6578,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) @@ -6707,6 +6877,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, @@ -7114,6 +7292,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) || @@ -7134,6 +7320,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) || @@ -7154,6 +7348,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, @@ -7199,6 +7401,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); @@ -7790,6 +8000,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; @@ -7812,6 +8030,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; @@ -7837,6 +8063,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; @@ -7861,6 +8095,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.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-03-07 12:23:38.545091525 +0000 +++ 0014-net-ixgbe-fix-crashes-in-secondary-processes.patch 2025-03-07 12:23:38.010838410 +0000 @@ -1 +1 @@ -From c092ecb6d1d4cc27eebbcaf43c2ad35c4cfed4e1 Mon Sep 17 00:00:00 2001 +From 4ce53784b3b30f8f48f798cdb6cf8bb578206638 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c092ecb6d1d4cc27eebbcaf43c2ad35c4cfed4e1 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -18,2 +19,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 +24 @@ -index c5c6a6c34b..8dcde7ae1c 100644 +index a3a19a0f49..f8eedb4c7f 100644 @@ -44,5 +45,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 99986aa1d4..c1211c2e59 100644 +--- a/drivers/net/ixgbe/ixgbe_ethdev.c ++++ b/drivers/net/ixgbe/ixgbe_ethdev.c +@@ -2621,6 +2621,14 @@ ixgbe_dev_start(struct rte_eth_dev *dev) @@ -63 +64 @@ -@@ -2918,6 +2926,14 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) +@@ -2909,6 +2917,14 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) @@ -78 +79 @@ -@@ -2980,6 +2996,15 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev) +@@ -2971,6 +2987,15 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev) @@ -94 +95 @@ -@@ -3011,6 +3036,15 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev) +@@ -3002,6 +3027,15 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev) @@ -110 +111 @@ -@@ -3879,6 +3913,14 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) +@@ -3864,6 +3898,14 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) @@ -125 +126 @@ -@@ -4789,6 +4831,14 @@ ixgbe_dev_led_on(struct rte_eth_dev *dev) +@@ -4762,6 +4804,14 @@ ixgbe_dev_led_on(struct rte_eth_dev *dev) @@ -140 +141 @@ -@@ -4798,6 +4848,14 @@ ixgbe_dev_led_off(struct rte_eth_dev *dev) +@@ -4771,6 +4821,14 @@ ixgbe_dev_led_off(struct rte_eth_dev *dev) @@ -155 +156 @@ -@@ -4871,6 +4929,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -4844,6 +4902,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -170 +171 @@ -@@ -5076,6 +5142,14 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p +@@ -5049,6 +5115,14 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p @@ -185 +186 @@ -@@ -5224,6 +5298,14 @@ ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, +@@ -5197,6 +5271,14 @@ ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, @@ -200 +201 @@ -@@ -5233,6 +5315,14 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) +@@ -5206,6 +5288,14 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) @@ -215 +216 @@ -@@ -5241,6 +5331,14 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) +@@ -5214,6 +5304,14 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) @@ -230 +231 @@ -@@ -5400,6 +5498,14 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) +@@ -5373,6 +5471,14 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) @@ -245 +246 @@ -@@ -5503,6 +5609,14 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) +@@ -5476,6 +5582,14 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) @@ -260 +261 @@ -@@ -5618,6 +5732,14 @@ ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) +@@ -5591,6 +5705,14 @@ ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) @@ -275 +276 @@ -@@ -5846,6 +5968,10 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5819,6 +5941,10 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -286 +287 @@ -@@ -5868,6 +5994,10 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5841,6 +5967,10 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -297 +298 @@ -@@ -5888,6 +6018,10 @@ ixgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5861,6 +5991,10 @@ ixgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -308 +309 @@ -@@ -5915,6 +6049,10 @@ ixgbe_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5888,6 +6022,10 @@ ixgbe_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -319 +320 @@ -@@ -6194,6 +6332,14 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, +@@ -6164,6 +6302,14 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, @@ -334 +335 @@ -@@ -6220,6 +6366,14 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) +@@ -6190,6 +6336,14 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) @@ -349 +350 @@ -@@ -6260,6 +6414,14 @@ ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, +@@ -6230,6 +6384,14 @@ ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, @@ -364 +365 @@ -@@ -6446,6 +6608,14 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) +@@ -6416,6 +6578,14 @@ ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) @@ -379 +380 @@ -@@ -6737,6 +6907,14 @@ ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, +@@ -6707,6 +6877,14 @@ ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, @@ -394 +395 @@ -@@ -7157,6 +7335,14 @@ ixgbe_get_eeprom(struct rte_eth_dev *dev, +@@ -7114,6 +7292,14 @@ ixgbe_get_eeprom(struct rte_eth_dev *dev, @@ -409 +410 @@ -@@ -7177,6 +7363,14 @@ ixgbe_set_eeprom(struct rte_eth_dev *dev, +@@ -7134,6 +7320,14 @@ ixgbe_set_eeprom(struct rte_eth_dev *dev, @@ -424 +425 @@ -@@ -7197,6 +7391,14 @@ ixgbe_get_module_info(struct rte_eth_dev *dev, +@@ -7154,6 +7348,14 @@ ixgbe_get_module_info(struct rte_eth_dev *dev, @@ -439 +440 @@ -@@ -7242,6 +7444,14 @@ ixgbe_get_module_eeprom(struct rte_eth_dev *dev, +@@ -7199,6 +7401,14 @@ ixgbe_get_module_eeprom(struct rte_eth_dev *dev, @@ -454 +455 @@ -@@ -7837,6 +8047,14 @@ ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev) +@@ -7790,6 +8000,14 @@ ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev) @@ -469 +470 @@ -@@ -7859,6 +8077,14 @@ ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) +@@ -7812,6 +8030,14 @@ ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) @@ -484 +485 @@ -@@ -7884,6 +8110,14 @@ ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev) +@@ -7837,6 +8063,14 @@ ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev) @@ -499 +500 @@ -@@ -7908,6 +8142,14 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev) +@@ -7861,6 +8095,14 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)