Module Name:    src
Committed By:   msaitoh
Date:           Mon May 22 07:35:15 UTC 2017

Modified Files:
        src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
 Fix a bug that the driver prints "Link is up 1 Gbps" even if the link is
100Mbps. This change is the same as a part of ixv.c rev. 1.42.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pci/ixgbe/ixgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.83 src/sys/dev/pci/ixgbe/ixgbe.c:1.84
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.83	Mon May 22 07:23:55 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon May 22 07:35:14 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/
-/*$NetBSD: ixgbe.c,v 1.83 2017/05/22 07:23:55 msaitoh Exp $*/
+/*$NetBSD: ixgbe.c,v 1.84 2017/05/22 07:35:14 msaitoh Exp $*/
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2381,7 +2381,7 @@ ixgbe_update_link_status(struct adapter 
 	device_t dev = adapter->dev;
 	struct ixgbe_hw *hw = &adapter->hw;
 
-	if (adapter->link_up){ 
+	if (adapter->link_up) {
 		if (adapter->link_active == FALSE) {
 			if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL){
 				/*
@@ -2394,10 +2394,26 @@ ixgbe_update_link_status(struct adapter 
 				IXGBE_READ_REG(hw, IXGBE_MRFC);
 			}
 
-			if (bootverbose)
-				device_printf(dev,"Link is up %d Gbps %s \n",
-				    ((adapter->link_speed == 128)? 10:1),
-				    "Full Duplex");
+			if (bootverbose) {
+				const char *bpsmsg;
+
+				switch (adapter->link_speed) {
+				case IXGBE_LINK_SPEED_10GB_FULL:
+					bpsmsg = "10 Gbps";
+					break;
+				case IXGBE_LINK_SPEED_1GB_FULL:
+					bpsmsg = "1 Gbps";
+					break;
+				case IXGBE_LINK_SPEED_100_FULL:
+					bpsmsg = "100 Mbps";
+					break;
+				default:
+					bpsmsg = "unknown speed";
+					break;
+				}
+				device_printf(dev,"Link is up %s %s \n",
+				    bpsmsg, "Full Duplex");
+			}
 			adapter->link_active = TRUE;
 			/* Update any Flow Control changes */
 			ixgbe_fc_enable(&adapter->hw);

Reply via email to