aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2016-10-28 11:43:49 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-31 15:00:47 -0400
commit8d059b0f6f5b1d3acf829454e1087818ad660058 (patch)
tree8e6f21ec540692e9417cbc75a0da706a6b8669cc /net/core/dev.c
parentnet: Move functions for configuring traffic classes out of inline headers (diff)
downloadlinux-dev-8d059b0f6f5b1d3acf829454e1087818ad660058.tar.xz
linux-dev-8d059b0f6f5b1d3acf829454e1087818ad660058.zip
net: Add sysfs value to determine queue traffic class
Add a sysfs attribute for a Tx queue that allows us to determine the traffic class for a given queue. This will allow us to more easily determine this in the future. It is needed as XPS will take the traffic class for a group of queues into account in order to avoid pulling traffic from one traffic class into another. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 2d54be912136..db0fdbbcd9b8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1948,6 +1948,23 @@ static void netif_setup_tc(struct net_device *dev, unsigned int txq)
}
}
+int netdev_txq_to_tc(struct net_device *dev, unsigned int txq)
+{
+ if (dev->num_tc) {
+ struct netdev_tc_txq *tc = &dev->tc_to_txq[0];
+ int i;
+
+ for (i = 0; i < TC_MAX_QUEUE; i++, tc++) {
+ if ((txq - tc->offset) < tc->count)
+ return i;
+ }
+
+ return -1;
+ }
+
+ return 0;
+}
+
#ifdef CONFIG_XPS
static DEFINE_MUTEX(xps_map_mutex);
#define xmap_dereference(P) \