aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2010-11-26 03:36:09 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-28 21:24:14 -0500
commitbf26414510103448ad3dc069c7422462f03ea3d7 (patch)
treeb8930bb2850dbc65f1e1f4e8bc6574f3c956b772 /include/linux/netdevice.h
parent8fa9208e305e24978b897d6ea057604444ce77e1 (diff)
xps: Add CONFIG_XPS
This patch adds XPS_CONFIG option to enable and disable XPS. This is done in the same manner as RPS_CONFIG. This is also fixes build failure in XPS code when SMP is not enabled. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h52
1 files changed, 28 insertions, 24 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7c6ae2f4b9ab..9ae4544f0cf0 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -536,30 +536,6 @@ struct rps_map {
536#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) 536#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
537 537
538/* 538/*
539 * This structure holds an XPS map which can be of variable length. The
540 * map is an array of queues.
541 */
542struct xps_map {
543 unsigned int len;
544 unsigned int alloc_len;
545 struct rcu_head rcu;
546 u16 queues[0];
547};
548#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + (_num * sizeof(u16)))
549#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \
550 / sizeof(u16))
551
552/*
553 * This structure holds all XPS maps for device. Maps are indexed by CPU.
554 */
555struct xps_dev_maps {
556 struct rcu_head rcu;
557 struct xps_map *cpu_map[0];
558};
559#define XPS_DEV_MAPS_SIZE (sizeof(struct xps_dev_maps) + \
560 (nr_cpu_ids * sizeof(struct xps_map *)))
561
562/*
563 * The rps_dev_flow structure contains the mapping of a flow to a CPU and the 539 * The rps_dev_flow structure contains the mapping of a flow to a CPU and the
564 * tail pointer for that CPU's input queue at the time of last enqueue. 540 * tail pointer for that CPU's input queue at the time of last enqueue.
565 */ 541 */
@@ -626,6 +602,32 @@ struct netdev_rx_queue {
626} ____cacheline_aligned_in_smp; 602} ____cacheline_aligned_in_smp;
627#endif /* CONFIG_RPS */ 603#endif /* CONFIG_RPS */
628 604
605#ifdef CONFIG_XPS
606/*
607 * This structure holds an XPS map which can be of variable length. The
608 * map is an array of queues.
609 */
610struct xps_map {
611 unsigned int len;
612 unsigned int alloc_len;
613 struct rcu_head rcu;
614 u16 queues[0];
615};
616#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + (_num * sizeof(u16)))
617#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \
618 / sizeof(u16))
619
620/*
621 * This structure holds all XPS maps for device. Maps are indexed by CPU.
622 */
623struct xps_dev_maps {
624 struct rcu_head rcu;
625 struct xps_map *cpu_map[0];
626};
627#define XPS_DEV_MAPS_SIZE (sizeof(struct xps_dev_maps) + \
628 (nr_cpu_ids * sizeof(struct xps_map *)))
629#endif /* CONFIG_XPS */
630
629/* 631/*
630 * This structure defines the management hooks for network devices. 632 * This structure defines the management hooks for network devices.
631 * The following hooks can be defined; unless noted otherwise, they are 633 * The following hooks can be defined; unless noted otherwise, they are
@@ -1046,7 +1048,9 @@ struct net_device {
1046 unsigned long tx_queue_len; /* Max frames per queue allowed */ 1048 unsigned long tx_queue_len; /* Max frames per queue allowed */
1047 spinlock_t tx_global_lock; 1049 spinlock_t tx_global_lock;
1048 1050
1051#ifdef CONFIG_XPS
1049 struct xps_dev_maps *xps_maps; 1052 struct xps_dev_maps *xps_maps;
1053#endif
1050 1054
1051 /* These may be needed for future network-power-down code. */ 1055 /* These may be needed for future network-power-down code. */
1052 1056