summaryrefslogtreecommitdiff
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2015-10-25 12:00:32 +0300
committerHelge Deller <deller@gmx.de>2015-10-25 12:00:32 +0300
commitc59f419bdd1f056e1ceacbd29f7be7bcff746a5d (patch)
treec2c07b8db121953681fcd7b94c1622f883263629 /include/linux/netdevice.h
parentb696e5e93835cee114f24b5b106c73f9f8503ec0 (diff)
downloadlinux-c59f419bdd1f056e1ceacbd29f7be7bcff746a5d.tar.xz
net/xps: Fix calculation of initial number of xps queues
The existing code breaks on architectures where the L1 cache size (L1_CACHE_BYTES) is smaller or equal the size of struct xps_map. The new code ensures that we get at minimum one initial xps queue, or even more as long as it fits into the next multiple of L1_CACHE_SIZE. Signed-off-by: Helge Deller <deller@gmx.de> Acked-by: Alexander Duyck <aduyck@mirantis.com>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 2d15e3831440..2212c8225deb 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -718,8 +718,8 @@ struct xps_map {
u16 queues[0];
};
#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
-#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \
- / sizeof(u16))
+#define XPS_MIN_MAP_ALLOC ((L1_CACHE_ALIGN(offsetof(struct xps_map, queues[1])) \
+ - sizeof(struct xps_map)) / sizeof(u16))
/*
* This structure holds all XPS maps for device. Maps are indexed by CPU.