@@ -3136,16 +3136,18 @@ parse_gre_match(struct flow_patterns *patterns,
greh_spec->k = !!(match->flow.tunnel.flags & FLOW_TNL_F_KEY);
greh_mask->k = 1;
- key_spec = per_thread_xzalloc(sizeof *key_spec);
- key_mask = per_thread_xzalloc(sizeof *key_mask);
+ if (greh_spec->k) {
+ key_spec = per_thread_xzalloc(sizeof *key_spec);
+ key_mask = per_thread_xzalloc(sizeof *key_mask);
- *key_spec = htonl(ntohll(match->flow.tunnel.tun_id));
- *key_mask = htonl(ntohll(match->wc.masks.tunnel.tun_id));
+ *key_spec = htonl(ntohll(match->flow.tunnel.tun_id));
+ *key_mask = htonl(ntohll(match->wc.masks.tunnel.tun_id));
+ add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_GRE_KEY, key_spec,
+ key_mask, NULL);
+ }
consumed_masks->tunnel.tun_id = 0;
consumed_masks->tunnel.flags &= ~FLOW_TNL_F_KEY;
- add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_GRE_KEY, key_spec,
- key_mask, NULL);
}
consumed_masks->tunnel.flags &= ~FLOW_TNL_F_DONT_FRAGMENT;
In case there is no match on GRE key, avoid adding the key match item. Fixes: 7617d0583c73 ("netdev-offload-dpdk: Add support for matching on gre fields.") Signed-off-by: Salem Sol <salems@nvidia.com> --- lib/netdev-offload-dpdk.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)