]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
include/net/netprio_cgroup.h: various fixes
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 30 Nov 2011 04:07:55 +0000 (15:07 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 30 Nov 2011 04:13:40 +0000 (15:13 +1100)
- 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 <nhorman@tuxdriver.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/net/netprio_cgroup.h
net/core/dev.c
net/core/sock.c

index e503b87c4c1b4d3310be150b07e4a94a36508133..9c8412e7cef337d63f5c7d37d060ce5123a31e91 100644 (file)
 #include <linux/hardirq.h>
 #include <linux/rcupdate.h>
 
+#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 */
index edb45b816b5b4e57d055bc82a57b8ba58089a2d9..802650934442e74f5cf0e7e50db082d7bbb6c63d 100644 (file)
@@ -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);
index 9777da86aeacd94ffb1a7c1110e71f3bea9a4a69..7339401dbd98e034b291952a7cdbf88305cb58e5 100644 (file)
@@ -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;