diff mbox

[1/1] net: sched: Make netns available for ematch extensions

Message ID 1378905614-29691-2-git-send-email-kadlec@blackhole.kfki.hu
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Jozsef Kadlecsik Sept. 11, 2013, 1:20 p.m. UTC
Ematch API (change, destroy) doesn't pass netns data to ematch extensions.
This prevents adding netns support to ipset, which is an ematch too.

The patch adds the required pointer to "struct tcf_proto", thus
making it available for every ematch.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
---
 include/net/sch_generic.h |    1 +
 net/sched/cls_api.c       |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

Comments

Eric Dumazet Sept. 11, 2013, 2:31 p.m. UTC | #1
On Wed, 2013-09-11 at 15:20 +0200, Jozsef Kadlecsik wrote:
> Ematch API (change, destroy) doesn't pass netns data to ematch extensions.
> This prevents adding netns support to ipset, which is an ematch too.
> 
> The patch adds the required pointer to "struct tcf_proto", thus
> making it available for every ematch.
> 
> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> ---
>  include/net/sch_generic.h |    1 +
>  net/sched/cls_api.c       |    1 +
>  2 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> index f4eb365..38e5e4b 100644
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -225,6 +225,7 @@ struct tcf_proto {
>  	struct Qdisc		*q;
>  	void			*data;
>  	const struct tcf_proto_ops	*ops;
> +	struct net		*net;
>  };
>  

Note that qdisc_dev(tp->q) should give you the pointer to device

Then ->nd_net gives you the struct net pointer.

On management path, this should be enough ;)





--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet Sept. 11, 2013, 2:32 p.m. UTC | #2
On Wed, 2013-09-11 at 07:31 -0700, Eric Dumazet wrote:

> 
> Note that qdisc_dev(tp->q) should give you the pointer to device
> 
> Then ->nd_net gives you the struct net pointer.
> 
> On management path, this should be enough ;)

(A device can be moved from net xxxx to net yyyy)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jozsef Kadlecsik Sept. 11, 2013, 6:37 p.m. UTC | #3
On Wed, 11 Sep 2013, Eric Dumazet wrote:

> On Wed, 2013-09-11 at 07:31 -0700, Eric Dumazet wrote:
> 
> > Note that qdisc_dev(tp->q) should give you the pointer to device
> > 
> > Then ->nd_net gives you the struct net pointer.
> > 
> > On management path, this should be enough ;)

Ohh, this is great, thanks indeed! Somehow I overlooked tp->q when 
searching to find a pointer to struct net.

> (A device can be moved from net xxxx to net yyyy)

So something like dev_net(qdisc_dev(tp->q)) is all what we need.
 
Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index f4eb365..38e5e4b 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -225,6 +225,7 @@  struct tcf_proto {
 	struct Qdisc		*q;
 	void			*data;
 	const struct tcf_proto_ops	*ops;
+	struct net		*net;
 };
 
 struct qdisc_skb_cb {
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 8e118af..1b1cb11 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -266,6 +266,7 @@  replay:
 		tp->q = q;
 		tp->classify = tp_ops->classify;
 		tp->classid = parent;
+		tp->net = net;
 
 		err = tp_ops->init(tp);
 		if (err != 0) {