Module Name:    src
Committed By:   martin
Date:           Wed Sep  2 12:34:55 UTC 2020

Modified Files:
        src/sys/dev/pci/ixgbe [netbsd-9]: if_bypass.c ixgbe.c ixgbe_common.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.4.8.1 -r1.4.8.2 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.199.2.11 -r1.199.2.12 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.25.2.2 -r1.25.2.3 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/if_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.4.8.1 src/sys/dev/pci/ixgbe/if_bypass.c:1.4.8.2
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.4.8.1	Sun Jan 26 11:03:17 2020
+++ src/sys/dev/pci/ixgbe/if_bypass.c	Wed Sep  2 12:34:55 2020
@@ -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 @@ ixgbe_bypass_mutex_enter(struct adapter 
 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 @@ ixgbe_bypass_mutex_clear(struct adapter 
 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 @@ ixgbe_bypass_wd_mutex_enter(struct adapt
 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 @@ ixgbe_bp_log(SYSCTLFN_ARGS)
 		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 @@ ixgbe_bp_log(SYSCTLFN_ARGS)
 
 	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 */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.11 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.12
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.11	Fri Jul 10 11:35:51 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Sep  2 12:34:55 2020
@@ -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 @@ ixgbe_attach(device_t parent, device_t d
 		str = "X550";
 		break;
 	case ixgbe_mac_X550EM_x:
-		str = "X550EM";
+		str = "X550EM X";
 		break;
 	case ixgbe_mac_X550EM_a:
 		str = "X550EM A";

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.2 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.3
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.2	Fri Jul 10 11:35:51 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Wed Sep  2 12:34:55 2020
@@ -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 @@ void ixgbe_get_oem_prod_version(struct i
 	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;
 

Reply via email to