summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2010-11-26 08:36:09 +0000
committerDavid S. Miller <davem@davemloft.net>2010-11-28 18:24:14 -0800
commitbf26414510103448ad3dc069c7422462f03ea3d7 (patch)
treeb8930bb2850dbc65f1e1f4e8bc6574f3c956b772 /include/linux
parent8fa9208e305e24978b897d6ea057604444ce77e1 (diff)
downloadop-kernel-dev-bf26414510103448ad3dc069c7422462f03ea3d7.zip
op-kernel-dev-bf26414510103448ad3dc069c7422462f03ea3d7.tar.gz
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')
-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 7c6ae2f..9ae4544 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -536,30 +536,6 @@ struct rps_map {
#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
/*
- * This structure holds an XPS map which can be of variable length. The
- * map is an array of queues.
- */
-struct xps_map {
- unsigned int len;
- unsigned int alloc_len;
- struct rcu_head rcu;
- 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))
-
-/*
- * This structure holds all XPS maps for device. Maps are indexed by CPU.
- */
-struct xps_dev_maps {
- struct rcu_head rcu;
- struct xps_map *cpu_map[0];
-};
-#define XPS_DEV_MAPS_SIZE (sizeof(struct xps_dev_maps) + \
- (nr_cpu_ids * sizeof(struct xps_map *)))
-
-/*
* The rps_dev_flow structure contains the mapping of a flow to a CPU and the
* tail pointer for that CPU's input queue at the time of last enqueue.
*/
@@ -626,6 +602,32 @@ struct netdev_rx_queue {
} ____cacheline_aligned_in_smp;
#endif /* CONFIG_RPS */
+#ifdef CONFIG_XPS
+/*
+ * This structure holds an XPS map which can be of variable length. The
+ * map is an array of queues.
+ */
+struct xps_map {
+ unsigned int len;
+ unsigned int alloc_len;
+ struct rcu_head rcu;
+ 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))
+
+/*
+ * This structure holds all XPS maps for device. Maps are indexed by CPU.
+ */
+struct xps_dev_maps {
+ struct rcu_head rcu;
+ struct xps_map *cpu_map[0];
+};
+#define XPS_DEV_MAPS_SIZE (sizeof(struct xps_dev_maps) + \
+ (nr_cpu_ids * sizeof(struct xps_map *)))
+#endif /* CONFIG_XPS */
+
/*
* This structure defines the management hooks for network devices.
* The following hooks can be defined; unless noted otherwise, they are
@@ -1046,7 +1048,9 @@ struct net_device {
unsigned long tx_queue_len; /* Max frames per queue allowed */
spinlock_t tx_global_lock;
+#ifdef CONFIG_XPS
struct xps_dev_maps *xps_maps;
+#endif
/* These may be needed for future network-power-down code. */
OpenPOWER on IntegriCloud