Skip to contentSkip to conversation

ixgbe: advertise highest capable link speed

PATCH Superseded Paul Greenwalt 2 participants 2 messages Oct 23, 2017 – Oct 24, 2017

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbe: advertise highest capable link speed

On module insert advertise highest capable link speed. If module is capable of 10G, then advertise 10G. If autoneg is enabled, then advertise modules capable link speeds. If module is capable of single-rate 1G, then advertise 1G.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +11 -9
index 901ab12..2bd132c 100644
@@ -7648,7 +7648,8 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter)
 static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	u32 speed;
+	u32 cap_speed;
+	u32 speed = 0;
 	bool autoneg = false;
 
 	if (!(adapter->flags & IXGBE_FLAG_NEED_LINK_CONFIG))
@@ -7660,15 +7661,16 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
 
 	adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
 
-	speed = hw->phy.autoneg_advertised;
-	if ((!speed) && (hw->mac.ops.get_link_capabilities)) {
-		hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg);
+	hw->mac.ops.get_link_capabilities(hw, &cap_speed, &autoneg);
 
-		/* setup the highest link when no autoneg */
-		if (!autoneg) {
-			if (speed & IXGBE_LINK_SPEED_10GB_FULL)
-				speed = IXGBE_LINK_SPEED_10GB_FULL;
-		}
+	/* advertise highest capable link speed */
+	if (cap_speed & IXGBE_LINK_SPEED_10GB_FULL) {
+		if (!autoneg)
+			speed = IXGBE_LINK_SPEED_10GB_FULL;
+		else
+			speed = cap_speed;
+	} else if (cap_speed == IXGBE_LINK_SPEED_1GB_FULL) {
+		speed = IXGBE_LINK_SPEED_1GB_FULL;
 	}
 
 	if (hw->mac.ops.setup_link)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 ixgbe: advertise highest capable link speed

Quoted 38 lines · Paul Greenwalt

On module insert advertise highest capable link speed. If module is capable of 10G, then advertise 10G. If autoneg is enabled, then advertise modules capable link speeds. If module is capable of single-rate 1G, then advertise 1G.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -9
index 901ab12..2bd132c 100644
@@ -7648,7 +7648,8 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter)
 static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
 {
        struct ixgbe_hw *hw = &adapter->hw;
-       u32 speed;
+       u32 cap_speed;
+       u32 speed = 0;
        bool autoneg = false;
 
        if (!(adapter->flags & IXGBE_FLAG_NEED_LINK_CONFIG))
@@ -7660,15 +7661,16 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
 
        adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
 
-       speed = hw->phy.autoneg_advertised;
-       if ((!speed) && (hw->mac.ops.get_link_capabilities)) {
-               hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg);
+       hw->mac.ops.get_link_capabilities(hw, &cap_speed, &autoneg);
 
-               /* setup the highest link when no autoneg */
-               if (!autoneg) {
-                       if (speed & IXGBE_LINK_SPEED_10GB_FULL)
-                               speed = IXGBE_LINK_SPEED_10GB_FULL;
-               }

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter) · line 7675

Quoted 10 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +8 -0
+       /* advertise highest capable link speed */
+       if (cap_speed & IXGBE_LINK_SPEED_10GB_FULL) {
+               if (!autoneg)
+                       speed = IXGBE_LINK_SPEED_10GB_FULL;
+               else
+                       speed = cap_speed;
+       } else if (cap_speed == IXGBE_LINK_SPEED_1GB_FULL) {
+               speed = IXGBE_LINK_SPEED_1GB_FULL;
        }
 

It seems like you could simplify this as follows:
if (!autoneg && (cap_speed & IXGBE_LINK_SPEED_10GB_FULL))

         speed = IXGBE_LINK_SPEED_10GB_FULL;

else
speed = cap_speed & (IXGBE_LINK_SPEED_10GB_FULL |
IXGBE_LINK_SPEED_1GB_FULL);

Quoted 8 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -1
        if (hw->mac.ops.setup_link)
--

2.7.4

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan