aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2011-11-22 00:10:51 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-22 15:22:23 -0500
commit5bc1421e34ecfe0bd4b26dc3232b7d5e25179144 (patch)
tree783ed95187915c06757a260b637308919b35d5a0 /net/core/dev.c
parent202ff1c26c768efeead20b388556eda265dc8352 (diff)
net: add network priority cgroup infrastructure (v4)
This patch adds in the infrastructure code to create the network priority cgroup. The cgroup, in addition to the standard processes file creates two control files: 1) prioidx - This is a read-only file that exports the index of this cgroup. This is a value that is both arbitrary and unique to a cgroup in this subsystem, and is used to index the per-device priority map 2) priomap - This is a writeable file. On read it reports a table of 2-tuples <name:priority> where name is the name of a network interface and priority is indicates the priority assigned to frames egresessing on the named interface and originating from a pid in this cgroup This cgroup allows for skb priority to be set prior to a root qdisc getting selected. This is benenficial for DCB enabled systems, in that it allows for any application to use dcb configured priorities so without application modification Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: John Fastabend <john.r.fastabend@intel.com> CC: Robert Love <robert.w.love@intel.com> CC: "David S. Miller" <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index f78959996148..8afb244b205f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2449,6 +2449,18 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
2449 return rc; 2449 return rc;
2450} 2450}
2451 2451
2452#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
2453static void skb_update_prio(struct sk_buff *skb)
2454{
2455 struct netprio_map *map = rcu_dereference(skb->dev->priomap);
2456
2457 if ((!skb->priority) && (skb->sk) && map)
2458 skb->priority = map->priomap[skb->sk->sk_cgrp_prioidx];
2459}
2460#else
2461#define skb_update_prio(skb)
2462#endif
2463
2452static DEFINE_PER_CPU(int, xmit_recursion); 2464static DEFINE_PER_CPU(int, xmit_recursion);
2453#define RECURSION_LIMIT 10 2465#define RECURSION_LIMIT 10
2454 2466
@@ -2489,6 +2501,8 @@ int dev_queue_xmit(struct sk_buff *skb)
2489 */ 2501 */
2490 rcu_read_lock_bh(); 2502 rcu_read_lock_bh();
2491 2503
2504 skb_update_prio(skb);
2505
2492 txq = dev_pick_tx(dev, skb); 2506 txq = dev_pick_tx(dev, skb);
2493 q = rcu_dereference_bh(txq->qdisc); 2507 q = rcu_dereference_bh(txq->qdisc);
2494 2508