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 6F851A0561 for ; Thu, 27 Feb 2020 18:39:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6AEFF2C02; Thu, 27 Feb 2020 18:39:01 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 9BC652C02 for ; Thu, 27 Feb 2020 18:39:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582825140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GBKMVCigJozJo+g/n7+Hui2P1iQAU668w8zbuB5Bwnw=; b=Bcltww9g+laIiKwdWqySwVm88AFEu8a/ymxfOSwSbFSF7JN1ezlBTQ0stPamhU7pj9rvCg GhNecD8G1QBsxkJ7FLueEgYuQvINnEb6vEMsPa97AUeF3Q+G4wf+WlRNtrKfNkh+Dcrzq+ vPExmE694INoKODXbRWhvCd9zugGRHs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-252-Y_L35vEfNaWH6iqY4u4BhQ-1; Thu, 27 Feb 2020 12:38:54 -0500 X-MC-Unique: Y_L35vEfNaWH6iqY4u4BhQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CA96418C35A0; Thu, 27 Feb 2020 17:38:53 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.123]) by smtp.corp.redhat.com (Postfix) with ESMTP id B65578C091; Thu, 27 Feb 2020 17:38:50 +0000 (UTC) From: Kevin Traynor To: Guinan Sun Cc: Tomasz Konieczny , Xiaolong Ye , dpdk stable Date: Thu, 27 Feb 2020 17:37:58 +0000 Message-Id: <20200227173807.28004-7-ktraynor@redhat.com> In-Reply-To: <20200227173807.28004-1-ktraynor@redhat.com> References: <20200227173807.28004-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'net/ixgbe: fix flow control mode setting' has been queued to LTS release 18.11.7 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 LTS release 18.11.7 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/02/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 rebasi= ng (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/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/1fa4864cd8691ca86e= 04a68fbec6536caa8e304e Thanks. Kevin. --- >From 1fa4864cd8691ca86e04a68fbec6536caa8e304e 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_eth= dev.c index e06cc433c7..2d49ea011b 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1155,6 +1155,6 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void = *init_params __rte_unused) =09ixgbe_dcb_init(hw, dcb_config); =09/* Get Hardware Flow Control setting */ -=09hw->fc.requested_mode =3D ixgbe_fc_full; -=09hw->fc.current_mode =3D ixgbe_fc_full; +=09hw->fc.requested_mode =3D ixgbe_fc_none; +=09hw->fc.current_mode =3D ixgbe_fc_none; =09hw->fc.pause_time =3D IXGBE_FC_PAUSE; =09for (i =3D 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) { @@ -2574,4 +2574,37 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uin= t16_t vf, } =20 +static int +ixgbe_flow_ctrl_enable(struct rte_eth_dev *dev, struct ixgbe_hw *hw) +{ +=09struct ixgbe_adapter *adapter =3D dev->data->dev_private; +=09int err; +=09uint32_t mflcn; + +=09err =3D ixgbe_fc_enable(hw); + +=09/* Not negotiated is not an error case */ +=09if (err =3D=3D IXGBE_SUCCESS || err =3D=3D IXGBE_ERR_FC_NOT_NEGOTIATED)= { +=09=09/* +=09=09 *check if we want to forward MAC frames - driver doesn't +=09=09 *have native capability to do that, +=09=09 *so we'll write the registers ourselves +=09=09 */ + +=09=09mflcn =3D IXGBE_READ_REG(hw, IXGBE_MFLCN); + +=09=09/* set or clear MFLCN.PMCF bit depending on configuration */ +=09=09if (adapter->mac_ctrl_frame_fwd !=3D 0) +=09=09=09mflcn |=3D IXGBE_MFLCN_PMCF; +=09=09else +=09=09=09mflcn &=3D ~IXGBE_MFLCN_PMCF; + +=09=09IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn); +=09=09IXGBE_WRITE_FLUSH(hw); + +=09=09return 0; +=09} +=09return err; +} + /* * Configure device link speed and setup link. @@ -2710,4 +2743,10 @@ ixgbe_dev_start(struct rte_eth_dev *dev) =09ixgbe_restore_statistics_mapping(dev); =20 +=09err =3D ixgbe_flow_ctrl_enable(dev, hw); +=09if (err < 0) { +=09=09PMD_INIT_LOG(ERR, "enable flow ctrl err"); +=09=09goto error; +=09} + =09err =3D ixgbe_dev_rxtx_start(dev); =09if (err < 0) { @@ -2926,4 +2965,6 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) =20 =09adapter->rss_reta_updated =3D 0; + +=09adapter->mac_ctrl_frame_fwd =3D 0; } =20 @@ -4639,8 +4680,8 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct r= te_eth_fc_conf *fc_conf) { =09struct ixgbe_hw *hw; +=09struct ixgbe_adapter *adapter =3D dev->data->dev_private; =09int err; =09uint32_t rx_buf_size; =09uint32_t max_high_water; -=09uint32_t mflcn; =09enum ixgbe_fc_mode rte_fcmode_2_ixgbe_fcmode[] =3D { =09=09ixgbe_fc_none, @@ -4674,29 +4715,12 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct= rte_eth_fc_conf *fc_conf) =09hw->fc.send_xon =3D fc_conf->send_xon; =09hw->fc.disable_fc_autoneg =3D !fc_conf->autoneg; +=09adapter->mac_ctrl_frame_fwd =3D fc_conf->mac_ctrl_frame_fwd; =20 -=09err =3D ixgbe_fc_enable(hw); - -=09/* Not negotiated is not an error case */ -=09if ((err =3D=3D IXGBE_SUCCESS) || (err =3D=3D IXGBE_ERR_FC_NOT_NEGOTIAT= ED)) { - -=09=09/* check if we want to forward MAC frames - driver doesn't have nati= ve -=09=09 * capability to do that, so we'll write the registers ourselves */ - -=09=09mflcn =3D IXGBE_READ_REG(hw, IXGBE_MFLCN); - -=09=09/* set or clear MFLCN.PMCF bit depending on configuration */ -=09=09if (fc_conf->mac_ctrl_frame_fwd !=3D 0) -=09=09=09mflcn |=3D IXGBE_MFLCN_PMCF; -=09=09else -=09=09=09mflcn &=3D ~IXGBE_MFLCN_PMCF; - -=09=09IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn); -=09=09IXGBE_WRITE_FLUSH(hw); - -=09=09return 0; +=09err =3D ixgbe_flow_ctrl_enable(dev, hw); +=09if (err < 0) { +=09=09PMD_INIT_LOG(ERR, "ixgbe_flow_ctrl_enable =3D 0x%x", err); +=09=09return -EIO; =09} - -=09PMD_INIT_LOG(ERR, "ixgbe_fc_enable =3D 0x%x", err); -=09return -EIO; +=09return err; } =20 diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_eth= dev.h index 752d7981e4..2177d37060 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -506,4 +506,5 @@ struct ixgbe_adapter { =09 */ =09uint8_t pflink_fullchk; +=09uint8_t mac_ctrl_frame_fwd; }; =20 --=20 2.21.1 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092020-02-27 17:26:24.085609083 +0000 +++ 0007-net-ixgbe-fix-flow-control-mode-setting.patch=092020-02-27 17:26:2= 3.641831285 +0000 @@ -1 +1 @@ -From a524f550da6e6c7a308ce7c2f4b6c3be60b5cbfa Mon Sep 17 00:00:00 2001 +From 1fa4864cd8691ca86e04a68fbec6536caa8e304e Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit a524f550da6e6c7a308ce7c2f4b6c3be60b5cbfa ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index 0ef84a2861..23b3f5b0cd 100644 +index e06cc433c7..2d49ea011b 100644 @@ -26 +27 @@ -@@ -1177,6 +1177,6 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void= *init_params __rte_unused) +@@ -1155,6 +1155,6 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void= *init_params __rte_unused) @@ -35 +36 @@ -@@ -2539,4 +2539,37 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, ui= nt16_t vf, +@@ -2574,4 +2574,37 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, ui= nt16_t vf, @@ -73 +74 @@ -@@ -2665,4 +2698,10 @@ ixgbe_dev_start(struct rte_eth_dev *dev) +@@ -2710,4 +2743,10 @@ ixgbe_dev_start(struct rte_eth_dev *dev) @@ -84,2 +85 @@ -@@ -2901,4 +2940,6 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) - =09adapter->rss_reta_updated =3D 0; +@@ -2926,4 +2965,6 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) @@ -87 +87 @@ -+=09adapter->mac_ctrl_frame_fwd =3D 0; + =09adapter->rss_reta_updated =3D 0; @@ -89 +89 @@ - =09hw->adapter_stopped =3D true; ++=09adapter->mac_ctrl_frame_fwd =3D 0; @@ -91 +91,2 @@ -@@ -4719,8 +4760,8 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct = rte_eth_fc_conf *fc_conf) +=20 +@@ -4639,8 +4680,8 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct = rte_eth_fc_conf *fc_conf) @@ -101 +102 @@ -@@ -4755,29 +4796,12 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struc= t rte_eth_fc_conf *fc_conf) +@@ -4674,29 +4715,12 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struc= t rte_eth_fc_conf *fc_conf) @@ -138 +139 @@ -index 5089347a7e..b8df756575 100644 +index 752d7981e4..2177d37060 100644 @@ -141 +142 @@ -@@ -512,4 +512,5 @@ struct ixgbe_adapter { +@@ -506,4 +506,5 @@ struct ixgbe_adapter { @@ -145,2 +146,2 @@ - =09rte_atomic32_t link_thread_running; - =09pthread_t link_thread_tid; + }; +=20