From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id A05EAA3 for ; Fri, 8 Mar 2019 18:48:02 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 8 Mar 2019 19:47:57 +0200 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x28HloAK002625; Fri, 8 Mar 2019 19:47:56 +0200 From: Yongseok Koh To: Xiaoyun Li Cc: Qi Zhang , dpdk stable Date: Fri, 8 Mar 2019 09:46:42 -0800 Message-Id: <20190308174749.30771-4-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190308174749.30771-1-yskoh@mellanox.com> References: <20190308174749.30771-1-yskoh@mellanox.com> Subject: [dpdk-stable] patch 'net/ixgbe: fix overwriting RSS RETA' has been queued to LTS release 17.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2019 17:48:03 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objection by 03/13/19. So please shout if anyone has objection. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Yongseok --- >>From 3dc7d6ef3f465c92b8ff8ff6855488adf019be82 Mon Sep 17 00:00:00 2001 From: Xiaoyun Li Date: Tue, 4 Dec 2018 12:37:57 +0800 Subject: [PATCH] net/ixgbe: fix overwriting RSS RETA [ upstream commit 8832837c6e64a75be31f32c49da261db15054c0d ] When starting the device, the RSS table is initialized. So the RSS update before device_start would be overwritten. This patch allows users to update the RSS reta table before device_start. Fixes: db5b65301dde ("ethdev: allow to set RSS hash computation flags and/or key") Signed-off-by: Xiaoyun Li Acked-by: Qi Zhang --- drivers/net/ixgbe/ixgbe_ethdev.c | 11 +++++++++++ drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++ drivers/net/ixgbe/ixgbe_rxtx.c | 24 ++++++++++++++---------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index f047db83c..ef0613bde 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2758,6 +2758,8 @@ static void ixgbe_dev_stop(struct rte_eth_dev *dev) { struct rte_eth_link link; + struct ixgbe_adapter *adapter = + (struct ixgbe_adapter *)dev->data->dev_private; struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ixgbe_vf_info *vfinfo = @@ -2818,6 +2820,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) /* reset hierarchy commit */ tm_conf->committed = false; + + adapter->rss_reta_updated = 0; } /* @@ -4794,6 +4798,8 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev, uint8_t j, mask; uint32_t reta, r; uint16_t idx, shift; + struct ixgbe_adapter *adapter = + (struct ixgbe_adapter *)dev->data->dev_private; struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t reta_reg; @@ -4835,6 +4841,7 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev, } IXGBE_WRITE_REG(hw, reta_reg, reta); } + adapter->rss_reta_updated = 1; return 0; } @@ -5139,6 +5146,8 @@ static void ixgbevf_dev_stop(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ixgbe_adapter *adapter = + (struct ixgbe_adapter *)dev->data->dev_private; struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; @@ -5168,6 +5177,8 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) rte_free(intr_handle->intr_vec); intr_handle->intr_vec = NULL; } + + adapter->rss_reta_updated = 0; } static void diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 762f1ad34..739022e53 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -504,6 +504,9 @@ struct ixgbe_adapter { struct rte_timecounter rx_tstamp_tc; struct rte_timecounter tx_tstamp_tc; struct ixgbe_tm_conf tm_conf; + + /* For RSS reta table update */ + uint8_t rss_reta_updated; }; #define IXGBE_DEV_PRIVATE_TO_HW(adapter)\ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 651b5e8de..ea6c038e0 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -3325,6 +3325,7 @@ static void ixgbe_rss_configure(struct rte_eth_dev *dev) { struct rte_eth_rss_conf rss_conf; + struct ixgbe_adapter *adapter; struct ixgbe_hw *hw; uint32_t reta; uint16_t i; @@ -3333,6 +3334,7 @@ ixgbe_rss_configure(struct rte_eth_dev *dev) uint32_t reta_reg; PMD_INIT_FUNC_TRACE(); + adapter = (struct ixgbe_adapter *)dev->data->dev_private; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); sp_reta_size = ixgbe_reta_size_get(hw->mac.type); @@ -3342,16 +3344,18 @@ ixgbe_rss_configure(struct rte_eth_dev *dev) * The byte-swap is needed because NIC registers are in * little-endian order. */ - reta = 0; - for (i = 0, j = 0; i < sp_reta_size; i++, j++) { - reta_reg = ixgbe_reta_reg_get(hw->mac.type, i); - - if (j == dev->data->nb_rx_queues) - j = 0; - reta = (reta << 8) | j; - if ((i & 3) == 3) - IXGBE_WRITE_REG(hw, reta_reg, - rte_bswap32(reta)); + if (adapter->rss_reta_updated == 0) { + reta = 0; + for (i = 0, j = 0; i < sp_reta_size; i++, j++) { + reta_reg = ixgbe_reta_reg_get(hw->mac.type, i); + + if (j == dev->data->nb_rx_queues) + j = 0; + reta = (reta << 8) | j; + if ((i & 3) == 3) + IXGBE_WRITE_REG(hw, reta_reg, + rte_bswap32(reta)); + } } /* -- 2.11.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-03-08 09:46:40.607675657 -0800 +++ 0004-net-ixgbe-fix-overwriting-RSS-RETA.patch 2019-03-08 09:46:39.954397000 -0800 @@ -1,14 +1,15 @@ -From 8832837c6e64a75be31f32c49da261db15054c0d Mon Sep 17 00:00:00 2001 +From 3dc7d6ef3f465c92b8ff8ff6855488adf019be82 Mon Sep 17 00:00:00 2001 From: Xiaoyun Li Date: Tue, 4 Dec 2018 12:37:57 +0800 Subject: [PATCH] net/ixgbe: fix overwriting RSS RETA +[ upstream commit 8832837c6e64a75be31f32c49da261db15054c0d ] + When starting the device, the RSS table is initialized. So the RSS update before device_start would be overwritten. This patch allows users to update the RSS reta table before device_start. Fixes: db5b65301dde ("ethdev: allow to set RSS hash computation flags and/or key") -Cc: stable@dpdk.org Signed-off-by: Xiaoyun Li Acked-by: Qi Zhang @@ -19,10 +20,10 @@ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c -index 91ba6201d..749311048 100644 +index f047db83c..ef0613bde 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c -@@ -2790,6 +2790,8 @@ static void +@@ -2758,6 +2758,8 @@ static void ixgbe_dev_stop(struct rte_eth_dev *dev) { struct rte_eth_link link; @@ -31,7 +32,7 @@ struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ixgbe_vf_info *vfinfo = -@@ -2850,6 +2852,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) +@@ -2818,6 +2820,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) /* reset hierarchy commit */ tm_conf->committed = false; @@ -40,7 +41,7 @@ } /* -@@ -4779,6 +4783,8 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev, +@@ -4794,6 +4798,8 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev, uint8_t j, mask; uint32_t reta, r; uint16_t idx, shift; @@ -49,7 +50,7 @@ struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t reta_reg; -@@ -4820,6 +4826,7 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev, +@@ -4835,6 +4841,7 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev, } IXGBE_WRITE_REG(hw, reta_reg, reta); } @@ -57,7 +58,7 @@ return 0; } -@@ -5143,6 +5150,8 @@ static void +@@ -5139,6 +5146,8 @@ static void ixgbevf_dev_stop(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -66,7 +67,7 @@ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; -@@ -5172,6 +5181,8 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) +@@ -5168,6 +5177,8 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) rte_free(intr_handle->intr_vec); intr_handle->intr_vec = NULL; } @@ -76,10 +77,10 @@ static void diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h -index d0b93968b..565c69c9e 100644 +index 762f1ad34..739022e53 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h -@@ -490,6 +490,9 @@ struct ixgbe_adapter { +@@ -504,6 +504,9 @@ struct ixgbe_adapter { struct rte_timecounter rx_tstamp_tc; struct rte_timecounter tx_tstamp_tc; struct ixgbe_tm_conf tm_conf; @@ -88,12 +89,12 @@ + uint8_t rss_reta_updated; }; - struct ixgbe_vf_representor { + #define IXGBE_DEV_PRIVATE_TO_HW(adapter)\ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c -index 7771d0e6d..9a79d18e4 100644 +index 651b5e8de..ea6c038e0 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c -@@ -3418,6 +3418,7 @@ static void +@@ -3325,6 +3325,7 @@ static void ixgbe_rss_configure(struct rte_eth_dev *dev) { struct rte_eth_rss_conf rss_conf; @@ -101,7 +102,7 @@ struct ixgbe_hw *hw; uint32_t reta; uint16_t i; -@@ -3426,6 +3427,7 @@ ixgbe_rss_configure(struct rte_eth_dev *dev) +@@ -3333,6 +3334,7 @@ ixgbe_rss_configure(struct rte_eth_dev *dev) uint32_t reta_reg; PMD_INIT_FUNC_TRACE(); @@ -109,7 +110,7 @@ hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); sp_reta_size = ixgbe_reta_size_get(hw->mac.type); -@@ -3435,16 +3437,18 @@ ixgbe_rss_configure(struct rte_eth_dev *dev) +@@ -3342,16 +3344,18 @@ ixgbe_rss_configure(struct rte_eth_dev *dev) * The byte-swap is needed because NIC registers are in * little-endian order. */