net: Add support for XPS with QoS via traffic classes
This patch adds support for setting and using XPS when QoS via traffic classes is enabled. With this change we will factor in the priority and traffic class mapping of the packet and use that information to correctly select the queue. This allows us to define a set of queues for a given traffic class via mqprio and then configure the XPS mapping for those queues so that the traffic flows can avoid head-of-line blocking between the individual CPUs if so desired. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6234f87407
commit
184c449f91
@@ -1210,29 +1210,38 @@ static ssize_t show_xps_map(struct netdev_queue *queue,
|
||||
struct netdev_queue_attribute *attribute, char *buf)
|
||||
{
|
||||
struct net_device *dev = queue->dev;
|
||||
int cpu, len, num_tc = 1, tc = 0;
|
||||
struct xps_dev_maps *dev_maps;
|
||||
cpumask_var_t mask;
|
||||
unsigned long index;
|
||||
int i, len;
|
||||
|
||||
if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
|
||||
return -ENOMEM;
|
||||
|
||||
index = get_netdev_queue_index(queue);
|
||||
|
||||
if (dev->num_tc) {
|
||||
num_tc = dev->num_tc;
|
||||
tc = netdev_txq_to_tc(dev, index);
|
||||
if (tc < 0)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rcu_read_lock();
|
||||
dev_maps = rcu_dereference(dev->xps_maps);
|
||||
if (dev_maps) {
|
||||
for_each_possible_cpu(i) {
|
||||
struct xps_map *map =
|
||||
rcu_dereference(dev_maps->cpu_map[i]);
|
||||
if (map) {
|
||||
int j;
|
||||
for (j = 0; j < map->len; j++) {
|
||||
if (map->queues[j] == index) {
|
||||
cpumask_set_cpu(i, mask);
|
||||
break;
|
||||
}
|
||||
for_each_possible_cpu(cpu) {
|
||||
int i, tci = cpu * num_tc + tc;
|
||||
struct xps_map *map;
|
||||
|
||||
map = rcu_dereference(dev_maps->cpu_map[tci]);
|
||||
if (!map)
|
||||
continue;
|
||||
|
||||
for (i = map->len; i--;) {
|
||||
if (map->queues[i] == index) {
|
||||
cpumask_set_cpu(cpu, mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user