Skip to content

Commit eacc77a

Browse files
ddvladkuba-moo
authored andcommitted
net/mlx5e: Use custom tunnel header for vxlan gbp
Symbolic (e.g. "vxlan") and custom (e.g. "tunnel_header_0") tunnels cannot be combined, but the match params interface does not have fields for matching on vxlan gbp. To match vxlan bgp, the tc_tun layer uses tunnel_header_0. Allow matching on both VNI and GBP by matching the VNI with a custom tunnel header instead of the symbolic field name. Matching solely on the VNI continues to use the symbolic field name. Fixes: 74a778b ("net/mlx5: HWS, added definers handling") Signed-off-by: Vlad Dogaru <[email protected]> Reviewed-by: Yevgeny Kliteynik <[email protected]> Signed-off-by: Mark Bloch <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bf20af0 commit eacc77a

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ static int mlx5e_tc_tun_parse_vxlan(struct mlx5e_priv *priv,
165165
struct flow_match_enc_keyid enc_keyid;
166166
void *misc_c, *misc_v;
167167

168-
misc_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, misc_parameters);
169-
misc_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters);
170-
171168
if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_KEYID))
172169
return 0;
173170

@@ -182,6 +179,30 @@ static int mlx5e_tc_tun_parse_vxlan(struct mlx5e_priv *priv,
182179
err = mlx5e_tc_tun_parse_vxlan_gbp_option(priv, spec, f);
183180
if (err)
184181
return err;
182+
183+
/* We can't mix custom tunnel headers with symbolic ones and we
184+
* don't have a symbolic field name for GBP, so we use custom
185+
* tunnel headers in this case. We need hardware support to
186+
* match on custom tunnel headers, but we already know it's
187+
* supported because the previous call successfully checked for
188+
* that.
189+
*/
190+
misc_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria,
191+
misc_parameters_5);
192+
misc_v = MLX5_ADDR_OF(fte_match_param, spec->match_value,
193+
misc_parameters_5);
194+
195+
/* Shift by 8 to account for the reserved bits in the vxlan
196+
* header after the VNI.
197+
*/
198+
MLX5_SET(fte_match_set_misc5, misc_c, tunnel_header_1,
199+
be32_to_cpu(enc_keyid.mask->keyid) << 8);
200+
MLX5_SET(fte_match_set_misc5, misc_v, tunnel_header_1,
201+
be32_to_cpu(enc_keyid.key->keyid) << 8);
202+
203+
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS_5;
204+
205+
return 0;
185206
}
186207

187208
/* match on VNI is required */
@@ -195,6 +216,11 @@ static int mlx5e_tc_tun_parse_vxlan(struct mlx5e_priv *priv,
195216
return -EOPNOTSUPP;
196217
}
197218

219+
misc_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria,
220+
misc_parameters);
221+
misc_v = MLX5_ADDR_OF(fte_match_param, spec->match_value,
222+
misc_parameters);
223+
198224
MLX5_SET(fte_match_set_misc, misc_c, vxlan_vni,
199225
be32_to_cpu(enc_keyid.mask->keyid));
200226
MLX5_SET(fte_match_set_misc, misc_v, vxlan_vni,

0 commit comments

Comments
 (0)