Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/x86/pci Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/c72fff28b567
branches:  netbsd-9
changeset: 932650:c72fff28b567
user:      martin <martin%NetBSD.org@localhost>
date:      Wed May 13 12:37:31 2020 +0000

description:
Pull up following revision(s) (requested by yamaguchi in ticket #902):

        sys/arch/x86/pci/if_vmx.c: revision 1.60

Fix the wrong logic about making the number of vmx(4) TX/RX queue
be power of two

reviewed by nonaka@n.o.

diffstat:

 sys/arch/x86/pci/if_vmx.c |  27 ++++++++-------------------
 1 files changed, 8 insertions(+), 19 deletions(-)

diffs (53 lines):

diff -r caaab779eb36 -r c72fff28b567 sys/arch/x86/pci/if_vmx.c
--- a/sys/arch/x86/pci/if_vmx.c Wed May 13 12:34:40 2020 +0000
+++ b/sys/arch/x86/pci/if_vmx.c Wed May 13 12:37:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vmx.c,v 1.45.2.6 2020/01/28 11:01:37 martin Exp $   */
+/*     $NetBSD: if_vmx.c,v 1.45.2.7 2020/05/13 12:37:31 martin Exp $   */
 /*     $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $        */
 
 /*
@@ -19,12 +19,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.45.2.6 2020/01/28 11:01:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.45.2.7 2020/05/13 12:37:31 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
 #include <sys/kernel.h>
 #include <sys/kmem.h>
+#include <sys/bitops.h>
 #include <sys/bus.h>
 #include <sys/device.h>
 #include <sys/mbuf.h>
@@ -460,23 +461,11 @@
 static int
 vmxnet3_calc_queue_size(int n)
 {
-       int v, q;
-
-       v = n;
-       while (v != 0) {
-               if (powerof2(n) != 0)
-                       break;
-               v /= 2;
-               q = rounddown2(n, v);
-               if (q != 0) {
-                       n = q;
-                       break;
-               }
-       }
-       if (n == 0)
-               n = 1;
-
-       return n;
+
+       if (__predict_false(n <= 0))
+               return 1;
+
+       return (1U << (fls32(n) - 1));
 }
 
 static inline void



Home | Main Index | Thread Index | Old Index