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 7409FA0C4C for ; Mon, 12 Jul 2021 15:12:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A6AB4069D; Mon, 12 Jul 2021 15:12:51 +0200 (CEST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mails.dpdk.org (Postfix) with ESMTP id 35D374069D for ; Mon, 12 Jul 2021 15:12:50 +0200 (CEST) Received: by mail-wm1-f44.google.com with SMTP id j34so11379147wms.5 for ; Mon, 12 Jul 2021 06:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cavnR/qPLXLTHFlk7w7uTW5Hzit0dDbcFzoV3ZdGCMw=; b=NxWD1+yKBKzUoZLntqrY9iy01/bmFVTJLNuqEJ0klf7SqO7fSsnROW2Pe0IAW8Ly4J Ok/wbcUstZifQ3FrDWD9KfdJ2SFkrjud1yXrcno6zamPFT5OLqXPwsCzct/OpNDAXvLG FGtO0v8E447xhgUMbJqZi66nftV3BBplHEFXLPa3AMgIbqRICynyXDMNRSZduvfxmoWF DA5nhF2BPEV0U//OZcy0kzAOAhJxQ7gFm/yGGz7LT0mq8p6MkykM+c1dgh/MgEoGYtOj xKrqN9DMP3tzmcaDzkEyg7jclYe6eE2UiyZIlXA7h10FjQxGSVCKGpdBlp8rGGhHdyI+ bUQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cavnR/qPLXLTHFlk7w7uTW5Hzit0dDbcFzoV3ZdGCMw=; b=PxQ7Q5Iepm7hc6S0fiIsBY0Z9Ga+qHXshtkbcZhCwJ0Oa4hxNSYv3Bri6d1l2osrJV /qZFMAGaq5jBZ6uZhjs2cTzM3UEGVYLDYAx1FrnwbSmi7ZPdhYoUF8YG8gFRRZZ2wK+s lp0ocjqB61318TeEN+63fz2HA0MQ7/LHkEKtmdNpJlt/wE6Xm5UzGEyc8/L5Ki4hbAhK 8XapH1jTTsHWRfSSd0WFfTjbCIPYGG7TjJ3o+pekzVJR4wx8upyRZxtmE4MJtrqEDFoM YG4n4ajW4pI1590JuXfnNmaHDz1WjJJYnwhCTi57aam9Kl7OgrfGdS895fUs5lA2DWCv xdBQ== X-Gm-Message-State: AOAM532/brreQS9Pdp1mQKfef1apfzQp4rAN1hGcfxatj4ukRr03H4v3 Krv/rdEXYFhRqQo/YPlkZ+Y= X-Google-Smtp-Source: ABdhPJxwWlYfgp9fOWcIWJb4dZpbykbqpR6GLVCJcbQp8oqSA84H8H0vVT2LY2XGDAbpWGKxMTPcbA== X-Received: by 2002:a05:600c:4ec8:: with SMTP id g8mr14754293wmq.150.1626095569870; Mon, 12 Jul 2021 06:12:49 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id j10sm14102079wrt.35.2021.07.12.06.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 06:12:49 -0700 (PDT) From: luca.boccassi@gmail.com To: Dapeng Yu Cc: Qi Zhang , dpdk stable Date: Mon, 12 Jul 2021 14:04:46 +0100 Message-Id: <20210712130551.2462159-51-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/i40e: fix multi-process shared data' has been queued to stable release 20.11.3 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/14/21. 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/37a61f47701ff59cc36dd37d5feb4bc8bf90385a Thanks. Luca Boccassi --- >From 37a61f47701ff59cc36dd37d5feb4bc8bf90385a Mon Sep 17 00:00:00 2001 From: Dapeng Yu Date: Mon, 21 Jun 2021 15:23:53 +0800 Subject: [PATCH] net/i40e: fix multi-process shared data [ upstream commit e391a7b7f815795eacfae3240c4405353cf37a53 ] The rte_eth_devices array is not in share memory, it should not be referenced by i40e_adapter which is shared by primary and secondary. Any process set i40e_adapter->eth_dev will corrupt another process's context. The patch removed the field "eth_dev" from i40e_adapter. Now, when the data paths try to access the rte_eth_dev_data instance, they should replace adapter->eth_dev->data with adapter->pf.dev_data. Fixes: 4861cde46116 ("i40e: new poll mode driver") Signed-off-by: Dapeng Yu Acked-by: Qi Zhang --- drivers/net/i40e/i40e_ethdev.c | 44 +++++++++++++------------- drivers/net/i40e/i40e_ethdev.h | 7 ++-- drivers/net/i40e/i40e_fdir.c | 4 +-- drivers/net/i40e/i40e_flow.c | 2 +- drivers/net/i40e/i40e_rxtx.c | 4 +-- drivers/net/i40e/i40e_vf_representor.c | 37 ++++++++++++---------- 6 files changed, 51 insertions(+), 47 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 63a9fc04d0..d617e9c71b 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -727,10 +727,11 @@ i40e_write_global_rx_ctl(struct i40e_hw *hw, uint32_t reg_addr, uint32_t reg_val) { uint32_t ori_reg_val; - struct rte_eth_dev *dev; + struct rte_eth_dev_data *dev_data = + ((struct i40e_adapter *)hw->back)->pf.dev_data; + struct rte_eth_dev *dev = &rte_eth_devices[dev_data->port_id]; ori_reg_val = i40e_read_rx_ctl(hw, reg_addr); - dev = ((struct i40e_adapter *)hw->back)->eth_dev; i40e_write_rx_ctl(hw, reg_addr, reg_val); if (ori_reg_val != reg_val) PMD_DRV_LOG(WARNING, @@ -1321,7 +1322,9 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw, struct i40e_asq_cmd_details *cmd_details) { uint64_t ori_reg_val; - struct rte_eth_dev *dev; + struct rte_eth_dev_data *dev_data = + ((struct i40e_adapter *)hw->back)->pf.dev_data; + struct rte_eth_dev *dev = &rte_eth_devices[dev_data->port_id]; int ret; ret = i40e_aq_debug_read_register(hw, reg_addr, &ori_reg_val, NULL); @@ -1331,7 +1334,6 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw, reg_addr); return -EIO; } - dev = ((struct i40e_adapter *)hw->back)->eth_dev; if (ori_reg_val != reg_val) PMD_DRV_LOG(WARNING, @@ -1506,7 +1508,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; pf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); - pf->adapter->eth_dev = dev; pf->dev_data = dev->data; hw->back = I40E_PF_TO_ADAPTER(pf); @@ -2039,7 +2040,7 @@ err: void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi) { - struct rte_eth_dev *dev = vsi->adapter->eth_dev; + struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); @@ -2155,7 +2156,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect, int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx) { - struct rte_eth_dev *dev = vsi->adapter->eth_dev; + struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); @@ -2231,7 +2232,7 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx) void i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi) { - struct rte_eth_dev *dev = vsi->adapter->eth_dev; + struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); @@ -2258,7 +2259,7 @@ i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi) void i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi) { - struct rte_eth_dev *dev = vsi->adapter->eth_dev; + struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); @@ -6472,8 +6473,7 @@ i40e_dev_tx_init(struct i40e_pf *pf) break; } if (ret == I40E_SUCCESS) - i40e_set_tx_function(container_of(pf, struct i40e_adapter, pf) - ->eth_dev); + i40e_set_tx_function(&rte_eth_devices[pf->dev_data->port_id]); return ret; } @@ -6501,8 +6501,7 @@ i40e_dev_rx_init(struct i40e_pf *pf) } } if (ret == I40E_SUCCESS) - i40e_set_rx_function(container_of(pf, struct i40e_adapter, pf) - ->eth_dev); + i40e_set_rx_function(&rte_eth_devices[pf->dev_data->port_id]); return ret; } @@ -7941,7 +7940,7 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) struct i40e_aqc_replace_cloud_filters_cmd filter_replace; struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf; struct i40e_hw *hw = I40E_PF_TO_HW(pf); - struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev; + struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; enum i40e_status_code status = I40E_SUCCESS; if (pf->support_multi_driver) { @@ -8002,7 +8001,7 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) struct i40e_aqc_replace_cloud_filters_cmd filter_replace; struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf; struct i40e_hw *hw = I40E_PF_TO_HW(pf); - struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev; + struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; enum i40e_status_code status = I40E_SUCCESS; if (pf->support_multi_driver) { @@ -8077,7 +8076,7 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) struct i40e_aqc_replace_cloud_filters_cmd filter_replace; struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf; struct i40e_hw *hw = I40E_PF_TO_HW(pf); - struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev; + struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; enum i40e_status_code status = I40E_SUCCESS; if (pf->support_multi_driver) { @@ -8165,7 +8164,7 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) struct i40e_aqc_replace_cloud_filters_cmd filter_replace; struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf; struct i40e_hw *hw = I40E_PF_TO_HW(pf); - struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev; + struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; enum i40e_status_code status = I40E_SUCCESS; if (pf->support_multi_driver) { @@ -8240,7 +8239,7 @@ i40e_replace_port_l1_filter(struct i40e_pf *pf, struct i40e_aqc_replace_cloud_filters_cmd filter_replace; enum i40e_status_code status = I40E_SUCCESS; struct i40e_hw *hw = I40E_PF_TO_HW(pf); - struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev; + struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; if (pf->support_multi_driver) { PMD_DRV_LOG(ERR, "Replace l1 filter is not supported."); @@ -8312,7 +8311,7 @@ i40e_replace_port_cloud_filter(struct i40e_pf *pf, struct i40e_aqc_replace_cloud_filters_cmd filter_replace; enum i40e_status_code status = I40E_SUCCESS; struct i40e_hw *hw = I40E_PF_TO_HW(pf); - struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev; + struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; if (pf->support_multi_driver) { PMD_DRV_LOG(ERR, "Replace cloud filter is not supported."); @@ -9646,9 +9645,10 @@ void i40e_check_write_global_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val) { uint32_t reg = i40e_read_rx_ctl(hw, addr); - struct rte_eth_dev *dev; + struct rte_eth_dev_data *dev_data = + ((struct i40e_adapter *)hw->back)->pf.dev_data; + struct rte_eth_dev *dev = &rte_eth_devices[dev_data->port_id]; - dev = ((struct i40e_adapter *)hw->back)->eth_dev; if (reg != val) { i40e_write_rx_ctl(hw, addr, val); PMD_DRV_LOG(WARNING, @@ -12493,7 +12493,7 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf) struct i40e_aqc_replace_cloud_filters_cmd filter_replace; struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf; struct i40e_hw *hw = I40E_PF_TO_HW(pf); - struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev; + struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; if (pf->support_multi_driver) { PMD_DRV_LOG(ERR, "Replace cloud filter is not supported."); diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index ba1bb3dc98..d80316d2f7 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -88,8 +88,10 @@ do { \ uint32_t ori_val; \ struct rte_eth_dev *dev; \ + struct rte_eth_dev_data *dev_data; \ ori_val = I40E_READ_REG((hw), (reg)); \ - dev = ((struct i40e_adapter *)hw->back)->eth_dev; \ + dev_data = ((struct i40e_adapter *)hw->back)->pf.dev_data; \ + dev = &rte_eth_devices[dev_data->port_id]; \ I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((hw), \ (reg)), (value)); \ if (ori_val != value) \ @@ -1264,7 +1266,6 @@ struct i40e_vf { struct i40e_adapter { /* Common for both PF and VF */ struct i40e_hw hw; - struct rte_eth_dev *eth_dev; /* Specific for PF or VF */ union { @@ -1514,7 +1515,7 @@ i40e_get_vsi_from_adapter(struct i40e_adapter *adapter) #define I40E_VSI_TO_DEV_DATA(vsi) \ (((struct i40e_vsi *)vsi)->adapter->pf.dev_data) #define I40E_VSI_TO_ETH_DEV(vsi) \ - (((struct i40e_vsi *)vsi)->adapter->eth_dev) + (&rte_eth_devices[((struct i40e_vsi *)vsi)->adapter->pf.dev_data->port_id]) /* I40E_PF_TO */ #define I40E_PF_TO_HW(pf) \ diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 5f8e167632..05fdcef24f 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -159,7 +159,7 @@ i40e_fdir_setup(struct i40e_pf *pf) int err = I40E_SUCCESS; char z_name[RTE_MEMZONE_NAMESIZE]; const struct rte_memzone *mz = NULL; - struct rte_eth_dev *eth_dev = pf->adapter->eth_dev; + struct rte_eth_dev *eth_dev = &rte_eth_devices[pf->dev_data->port_id]; uint16_t i; if ((pf->flags & I40E_FLAG_FDIR) == 0) { @@ -283,7 +283,7 @@ i40e_fdir_teardown(struct i40e_pf *pf) { struct i40e_hw *hw = I40E_PF_TO_HW(pf); struct i40e_vsi *vsi; - struct rte_eth_dev *dev = pf->adapter->eth_dev; + struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; vsi = pf->fdir.fdir_vsi; if (!vsi) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 7de1a8dbc0..70c5c72326 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -5458,7 +5458,7 @@ i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error) static int i40e_flow_flush_fdir_filter(struct i40e_pf *pf) { - struct rte_eth_dev *dev = pf->adapter->eth_dev; + struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; struct i40e_fdir_info *fdir_info = &pf->fdir; struct i40e_fdir_filter *fdir_filter; enum i40e_filter_pctype pctype; diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 3986842a62..39a69b74d1 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2952,7 +2952,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf) return I40E_ERR_BAD_PTR; } - dev = pf->adapter->eth_dev; + dev = &rte_eth_devices[pf->dev_data->port_id]; /* Allocate the TX queue data structure. */ txq = rte_zmalloc_socket("i40e fdir tx queue", @@ -3010,7 +3010,7 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf) return I40E_ERR_BAD_PTR; } - dev = pf->adapter->eth_dev; + dev = &rte_eth_devices[pf->dev_data->port_id]; /* Allocate the RX queue data structure. */ rxq = rte_zmalloc_socket("i40e fdir rx queue", diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c index 9e40406a3d..7ab4b19a42 100644 --- a/drivers/net/i40e/i40e_vf_representor.c +++ b/drivers/net/i40e/i40e_vf_representor.c @@ -19,15 +19,18 @@ i40e_vf_representor_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) { struct i40e_vf_representor *representor = ethdev->data->dev_private; + struct rte_eth_dev *dev = + &rte_eth_devices[representor->adapter->pf.dev_data->port_id]; - return i40e_dev_link_update(representor->adapter->eth_dev, - wait_to_complete); + return i40e_dev_link_update(dev, wait_to_complete); } static int i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, struct rte_eth_dev_info *dev_info) { struct i40e_vf_representor *representor = ethdev->data->dev_private; + struct rte_eth_dev_data *pf_dev_data = + representor->adapter->pf.dev_data; /* get dev info for the vdev */ dev_info->device = ethdev->device; @@ -99,7 +102,7 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, }; dev_info->switch_info.name = - representor->adapter->eth_dev->device->name; + rte_eth_devices[pf_dev_data->port_id].device->name; dev_info->switch_info.domain_id = representor->switch_domain_id; dev_info->switch_info.port_id = representor->vf_id; @@ -213,7 +216,7 @@ i40e_vf_representor_stats_get(struct rte_eth_dev *ethdev, int ret; ret = rte_pmd_i40e_get_vf_native_stats( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, &native_stats); if (ret == 0) { i40evf_stat_update_48( @@ -273,7 +276,7 @@ i40e_vf_representor_stats_reset(struct rte_eth_dev *ethdev) struct i40e_vf_representor *representor = ethdev->data->dev_private; return rte_pmd_i40e_get_vf_native_stats( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, &representor->stats_offset); } @@ -283,7 +286,7 @@ i40e_vf_representor_promiscuous_enable(struct rte_eth_dev *ethdev) struct i40e_vf_representor *representor = ethdev->data->dev_private; return rte_pmd_i40e_set_vf_unicast_promisc( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, 1); } @@ -293,7 +296,7 @@ i40e_vf_representor_promiscuous_disable(struct rte_eth_dev *ethdev) struct i40e_vf_representor *representor = ethdev->data->dev_private; return rte_pmd_i40e_set_vf_unicast_promisc( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, 0); } @@ -303,7 +306,7 @@ i40e_vf_representor_allmulticast_enable(struct rte_eth_dev *ethdev) struct i40e_vf_representor *representor = ethdev->data->dev_private; return rte_pmd_i40e_set_vf_multicast_promisc( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, 1); } @@ -313,7 +316,7 @@ i40e_vf_representor_allmulticast_disable(struct rte_eth_dev *ethdev) struct i40e_vf_representor *representor = ethdev->data->dev_private; return rte_pmd_i40e_set_vf_multicast_promisc( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, 0); } @@ -323,7 +326,7 @@ i40e_vf_representor_mac_addr_remove(struct rte_eth_dev *ethdev, uint32_t index) struct i40e_vf_representor *representor = ethdev->data->dev_private; rte_pmd_i40e_remove_vf_mac_addr( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, ðdev->data->mac_addrs[index]); } @@ -334,7 +337,7 @@ i40e_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, struct i40e_vf_representor *representor = ethdev->data->dev_private; return rte_pmd_i40e_set_vf_mac_addr( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, mac_addr); } @@ -346,7 +349,7 @@ i40e_vf_representor_vlan_filter_set(struct rte_eth_dev *ethdev, uint64_t vf_mask = 1ULL << representor->vf_id; return rte_pmd_i40e_set_vf_vlan_filter( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, vlan_id, vf_mask, on); } @@ -360,7 +363,7 @@ i40e_vf_representor_vlan_offload_set(struct rte_eth_dev *ethdev, int mask) struct i40e_pf *pf; uint32_t vfid; - pdev = representor->adapter->eth_dev; + pdev = &rte_eth_devices[representor->adapter->pf.dev_data->port_id]; vfid = representor->vf_id; if (!is_i40e_supported(pdev)) { @@ -410,7 +413,7 @@ i40e_vf_representor_vlan_strip_queue_set(struct rte_eth_dev *ethdev, struct i40e_vf_representor *representor = ethdev->data->dev_private; rte_pmd_i40e_set_vf_vlan_stripq( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, on); } @@ -421,7 +424,7 @@ i40e_vf_representor_vlan_pvid_set(struct rte_eth_dev *ethdev, uint16_t vlan_id, struct i40e_vf_representor *representor = ethdev->data->dev_private; return rte_pmd_i40e_set_vf_vlan_insert( - representor->adapter->eth_dev->data->port_id, + representor->adapter->pf.dev_data->port_id, representor->vf_id, vlan_id); } @@ -487,7 +490,7 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) ((struct i40e_vf_representor *)init_params)->adapter; pf = I40E_DEV_PRIVATE_TO_PF( - representor->adapter->eth_dev->data->dev_private); + representor->adapter->pf.dev_data->dev_private); if (representor->vf_id >= pf->vf_num) return -ENODEV; @@ -519,7 +522,7 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) ethdev->data->mac_addrs = &vf->mac_addr; /* Link state. Inherited from PF */ - link = &representor->adapter->eth_dev->data->dev_link; + link = &representor->adapter->pf.dev_data->dev_link; ethdev->data->dev_link.link_speed = link->link_speed; ethdev->data->dev_link.link_duplex = link->link_duplex; -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-12 13:41:39.297403515 +0100 +++ 0051-net-i40e-fix-multi-process-shared-data.patch 2021-07-12 13:41:36.430121361 +0100 @@ -1 +1 @@ -From e391a7b7f815795eacfae3240c4405353cf37a53 Mon Sep 17 00:00:00 2001 +From 37a61f47701ff59cc36dd37d5feb4bc8bf90385a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e391a7b7f815795eacfae3240c4405353cf37a53 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -25 +25,0 @@ - drivers/net/i40e/i40e_hash.c | 7 ++-- @@ -28 +28 @@ - 7 files changed, 55 insertions(+), 50 deletions(-) + 6 files changed, 51 insertions(+), 47 deletions(-) @@ -31 +31 @@ -index df716c180f..5b0a7f2537 100644 +index 63a9fc04d0..d617e9c71b 100644 @@ -34 +34 @@ -@@ -732,10 +732,11 @@ i40e_write_global_rx_ctl(struct i40e_hw *hw, uint32_t reg_addr, +@@ -727,10 +727,11 @@ i40e_write_global_rx_ctl(struct i40e_hw *hw, uint32_t reg_addr, @@ -48 +48 @@ -@@ -1326,7 +1327,9 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw, +@@ -1321,7 +1322,9 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw, @@ -59 +59 @@ -@@ -1336,7 +1339,6 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw, +@@ -1331,7 +1334,6 @@ i40e_aq_debug_write_global_register(struct i40e_hw *hw, @@ -67 +67 @@ -@@ -1455,7 +1457,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) +@@ -1506,7 +1508,6 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) @@ -75 +75 @@ -@@ -1982,7 +1983,7 @@ err: +@@ -2039,7 +2040,7 @@ err: @@ -84 +84 @@ -@@ -2098,7 +2099,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect, +@@ -2155,7 +2156,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect, @@ -93 +93 @@ -@@ -2174,7 +2175,7 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx) +@@ -2231,7 +2232,7 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx) @@ -102 +102 @@ -@@ -2201,7 +2202,7 @@ i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi) +@@ -2258,7 +2259,7 @@ i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi) @@ -111 +111 @@ -@@ -6416,8 +6417,7 @@ i40e_dev_tx_init(struct i40e_pf *pf) +@@ -6472,8 +6473,7 @@ i40e_dev_tx_init(struct i40e_pf *pf) @@ -121 +121 @@ -@@ -6445,8 +6445,7 @@ i40e_dev_rx_init(struct i40e_pf *pf) +@@ -6501,8 +6501,7 @@ i40e_dev_rx_init(struct i40e_pf *pf) @@ -131 +131 @@ -@@ -7885,7 +7884,7 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) +@@ -7941,7 +7940,7 @@ i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) @@ -140 +140 @@ -@@ -7946,7 +7945,7 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) +@@ -8002,7 +8001,7 @@ i40e_status_code i40e_replace_mpls_cloud_filter(struct i40e_pf *pf) @@ -149 +149 @@ -@@ -8021,7 +8020,7 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) +@@ -8077,7 +8076,7 @@ i40e_replace_gtp_l1_filter(struct i40e_pf *pf) @@ -158 +158 @@ -@@ -8109,7 +8108,7 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) +@@ -8165,7 +8164,7 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) @@ -167 +167 @@ -@@ -8184,7 +8183,7 @@ i40e_replace_port_l1_filter(struct i40e_pf *pf, +@@ -8240,7 +8239,7 @@ i40e_replace_port_l1_filter(struct i40e_pf *pf, @@ -176 +176 @@ -@@ -8256,7 +8255,7 @@ i40e_replace_port_cloud_filter(struct i40e_pf *pf, +@@ -8312,7 +8311,7 @@ i40e_replace_port_cloud_filter(struct i40e_pf *pf, @@ -185 +185 @@ -@@ -9583,9 +9582,10 @@ void +@@ -9646,9 +9645,10 @@ void @@ -198 +198 @@ -@@ -12377,7 +12377,7 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf) +@@ -12493,7 +12493,7 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf) @@ -208 +208 @@ -index 585a0d8eb2..cd6deabd60 100644 +index ba1bb3dc98..d80316d2f7 100644 @@ -211 +211 @@ -@@ -90,8 +90,10 @@ +@@ -88,8 +88,10 @@ @@ -223 +223 @@ -@@ -1285,7 +1287,6 @@ struct i40e_vf { +@@ -1264,7 +1266,6 @@ struct i40e_vf { @@ -231 +231 @@ -@@ -1540,7 +1541,7 @@ i40e_get_vsi_from_adapter(struct i40e_adapter *adapter) +@@ -1514,7 +1515,7 @@ i40e_get_vsi_from_adapter(struct i40e_adapter *adapter) @@ -241 +241 @@ -index 6f73936091..af075fda2a 100644 +index 5f8e167632..05fdcef24f 100644 @@ -244 +244 @@ -@@ -160,7 +160,7 @@ i40e_fdir_setup(struct i40e_pf *pf) +@@ -159,7 +159,7 @@ i40e_fdir_setup(struct i40e_pf *pf) @@ -253 +253 @@ -@@ -284,7 +284,7 @@ i40e_fdir_teardown(struct i40e_pf *pf) +@@ -283,7 +283,7 @@ i40e_fdir_teardown(struct i40e_pf *pf) @@ -263 +263 @@ -index ff8441b378..3c1570bd9c 100644 +index 7de1a8dbc0..70c5c72326 100644 @@ -266 +266 @@ -@@ -4897,7 +4897,7 @@ i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error) +@@ -5458,7 +5458,7 @@ i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error) @@ -275,32 +274,0 @@ -diff --git a/drivers/net/i40e/i40e_hash.c b/drivers/net/i40e/i40e_hash.c -index 8787a6996d..1fb8c9abfc 100644 ---- a/drivers/net/i40e/i40e_hash.c -+++ b/drivers/net/i40e/i40e_hash.c -@@ -732,7 +732,7 @@ i40e_hash_config_region(struct i40e_pf *pf, - const struct i40e_rte_flow_rss_conf *rss_conf) - { - struct i40e_hw *hw = &pf->adapter->hw; -- struct rte_eth_dev *dev = pf->adapter->eth_dev; -+ struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id]; - struct i40e_queue_region_info *regions = pf->queue_region.region; - uint32_t num = pf->queue_region.queue_region_number; - uint32_t i, region_id_mask = 0; -@@ -1270,6 +1270,7 @@ i40e_hash_reset_conf(struct i40e_pf *pf, - struct i40e_rte_flow_rss_conf *rss_conf) - { - struct i40e_hw *hw = &pf->adapter->hw; -+ struct rte_eth_dev *dev; - uint64_t inset; - uint32_t idx; - int ret; -@@ -1283,8 +1284,8 @@ i40e_hash_reset_conf(struct i40e_pf *pf, - } - - if (rss_conf->misc_reset_flags & I40E_HASH_FLOW_RESET_FLAG_REGION) { -- ret = i40e_flush_queue_region_all_conf(pf->adapter->eth_dev, -- hw, pf, 0); -+ dev = &rte_eth_devices[pf->dev_data->port_id]; -+ ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 0); - if (ret) - return ret; - @@ -308 +276 @@ -index ee19102ad3..8d65f287f4 100644 +index 3986842a62..39a69b74d1 100644 @@ -311 +279 @@ -@@ -3064,7 +3064,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf) +@@ -2952,7 +2952,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf) @@ -320 +288 @@ -@@ -3122,7 +3122,7 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf) +@@ -3010,7 +3010,7 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf) @@ -330 +298 @@ -index 7ed47c1a2c..0481b55381 100644 +index 9e40406a3d..7ab4b19a42 100644