* [RFC PATCH net-next 2/4] cls_cgroup: introduce a helper: bk_cls_classid()
@ 2014-01-03 3:11 ` Libo Chen
0 siblings, 0 replies; 3+ messages in thread
From: Libo Chen @ 2014-01-03 3:11 UTC (permalink / raw)
To: David Miller, jhs
Cc: netdev, LKML, ebiederm, containers, cgroups, Serge Hallyn, Li Zefan
it can save classid from skb->sk->sk_classid
to skb->bk_classid
Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
---
include/net/cls_cgroup.h | 11 +++++++++++
net/sched/cls_cgroup.c | 1 -
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 33d03b6..4249ea3 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -16,6 +16,7 @@
#include <linux/cgroup.h>
#include <linux/hardirq.h>
#include <linux/rcupdate.h>
+#include <net/sock.h>
#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
struct cgroup_cls_state
@@ -26,6 +27,12 @@ struct cgroup_cls_state
void sock_update_classid(struct sock *sk);
+static inline void bk_cls_classid(struct sk_buff *skb)
+{
+ if (skb->sk && skb->sk->sk_classid)
+ skb->backup_classid = skb->sk->sk_classid;
+}
+
#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
static inline u32 task_cls_classid(struct task_struct *p)
{
@@ -61,6 +68,10 @@ static inline u32 task_cls_classid(struct task_struct *p)
}
#endif
#else /* !CGROUP_NET_CLS_CGROUP */
+static inline void bk_cls_classid(struct sk_buff *skb)
+{
+}
+
static inline void sock_update_classid(struct sock *sk)
{
}
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index f9d21258..d228a5d 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -20,7 +20,6 @@
#include <linux/fdtable.h>
#include <net/rtnetlink.h>
#include <net/pkt_cls.h>
-#include <net/sock.h>
#include <net/cls_cgroup.h>
static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_state *css)
--
1.8.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC PATCH net-next 2/4] cls_cgroup: introduce a helper: bk_cls_classid()
@ 2014-01-03 3:11 ` Libo Chen
0 siblings, 0 replies; 3+ messages in thread
From: Libo Chen @ 2014-01-03 3:11 UTC (permalink / raw)
To: David Miller, jhs
Cc: netdev, LKML, ebiederm, containers, cgroups, Serge Hallyn, Li Zefan
it can save classid from skb->sk->sk_classid
to skb->bk_classid
Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
---
include/net/cls_cgroup.h | 11 +++++++++++
net/sched/cls_cgroup.c | 1 -
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 33d03b6..4249ea3 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -16,6 +16,7 @@
#include <linux/cgroup.h>
#include <linux/hardirq.h>
#include <linux/rcupdate.h>
+#include <net/sock.h>
#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
struct cgroup_cls_state
@@ -26,6 +27,12 @@ struct cgroup_cls_state
void sock_update_classid(struct sock *sk);
+static inline void bk_cls_classid(struct sk_buff *skb)
+{
+ if (skb->sk && skb->sk->sk_classid)
+ skb->backup_classid = skb->sk->sk_classid;
+}
+
#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
static inline u32 task_cls_classid(struct task_struct *p)
{
@@ -61,6 +68,10 @@ static inline u32 task_cls_classid(struct task_struct *p)
}
#endif
#else /* !CGROUP_NET_CLS_CGROUP */
+static inline void bk_cls_classid(struct sk_buff *skb)
+{
+}
+
static inline void sock_update_classid(struct sock *sk)
{
}
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index f9d21258..d228a5d 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -20,7 +20,6 @@
#include <linux/fdtable.h>
#include <net/rtnetlink.h>
#include <net/pkt_cls.h>
-#include <net/sock.h>
#include <net/cls_cgroup.h>
static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_state *css)
--
1.8.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC PATCH net-next 2/4] cls_cgroup: introduce a helper: bk_cls_classid()
@ 2014-01-03 3:11 Libo Chen
0 siblings, 0 replies; 3+ messages in thread
From: Libo Chen @ 2014-01-03 3:11 UTC (permalink / raw)
To: David Miller, jhs-jkUAjuhPggJWk0Htik3J/w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
Serge Hallyn, LKML, ebiederm-aS9lmoZGLiVWk0Htik3J/w,
cgroups-u79uwXL29TY76Z2rM5mHXA
it can save classid from skb->sk->sk_classid
to skb->bk_classid
Signed-off-by: Libo Chen <clbchenlibo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
include/net/cls_cgroup.h | 11 +++++++++++
net/sched/cls_cgroup.c | 1 -
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 33d03b6..4249ea3 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -16,6 +16,7 @@
#include <linux/cgroup.h>
#include <linux/hardirq.h>
#include <linux/rcupdate.h>
+#include <net/sock.h>
#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
struct cgroup_cls_state
@@ -26,6 +27,12 @@ struct cgroup_cls_state
void sock_update_classid(struct sock *sk);
+static inline void bk_cls_classid(struct sk_buff *skb)
+{
+ if (skb->sk && skb->sk->sk_classid)
+ skb->backup_classid = skb->sk->sk_classid;
+}
+
#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
static inline u32 task_cls_classid(struct task_struct *p)
{
@@ -61,6 +68,10 @@ static inline u32 task_cls_classid(struct task_struct *p)
}
#endif
#else /* !CGROUP_NET_CLS_CGROUP */
+static inline void bk_cls_classid(struct sk_buff *skb)
+{
+}
+
static inline void sock_update_classid(struct sock *sk)
{
}
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index f9d21258..d228a5d 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -20,7 +20,6 @@
#include <linux/fdtable.h>
#include <net/rtnetlink.h>
#include <net/pkt_cls.h>
-#include <net/sock.h>
#include <net/cls_cgroup.h>
static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_state *css)
--
1.8.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-03 3:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-03 3:11 [RFC PATCH net-next 2/4] cls_cgroup: introduce a helper: bk_cls_classid() Libo Chen
2014-01-03 3:11 ` Libo Chen
2014-01-03 3:11 Libo Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.