Skip to content

Commit

Permalink
net: netprio: rename config to be more consistent with cgroup configs
Browse files Browse the repository at this point in the history
While we're at it and introduced CGROUP_NET_CLASSID, lets also make
NETPRIO_CGROUP more consistent with the rest of cgroups and rename it
into CONFIG_CGROUP_NET_PRIO so that for networking, we now have
CONFIG_CGROUP_NET_{PRIO,CLASSID}. This not only makes the CONFIG
option consistent among networking cgroups, but also among cgroups
CONFIG conventions in general as the vast majority has a prefix of
CONFIG_CGROUP_<SUBSYS>.

Signed-off-by: Daniel Borkmann <[email protected]>
Cc: Zefan Li <[email protected]>
Cc: [email protected]
Acked-by: Li Zefan <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
Daniel Borkmann authored and ummakynes committed Jan 3, 2014
1 parent fe1217c commit 86f8515
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion include/linux/cgroup_subsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SUBSYS(blkio)
SUBSYS(perf)
#endif

#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_NET_PRIO)
SUBSYS(net_prio)
#endif

Expand Down
2 changes: 1 addition & 1 deletion include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ struct net_device {
/* max exchange id for FCoE LRO by ddp */
unsigned int fcoe_ddp_xid;
#endif
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
struct netprio_map __rcu *priomap;
#endif
/* phy device may attach itself for hardware timestamping */
Expand Down
18 changes: 6 additions & 12 deletions include/net/netprio_cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

#ifndef _NETPRIO_CGROUP_H
#define _NETPRIO_CGROUP_H

#include <linux/cgroup.h>
#include <linux/hardirq.h>
#include <linux/rcupdate.h>


#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
struct netprio_map {
struct rcu_head rcu;
u32 priomap_len;
Expand All @@ -27,8 +27,7 @@ struct netprio_map {

void sock_update_netprioidx(struct sock *sk);

#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)

#if IS_BUILTIN(CONFIG_CGROUP_NET_PRIO)
static inline u32 task_netprioidx(struct task_struct *p)
{
struct cgroup_subsys_state *css;
Expand All @@ -40,9 +39,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
rcu_read_unlock();
return idx;
}

#elif IS_MODULE(CONFIG_NETPRIO_CGROUP)

#elif IS_MODULE(CONFIG_CGROUP_NET_PRIO)
static inline u32 task_netprioidx(struct task_struct *p)
{
struct cgroup_subsys_state *css;
Expand All @@ -56,16 +53,13 @@ static inline u32 task_netprioidx(struct task_struct *p)
return idx;
}
#endif

#else /* !CONFIG_NETPRIO_CGROUP */

#else /* !CONFIG_CGROUP_NET_PRIO */
static inline u32 task_netprioidx(struct task_struct *p)
{
return 0;
}

#define sock_update_netprioidx(sk)

#endif /* CONFIG_NETPRIO_CGROUP */

#endif /* CONFIG_CGROUP_NET_PRIO */
#endif /* _NET_CLS_CGROUP_H */
2 changes: 1 addition & 1 deletion include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ struct sock {
unsigned short sk_ack_backlog;
unsigned short sk_max_ack_backlog;
__u32 sk_priority;
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
__u32 sk_cgrp_prioidx;
#endif
struct pid *sk_peer_pid;
Expand Down
4 changes: 2 additions & 2 deletions net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ config XPS
depends on SMP
default y

config NETPRIO_CGROUP
config CGROUP_NET_PRIO
tristate "Network priority cgroup"
depends on CGROUPS
---help---
Cgroup subsystem for use in assigning processes to network priorities on
a per-interface basis
a per-interface basis.

config CGROUP_NET_CLASSID
boolean "Network classid cgroup"
Expand Down
2 changes: 1 addition & 1 deletion net/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ obj-$(CONFIG_FIB_RULES) += fib_rules.o
obj-$(CONFIG_TRACEPOINTS) += net-traces.o
obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o
obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o
obj-$(CONFIG_NETPRIO_CGROUP) += netprio_cgroup.o
obj-$(CONFIG_CGROUP_NET_PRIO) += netprio_cgroup.o
obj-$(CONFIG_CGROUP_NET_CLASSID) += netclassid_cgroup.o
2 changes: 1 addition & 1 deletion net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2747,7 +2747,7 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
return rc;
}

#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
static void skb_update_prio(struct sk_buff *skb)
{
struct netprio_map *map = rcu_dereference_bh(skb->dev->priomap);
Expand Down
2 changes: 1 addition & 1 deletion net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
module_put(owner);
}

#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
void sock_update_netprioidx(struct sock *sk)
{
if (in_interrupt())
Expand Down

0 comments on commit 86f8515

Please sign in to comment.