Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/pci/ixgbe Pull up following revision(s) (requeste...



details:   https://anonhg.NetBSD.org/src/rev/74e96cee7d91
branches:  netbsd-9
changeset: 964101:74e96cee7d91
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Sep 02 12:34:55 2020 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1070):

        sys/dev/pci/ixgbe/if_bypass.c: revision 1.6
        sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.28
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.246

Fix checking return value of atomic_cas_uint().

This change fixes a bug that extra delay() is called only once even if
atomic_cas_uint() isn't failed or delay() isn't called when atomic_cas_uint()
failed.

The reason of this bug was that I simply converted FreeBSD' atomic_cmpset_int()
to atomic_cas_uint(). The return value's semantics is different.

 -

Minor change.
  - Print "X550EM X" instead of "X550EM" for Xeon D devices.
  - Fix typo in comment. Same as FreeBSD.

diffstat:

 sys/dev/pci/ixgbe/if_bypass.c    |  18 +++++++++---------
 sys/dev/pci/ixgbe/ixgbe.c        |   4 ++--
 sys/dev/pci/ixgbe/ixgbe_common.c |   4 ++--
 3 files changed, 13 insertions(+), 13 deletions(-)

diffs (107 lines):

diff -r 5365e2eb5e89 -r 74e96cee7d91 sys/dev/pci/ixgbe/if_bypass.c
--- a/sys/dev/pci/ixgbe/if_bypass.c     Sat Aug 29 17:03:39 2020 +0000
+++ b/sys/dev/pci/ixgbe/if_bypass.c     Wed Sep 02 12:34:55 2020 +0000
@@ -45,9 +45,9 @@
 static void
 ixgbe_bypass_mutex_enter(struct adapter *adapter)
 {
-       while (atomic_cas_uint(&adapter->bypass.low, 0, 1) == 0)
+       while (atomic_cas_uint(&adapter->bypass.low, 0, 1) != 0)
                usec_delay(3000);
-       while (atomic_cas_uint(&adapter->bypass.high, 0, 1) == 0)
+       while (atomic_cas_uint(&adapter->bypass.high, 0, 1) != 0)
                usec_delay(3000);
        return;
 } /* ixgbe_bypass_mutex_enter */
@@ -58,9 +58,9 @@
 static void
 ixgbe_bypass_mutex_clear(struct adapter *adapter)
 {
-       while (atomic_cas_uint(&adapter->bypass.high, 1, 0) == 0)
+       while (atomic_cas_uint(&adapter->bypass.high, 1, 0) != 1)
                usec_delay(6000);
-       while (atomic_cas_uint(&adapter->bypass.low, 1, 0) == 0)
+       while (atomic_cas_uint(&adapter->bypass.low, 1, 0) != 1)
                usec_delay(6000);
        return;
 } /* ixgbe_bypass_mutex_clear */
@@ -73,7 +73,7 @@
 static void
 ixgbe_bypass_wd_mutex_enter(struct adapter *adapter)
 {
-       while (atomic_cas_uint(&adapter->bypass.high, 0, 1) == 0)
+       while (atomic_cas_uint(&adapter->bypass.high, 0, 1) != 0)
                usec_delay(3000);
        return;
 } /* ixgbe_bypass_wd_mutex_enter */
@@ -84,7 +84,7 @@
 static void
 ixgbe_bypass_wd_mutex_clear(struct adapter *adapter)
 {
-       while (atomic_cas_uint(&adapter->bypass.high, 1, 0) == 0)
+       while (atomic_cas_uint(&adapter->bypass.high, 1, 0) != 1)
                usec_delay(6000);
        return;
 } /* ixgbe_bypass_wd_mutex_clear */
@@ -585,7 +585,7 @@
                return (error);
 
        /* Keep the log display single-threaded */
-       while (atomic_cas_uint(&adapter->bypass.log, 0, 1) == 0)
+       while (atomic_cas_uint(&adapter->bypass.log, 0, 1) != 0)
                usec_delay(3000);
 
        ixgbe_bypass_mutex_enter(adapter);
@@ -713,14 +713,14 @@
 
        status = 0; /* reset */
        /* Another log command can now run */
-       while (atomic_cas_uint(&adapter->bypass.log, 1, 0) == 0)
+       while (atomic_cas_uint(&adapter->bypass.log, 1, 0) != 1)
                usec_delay(3000);
        return (error);
 
 unlock_err:
        ixgbe_bypass_mutex_clear(adapter);
        status = 0; /* reset */
-       while (atomic_cas_uint(&adapter->bypass.log, 1, 0) == 0)
+       while (atomic_cas_uint(&adapter->bypass.log, 1, 0) != 1)
                usec_delay(3000);
        return (EINVAL);
 } /* ixgbe_bp_log */
diff -r 5365e2eb5e89 -r 74e96cee7d91 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Sat Aug 29 17:03:39 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Sep 02 12:34:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.11 2020/07/10 11:35:51 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.12 2020/09/02 12:34:55 martin Exp $ */
 
 /******************************************************************************
 
@@ -861,7 +861,7 @@
                str = "X550";
                break;
        case ixgbe_mac_X550EM_x:
-               str = "X550EM";
+               str = "X550EM X";
                break;
        case ixgbe_mac_X550EM_a:
                str = "X550EM A";
diff -r 5365e2eb5e89 -r 74e96cee7d91 sys/dev/pci/ixgbe/ixgbe_common.c
--- a/sys/dev/pci/ixgbe/ixgbe_common.c  Sat Aug 29 17:03:39 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.c  Wed Sep 02 12:34:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.25.2.2 2020/07/10 11:35:51 martin Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.25.2.3 2020/09/02 12:34:55 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -5234,7 +5234,7 @@
        nvm_ver->oem_valid = FALSE;
        hw->eeprom.ops.read(hw, NVM_OEM_PROD_VER_PTR, &offset);
 
-       /* Return is offset to OEM Product Version block is invalid */
+       /* Return if offset to OEM Product Version block is invalid */
        if (offset == 0x0 || offset == NVM_INVALID_PTR)
                return;
 



Home | Main Index | Thread Index | Old Index