netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] Make netns available for ematch extensions
@ 2013-09-11 13:20 Jozsef Kadlecsik
  2013-09-11 13:20 ` [PATCH 1/1] net: sched: " Jozsef Kadlecsik
  0 siblings, 1 reply; 5+ messages in thread
From: Jozsef Kadlecsik @ 2013-09-11 13:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, V. Lavrov

Hi Dave,

ipset needs netns support and ipset is supported as an ematch extension.
However netns data is not available for ematch extensions. In the next
patch I tried to find the less obtrusive way to pass the required data
to the extensions. Please consider applying it to net-next.

Best regards,
Jozsef

Jozsef Kadlecsik (1):
  net: sched: Make netns available for ematch extensions

 include/net/sch_generic.h |    1 +
 net/sched/cls_api.c       |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] net: sched: Make netns available for ematch extensions
  2013-09-11 13:20 [PATCH 0/1] Make netns available for ematch extensions Jozsef Kadlecsik
@ 2013-09-11 13:20 ` Jozsef Kadlecsik
  2013-09-11 14:31   ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Jozsef Kadlecsik @ 2013-09-11 13:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, V. Lavrov

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;
 };
 
 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) {
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] net: sched: Make netns available for ematch extensions
  2013-09-11 13:20 ` [PATCH 1/1] net: sched: " Jozsef Kadlecsik
@ 2013-09-11 14:31   ` Eric Dumazet
  2013-09-11 14:32     ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2013-09-11 14:31 UTC (permalink / raw)
  To: Jozsef Kadlecsik; +Cc: David Miller, netdev, V. Lavrov

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 ;)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] net: sched: Make netns available for ematch extensions
  2013-09-11 14:31   ` Eric Dumazet
@ 2013-09-11 14:32     ` Eric Dumazet
  2013-09-11 18:37       ` Jozsef Kadlecsik
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2013-09-11 14:32 UTC (permalink / raw)
  To: Jozsef Kadlecsik; +Cc: David Miller, netdev, V. Lavrov

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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] net: sched: Make netns available for ematch extensions
  2013-09-11 14:32     ` Eric Dumazet
@ 2013-09-11 18:37       ` Jozsef Kadlecsik
  0 siblings, 0 replies; 5+ messages in thread
From: Jozsef Kadlecsik @ 2013-09-11 18:37 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, V. Lavrov

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-11 18:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-11 13:20 [PATCH 0/1] Make netns available for ematch extensions Jozsef Kadlecsik
2013-09-11 13:20 ` [PATCH 1/1] net: sched: " Jozsef Kadlecsik
2013-09-11 14:31   ` Eric Dumazet
2013-09-11 14:32     ` Eric Dumazet
2013-09-11 18:37       ` Jozsef Kadlecsik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).