Commit 1e74152e authored by Roi Dayan's avatar Roi Dayan Committed by Saeed Mahameed
Browse files

net/mlx5e: Check correct ip_version in decapsulation route resolution



flow_attr->ip_version has the matching that should be done inner/outer.
When working with chains, decapsulation is done on chain0 and next chain
match on outer header which is the original inner which could be ipv4.
So in tunnel route resolution we cannot use that to know which ip version
we are at so save tun_ip_version when parsing the tunnel match and use
that.

Fixes: a508728a ("net/mlx5e: VF tunnel RX traffic offloading")
Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
Reviewed-by: default avatarDmytro Linkin <dlinkin@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 55affa97
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -685,14 +685,14 @@ int mlx5e_tc_tun_route_lookup(struct mlx5e_priv *priv,
	u16 vport_num;
	int err = 0;

	if (flow_attr->ip_version == 4) {
	if (flow_attr->tun_ip_version == 4) {
		/* Addresses are swapped for decap */
		attr.fl.fl4.saddr = esw_attr->rx_tun_attr->dst_ip.v4;
		attr.fl.fl4.daddr = esw_attr->rx_tun_attr->src_ip.v4;
		err = mlx5e_route_lookup_ipv4_get(priv, priv->netdev, &attr);
	}
#if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
	else if (flow_attr->ip_version == 6) {
	else if (flow_attr->tun_ip_version == 6) {
		/* Addresses are swapped for decap */
		attr.fl.fl6.saddr = esw_attr->rx_tun_attr->dst_ip.v6;
		attr.fl.fl6.daddr = esw_attr->rx_tun_attr->src_ip.v6;
@@ -718,10 +718,10 @@ int mlx5e_tc_tun_route_lookup(struct mlx5e_priv *priv,
	esw_attr->rx_tun_attr->decap_vport = vport_num;

out:
	if (flow_attr->ip_version == 4)
	if (flow_attr->tun_ip_version == 4)
		mlx5e_route_lookup_ipv4_put(&attr);
#if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
	else if (flow_attr->ip_version == 6)
	else if (flow_attr->tun_ip_version == 6)
		mlx5e_route_lookup_ipv6_put(&attr);
#endif
	return err;
+2 −1
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ int mlx5e_tc_set_attr_rx_tun(struct mlx5e_tc_flow *flow,
	 * required to establish routing.
	 */
	flow_flag_set(flow, TUN_RX);
	flow->attr->tun_ip_version = ip_version;
	return 0;
}

@@ -1091,7 +1092,7 @@ int mlx5e_attach_decap_route(struct mlx5e_priv *priv,
	if (err || !esw_attr->rx_tun_attr->decap_vport)
		goto out;

	key.ip_version = attr->ip_version;
	key.ip_version = attr->tun_ip_version;
	if (key.ip_version == 4)
		key.endpoint_ip.v4 = esw_attr->rx_tun_attr->dst_ip.v4;
	else
+1 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ struct mlx5_flow_attr {
	u8 inner_match_level;
	u8 outer_match_level;
	u8 ip_version;
	u8 tun_ip_version;
	u32 flags;
	union {
		struct mlx5_esw_flow_attr esw_attr[0];