Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Fix ixgbe_sfp_cage_full() on X550EM_A.



details:   https://anonhg.NetBSD.org/src/rev/f8c44e3b6653
branches:  trunk
changeset: 1013294:f8c44e3b6653
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Aug 24 18:31:14 2020 +0000

description:
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

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r a2fbbbe47a53 -r f8c44e3b6653 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Mon Aug 24 18:22:30 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Mon Aug 24 18:31:14 2020 +0000
@@ -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 @@
 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 @@
                        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;



Home | Main Index | Thread Index | Old Index