net/mlx5: add RHEL-7.2 VXLAN device metadata workaround

RH7.2 with kernel 3.10.0-327 does not support VXLAN
devices metadata and IFLA_VXLAN_COLLECT_METADATA
key is neither defined nor supported. We must specify
VNI parameter, which will be actually ignored by kernel,
applied rules will be processed by mlx5 kernel driver
and the actual VNI from rules will be used.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
This commit is contained in:
Viacheslav Ovsiienko 2018-12-29 19:55:40 +00:00 committed by Ferruh Yigit
parent 8ba325b051
commit 01925b8c64

View File

@ -316,9 +316,8 @@ struct tc_tunnel_key {
#define TCA_ACT_MAX_PRIO 32
#endif
/** UDP port range of VXLAN devices created by driver. */
#define MLX5_VXLAN_PORT_MIN 30000
#define MLX5_VXLAN_PORT_MAX 60000
/** Parameters of VXLAN devices created by driver. */
#define MLX5_VXLAN_DEFAULT_VNI 1
#define MLX5_VXLAN_DEVICE_PFX "vmlx_"
/** Tunnel action type, used for @p type in header structure. */
@ -4918,7 +4917,6 @@ flow_tcf_vtep_delete(struct mlx5_flow_tcf_context *tcf,
* Pointer to created device structure on success,
* NULL otherwise and rte_errno is set.
*/
#ifdef HAVE_IFLA_VXLAN_COLLECT_METADATA
static struct tcf_vtep*
flow_tcf_vtep_create(struct mlx5_flow_tcf_context *tcf,
uint16_t port, struct rte_flow_error *error)
@ -4968,10 +4966,24 @@ flow_tcf_vtep_create(struct mlx5_flow_tcf_context *tcf,
mnl_attr_put_strz(nlh, IFLA_INFO_KIND, "vxlan");
na_vxlan = mnl_attr_nest_start(nlh, IFLA_INFO_DATA);
assert(na_vxlan);
#ifdef HAVE_IFLA_VXLAN_COLLECT_METADATA
/*
* RH 7.2 does not support metadata for tunnel device.
* It does not matter because we are going to use the
* hardware offload by mlx5 driver.
*/
mnl_attr_put_u8(nlh, IFLA_VXLAN_COLLECT_METADATA, 1);
#endif
mnl_attr_put_u8(nlh, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, 1);
mnl_attr_put_u8(nlh, IFLA_VXLAN_LEARNING, 0);
mnl_attr_put_u16(nlh, IFLA_VXLAN_PORT, vxlan_port);
#ifndef HAVE_IFLA_VXLAN_COLLECT_METADATA
/*
* We must specify VNI explicitly if metadata not supported.
* Note, VNI is transferred with native endianness format.
*/
mnl_attr_put_u16(nlh, IFLA_VXLAN_ID, MLX5_VXLAN_DEFAULT_VNI);
#endif
mnl_attr_nest_end(nlh, na_vxlan);
mnl_attr_nest_end(nlh, na_info);
assert(sizeof(buf) >= nlh->nlmsg_len);
@ -5040,19 +5052,6 @@ error:
rte_free(vtep);
return NULL;
}
#else
static struct tcf_vtep*
flow_tcf_vtep_create(struct mlx5_flow_tcf_context *tcf __rte_unused,
uint16_t port __rte_unused,
struct rte_flow_error *error)
{
rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"netlink: failed to create VTEP, "
"vxlan metadata are not supported by kernel");
return NULL;
}
#endif /* HAVE_IFLA_VXLAN_COLLECT_METADATA */
/**
* Acquire target interface index for VXLAN tunneling decapsulation.