Skip to content

Commit 62b3237

Browse files
shorman-netronomedavem330
authored andcommitted
flow_dissector: dissect tunnel info outside __skb_flow_dissect()
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 <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 96f8406 commit 62b3237

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

include/linux/skbuff.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,11 @@ static inline bool skb_flow_dissect_flow_keys_buf(struct flow_keys *flow,
12111211
data, proto, nhoff, hlen, flags);
12121212
}
12131213

1214+
void
1215+
skb_flow_dissect_tunnel_info(const struct sk_buff *skb,
1216+
struct flow_dissector *flow_dissector,
1217+
void *target_container);
1218+
12141219
static inline __u32 skb_get_hash(struct sk_buff *skb)
12151220
{
12161221
if (!skb->l4_hash && !skb->sw_hash)

net/core/flow_dissector.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ skb_flow_dissect_set_enc_addr_type(enum flow_dissector_key_id type,
133133
ctrl->addr_type = type;
134134
}
135135

136-
static void
137-
__skb_flow_dissect_tunnel_info(const struct sk_buff *skb,
138-
struct flow_dissector *flow_dissector,
139-
void *target_container)
136+
void
137+
skb_flow_dissect_tunnel_info(const struct sk_buff *skb,
138+
struct flow_dissector *flow_dissector,
139+
void *target_container)
140140
{
141141
struct ip_tunnel_info *info;
142142
struct ip_tunnel_key *key;
@@ -212,6 +212,7 @@ __skb_flow_dissect_tunnel_info(const struct sk_buff *skb,
212212
tp->dst = key->tp_dst;
213213
}
214214
}
215+
EXPORT_SYMBOL(skb_flow_dissect_tunnel_info);
215216

216217
static enum flow_dissect_ret
217218
__skb_flow_dissect_mpls(const struct sk_buff *skb,
@@ -576,9 +577,6 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
576577
FLOW_DISSECTOR_KEY_BASIC,
577578
target_container);
578579

579-
__skb_flow_dissect_tunnel_info(skb, flow_dissector,
580-
target_container);
581-
582580
if (dissector_uses_key(flow_dissector,
583581
FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
584582
struct ethhdr *eth = eth_hdr(skb);

net/sched/cls_flower.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
166166
* so do it rather here.
167167
*/
168168
skb_key.basic.n_proto = skb->protocol;
169+
skb_flow_dissect_tunnel_info(skb, &head->dissector, &skb_key);
169170
skb_flow_dissect(skb, &head->dissector, &skb_key, 0);
170171

171172
fl_set_masked_key(&skb_mkey, &skb_key, &head->mask);

0 commit comments

Comments
 (0)