aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r--net/core/net-sysfs.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index dce3ae0fbca2..ffa1d18f2c2c 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1054,11 +1054,23 @@ static ssize_t traffic_class_show(struct netdev_queue *queue,
1054 return -ENOENT; 1054 return -ENOENT;
1055 1055
1056 index = get_netdev_queue_index(queue); 1056 index = get_netdev_queue_index(queue);
1057
1058 /* If queue belongs to subordinate dev use its TC mapping */
1059 dev = netdev_get_tx_queue(dev, index)->sb_dev ? : dev;
1060
1057 tc = netdev_txq_to_tc(dev, index); 1061 tc = netdev_txq_to_tc(dev, index);
1058 if (tc < 0) 1062 if (tc < 0)
1059 return -EINVAL; 1063 return -EINVAL;
1060 1064
1061 return sprintf(buf, "%u\n", tc); 1065 /* We can report the traffic class one of two ways:
1066 * Subordinate device traffic classes are reported with the traffic
1067 * class first, and then the subordinate class so for example TC0 on
1068 * subordinate device 2 will be reported as "0-2". If the queue
1069 * belongs to the root device it will be reported with just the
1070 * traffic class, so just "0" for TC 0 for example.
1071 */
1072 return dev->num_tc < 0 ? sprintf(buf, "%u%d\n", tc, dev->num_tc) :
1073 sprintf(buf, "%u\n", tc);
1062} 1074}
1063 1075
1064#ifdef CONFIG_XPS 1076#ifdef CONFIG_XPS
@@ -1225,7 +1237,14 @@ static ssize_t xps_cpus_show(struct netdev_queue *queue,
1225 index = get_netdev_queue_index(queue); 1237 index = get_netdev_queue_index(queue);
1226 1238
1227 if (dev->num_tc) { 1239 if (dev->num_tc) {
1240 /* Do not allow XPS on subordinate device directly */
1228 num_tc = dev->num_tc; 1241 num_tc = dev->num_tc;
1242 if (num_tc < 0)
1243 return -EINVAL;
1244
1245 /* If queue belongs to subordinate dev use its map */
1246 dev = netdev_get_tx_queue(dev, index)->sb_dev ? : dev;
1247
1229 tc = netdev_txq_to_tc(dev, index); 1248 tc = netdev_txq_to_tc(dev, index);
1230 if (tc < 0) 1249 if (tc < 0)
1231 return -EINVAL; 1250 return -EINVAL;