summaryrefslogtreecommitdiff
path: root/lib/tc.c
diff options
context:
space:
mode:
authorPaul Blakey <paulb@mellanox.com>2019-12-22 12:16:39 +0200
committerSimon Horman <simon.horman@netronome.com>2019-12-22 11:54:40 +0100
commit7c53bd7839d839f8650c1c0298e5fb42271fc1ea (patch)
tree658326b2191d5630ad5f8fbca7a1f25053cb6e43 /lib/tc.c
parentdcdcad68c6a393274e9c6c13a3c85220a1fd850e (diff)
downloadopenvswitch-7c53bd7839d839f8650c1c0298e5fb42271fc1ea.tar.gz
tc: Move tunnel_key unset action before output ports
Since OvS datapath gets packets already decapsulated from tunnel devices, it doesn't explicitly decapsulate them. So in a recirculation setup, the tunnel matching continues in the recirculation as the tunnel metadata still exists on the SKB. Tunnel key unset action unsets this metadata. Some drivers might rely on this explicit tunnel key unset to know when to decapsulate the packet instead of the device type. So instead of removing it completly, we move it near the output actions. This way, we also keep SKB metadata through recirculation, and for non-recirculation rules, the resulting tc rules should remain the same. Signed-off-by: Paul Blakey <paulb@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
Diffstat (limited to 'lib/tc.c')
-rw-r--r--lib/tc.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/tc.c b/lib/tc.c
index b2d8ca782..7a4accee9 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -665,6 +665,12 @@ nl_parse_flower_tunnel(struct nlattr **attrs, struct tc_flower *flower)
flower->mask.tunnel.ttl =
nl_attr_get_u8(attrs[TCA_FLOWER_KEY_ENC_IP_TTL_MASK]);
}
+
+ if (!is_all_zeros(&flower->mask.tunnel, sizeof flower->mask.tunnel) ||
+ !is_all_zeros(&flower->key.tunnel, sizeof flower->key.tunnel)) {
+ flower->tunnel = true;
+ }
+
if (attrs[TCA_FLOWER_KEY_ENC_OPTS] &&
attrs[TCA_FLOWER_KEY_ENC_OPTS_MASK]) {
err = nl_parse_flower_tunnel_opts(attrs[TCA_FLOWER_KEY_ENC_OPTS],
@@ -2091,24 +2097,17 @@ nl_msg_put_flower_rewrite_pedits(struct ofpbuf *request,
static int
nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower)
{
+ bool ingress, released = false;
size_t offset;
size_t act_offset;
uint16_t act_index = 1;
struct tc_action *action;
int i, ifindex = 0;
- bool ingress;
offset = nl_msg_start_nested(request, TCA_FLOWER_ACT);
{
int error;
- if (flower->tunnel) {
- act_offset = nl_msg_start_nested(request, act_index++);
- nl_msg_put_act_tunnel_key_release(request);
- nl_msg_put_act_flags(request);
- nl_msg_end_nested(request, act_offset);
- }
-
action = flower->actions;
for (i = 0; i < flower->action_count; i++, action++) {
switch (action->type) {
@@ -2185,6 +2184,13 @@ nl_msg_put_flower_acts(struct ofpbuf *request, struct tc_flower *flower)
}
break;
case TC_ACT_OUTPUT: {
+ if (!released && flower->tunnel) {
+ act_offset = nl_msg_start_nested(request, act_index++);
+ nl_msg_put_act_tunnel_key_release(request);
+ nl_msg_end_nested(request, act_offset);
+ released = true;
+ }
+
ingress = action->out.ingress;
ifindex = action->out.ifindex_out;
if (ifindex < 1) {