Re: [PATCH bpf-next 1/4] bpf: Introduce bpf_skb_ancestor_cgroup_id helper

2018-08-13 Thread Andrey Ignatov
Tejun Heo [Mon, 2018-08-13 07:47 -0700]: > Hello, Andrey. Hey Tejun! > On Fri, Aug 10, 2018 at 10:35:23PM -0700, Andrey Ignatov wrote: > > +static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp, > > +int ancestor_level) > > +{ > > + struct cgr

Re: [PATCH bpf-next 1/4] bpf: Introduce bpf_skb_ancestor_cgroup_id helper

2018-08-13 Thread Tejun Heo
Hello, Andrey. On Fri, Aug 10, 2018 at 10:35:23PM -0700, Andrey Ignatov wrote: > +static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp, > + int ancestor_level) > +{ > + struct cgroup *ptr; > + > + if (cgrp->level < ancestor_level) > +

[PATCH bpf-next 1/4] bpf: Introduce bpf_skb_ancestor_cgroup_id helper

2018-08-10 Thread Andrey Ignatov
== Problem description == It's useful to be able to identify cgroup associated with skb in TC so that a policy can be applied to this skb, and existing bpf_skb_cgroup_id helper can help with this. Though in real life cgroup hierarchy and hierarchy to apply a policy to don't map 1:1. It's often t