Skip to content

Commit c59f419

Browse files
committed
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>
1 parent b696e5e commit c59f419

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎include/linux/netdevice.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,8 @@ struct xps_map {
718718
u16 queues[0];
719719
};
720720
#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
721-
#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \
722-
/ sizeof(u16))
721+
#define XPS_MIN_MAP_ALLOC ((L1_CACHE_ALIGN(offsetof(struct xps_map, queues[1])) \
722+
- sizeof(struct xps_map)) / sizeof(u16))
723723

724724
/*
725725
* This structure holds all XPS maps for device. Maps are indexed by CPU.

0 commit comments

Comments
 (0)