From 9222aa56c0cef58b9c22954a46646f6b2fa74045 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 30 Nov 2011 15:07:55 +1100 Subject: [PATCH] include/net/netprio_cgroup.h: various fixes - make task_netprio_state() stub an inline C function - Untangle strange ifdef arrangement - remove mention of CONFIG_CGROUPS and make everything depend on CONFIG_NETPRIO_CGROUP. - Don't build sock_update_netprioidx() when CONFIG_NETPRIO_CGROUP=n - make the skb_update_prio() stub an inlined C function Cc: Neil Horman Cc: John Fastabend Cc: Robert Love Cc: "David S. Miller" Cc: Stephen Rothwell Signed-off-by: Andrew Morton --- include/net/netprio_cgroup.h | 38 +++++++++++++++++++----------------- net/core/dev.c | 4 +++- net/core/sock.c | 2 ++ 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h index e503b87c4c1b..9c8412e7cef3 100644 --- a/include/net/netprio_cgroup.h +++ b/include/net/netprio_cgroup.h @@ -18,6 +18,12 @@ #include #include +#if IS_ENABLED(CONFIG_NETPRIO_CGROUP) + +struct cgroup_netprio_state { + struct cgroup_subsys_state css; + u32 prioidx; +}; struct netprio_map { struct rcu_head rcu; @@ -25,33 +31,29 @@ struct netprio_map { u32 priomap[]; }; -#ifdef CONFIG_CGROUPS - -struct cgroup_netprio_state { - struct cgroup_subsys_state css; - u32 prioidx; -}; - -#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) +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 +#else /* CONFIG_NETPRIO_CGROUP */ + +static inline void sock_update_netprioidx(struct sock *sk) +{ +} + +static inline struct cgroup_netprio_state * +task_netprio_state(struct task_struct *p) +{ + return NULL; +} -#define sock_update_netprioidx(sk) -#endif +#endif /* CONFIG_NETPRIO_CGROUP */ #endif /* _NET_CLS_CGROUP_H */ diff --git a/net/core/dev.c b/net/core/dev.c index edb45b816b5b..802650934442 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2479,7 +2479,9 @@ static void skb_update_prio(struct sk_buff *skb) skb->priority = map->priomap[skb->sk->sk_cgrp_prioidx]; } #else -#define skb_update_prio(skb) +static inline void skb_update_prio(struct sk_buff *skb) +{ +} #endif static DEFINE_PER_CPU(int, xmit_recursion); diff --git a/net/core/sock.c b/net/core/sock.c index 9777da86aeac..7339401dbd98 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1127,7 +1127,9 @@ void sock_update_classid(struct sock *sk) sk->sk_classid = classid; } EXPORT_SYMBOL(sock_update_classid); +#endif +#if IS_ENABLED(CONFIG_NETPRIO_CGROUP) void sock_update_netprioidx(struct sock *sk) { struct cgroup_netprio_state *state; -- 2.39.5