patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Igor Russkikh <Igor.Russkikh@aquantia.com>
To: "stable@dpdk.org" <stable@dpdk.org>,
	"ktraynor@redhat.com" <ktraynor@redhat.com>
Cc: Pavel Belous <Pavel.Belous@aquantia.com>,
	Igor Russkikh <Igor.Russkikh@aquantia.com>,
	Pavel Belous <Pavel.Belous@aquantia.com>
Subject: [dpdk-stable] [PATCH 18.11 10/10] net/atlantic: fix link configuration
Date: Sat, 18 May 2019 09:47:54 +0000	[thread overview]
Message-ID: <bd3e92dffdefa13c41c80bfb92329b5fba861db4.1558172288.git.igor.russkikh@aquantia.com> (raw)
In-Reply-To: <cover.1558172288.git.igor.russkikh@aquantia.com>

In case link speed is re configured after port start, it does not
takes the requested speed value, but instead just sets full autoneg
mask.

Fixes: 7943ba05f67c ("net/atlantic: add link status and interrupt management")
Cc: stable@dpdk.org

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
 drivers/net/atlantic/atl_ethdev.c | 47 +++++++++++++------------------
 1 file changed, 20 insertions(+), 27 deletions(-)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 572ce564053e..dc6668fa5582 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -467,8 +467,6 @@ atl_dev_start(struct rte_eth_dev *dev)
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	uint32_t intr_vector = 0;
-	uint32_t *link_speeds;
-	uint32_t speed = 0;
 	int status;
 	int err;
 
@@ -545,6 +543,8 @@ atl_dev_start(struct rte_eth_dev *dev)
 		goto error;
 	}
 
+	err = atl_dev_set_link_up(dev);
+
 	err = hw->aq_fw_ops->update_link_status(hw);
 
 	if (err)
@@ -552,29 +552,6 @@ atl_dev_start(struct rte_eth_dev *dev)
 
 	dev->data->dev_link.link_status = hw->aq_link_status.mbps != 0;
 
-	link_speeds = &dev->data->dev_conf.link_speeds;
-
-	speed = 0x0;
-
-	if (*link_speeds == ETH_LINK_SPEED_AUTONEG) {
-		speed = hw->aq_nic_cfg->link_speed_msk;
-	} else {
-		if (*link_speeds & ETH_LINK_SPEED_10G)
-			speed |= AQ_NIC_RATE_10G;
-		if (*link_speeds & ETH_LINK_SPEED_5G)
-			speed |= AQ_NIC_RATE_5G;
-		if (*link_speeds & ETH_LINK_SPEED_1G)
-			speed |= AQ_NIC_RATE_1G;
-		if (*link_speeds & ETH_LINK_SPEED_2_5G)
-			speed |=  AQ_NIC_RATE_2G5;
-		if (*link_speeds & ETH_LINK_SPEED_100M)
-			speed |= AQ_NIC_RATE_100M;
-	}
-
-	err = hw->aq_fw_ops->set_link_speed(hw, speed);
-	if (err)
-		goto error;
-
 	if (rte_intr_allow_others(intr_handle)) {
 		/* check if lsc interrupt is enabled */
 		if (dev->data->dev_conf.intr_conf.lsc != 0)
@@ -659,9 +636,25 @@ static int
 atl_dev_set_link_up(struct rte_eth_dev *dev)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t link_speeds = dev->data->dev_conf.link_speeds;
+	uint32_t speed_mask = 0;
+
+	if (link_speeds == ETH_LINK_SPEED_AUTONEG) {
+		speed_mask = hw->aq_nic_cfg->link_speed_msk;
+	} else {
+		if (link_speeds & ETH_LINK_SPEED_10G)
+			speed_mask |= AQ_NIC_RATE_10G;
+		if (link_speeds & ETH_LINK_SPEED_5G)
+			speed_mask |= AQ_NIC_RATE_5G;
+		if (link_speeds & ETH_LINK_SPEED_1G)
+			speed_mask |= AQ_NIC_RATE_1G;
+		if (link_speeds & ETH_LINK_SPEED_2_5G)
+			speed_mask |=  AQ_NIC_RATE_2G5;
+		if (link_speeds & ETH_LINK_SPEED_100M)
+			speed_mask |= AQ_NIC_RATE_100M;
+	}
 
-	return hw->aq_fw_ops->set_link_speed(hw,
-			hw->aq_nic_cfg->link_speed_msk);
+	return hw->aq_fw_ops->set_link_speed(hw, speed_mask);
 }
 
 /*
-- 
2.17.1


  parent reply	other threads:[~2019-05-18  9:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-18  9:47 [dpdk-stable] [PATCH 18.11 00/10] Aquantia atlantic bugfixes Igor Russkikh
2019-05-18  9:47 ` [dpdk-stable] [PATCH 18.11 01/10] net/atlantic: enable broadcast traffic Igor Russkikh
2019-05-18  9:47 ` [dpdk-stable] [PATCH 18.11 02/10] net/atlantic: extra line at eof Igor Russkikh
2019-05-18  9:47 ` [dpdk-stable] [PATCH 18.11 03/10] net/atlantic: error handling for mailbox access Igor Russkikh
2019-05-18  9:47 ` [dpdk-stable] [PATCH 18.11 04/10] net/atlantic: eeprom get/set should consider offset Igor Russkikh
2019-05-18  9:47 ` [dpdk-stable] [PATCH 18.11 05/10] net/atlantic: fix max eeprom size Igor Russkikh
2019-05-18  9:47 ` [dpdk-stable] [PATCH 18.11 06/10] net/atlantic: validity check for eeprom dev address Igor Russkikh
2019-05-18  9:47 ` [dpdk-stable] [PATCH 18.11 07/10] net/atlantic: bad logic with offsets talking with firmware Igor Russkikh
2019-05-18  9:47 ` [dpdk-stable] [PATCH 18.11 08/10] net/atlantic: flow control settings synchronization on rx Igor Russkikh
2019-05-18  9:47 ` [dpdk-stable] [PATCH 18.11 09/10] net/atlantic: use capability bits to detect eeprom access Igor Russkikh
2019-05-18  9:47 ` Igor Russkikh [this message]
2019-05-20 16:20 ` [dpdk-stable] [PATCH 18.11 00/10] Aquantia atlantic bugfixes Kevin Traynor
2019-05-21  8:57   ` Igor Russkikh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd3e92dffdefa13c41c80bfb92329b5fba861db4.1558172288.git.igor.russkikh@aquantia.com \
    --to=igor.russkikh@aquantia.com \
    --cc=Pavel.Belous@aquantia.com \
    --cc=ktraynor@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).