netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] flow_dissector: dissect tunnel info outside __skb_flow_dissect()
@ 2017-12-04 10:31 Simon Horman
  2017-12-05 17:10 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Horman @ 2017-12-04 10:31 UTC (permalink / raw)
  To: David Miller, Jiri Pirko
  Cc: Jamal Hadi Salim, Cong Wang, netdev, oss-drivers, Tom Herbert,
	Willem de Bruijn, Simon Horman

Move dissection of tunnel info to outside of the main flow dissection
function, __skb_flow_dissect(). The sole user of this feature, the flower
classifier, is updated to call tunnel info dissection directly, using
skb_flow_dissect_tunnel_info().

This results in a slightly less complex implementation of
__skb_flow_dissect(), in particular removing logic from that call path
which is not used by the majority of users. The expense of this is borne by
the flower classifier which now has to make an extra call for tunnel info
dissection.

This patch should not result in any behavioural change.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 include/linux/skbuff.h    |  5 +++++
 net/core/flow_dissector.c | 12 +++++-------
 net/sched/cls_flower.c    |  1 +
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bc486ef23f20..7d053bbaa5d1 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1211,6 +1211,11 @@ static inline bool skb_flow_dissect_flow_keys_buf(struct flow_keys *flow,
 				  data, proto, nhoff, hlen, flags);
 }
 
+void
+skb_flow_dissect_tunnel_info(const struct sk_buff *skb,
+			     struct flow_dissector *flow_dissector,
+			     void *target_container);
+
 static inline __u32 skb_get_hash(struct sk_buff *skb)
 {
 	if (!skb->l4_hash && !skb->sw_hash)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 15ce30063765..cc75488d3653 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -133,10 +133,10 @@ skb_flow_dissect_set_enc_addr_type(enum flow_dissector_key_id type,
 	ctrl->addr_type = type;
 }
 
-static void
-__skb_flow_dissect_tunnel_info(const struct sk_buff *skb,
-			       struct flow_dissector *flow_dissector,
-			       void *target_container)
+void
+skb_flow_dissect_tunnel_info(const struct sk_buff *skb,
+			     struct flow_dissector *flow_dissector,
+			     void *target_container)
 {
 	struct ip_tunnel_info *info;
 	struct ip_tunnel_key *key;
@@ -212,6 +212,7 @@ __skb_flow_dissect_tunnel_info(const struct sk_buff *skb,
 		tp->dst = key->tp_dst;
 	}
 }
+EXPORT_SYMBOL(skb_flow_dissect_tunnel_info);
 
 static enum flow_dissect_ret
 __skb_flow_dissect_mpls(const struct sk_buff *skb,
@@ -576,9 +577,6 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 					      FLOW_DISSECTOR_KEY_BASIC,
 					      target_container);
 
-	__skb_flow_dissect_tunnel_info(skb, flow_dissector,
-				       target_container);
-
 	if (dissector_uses_key(flow_dissector,
 			       FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
 		struct ethhdr *eth = eth_hdr(skb);
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 543a3e875d05..6132a7317efa 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -166,6 +166,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 	 * so do it rather here.
 	 */
 	skb_key.basic.n_proto = skb->protocol;
+	skb_flow_dissect_tunnel_info(skb, &head->dissector, &skb_key);
 	skb_flow_dissect(skb, &head->dissector, &skb_key, 0);
 
 	fl_set_masked_key(&skb_mkey, &skb_key, &head->mask);
-- 
2.11.0

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

* Re: [PATCH net-next] flow_dissector: dissect tunnel info outside __skb_flow_dissect()
  2017-12-04 10:31 [PATCH net-next] flow_dissector: dissect tunnel info outside __skb_flow_dissect() Simon Horman
@ 2017-12-05 17:10 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-12-05 17:10 UTC (permalink / raw)
  To: simon.horman
  Cc: jiri, jhs, xiyou.wangcong, netdev, oss-drivers, tom,
	willemdebruijn.kernel

From: Simon Horman <simon.horman@netronome.com>
Date: Mon,  4 Dec 2017 11:31:48 +0100

> Move dissection of tunnel info to outside of the main flow dissection
> function, __skb_flow_dissect(). The sole user of this feature, the flower
> classifier, is updated to call tunnel info dissection directly, using
> skb_flow_dissect_tunnel_info().
> 
> This results in a slightly less complex implementation of
> __skb_flow_dissect(), in particular removing logic from that call path
> which is not used by the majority of users. The expense of this is borne by
> the flower classifier which now has to make an extra call for tunnel info
> dissection.
> 
> This patch should not result in any behavioural change.
> 
> Signed-off-by: Simon Horman <simon.horman@netronome.com>
> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Ok, let's see where this goes :-)

Applied, thanks.

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

end of thread, other threads:[~2017-12-05 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-04 10:31 [PATCH net-next] flow_dissector: dissect tunnel info outside __skb_flow_dissect() Simon Horman
2017-12-05 17:10 ` David Miller

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