DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wei Dai <wei.dai@intel.com>
To: helin.zhang@intel.com, konstantin.ananyev@intel.com
Cc: dev@dpdk.org, Wei Dai <wei.dai@intel.com>
Subject: [dpdk-dev] [PATCH 14/29] net/ixgbe/base: update setup PHY link to unset all speeds
Date: Sun,  4 Dec 2016 14:31:25 +0800	[thread overview]
Message-ID: <1480833100-48545-14-git-send-email-wei.dai@intel.com> (raw)
In-Reply-To: <1480833100-48545-1-git-send-email-wei.dai@intel.com>

This patch updates ixgbe_setup_phy_link_generic to set/unset
auto-negotiation for all speeds. This ensures that unsupported
speeds are unset. This is necessary since the PHY NVM may
advertise unsupported speeds.

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_phy.c | 130 +++++++++++++++----------------------
 1 file changed, 51 insertions(+), 79 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
index 1d9fb3e..54e45b2 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.c
+++ b/drivers/net/ixgbe/base/ixgbe_phy.c
@@ -787,91 +787,63 @@ s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw)
 
 	ixgbe_get_copper_link_capabilities_generic(hw, &speed, &autoneg);
 
-	if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
-		/* Set or unset auto-negotiation 10G advertisement */
-		hw->phy.ops.read_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
-				     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				     &autoneg_reg);
-
-		autoneg_reg &= ~IXGBE_MII_10GBASE_T_ADVERTISE;
-		if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL)
-			autoneg_reg |= IXGBE_MII_10GBASE_T_ADVERTISE;
-
-		hw->phy.ops.write_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      autoneg_reg);
-	}
-
-	if (hw->mac.type == ixgbe_mac_X550) {
-		if (speed & IXGBE_LINK_SPEED_5GB_FULL) {
-			/* Set or unset auto-negotiation 5G advertisement */
-			hw->phy.ops.read_reg(hw,
-				IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				&autoneg_reg);
-
-			autoneg_reg &= ~IXGBE_MII_5GBASE_T_ADVERTISE;
-			if (hw->phy.autoneg_advertised &
-			     IXGBE_LINK_SPEED_5GB_FULL)
-				autoneg_reg |= IXGBE_MII_5GBASE_T_ADVERTISE;
-
-			hw->phy.ops.write_reg(hw,
-				IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				autoneg_reg);
-		}
+	/* Set or unset auto-negotiation 10G advertisement */
+	hw->phy.ops.read_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
+			     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			     &autoneg_reg);
 
-		if (speed & IXGBE_LINK_SPEED_2_5GB_FULL) {
-			/* Set or unset auto-negotiation 2.5G advertisement */
-			hw->phy.ops.read_reg(hw,
-				IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				&autoneg_reg);
-
-			autoneg_reg &= ~IXGBE_MII_2_5GBASE_T_ADVERTISE;
-			if (hw->phy.autoneg_advertised &
-			    IXGBE_LINK_SPEED_2_5GB_FULL)
-				autoneg_reg |= IXGBE_MII_2_5GBASE_T_ADVERTISE;
-
-			hw->phy.ops.write_reg(hw,
-				IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				autoneg_reg);
-		}
-	}
+	autoneg_reg &= ~IXGBE_MII_10GBASE_T_ADVERTISE;
+	if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) &&
+	    (speed & IXGBE_LINK_SPEED_10GB_FULL))
+		autoneg_reg |= IXGBE_MII_10GBASE_T_ADVERTISE;
 
-	if (speed & IXGBE_LINK_SPEED_1GB_FULL) {
-		/* Set or unset auto-negotiation 1G advertisement */
-		hw->phy.ops.read_reg(hw,
-				     IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				     &autoneg_reg);
+	hw->phy.ops.write_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
+			      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			      autoneg_reg);
 
-		autoneg_reg &= ~IXGBE_MII_1GBASE_T_ADVERTISE;
-		if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL)
-			autoneg_reg |= IXGBE_MII_1GBASE_T_ADVERTISE;
+	hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
+			     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			     &autoneg_reg);
 
-		hw->phy.ops.write_reg(hw,
-				      IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      autoneg_reg);
+	if (hw->mac.type == ixgbe_mac_X550) {
+		/* Set or unset auto-negotiation 5G advertisement */
+		autoneg_reg &= ~IXGBE_MII_5GBASE_T_ADVERTISE;
+		if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_5GB_FULL) &&
+		    (speed & IXGBE_LINK_SPEED_5GB_FULL))
+			autoneg_reg |= IXGBE_MII_5GBASE_T_ADVERTISE;
+
+		/* Set or unset auto-negotiation 2.5G advertisement */
+		autoneg_reg &= ~IXGBE_MII_2_5GBASE_T_ADVERTISE;
+		if ((hw->phy.autoneg_advertised &
+		     IXGBE_LINK_SPEED_2_5GB_FULL) &&
+		    (speed & IXGBE_LINK_SPEED_2_5GB_FULL))
+			autoneg_reg |= IXGBE_MII_2_5GBASE_T_ADVERTISE;
 	}
 
