#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;
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 */
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);
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;