forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Signed-off-by: John Fastabend <[email protected]> CC: Robert Love <[email protected]> CC: "David S. Miller" <[email protected]> Signed-off-by: David S. Miller <[email protected]>
- Loading branch information
Showing
10 changed files
with
469 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* netprio_cgroup.h Control Group Priority set | ||
* | ||
* | ||
* Authors: Neil Horman <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation; either version 2 of the License, or (at your option) | ||
* any later version. | ||
* | ||
*/ | ||
|
||
#ifndef _NETPRIO_CGROUP_H | ||
#define _NETPRIO_CGROUP_H | ||
#include <linux/module.h> | ||
#include <linux/cgroup.h> | ||
#include <linux/hardirq.h> | ||
#include <linux/rcupdate.h> | ||
|
||
struct cgroup_netprio_state | ||
{ | ||
struct cgroup_subsys_state css; | ||
u32 prioidx; | ||
}; | ||
|
||
struct netprio_map { | ||
struct rcu_head rcu; | ||
u32 priomap_len; | ||
u32 priomap[]; | ||
}; | ||
|
||
#ifdef CONFIG_CGROUPS | ||
|
||
#ifndef CONFIG_NETPRIO_CGROUP | ||
extern int net_prio_subsys_id; | ||
#endif | ||
|
||
extern void sock_update_netprioidx(struct sock *sk); | ||
|
||
static inline struct cgroup_netprio_state | ||
*task_netprio_state(struct task_struct *p) | ||
{ | ||
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP) | ||
return container_of(task_subsys_state(p, net_prio_subsys_id), | ||
struct cgroup_netprio_state, css); | ||
#else | ||
return NULL; | ||
#endif | ||
} | ||
|
||
#else | ||
|
||
#define sock_update_netprioidx(sk) | ||
#define skb_update_prio(skb) | ||
|
||
static inline struct cgroup_netprio_state | ||
*task_netprio_state(struct task_struct *p) | ||
{ | ||
return NULL; | ||
} | ||
|
||
#endif | ||
|
||
#endif /* _NET_CLS_CGROUP_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.