-	if (speed & IXGBE_LINK_SPEED_100_FULL) {
-		/* Set or unset auto-negotiation 100M advertisement */
-		hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG,
-				     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				     &autoneg_reg);
-
-		autoneg_reg &= ~(IXGBE_MII_100BASE_T_ADVERTISE |
-				 IXGBE_MII_100BASE_T_ADVERTISE_HALF);
-		if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL)
-			autoneg_reg |= IXGBE_MII_100BASE_T_ADVERTISE;
-
-		hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      autoneg_reg);
-	}
+	/* Set or unset auto-negotiation 1G advertisement */
+	autoneg_reg &= ~IXGBE_MII_1GBASE_T_ADVERTISE;
+	if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) &&
+	    (speed & IXGBE_LINK_SPEED_1GB_FULL))
+		autoneg_reg |= IXGBE_MII_1GBASE_T_ADVERTISE;
+
+	hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
+			      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			      autoneg_reg);
+
+	/* Set or unset auto-negotiation 100M advertisement */
+	hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG,
+			     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			     &autoneg_reg);
+
+	autoneg_reg &= ~(IXGBE_MII_100BASE_T_ADVERTISE |
+			 IXGBE_MII_100BASE_T_ADVERTISE_HALF);
+	if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) &&
+	    (speed & IXGBE_LINK_SPEED_100_FULL))
+		autoneg_reg |= IXGBE_MII_100BASE_T_ADVERTISE;
+
+	hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG,
+			      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			      autoneg_reg);
 
 	/* Blocked by MNG FW so don't reset PHY */
 	if (ixgbe_check_reset_blocked(hw))
-- 
2.7.4

  parent reply	other threads:[~2016-12-04  6:35 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-04  6:31 [dpdk-dev] [PATCH 01/29] net/ixgbe/base: fix check for PHY reset Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 02/29] net/ixgbe/base: fix condition to clear RAR entry Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 03/29] net/ixgbe/base: use fast MDIO for non-10G MDIO devices Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 04/29] net/ixgbe/base: fix PHY identification Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 05/29] net/ixgbe/base: clean up X557 link status check Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 06/29] net/ixgbe/base: add driver version to firmware Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 07/29] net/ixgbe/base: add support to store LED link active Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 08/29] net/ixgbe/base: cleanup logic in X540 checksum calculation Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 09/29] net/ixgbe/base: enable LASI interrupts only for X552 devices Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 10/29] net/ixgbe/base: add X552 MAC check for iXFI flows Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 11/29] net/ixgbe/base: fix getting phy type Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 12/29] net/ixgbe/base: fix SGMII link setup for M88 PHYs Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 13/29] net/ixgbe/base: cleanup dead EEE code Wei Dai
2016-12-04  6:31 ` Wei Dai [this message]
2016-12-04  6:31 ` [dpdk-dev] [PATCH 15/29] net/ixgbe/base: support FW commands to control some PHYs Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 16/29] net/ixgbe/base: use " Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 17/29] net/ixgbe/base: support busy SGMII register reads Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 18/29] net/ixgbe/base: include new speeds in VFLINK interpretation Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 19/29] net/ixgbe/base: check only X550 devices support 5G Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 20/29] net/ixgbe/base: add physical layer options for FW PHY type Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 21/29] net/ixgbe/base: remove unneeded MAC check Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 22/29] net/ixgbe/base: remove unused PHY ID Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 23/29] net/ixgbe/base: update FW PHY flow control Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 24/29] net/ixgbe/base: add EEE support for DNL-controlled PHYs Wei Dai
2016-12-05 19:40   ` Ferruh Yigit
2016-12-21 10:17     ` Dai, Wei
2016-12-04  6:31 ` [dpdk-dev] [PATCH 25/29] net/ixgbe/base: fix incorrect IXGBE LSWFW register Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 26/29] net/ixgbe/base: remove unused old EEE code Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 27/29] net/ixgbe/base: add write flush required by Inphi Wei Dai
2016-12-05 19:40   ` Ferruh Yigit
2016-12-21 10:31     ` Dai, Wei
2016-12-04  6:31 ` [dpdk-dev] [PATCH 28/29] net/ixgbe/base: report physical layer for SGMII PHY type Wei Dai
2016-12-04  6:31 ` [dpdk-dev] [PATCH 29/29] net/ixgbe/base: update version of basical codes in README Wei Dai
2016-12-05 19:41   ` Ferruh Yigit
2016-12-17 14:39     ` Dai, Wei
2016-12-21 10:32     ` Dai, Wei

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=1480833100-48545-14-git-send-email-wei.dai@intel.com \
    --to=wei.dai@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=konstantin.ananyev@intel.com \
    /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).