@@ -1302,7 +1302,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
1302
1302
static int parse_tunnel_attr (struct mlx5e_priv * priv ,
1303
1303
struct mlx5_flow_spec * spec ,
1304
1304
struct tc_cls_flower_offload * f ,
1305
- struct net_device * filter_dev )
1305
+ struct net_device * filter_dev , u8 * match_level )
1306
1306
{
1307
1307
struct netlink_ext_ack * extack = f -> common .extack ;
1308
1308
void * headers_c = MLX5_ADDR_OF (fte_match_param , spec -> match_criteria ,
@@ -1317,7 +1317,7 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv,
1317
1317
int err = 0 ;
1318
1318
1319
1319
err = mlx5e_tc_tun_parse (filter_dev , priv , spec , f ,
1320
- headers_c , headers_v );
1320
+ headers_c , headers_v , match_level );
1321
1321
if (err ) {
1322
1322
NL_SET_ERR_MSG_MOD (extack ,
1323
1323
"failed to parse tunnel attributes" );
@@ -1426,7 +1426,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
1426
1426
struct mlx5_flow_spec * spec ,
1427
1427
struct tc_cls_flower_offload * f ,
1428
1428
struct net_device * filter_dev ,
1429
- u8 * match_level )
1429
+ u8 * match_level , u8 * tunnel_match_level )
1430
1430
{
1431
1431
struct netlink_ext_ack * extack = f -> common .extack ;
1432
1432
void * headers_c = MLX5_ADDR_OF (fte_match_param , spec -> match_criteria ,
@@ -1477,7 +1477,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
1477
1477
switch (key -> addr_type ) {
1478
1478
case FLOW_DISSECTOR_KEY_IPV4_ADDRS :
1479
1479
case FLOW_DISSECTOR_KEY_IPV6_ADDRS :
1480
- if (parse_tunnel_attr (priv , spec , f , filter_dev ))
1480
+ if (parse_tunnel_attr (priv , spec , f , filter_dev , tunnel_match_level ))
1481
1481
return - EOPNOTSUPP ;
1482
1482
break ;
1483
1483
default :
@@ -1826,11 +1826,11 @@ static int parse_cls_flower(struct mlx5e_priv *priv,
1826
1826
struct mlx5_core_dev * dev = priv -> mdev ;
1827
1827
struct mlx5_eswitch * esw = dev -> priv .eswitch ;
1828
1828
struct mlx5e_rep_priv * rpriv = priv -> ppriv ;
1829
+ u8 match_level , tunnel_match_level = MLX5_MATCH_NONE ;
1829
1830
struct mlx5_eswitch_rep * rep ;
1830
- u8 match_level ;
1831
1831
int err ;
1832
1832
1833
- err = __parse_cls_flower (priv , spec , f , filter_dev , & match_level );
1833
+ err = __parse_cls_flower (priv , spec , f , filter_dev , & match_level , & tunnel_match_level );
1834
1834
1835
1835
if (!err && (flow -> flags & MLX5E_TC_FLOW_ESWITCH )) {
1836
1836
rep = rpriv -> rep ;
@@ -1846,10 +1846,12 @@ static int parse_cls_flower(struct mlx5e_priv *priv,
1846
1846
}
1847
1847
}
1848
1848
1849
- if (flow -> flags & MLX5E_TC_FLOW_ESWITCH )
1849
+ if (flow -> flags & MLX5E_TC_FLOW_ESWITCH ) {
1850
1850
flow -> esw_attr -> match_level = match_level ;
1851
- else
1851
+ flow -> esw_attr -> tunnel_match_level = tunnel_match_level ;
1852
+ } else {
1852
1853
flow -> nic_attr -> match_level = match_level ;
1854
+ }
1853
1855
1854
1856
return err ;
1855
1857
}
@@ -2179,6 +2181,7 @@ static bool csum_offload_supported(struct mlx5e_priv *priv,
2179
2181
2180
2182
static bool modify_header_match_supported (struct mlx5_flow_spec * spec ,
2181
2183
struct tcf_exts * exts ,
2184
+ u32 actions ,
2182
2185
struct netlink_ext_ack * extack )
2183
2186
{
2184
2187
const struct tc_action * a ;
@@ -2188,7 +2191,11 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec,
2188
2191
u16 ethertype ;
2189
2192
int nkeys , i ;
2190
2193
2191
- headers_v = MLX5_ADDR_OF (fte_match_param , spec -> match_value , outer_headers );
2194
+ if (actions & MLX5_FLOW_CONTEXT_ACTION_DECAP )
2195
+ headers_v = MLX5_ADDR_OF (fte_match_param , spec -> match_value , inner_headers );
2196
+ else
2197
+ headers_v = MLX5_ADDR_OF (fte_match_param , spec -> match_value , outer_headers );
2198
+
2192
2199
ethertype = MLX5_GET (fte_match_set_lyr_2_4 , headers_v , ethertype );
2193
2200
2194
2201
/* for non-IP we only re-write MACs, so we're okay */
@@ -2245,7 +2252,7 @@ static bool actions_match_supported(struct mlx5e_priv *priv,
2245
2252
2246
2253
if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR )
2247
2254
return modify_header_match_supported (& parse_attr -> spec , exts ,
2248
- extack );
2255
+ actions , extack );
2249
2256
2250
2257
return true;
2251
2258
}
0 commit comments