net/mlx5: fix VXLAN device rollback if rule apply fails

If rule contains tunneling action (like VXLAN encapsulation)
the VTEP (Virtual Tunneling EndPoint) device is pre-configured
before applying the rule. If kernel returns an error this
VTEP configuration should be rolled back to the origin state.
The patch adds the missing VTEP configuration restoration.

Fixes: 95a464cecc ("net/mlx5: add E-switch VXLAN tunnel devices management")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
This commit is contained in:
Viacheslav Ovsiienko 2018-11-10 10:01:59 +00:00 committed by Ferruh Yigit
parent 1f64486170
commit 817a6c4740

View File

@ -5124,6 +5124,13 @@ flow_tcf_apply(struct rte_eth_dev *dev, struct rte_flow *flow,
dev_flow->tcf.applied = 1;
return 0;
}
if (dev_flow->tcf.tunnel) {
/* Rollback the VTEP configuration if rule apply failed. */
assert(dev_flow->tcf.tunnel->vtep);
flow_tcf_vtep_release(ctx, dev_flow->tcf.tunnel->vtep,
dev_flow);
dev_flow->tcf.tunnel->vtep = NULL;
}
return rte_flow_error_set(error, rte_errno,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"netlink: failed to create TC flow rule");