Commit 8fb974c9 authored by Daniel Wagner's avatar Daniel Wagner Committed by Tejun Heo

cgroup: net_cls: Do not define task_cls_classid() when not selected

task_cls_classid() should not be defined in case the configuration is
CONFIG_NET_CLS_CGROUP=n. The reason is that in a following patch the
net_cls_subsys_id will only be defined if CONFIG_NET_CLS_CGROUP!=n.
When net_cls is not built at all a callee should only get an empty
task_cls_classid() without any references to net_cls_subsys_id.
Signed-off-by: default avatarDaniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarLi Zefan <lizefan@huawei.com>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
parent f3419807
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <linux/hardirq.h> #include <linux/hardirq.h>
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#ifdef CONFIG_CGROUPS #if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
struct cgroup_cls_state struct cgroup_cls_state
{ {
struct cgroup_subsys_state css; struct cgroup_subsys_state css;
...@@ -26,7 +26,7 @@ struct cgroup_cls_state ...@@ -26,7 +26,7 @@ struct cgroup_cls_state
extern void sock_update_classid(struct sock *sk); extern void sock_update_classid(struct sock *sk);
#ifdef CONFIG_NET_CLS_CGROUP #if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
static inline u32 task_cls_classid(struct task_struct *p) static inline u32 task_cls_classid(struct task_struct *p)
{ {
int classid; int classid;
...@@ -41,7 +41,8 @@ static inline u32 task_cls_classid(struct task_struct *p) ...@@ -41,7 +41,8 @@ static inline u32 task_cls_classid(struct task_struct *p)
return classid; return classid;
} }
#else #elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
extern int net_cls_subsys_id; extern int net_cls_subsys_id;
static inline u32 task_cls_classid(struct task_struct *p) static inline u32 task_cls_classid(struct task_struct *p)
...@@ -63,7 +64,7 @@ static inline u32 task_cls_classid(struct task_struct *p) ...@@ -63,7 +64,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
return classid; return classid;
} }
#endif #endif
#else #else /* !CGROUP_NET_CLS_CGROUP */
static inline void sock_update_classid(struct sock *sk) static inline void sock_update_classid(struct sock *sk)
{ {
} }
...@@ -72,5 +73,5 @@ static inline u32 task_cls_classid(struct task_struct *p) ...@@ -72,5 +73,5 @@ static inline u32 task_cls_classid(struct task_struct *p)
{ {
return 0; return 0;
} }
#endif #endif /* CGROUP_NET_CLS_CGROUP */
#endif /* _NET_CLS_CGROUP_H */ #endif /* _NET_CLS_CGROUP_H */
...@@ -1223,6 +1223,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk) ...@@ -1223,6 +1223,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
} }
#ifdef CONFIG_CGROUPS #ifdef CONFIG_CGROUPS
#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
void sock_update_classid(struct sock *sk) void sock_update_classid(struct sock *sk)
{ {
u32 classid; u32 classid;
...@@ -1234,6 +1235,7 @@ void sock_update_classid(struct sock *sk) ...@@ -1234,6 +1235,7 @@ void sock_update_classid(struct sock *sk)
sk->sk_classid = classid; sk->sk_classid = classid;
} }
EXPORT_SYMBOL(sock_update_classid); EXPORT_SYMBOL(sock_update_classid);
#endif
void sock_update_netprioidx(struct sock *sk, struct task_struct *task) void sock_update_netprioidx(struct sock *sk, struct task_struct *task)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment