Module Name:    src
Committed By:   msaitoh
Date:           Mon Aug 24 18:31:15 UTC 2020

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

Log Message:
 Fix ixgbe_sfp_cage_full() on X550EM_A.

In ixgbe_handle_mod():

                switch (hw->mac.type) {
                case ixgbe_mac_82599EB:
                        cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
                            IXGBE_ESDP_SDP2;
                        break;
                case ixgbe_mac_X550EM_x:
                case ixgbe_mac_X550EM_a:
                        cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
                            IXGBE_ESDP_SDP0;
                        break;
                default:
                        break;
                }

so I had thought that IXGBE_ESDP_SDP0 bit is 1 on cage is full.
In reality, at least, X550EM_A's SFP+ cage is 0 on cage is full.
So invert the logic of ixgbe_sfp_cage_full() on X550EM_A


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 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.241 src/sys/dev/pci/ixgbe/ixgbe.c:1.242
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.241	Mon Aug 24 18:21:59 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Aug 24 18:31:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.241 2020/08/24 18:21:59 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.242 2020/08/24 18:31:14 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -4624,13 +4624,20 @@ static bool
 ixgbe_sfp_cage_full(struct ixgbe_hw *hw)
 {
 	uint32_t mask;
+	int rv;
 
 	if (hw->mac.type >= ixgbe_mac_X540)
 		mask = IXGBE_ESDP_SDP0;
 	else
 		mask = IXGBE_ESDP_SDP2;
 
-	return IXGBE_READ_REG(hw, IXGBE_ESDP) & mask;
+	rv = IXGBE_READ_REG(hw, IXGBE_ESDP) & mask;
+	if (hw->mac.type == ixgbe_mac_X550EM_a) {
+		/* It seems X550EM_a's SDP0 is inverted than others... */
+		return (rv == 0);
+	}
+
+	return rv;
 } /* ixgbe_sfp_cage_full */
 
 /************************************************************************
@@ -4653,6 +4660,10 @@ ixgbe_handle_mod(void *context)
 			break;
 		case ixgbe_mac_X550EM_x:
 		case ixgbe_mac_X550EM_a:
+			/*
+			 * XXX See ixgbe_sfp_cage_full(). It seems the bit is
+			 * inverted on X550EM_a, so I think this is incorrect.
+			 */
 			cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
 			    IXGBE_ESDP_SDP0;
 			break;

Reply via email to