From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E12AA055A for ; Thu, 27 Feb 2020 10:34:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 64AA81BFCD; Thu, 27 Feb 2020 10:34:34 +0100 (CET) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id C53201BFE2 for ; Thu, 27 Feb 2020 10:34:32 +0100 (CET) Received: by mail-wr1-f65.google.com with SMTP id j16so867849wrt.3 for ; Thu, 27 Feb 2020 01:34:32 -0800 (PST) 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=JfWB7pId7tO9bBUMxSUu8sIEIQ9cCJWvJ5+acK0JlWE=; b=UUz+q6QFrMQCoVAdFZWJpKj2DdFqeKrEhMcgrMQZvuptIM6Xst9t2fTkgbyqLPNeOU bpQ/za9SJYqyyRzbx4x8yQtKTDe+g8xqHI9XqolEFGW1dJUmQonZjAKOnEQTAPPW1Otl XAzh1Tpcr7l4xDAbq4+0xQm+w97d5Olt54JoiAv6Dh54pM/6nchGErR3imsu5f4iwJgS 74SFNESAC8LXXilJ6Bv+fGs7TIQ5xflS/q3tCdVPVY4lYGgyix2RET5JWgoEMBj2h7s0 EWEUDu8rGwcSR4L/CyARxayBRR86XINVjwGUn+eI8+B4xrLE69Yt938F1jyE1iLctkAi 9pjQ== 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=JfWB7pId7tO9bBUMxSUu8sIEIQ9cCJWvJ5+acK0JlWE=; b=E1tMipe/RGP0LrmwvYlwD6emPj3kxI6y6NLddcL5oBzGABVshowznWIETd2fUkxp22 Mwnfzz+FUEpfZ6HNE/p5MqduSr63d5vLc77i/mb2P/JUM3q6V4OzIOC/vkMJsn3WfOQP jwvwz0PGT2keggkHvpRI1L2qzbg5NOKluqWKyrhRTdxyy9ChjftSifBZV9MB105FDrai MlVU+DD1X66L8dxuuk3tGRiXTMLJbSzMQ/Z8lkZ4XxtEAQWDQgm8fvPXtaXSwJMM3EtC tJ+z1dagPmtDKr/dEDSI4D3tcPo2eqvdC0tJa73TyVn1NHvNAKkyRcQ7fHC/HxYGFoJR OSaQ== X-Gm-Message-State: APjAAAVGxetJmYs0IS7/i5dlcFC7JFQmHOFrnO5qjE0/kuEjYqZCjsoC JXzm4nxt3kWrBye2y7WAem3oWcP8 X-Google-Smtp-Source: APXvYqxgijDKeXms6k26Gw0yfYbkphtcsSQgsq5yesGb3cLZOpf1/iscs2nWVEqqe+WCNsRGsszEhg== X-Received: by 2002:adf:a50b:: with SMTP id i11mr4131624wrb.60.1582796072432; Thu, 27 Feb 2020 01:34:32 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id o15sm7411410wra.83.2020.02.27.01.34.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 01:34:31 -0800 (PST) From: luca.boccassi@gmail.com To: Guinan Sun Cc: Tomasz Konieczny , Xiaolong Ye , dpdk stable Date: Thu, 27 Feb 2020 09:33:31 +0000 Message-Id: <20200227093402.17690-11-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227093402.17690-1-luca.boccassi@gmail.com> References: <20200217174546.25334-54-luca.boccassi@gmail.com> <20200227093402.17690-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/ixgbe: fix flow control mode setting' has been queued to stable release 19.11.1 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/29/20. 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. Thanks. Luca Boccassi --- >From ccbd09be2352fde2afd9f4692cca6eb01b23f88d Mon Sep 17 00:00:00 2001 From: Guinan Sun Date: Tue, 18 Feb 2020 03:39:31 +0000 Subject: [PATCH] net/ixgbe: fix flow control mode setting [ upstream commit a524f550da6e6c7a308ce7c2f4b6c3be60b5cbfa ] When the port restarts, the flow ctrl register will be reset, we need to make sure it can be configured the same as previous setting, otherwise a register read error would occur. This patch fixes this issue. Fixes: af75078fece3 ("first public release") Signed-off-by: Guinan Sun Tested-by: Tomasz Konieczny Reviewed-by: Xiaolong Ye --- drivers/net/ixgbe/ixgbe_ethdev.c | 76 +++++++++++++++++++++----------- drivers/net/ixgbe/ixgbe_ethdev.h | 1 + 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 51fc0ff09f..3f66b490ed 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1174,8 +1174,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config)); ixgbe_dcb_init(hw, dcb_config); /* Get Hardware Flow Control setting */ - hw->fc.requested_mode = ixgbe_fc_full; - hw->fc.current_mode = ixgbe_fc_full; + hw->fc.requested_mode = ixgbe_fc_none; + hw->fc.current_mode = ixgbe_fc_none; hw->fc.pause_time = IXGBE_FC_PAUSE; for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) { hw->fc.low_water[i] = IXGBE_FC_LO; @@ -2536,6 +2536,39 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf, return 0; } +static int +ixgbe_flow_ctrl_enable(struct rte_eth_dev *dev, struct ixgbe_hw *hw) +{ + struct ixgbe_adapter *adapter = dev->data->dev_private; + int err; + uint32_t mflcn; + + err = ixgbe_fc_enable(hw); + + /* Not negotiated is not an error case */ + if (err == IXGBE_SUCCESS || err == IXGBE_ERR_FC_NOT_NEGOTIATED) { + /* + *check if we want to forward MAC frames - driver doesn't + *have native capability to do that, + *so we'll write the registers ourselves + */ + + mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN); + + /* set or clear MFLCN.PMCF bit depending on configuration */ + if (adapter->mac_ctrl_frame_fwd != 0) + mflcn |= IXGBE_MFLCN_PMCF; + else + mflcn &= ~IXGBE_MFLCN_PMCF; + + IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn); + IXGBE_WRITE_FLUSH(hw); + + return 0; + } + return err; +} + /* * Configure device link speed and setup link. * It returns 0 on success. @@ -2661,6 +2694,12 @@ ixgbe_dev_start(struct rte_eth_dev *dev) ixgbe_restore_statistics_mapping(dev); + err = ixgbe_flow_ctrl_enable(dev, hw); + if (err < 0) { + PMD_INIT_LOG(ERR, "enable flow ctrl err"); + goto error; + } + err = ixgbe_dev_rxtx_start(dev); if (err < 0) { PMD_INIT_LOG(ERR, "Unable to start rxtx queues"); @@ -2897,6 +2936,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) adapter->rss_reta_updated = 0; + adapter->mac_ctrl_frame_fwd = 0; + hw->adapter_stopped = true; } @@ -4714,10 +4755,10 @@ static int ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) { struct ixgbe_hw *hw; + struct ixgbe_adapter *adapter = dev->data->dev_private; int err; uint32_t rx_buf_size; uint32_t max_high_water; - uint32_t mflcn; enum ixgbe_fc_mode rte_fcmode_2_ixgbe_fcmode[] = { ixgbe_fc_none, ixgbe_fc_rx_pause, @@ -4750,31 +4791,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) hw->fc.low_water[0] = fc_conf->low_water; hw->fc.send_xon = fc_conf->send_xon; hw->fc.disable_fc_autoneg = !fc_conf->autoneg; + adapter->mac_ctrl_frame_fwd = fc_conf->mac_ctrl_frame_fwd; - err = ixgbe_fc_enable(hw); - - /* Not negotiated is not an error case */ - if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED)) { - - /* check if we want to forward MAC frames - driver doesn't have native - * capability to do that, so we'll write the registers ourselves */ - - mflcn = IXGBE_READ_REG(hw, IXGBE_MFLCN); - - /* set or clear MFLCN.PMCF bit depending on configuration */ - if (fc_conf->mac_ctrl_frame_fwd != 0) - mflcn |= IXGBE_MFLCN_PMCF; - else - mflcn &= ~IXGBE_MFLCN_PMCF; - - IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn); - IXGBE_WRITE_FLUSH(hw); - - return 0; + err = ixgbe_flow_ctrl_enable(dev, hw); + if (err < 0) { + PMD_INIT_LOG(ERR, "ixgbe_flow_ctrl_enable = 0x%x", err); + return -EIO; } - - PMD_INIT_LOG(ERR, "ixgbe_fc_enable = 0x%x", err); - return -EIO; + return err; } /** diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 318fbe6215..0334c226be 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -510,6 +510,7 @@ struct ixgbe_adapter { * mailbox status) link status. */ uint8_t pflink_fullchk; + uint8_t mac_ctrl_frame_fwd; rte_atomic32_t link_thread_running; pthread_t link_thread_tid; }; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-27 09:31:56.209775167 +0000 +++ 0011-net-ixgbe-fix-flow-control-mode-setting.patch 2020-02-27 09:31:55.699945610 +0000 @@ -1,15 +1,16 @@ -From a524f550da6e6c7a308ce7c2f4b6c3be60b5cbfa Mon Sep 17 00:00:00 2001 +From ccbd09be2352fde2afd9f4692cca6eb01b23f88d Mon Sep 17 00:00:00 2001 From: Guinan Sun Date: Tue, 18 Feb 2020 03:39:31 +0000 Subject: [PATCH] net/ixgbe: fix flow control mode setting +[ upstream commit a524f550da6e6c7a308ce7c2f4b6c3be60b5cbfa ] + When the port restarts, the flow ctrl register will be reset, we need to make sure it can be configured the same as previous setting, otherwise a register read error would occur. This patch fixes this issue. Fixes: af75078fece3 ("first public release") -Cc: stable@dpdk.org Signed-off-by: Guinan Sun Tested-by: Tomasz Konieczny @@ -20,10 +21,10 @@ 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c -index 0ef84a2861..23b3f5b0cd 100644 +index 51fc0ff09f..3f66b490ed 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c -@@ -1176,8 +1176,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -1174,8 +1174,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config)); ixgbe_dcb_init(hw, dcb_config); /* Get Hardware Flow Control setting */ @@ -34,7 +35,7 @@ hw->fc.pause_time = IXGBE_FC_PAUSE; for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) { hw->fc.low_water[i] = IXGBE_FC_LO; -@@ -2538,6 +2538,39 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf, +@@ -2536,6 +2536,39 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf, return 0; } @@ -74,7 +75,7 @@ /* * Configure device link speed and setup link. * It returns 0 on success. -@@ -2664,6 +2697,12 @@ ixgbe_dev_start(struct rte_eth_dev *dev) +@@ -2661,6 +2694,12 @@ ixgbe_dev_start(struct rte_eth_dev *dev) ixgbe_restore_statistics_mapping(dev); @@ -87,7 +88,7 @@ err = ixgbe_dev_rxtx_start(dev); if (err < 0) { PMD_INIT_LOG(ERR, "Unable to start rxtx queues"); -@@ -2900,6 +2939,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) +@@ -2897,6 +2936,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) adapter->rss_reta_updated = 0; @@ -96,7 +97,7 @@ hw->adapter_stopped = true; } -@@ -4718,10 +4759,10 @@ static int +@@ -4714,10 +4755,10 @@ static int ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) { struct ixgbe_hw *hw; @@ -108,7 +109,7 @@ enum ixgbe_fc_mode rte_fcmode_2_ixgbe_fcmode[] = { ixgbe_fc_none, ixgbe_fc_rx_pause, -@@ -4754,31 +4795,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -4750,31 +4791,14 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) hw->fc.low_water[0] = fc_conf->low_water; hw->fc.send_xon = fc_conf->send_xon; hw->fc.disable_fc_autoneg = !fc_conf->autoneg; @@ -147,10 +148,10 @@ /** diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h -index 5089347a7e..b8df756575 100644 +index 318fbe6215..0334c226be 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h -@@ -511,6 +511,7 @@ struct ixgbe_adapter { +@@ -510,6 +510,7 @@ struct ixgbe_adapter { * mailbox status) link status. */ uint8_t pflink_fullchk;