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 42E5246364 for ; Fri, 7 Mar 2025 13:25:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 370E940E3A; Fri, 7 Mar 2025 13:25:11 +0100 (CET) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id 4FFE640E35 for ; Fri, 7 Mar 2025 13:25:10 +0100 (CET) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-43bcad638efso10515475e9.2 for ; Fri, 07 Mar 2025 04:25:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741350310; x=1741955110; 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=tw5ZBAL2xRapZP9KoAzwGXZ/MK7TpEri1vidIsd4tb8=; b=DPc6s5yk9kgPuouGprWwKYXe+zzHy5lMZETqwJTNdTv31Vr8TwjRX0npfqF7VPlbvs XOfM1fUxifj/USdycx/9K7pyMZq8HSSTVXIWUISmyDyTnaSEV+T90sQnrSTyhbcnrx+M LJXM1VaLxpLCOhepGEtKvjKcKCVJXeFReDQYl1fnpuBAGfHWksx2vZSOf5qoADNlU1ld UU4v8YAON3oD7Sq/tvHlapddcSdcCI7w3O1IWwEqDKbVHcoEtQyv7LieEnvMNBdcItBE rCEPLKbLRWuy5WT6V9kEPQfPur6r2vwbjalwnRE+GQsm29KPPJda4IgoT0PYDvMtuYix T3dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741350310; x=1741955110; 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=tw5ZBAL2xRapZP9KoAzwGXZ/MK7TpEri1vidIsd4tb8=; b=pKRU2B+MavoDhDoUo4Dk8nVDPJS+BDHshFkPmSkr5+hM13bChKr3k9TVTAbZ+/kxrl TE7WUBIKnzsXjwjhmWOsBGYctkz/X8sXw6r+mEO/XDlB/zK123SfyQmJd2B8rKMAlHqE cvOUoVfcrCnKJUH/DnDhfOz9j0qLfqQhT2jxgbnYcMAKF4k5oqUhGeolj1KZPHbtImsi jcBftl2CAQESW4UhujPCJ8xEMMmc3u8fe9xB77G/YgtfOJAo+HeCJoB9rxnMv3MUsDit Aez2v1W687ZtKnbeDcpMfzaBx+HzYy2DKC1P0Vk7HmqLv4+j0qo09D5QLF1NbgtrwXPA LOjg== X-Forwarded-Encrypted: i=1; AJvYcCVsuMzAtpeyout1GvJF8hcVF3KqFWW6VlEzisysH1B5Nrda5t8hPNuGlJ5WvALD5InsoM6xsFU=@dpdk.org X-Gm-Message-State: AOJu0YzK0y8kSfqWsgQKr/ML8ciqUsl6edFhgULWLaxhtP5ja3lQBOUR 3F4Y+c+YZ50LM70lNNlgd0OVkh01HHYRIsHqSL81Dcr0E+EYltJVeV5EJJl0 X-Gm-Gg: ASbGncsKW/tGEee2vrOPh599ZzMj5E70pYRjFOSnNAc4TxMGItDrlJQ2nzTPR387r0L WQtSLnB1iv2LHXf5PM3vDZW/OenF31WgH7BYuATDo7mtG0SPgqLgS2l1tBb2of2KLoajXFQOym/ GomkD+K9BKtQ8xKpFUriwOVnPbzeskycGtArIaxFAJI3LppZcYpKmUON02Izj6Dz1AxGKk/+2u7 LoitnfgZvdf1yZ3xjFSN7f+uWweusKCSeEZ6DQUpqUugoKQ7BAQQuJR4Z87rCuEMCLk56gDESem tpGEnltfqxlCtpqDSwVVEBF3BqYQLE9mxdplJiZGoJKsbexvJzY= X-Google-Smtp-Source: AGHT+IEC6UcPIO83Er/GhyUjD82XKaAom0AVyfyYgGb0tNQgvJuATEzfa/FO2pP4oIVbhfIvcmEYYQ== X-Received: by 2002:a05:600c:45d1:b0:43b:d0fe:b8ac with SMTP id 5b1f17b1804b1-43c686f96a0mr24834615e9.30.1741350309434; Fri, 07 Mar 2025 04:25:09 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:ff31:f049:bd38:f7cf]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-43bdd8de4ffsm50305935e9.24.2025.03.07.04.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 04:25:08 -0800 (PST) From: luca.boccassi@gmail.com To: Anatoly Burakov Cc: Bruce Richardson , dpdk stable Subject: patch 'net/e1000: fix crashes in secondary processes' has been queued to stable release 22.11.8 Date: Fri, 7 Mar 2025 12:24:12 +0000 Message-ID: <20250307122431.1415551-13-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/ce45f96ea2efb031223e66b22f134ef2e53c7b36 Thanks. Luca Boccassi --- >From ce45f96ea2efb031223e66b22f134ef2e53c7b36 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Mon, 17 Feb 2025 13:54:05 +0000 Subject: [PATCH] net/e1000: fix crashes in secondary processes [ upstream commit b0ef6e7a970bc745537c5b5140d838431f118c5e ] Currently, the architecture of e1000 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 EM, IGB and IGC ethdev drivers from calling into these functions from secondary processes Fixes: af75078fece3 ("first public release") Fixes: 805803445a02 ("e1000: support EM devices (also known as e1000/e1000e)") Fixes: 4f09bc55ac3d ("net/igc: implement device base operations") Signed-off-by: Anatoly Burakov Acked-by: Bruce Richardson --- doc/guides/nics/e1000em.rst | 5 + doc/guides/nics/igb.rst | 12 +++ doc/guides/nics/igc.rst | 5 + drivers/net/e1000/em_ethdev.c | 80 +++++++++++++++ drivers/net/e1000/igb_ethdev.c | 176 +++++++++++++++++++++++++++++++++ drivers/net/igc/igc_ethdev.c | 81 +++++++++++++++ 6 files changed, 359 insertions(+) diff --git a/doc/guides/nics/e1000em.rst b/doc/guides/nics/e1000em.rst index 5e752a29e5..ed4f57e9c6 100644 --- a/doc/guides/nics/e1000em.rst +++ b/doc/guides/nics/e1000em.rst @@ -153,3 +153,8 @@ The following are known limitations: #. Qemu e1000 only supports one interrupt source, so link and Rx interrupt should be exclusive. #. Qemu e1000 does not support interrupt auto-clear, application should disable interrupt immediately when woken up. + +Secondary Process Support +------------------------- + +Control plane operations are currently not supported in secondary processes. diff --git a/doc/guides/nics/igb.rst b/doc/guides/nics/igb.rst index 8231f9eef4..76314f809b 100644 --- a/doc/guides/nics/igb.rst +++ b/doc/guides/nics/igb.rst @@ -23,6 +23,18 @@ Features of the IGB PMD are: * TCP segmentation offload * Jumbo frames supported +Secondary Process Support +------------------------- + +IGB Physical Function Driver +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Control plane operations are currently not supported in secondary processes. + +IGB Virtual Function Driver +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Control plane operations are currently not supported in secondary processes. Limitations or Known issues --------------------------- diff --git a/doc/guides/nics/igc.rst b/doc/guides/nics/igc.rst index 399d2d650c..e23dc46ea7 100644 --- a/doc/guides/nics/igc.rst +++ b/doc/guides/nics/igc.rst @@ -104,3 +104,8 @@ Add a rule to enable ipv4-udp RSS: .. code-block:: console testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp end / end + +Secondary Process Support +------------------------- + +Control plane operations are currently not supported in secondary processes. diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index efe3665cec..e74a58fbcf 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -532,6 +532,14 @@ eth_em_start(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; + ret = eth_em_stop(dev); if (ret != 0) return ret; @@ -716,6 +724,14 @@ eth_em_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; + dev->data->dev_started = 0; eth_em_rxtx_control(dev, false); @@ -1003,6 +1019,10 @@ eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __rte_unused uint16_t queue struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = pci_dev->intr_handle; + /* device interrupts are only subscribed to in primary processes */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -E_RTE_SECONDARY; + em_rxq_intr_enable(hw); rte_intr_ack(intr_handle); @@ -1014,6 +1034,10 @@ eth_em_rx_queue_intr_disable(struct rte_eth_dev *dev, __rte_unused uint16_t queu { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(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; + em_rxq_intr_disable(hw); return 0; @@ -1639,6 +1663,14 @@ eth_em_led_on(struct rte_eth_dev *dev) { struct e1000_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 = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); return e1000_led_on(hw) == E1000_SUCCESS ? 0 : -ENOTSUP; } @@ -1648,6 +1680,14 @@ eth_em_led_off(struct rte_eth_dev *dev) { struct e1000_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 = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); return e1000_led_off(hw) == E1000_SUCCESS ? 0 : -ENOTSUP; } @@ -1709,6 +1749,14 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) uint32_t max_high_water; uint32_t rctl; + /* + * 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 = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (fc_conf->autoneg != hw->mac.autoneg) return -ENOTSUP; @@ -1760,6 +1808,14 @@ eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, { struct e1000_hw *hw = E1000_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; + return e1000_rar_set(hw, mac_addr->addr_bytes, index); } @@ -1769,6 +1825,14 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index) uint8_t addr[RTE_ETHER_ADDR_LEN]; struct e1000_hw *hw = E1000_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; + memset(addr, 0, sizeof(addr)); e1000_rar_set(hw, addr, index); @@ -1778,6 +1842,14 @@ static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { + /* + * 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; + eth_em_rar_clear(dev, 0); return eth_em_rar_set(dev, (void *)addr, 0, 0); @@ -1822,6 +1894,14 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev, { struct e1000_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 = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); e1000_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr); return 0; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index e9ad558c82..79d001e69a 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -1206,6 +1206,14 @@ eth_igb_start(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; + /* disable uio/vfio intr/eventfd mapping */ rte_intr_disable(intr_handle); @@ -1421,6 +1429,14 @@ eth_igb_stop(struct rte_eth_dev *dev) struct e1000_adapter *adapter = E1000_DEV_PRIVATE(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 (adapter->stopped) return 0; @@ -1474,6 +1490,14 @@ eth_igb_dev_set_link_up(struct rte_eth_dev *dev) { struct e1000_hw *hw = E1000_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->phy.media_type == e1000_media_type_copper) e1000_power_up_phy(hw); else @@ -1487,6 +1511,14 @@ eth_igb_dev_set_link_down(struct rte_eth_dev *dev) { struct e1000_hw *hw = E1000_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->phy.media_type == e1000_media_type_copper) e1000_power_down_phy(hw); else @@ -2108,6 +2140,14 @@ eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, struct e1000_fw_version fw; 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; + e1000_get_fw_version(hw, &fw); switch (hw->mac.type) { @@ -2355,6 +2395,14 @@ eth_igb_link_update(struct rte_eth_dev *dev, int wait_to_complete) struct rte_eth_link link; int link_check, count; + /* + * 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; + link_check = 0; hw->mac.get_link_status = 1; @@ -2977,6 +3025,14 @@ eth_igb_led_on(struct rte_eth_dev *dev) { struct e1000_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 = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); return e1000_led_on(hw) == E1000_SUCCESS ? 0 : -ENOTSUP; } @@ -2986,6 +3042,14 @@ eth_igb_led_off(struct rte_eth_dev *dev) { struct e1000_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 = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); return e1000_led_off(hw) == E1000_SUCCESS ? 0 : -ENOTSUP; } @@ -3048,6 +3112,14 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) uint32_t rctl; uint32_t ctrl; + /* + * 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 = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (fc_conf->autoneg != hw->mac.autoneg) return -ENOTSUP; @@ -3134,6 +3206,14 @@ eth_igb_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t rah; + /* + * 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; + e1000_rar_set(hw, mac_addr->addr_bytes, index); rah = E1000_READ_REG(hw, E1000_RAH(index)); rah |= (0x1 << (E1000_RAH_POOLSEL_SHIFT + pool)); @@ -3147,6 +3227,14 @@ eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) uint8_t addr[RTE_ETHER_ADDR_LEN]; struct e1000_hw *hw = E1000_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; + memset(addr, 0, sizeof(addr)); e1000_rar_set(hw, addr, index); @@ -3156,6 +3244,14 @@ static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { + /* + * 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; + eth_igb_rar_clear(dev, 0); eth_igb_rar_set(dev, (void *)addr, 0, 0); @@ -3289,6 +3385,14 @@ igbvf_dev_start(struct rte_eth_dev *dev) int ret; uint32_t intr_vector = 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(); hw->mac.ops.reset_hw(hw); @@ -3345,6 +3449,14 @@ igbvf_dev_stop(struct rte_eth_dev *dev) struct e1000_adapter *adapter = E1000_DEV_PRIVATE(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 (adapter->stopped) return 0; @@ -3417,6 +3529,14 @@ igbvf_promiscuous_enable(struct rte_eth_dev *dev) { struct e1000_hw *hw = E1000_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; + /* Set both unicast and multicast promisc */ e1000_promisc_set_vf(hw, e1000_promisc_enabled); @@ -3428,6 +3548,14 @@ igbvf_promiscuous_disable(struct rte_eth_dev *dev) { struct e1000_hw *hw = E1000_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 in allmulticast mode leave multicast promisc */ if (dev->data->all_multicast == 1) e1000_promisc_set_vf(hw, e1000_promisc_multicast); @@ -3442,6 +3570,14 @@ igbvf_allmulticast_enable(struct rte_eth_dev *dev) { struct e1000_hw *hw = E1000_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; + /* In promiscuous mode multicast promisc already set */ if (dev->data->promiscuous == 0) e1000_promisc_set_vf(hw, e1000_promisc_multicast); @@ -3454,6 +3590,14 @@ igbvf_allmulticast_disable(struct rte_eth_dev *dev) { struct e1000_hw *hw = E1000_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; + /* In promiscuous mode leave multicast promisc enabled */ if (dev->data->promiscuous == 0) e1000_promisc_set_vf(hw, e1000_promisc_disabled); @@ -4557,6 +4701,14 @@ eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, { struct e1000_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 = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); e1000_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr); return 0; @@ -4986,6 +5138,14 @@ eth_igb_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->nvm.word_size) || @@ -5010,6 +5170,14 @@ eth_igb_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->nvm.word_size) || @@ -5110,6 +5278,10 @@ eth_igb_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 = E1000_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 = E1000_RX_VEC_START; @@ -5130,6 +5302,10 @@ eth_igb_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) struct rte_intr_handle *intr_handle = pci_dev->intr_handle; uint32_t vec = E1000_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 = E1000_RX_VEC_START; diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c index dcd262f0cf..ce1f425eaf 100644 --- a/drivers/net/igc/igc_ethdev.c +++ b/drivers/net/igc/igc_ethdev.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "igc_logs.h" #include "igc_txrx.h" @@ -357,6 +358,14 @@ eth_igc_set_link_up(struct rte_eth_dev *dev) { struct igc_hw *hw = IGC_DEV_PRIVATE_HW(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; + if (hw->phy.media_type == igc_media_type_copper) igc_power_up_phy(hw); else @@ -369,6 +378,14 @@ eth_igc_set_link_down(struct rte_eth_dev *dev) { struct igc_hw *hw = IGC_DEV_PRIVATE_HW(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; + if (hw->phy.media_type == igc_media_type_copper) igc_power_down_phy(hw); else @@ -442,6 +459,14 @@ eth_igc_link_update(struct rte_eth_dev *dev, int wait_to_complete) struct rte_eth_link link; int link_check, count; + /* + * 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; + link_check = 0; hw->mac.get_link_status = 1; @@ -619,6 +644,14 @@ eth_igc_stop(struct rte_eth_dev *dev) struct rte_intr_handle *intr_handle = pci_dev->intr_handle; struct rte_eth_link link; + /* + * 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; + dev->data->dev_started = 0; adapter->stopped = 1; @@ -925,6 +958,14 @@ eth_igc_start(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; + /* disable all MSI-X interrupts */ IGC_WRITE_REG(hw, IGC_EIMC, 0x1f); IGC_WRITE_FLUSH(hw); @@ -1459,6 +1500,14 @@ eth_igc_fw_version_get(struct rte_eth_dev *dev, char *fw_version, struct igc_fw_version fw; 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; + igc_get_fw_version(hw, &fw); /* if option rom is valid, display its version too */ @@ -1549,6 +1598,14 @@ eth_igc_led_on(struct rte_eth_dev *dev) { struct igc_hw *hw = IGC_DEV_PRIVATE_HW(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; + return igc_led_on(hw) == IGC_SUCCESS ? 0 : -ENOTSUP; } @@ -1557,6 +1614,14 @@ eth_igc_led_off(struct rte_eth_dev *dev) { struct igc_hw *hw = IGC_DEV_PRIVATE_HW(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; + return igc_led_off(hw) == IGC_SUCCESS ? 0 : -ENOTSUP; } @@ -2099,6 +2164,10 @@ eth_igc_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 = IGC_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 = IGC_RX_VEC_START; @@ -2118,6 +2187,10 @@ eth_igc_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) struct rte_intr_handle *intr_handle = pci_dev->intr_handle; uint32_t vec = IGC_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 = IGC_RX_VEC_START; @@ -2181,6 +2254,14 @@ eth_igc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) uint32_t rctl; int err; + /* + * 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 (fc_conf->autoneg != hw->mac.autoneg) return -ENOTSUP; -- 2.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-03-07 12:23:38.506248723 +0000 +++ 0013-net-e1000-fix-crashes-in-secondary-processes.patch 2025-03-07 12:23:38.006838293 +0000 @@ -1 +1 @@ -From b0ef6e7a970bc745537c5b5140d838431f118c5e Mon Sep 17 00:00:00 2001 +From ce45f96ea2efb031223e66b22f134ef2e53c7b36 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b0ef6e7a970bc745537c5b5140d838431f118c5e ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -20,7 +21,7 @@ - doc/guides/nics/e1000em.rst | 5 + - doc/guides/nics/igb.rst | 13 ++ - doc/guides/nics/igc.rst | 5 + - drivers/net/intel/e1000/em_ethdev.c | 80 ++++++++++++ - drivers/net/intel/e1000/igb_ethdev.c | 176 +++++++++++++++++++++++++++ - drivers/net/intel/e1000/igc_ethdev.c | 97 +++++++++++++++ - 6 files changed, 376 insertions(+) + doc/guides/nics/e1000em.rst | 5 + + doc/guides/nics/igb.rst | 12 +++ + doc/guides/nics/igc.rst | 5 + + drivers/net/e1000/em_ethdev.c | 80 +++++++++++++++ + drivers/net/e1000/igb_ethdev.c | 176 +++++++++++++++++++++++++++++++++ + drivers/net/igc/igc_ethdev.c | 81 +++++++++++++++ + 6 files changed, 359 insertions(+) @@ -42 +43 @@ -index e3a91c316b..3f7a4156ff 100644 +index 8231f9eef4..76314f809b 100644 @@ -45,2 +46 @@ -@@ -31,3 +31,16 @@ Features of the IGB PMD are: - * Checksum offload +@@ -23,6 +23,18 @@ Features of the IGB PMD are: @@ -49 +49 @@ -+ + @@ -61,0 +62,3 @@ + + Limitations or Known issues + --------------------------- @@ -63 +66 @@ -index c267431c5f..9790b58102 100644 +index 399d2d650c..e23dc46ea7 100644 @@ -75,5 +78,5 @@ -diff --git a/drivers/net/intel/e1000/em_ethdev.c b/drivers/net/intel/e1000/em_ethdev.c -index bd3f7e44df..39dddf3384 100644 ---- a/drivers/net/intel/e1000/em_ethdev.c -+++ b/drivers/net/intel/e1000/em_ethdev.c -@@ -573,6 +573,14 @@ eth_em_start(struct rte_eth_dev *dev) +diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c +index efe3665cec..e74a58fbcf 100644 +--- a/drivers/net/e1000/em_ethdev.c ++++ b/drivers/net/e1000/em_ethdev.c +@@ -532,6 +532,14 @@ eth_em_start(struct rte_eth_dev *dev) @@ -94 +97 @@ -@@ -757,6 +765,14 @@ eth_em_stop(struct rte_eth_dev *dev) +@@ -716,6 +724,14 @@ eth_em_stop(struct rte_eth_dev *dev) @@ -109 +112 @@ -@@ -1048,6 +1064,10 @@ eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __rte_unused uint16_t queue +@@ -1003,6 +1019,10 @@ eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __rte_unused uint16_t queue @@ -120 +123 @@ -@@ -1059,6 +1079,10 @@ eth_em_rx_queue_intr_disable(struct rte_eth_dev *dev, __rte_unused uint16_t queu +@@ -1014,6 +1034,10 @@ eth_em_rx_queue_intr_disable(struct rte_eth_dev *dev, __rte_unused uint16_t queu @@ -131 +134 @@ -@@ -1688,6 +1712,14 @@ eth_em_led_on(struct rte_eth_dev *dev) +@@ -1639,6 +1663,14 @@ eth_em_led_on(struct rte_eth_dev *dev) @@ -146 +149 @@ -@@ -1697,6 +1729,14 @@ eth_em_led_off(struct rte_eth_dev *dev) +@@ -1648,6 +1680,14 @@ eth_em_led_off(struct rte_eth_dev *dev) @@ -161 +164 @@ -@@ -1758,6 +1798,14 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -1709,6 +1749,14 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -176 +179 @@ -@@ -1809,6 +1857,14 @@ eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, +@@ -1760,6 +1808,14 @@ eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, @@ -191 +194 @@ -@@ -1818,6 +1874,14 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index) +@@ -1769,6 +1825,14 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index) @@ -206 +209 @@ -@@ -1827,6 +1891,14 @@ static int +@@ -1778,6 +1842,14 @@ static int @@ -221 +224 @@ -@@ -1871,6 +1943,14 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev, +@@ -1822,6 +1894,14 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev, @@ -236,5 +239,5 @@ -diff --git a/drivers/net/intel/e1000/igb_ethdev.c b/drivers/net/intel/e1000/igb_ethdev.c -index be3123572f..cbd2f15f5f 100644 ---- a/drivers/net/intel/e1000/igb_ethdev.c -+++ b/drivers/net/intel/e1000/igb_ethdev.c -@@ -1248,6 +1248,14 @@ eth_igb_start(struct rte_eth_dev *dev) +diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c +index e9ad558c82..79d001e69a 100644 +--- a/drivers/net/e1000/igb_ethdev.c ++++ b/drivers/net/e1000/igb_ethdev.c +@@ -1206,6 +1206,14 @@ eth_igb_start(struct rte_eth_dev *dev) @@ -255 +258 @@ -@@ -1471,6 +1479,14 @@ eth_igb_stop(struct rte_eth_dev *dev) +@@ -1421,6 +1429,14 @@ eth_igb_stop(struct rte_eth_dev *dev) @@ -270 +273 @@ -@@ -1524,6 +1540,14 @@ eth_igb_dev_set_link_up(struct rte_eth_dev *dev) +@@ -1474,6 +1490,14 @@ eth_igb_dev_set_link_up(struct rte_eth_dev *dev) @@ -285 +288 @@ -@@ -1537,6 +1561,14 @@ eth_igb_dev_set_link_down(struct rte_eth_dev *dev) +@@ -1487,6 +1511,14 @@ eth_igb_dev_set_link_down(struct rte_eth_dev *dev) @@ -300 +303 @@ -@@ -2158,6 +2190,14 @@ eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, +@@ -2108,6 +2140,14 @@ eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, @@ -315 +318 @@ -@@ -2406,6 +2446,14 @@ eth_igb_link_update(struct rte_eth_dev *dev, int wait_to_complete) +@@ -2355,6 +2395,14 @@ eth_igb_link_update(struct rte_eth_dev *dev, int wait_to_complete) @@ -330 +333 @@ -@@ -3028,6 +3076,14 @@ eth_igb_led_on(struct rte_eth_dev *dev) +@@ -2977,6 +3025,14 @@ eth_igb_led_on(struct rte_eth_dev *dev) @@ -345 +348 @@ -@@ -3037,6 +3093,14 @@ eth_igb_led_off(struct rte_eth_dev *dev) +@@ -2986,6 +3042,14 @@ eth_igb_led_off(struct rte_eth_dev *dev) @@ -360 +363 @@ -@@ -3099,6 +3163,14 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -3048,6 +3112,14 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -375 +378 @@ -@@ -3185,6 +3257,14 @@ eth_igb_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, +@@ -3134,6 +3206,14 @@ eth_igb_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, @@ -390 +393 @@ -@@ -3198,6 +3278,14 @@ eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) +@@ -3147,6 +3227,14 @@ eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) @@ -405 +408 @@ -@@ -3207,6 +3295,14 @@ static int +@@ -3156,6 +3244,14 @@ static int @@ -420 +423 @@ -@@ -3340,6 +3436,14 @@ igbvf_dev_start(struct rte_eth_dev *dev) +@@ -3289,6 +3385,14 @@ igbvf_dev_start(struct rte_eth_dev *dev) @@ -435 +438 @@ -@@ -3396,6 +3500,14 @@ igbvf_dev_stop(struct rte_eth_dev *dev) +@@ -3345,6 +3449,14 @@ igbvf_dev_stop(struct rte_eth_dev *dev) @@ -450 +453 @@ -@@ -3468,6 +3580,14 @@ igbvf_promiscuous_enable(struct rte_eth_dev *dev) +@@ -3417,6 +3529,14 @@ igbvf_promiscuous_enable(struct rte_eth_dev *dev) @@ -465 +468 @@ -@@ -3479,6 +3599,14 @@ igbvf_promiscuous_disable(struct rte_eth_dev *dev) +@@ -3428,6 +3548,14 @@ igbvf_promiscuous_disable(struct rte_eth_dev *dev) @@ -480 +483 @@ -@@ -3493,6 +3621,14 @@ igbvf_allmulticast_enable(struct rte_eth_dev *dev) +@@ -3442,6 +3570,14 @@ igbvf_allmulticast_enable(struct rte_eth_dev *dev) @@ -495 +498 @@ -@@ -3505,6 +3641,14 @@ igbvf_allmulticast_disable(struct rte_eth_dev *dev) +@@ -3454,6 +3590,14 @@ igbvf_allmulticast_disable(struct rte_eth_dev *dev) @@ -510 +513 @@ -@@ -4608,6 +4752,14 @@ eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, +@@ -4557,6 +4701,14 @@ eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, @@ -525 +528 @@ -@@ -5056,6 +5208,14 @@ eth_igb_get_eeprom(struct rte_eth_dev *dev, +@@ -4986,6 +5138,14 @@ eth_igb_get_eeprom(struct rte_eth_dev *dev, @@ -540 +543 @@ -@@ -5080,6 +5240,14 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev, +@@ -5010,6 +5170,14 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev, @@ -555 +558 @@ -@@ -5180,6 +5348,10 @@ eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5110,6 +5278,10 @@ eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -566 +569 @@ -@@ -5200,6 +5372,10 @@ eth_igb_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -5130,6 +5302,10 @@ eth_igb_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -577,4 +580,4 @@ -diff --git a/drivers/net/intel/e1000/igc_ethdev.c b/drivers/net/intel/e1000/igc_ethdev.c -index 136f5af2a0..e712cfcf7c 100644 ---- a/drivers/net/intel/e1000/igc_ethdev.c -+++ b/drivers/net/intel/e1000/igc_ethdev.c +diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c +index dcd262f0cf..ce1f425eaf 100644 +--- a/drivers/net/igc/igc_ethdev.c ++++ b/drivers/net/igc/igc_ethdev.c @@ -587 +590 @@ - #include "e1000_logs.h" + #include "igc_logs.h" @@ -589 +592 @@ -@@ -397,6 +398,14 @@ eth_igc_set_link_up(struct rte_eth_dev *dev) +@@ -357,6 +358,14 @@ eth_igc_set_link_up(struct rte_eth_dev *dev) @@ -591 +594 @@ - struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev); + struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev); @@ -601,2 +604,2 @@ - if (hw->phy.media_type == e1000_media_type_copper) - e1000_power_up_phy(hw); + if (hw->phy.media_type == igc_media_type_copper) + igc_power_up_phy(hw); @@ -604 +607 @@ -@@ -409,6 +418,14 @@ eth_igc_set_link_down(struct rte_eth_dev *dev) +@@ -369,6 +378,14 @@ eth_igc_set_link_down(struct rte_eth_dev *dev) @@ -606 +609 @@ - struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev); + struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev); @@ -616,2 +619,2 @@ - if (hw->phy.media_type == e1000_media_type_copper) - e1000_power_down_phy(hw); + if (hw->phy.media_type == igc_media_type_copper) + igc_power_down_phy(hw); @@ -619 +622 @@ -@@ -482,6 +499,14 @@ eth_igc_link_update(struct rte_eth_dev *dev, int wait_to_complete) +@@ -442,6 +459,14 @@ eth_igc_link_update(struct rte_eth_dev *dev, int wait_to_complete) @@ -634 +637 @@ -@@ -659,6 +684,14 @@ eth_igc_stop(struct rte_eth_dev *dev) +@@ -619,6 +644,14 @@ eth_igc_stop(struct rte_eth_dev *dev) @@ -649 +652 @@ -@@ -970,6 +1003,14 @@ eth_igc_start(struct rte_eth_dev *dev) +@@ -925,6 +958,14 @@ eth_igc_start(struct rte_eth_dev *dev) @@ -662,4 +665,4 @@ - E1000_WRITE_REG(hw, E1000_EIMC, 0x1f); - E1000_WRITE_FLUSH(hw); -@@ -1553,6 +1594,14 @@ eth_igc_fw_version_get(struct rte_eth_dev *dev, char *fw_version, - struct e1000_fw_version fw; + IGC_WRITE_REG(hw, IGC_EIMC, 0x1f); + IGC_WRITE_FLUSH(hw); +@@ -1459,6 +1500,14 @@ eth_igc_fw_version_get(struct rte_eth_dev *dev, char *fw_version, + struct igc_fw_version fw; @@ -676 +679 @@ - e1000_get_fw_version(hw, &fw); + igc_get_fw_version(hw, &fw); @@ -679 +682 @@ -@@ -1643,6 +1692,14 @@ eth_igc_led_on(struct rte_eth_dev *dev) +@@ -1549,6 +1598,14 @@ eth_igc_led_on(struct rte_eth_dev *dev) @@ -681 +684 @@ - struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev); + struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev); @@ -691 +694 @@ - return e1000_led_on(hw) == E1000_SUCCESS ? 0 : -ENOTSUP; + return igc_led_on(hw) == IGC_SUCCESS ? 0 : -ENOTSUP; @@ -694 +697 @@ -@@ -1651,6 +1708,14 @@ eth_igc_led_off(struct rte_eth_dev *dev) +@@ -1557,6 +1614,14 @@ eth_igc_led_off(struct rte_eth_dev *dev) @@ -696 +699 @@ - struct e1000_hw *hw = IGC_DEV_PRIVATE_HW(dev); + struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev); @@ -706 +709 @@ - return e1000_led_off(hw) == E1000_SUCCESS ? 0 : -ENOTSUP; + return igc_led_off(hw) == IGC_SUCCESS ? 0 : -ENOTSUP; @@ -709 +712 @@ -@@ -2194,6 +2259,10 @@ eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -2099,6 +2164,10 @@ eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -720 +723 @@ -@@ -2213,6 +2282,10 @@ eth_igc_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) +@@ -2118,6 +2187,10 @@ eth_igc_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) @@ -731 +734 @@ -@@ -2276,6 +2349,14 @@ eth_igc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -2181,6 +2254,14 @@ eth_igc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -746,30 +748,0 @@ -@@ -2777,6 +2858,14 @@ eth_igc_timesync_read_rx_timestamp(__rte_unused struct rte_eth_dev *dev, - struct igc_rx_queue *rxq; - uint64_t rx_timestamp; - -+ /* -+ * 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; -+ - /* Get current link speed. */ - eth_igc_link_update(dev, 1); - rte_eth_linkstatus_get(dev, &link); -@@ -2813,6 +2902,14 @@ eth_igc_timesync_read_tx_timestamp(struct rte_eth_dev *dev, - uint64_t tx_timestamp; - int adjust = 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; -+ - val = E1000_READ_REG(hw, E1000_TSYNCTXCTL); - if (!(val & E1000_TSYNCTXCTL_VALID)) - return -EINVAL;