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 7ED98A04F3 for ; Thu, 19 Dec 2019 06:00:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 59C7C1BF71; Thu, 19 Dec 2019 06:00:25 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 75C651BC25; Thu, 19 Dec 2019 06:00:21 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Dec 2019 21:00:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="222175526" Received: from intel.sh.intel.com ([10.239.255.23]) by fmsmga001.fm.intel.com with ESMTP; 18 Dec 2019 21:00:18 -0800 From: Sun GuinanX To: dev@dpdk.org Cc: Wenzhuo Lu , Qiming Yang , Qi Zhang , Sun GuinanX , stable@dpdk.org Date: Thu, 19 Dec 2019 04:43:56 +0000 Message-Id: <20191219044356.30762-1-guinanx.sun@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH] net/ixgbe: fix flow ctrl mode setting 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" When the port starts, the hw register is reset first, and then the required parameters are set again. If the parameters to be used are not set after resetting the register, a read register error will occur. This patch is used to fix the problem. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Sun GuinanX --- drivers/net/ixgbe/ixgbe_ethdev.c | 20 ++++++++++++++++++++ drivers/net/ixgbe/ixgbe_ethdev.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 2c6fd0f13..e602df02b 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2539,6 +2539,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ixgbe_adapter *adapter = dev->data->dev_private; struct ixgbe_vf_info *vfinfo = *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -2555,6 +2556,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev) IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private); struct ixgbe_macsec_setting *macsec_setting = IXGBE_DEV_PRIVATE_TO_MACSEC_SETTING(dev->data->dev_private); + uint32_t mflcn; PMD_INIT_FUNC_TRACE(); @@ -2665,6 +2667,20 @@ ixgbe_dev_start(struct rte_eth_dev *dev) } ixgbe_restore_statistics_mapping(dev); + err = ixgbe_fc_enable(hw); + if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED)) { + + 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); + } err = ixgbe_dev_rxtx_start(dev); if (err < 0) { @@ -2893,6 +2909,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) adapter->rss_reta_updated = 0; + adapter->mac_ctrl_frame_fwd = 0; + hw->adapter_stopped = true; } @@ -4646,6 +4664,7 @@ 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; @@ -4682,6 +4701,7 @@ 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); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 76a1b9d18..5af584f9e 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; }; struct ixgbe_vf_representor { -- 2.17.1