Module Name:    src
Committed By:   msaitoh
Date:           Fri Oct  6 14:41:24 UTC 2023

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

Log Message:
ixg(4): Filter out spurious link up indication

 - Extend SFP+ cage crosstalk fix by re-checking link state after 5ms delay
   to filter out spurious link up indication by transceiver with no fiber
   cable connected.
 - From FreeBSD:
     In-tree: 04a5e6d7cadd06b10169c3c3a560649e7dc7444c
     Out of tree: ix-3.3.33.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ixgbe_common.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_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.45 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.46
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.45	Fri Oct  6 14:37:04 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Fri Oct  6 14:41:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.45 2023/10/06 14:37:04 msaitoh Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.46 2023/10/06 14:41:24 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -36,7 +36,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.45 2023/10/06 14:37:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.46 2023/10/06 14:41:24 msaitoh Exp $");
 
 #include "ixgbe_common.h"
 #include "ixgbe_phy.h"
@@ -4296,10 +4296,25 @@ s32 ixgbe_check_mac_link_generic(struct 
 			links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
 		}
 	} else {
-		if (links_reg & IXGBE_LINKS_UP)
+		if (links_reg & IXGBE_LINKS_UP) {
+			if (ixgbe_need_crosstalk_fix(hw)) {
+				/* Check the link state again after a delay
+				 * to filter out spurious link up
+				 * notifications.
+				 */
+				msec_delay(5);
+				links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
+				if (!(links_reg & IXGBE_LINKS_UP)) {
+					*link_up = false;
+					*speed = IXGBE_LINK_SPEED_UNKNOWN;
+					return IXGBE_SUCCESS;
+				}
+
+			}
 			*link_up = TRUE;
-		else
+		} else {
 			*link_up = FALSE;
+		}
 	}
 
 	switch (links_reg & IXGBE_LINKS_SPEED_82599) {

Reply via email to