[SRU,Xenial/gcp,1/11] cpumask: make cpumask_next_wrap available without smp
diff mbox series

Message ID 20190919092353.29993-2-khalid.elmously@canonical.com
State New
Headers show
Series
  • Enable napi_tx
Related show

Commit Message

Khaled Elmously Sept. 19, 2019, 9:23 a.m. UTC
From: Willem de Bruijn <willemb@google.com>

BugLink: https://bugs.launchpad.net/bugs/1810457

The kbuild robot shows build failure on machines without CONFIG_SMP:

  drivers/net/virtio_net.c:1916:10: error:
    implicit declaration of function 'cpumask_next_wrap'

cpumask_next_wrap is exported from lib/cpumask.o, which has

    lib-$(CONFIG_SMP) += cpumask.o

same as other functions, also define it as static inline in the
NR_CPUS==1 branch in include/linux/cpumask.h.

If wrap is true and next == start, return nr_cpumask_bits, or 1.
Else wrap across the range of valid cpus, here [0].

Fixes: 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Tested-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9af18e56d43ca4864ce65c3542c513827c2697de)
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
---
 include/linux/cpumask.h | 7 +++++++
 1 file changed, 7 insertions(+)

Patch
diff mbox series

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 09b8d8aaa35f..e8ab8e941b91 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -154,6 +154,13 @@  static inline unsigned int cpumask_next_and(int n,
 	return n+1;
 }
 
+static inline unsigned int cpumask_next_wrap(int n, const struct cpumask *mask,
+					     int start, bool wrap)
+{
+	/* cpu0 unless stop condition, wrap and at cpu0, then nr_cpumask_bits */
+	return (wrap && n == 0);
+}
+
 /* cpu must be a valid cpu, ie 0, so there's no other choice. */
 static inline unsigned int cpumask_any_but(const struct cpumask *mask,
 					   unsigned int cpu)