Skip to content

Commit 9c0bda6

Browse files
committed
Merge tag 'mlx5-fixes-2019-02-05' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
mlx5-fixes-2019-02-05
2 parents f09bef6 + 1651925 commit 9c0bda6

File tree

6 files changed

+37
-20
lines changed

6 files changed

+37
-20
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,16 +612,18 @@ int mlx5e_tc_tun_parse(struct net_device *filter_dev,
612612
struct mlx5_flow_spec *spec,
613613
struct tc_cls_flower_offload *f,
614614
void *headers_c,
615-
void *headers_v)
615+
void *headers_v, u8 *match_level)
616616
{
617617
int tunnel_type;
618618
int err = 0;
619619

620620
tunnel_type = mlx5e_tc_tun_get_type(filter_dev);
621621
if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_VXLAN) {
622+
*match_level = MLX5_MATCH_L4;
622623
err = mlx5e_tc_tun_parse_vxlan(priv, spec, f,
623624
headers_c, headers_v);
624625
} else if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_GRETAP) {
626+
*match_level = MLX5_MATCH_L3;
625627
err = mlx5e_tc_tun_parse_gretap(priv, spec, f,
626628
headers_c, headers_v);
627629
} else {

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ int mlx5e_tc_tun_parse(struct net_device *filter_dev,
3939
struct mlx5_flow_spec *spec,
4040
struct tc_cls_flower_offload *f,
4141
void *headers_c,
42-
void *headers_v);
42+
void *headers_v, u8 *match_level);
4343

4444
#endif //__MLX5_EN_TC_TUNNEL_H__

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
13021302
static int parse_tunnel_attr(struct mlx5e_priv *priv,
13031303
struct mlx5_flow_spec *spec,
13041304
struct tc_cls_flower_offload *f,
1305-
struct net_device *filter_dev)
1305+
struct net_device *filter_dev, u8 *match_level)
13061306
{
13071307
struct netlink_ext_ack *extack = f->common.extack;
13081308
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,
13171317
int err = 0;
13181318

13191319
err = mlx5e_tc_tun_parse(filter_dev, priv, spec, f,
1320-
headers_c, headers_v);
1320+
headers_c, headers_v, match_level);
13211321
if (err) {
13221322
NL_SET_ERR_MSG_MOD(extack,
13231323
"failed to parse tunnel attributes");
@@ -1426,7 +1426,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
14261426
struct mlx5_flow_spec *spec,
14271427
struct tc_cls_flower_offload *f,
14281428
struct net_device *filter_dev,
1429-
u8 *match_level)
1429+
u8 *match_level, u8 *tunnel_match_level)
14301430
{
14311431
struct netlink_ext_ack *extack = f->common.extack;
14321432
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,
14771477
switch (key->addr_type) {
14781478
case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
14791479
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))
14811481
return -EOPNOTSUPP;
14821482
break;
14831483
default:
@@ -1826,11 +1826,11 @@ static int parse_cls_flower(struct mlx5e_priv *priv,
18261826
struct mlx5_core_dev *dev = priv->mdev;
18271827
struct mlx5_eswitch *esw = dev->priv.eswitch;
18281828
struct mlx5e_rep_priv *rpriv = priv->ppriv;
1829+
u8 match_level, tunnel_match_level = MLX5_MATCH_NONE;
18291830
struct mlx5_eswitch_rep *rep;
1830-
u8 match_level;
18311831
int err;
18321832

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);
18341834

18351835
if (!err && (flow->flags & MLX5E_TC_FLOW_ESWITCH)) {
18361836
rep = rpriv->rep;
@@ -1846,10 +1846,12 @@ static int parse_cls_flower(struct mlx5e_priv *priv,
18461846
}
18471847
}
18481848

1849-
if (flow->flags & MLX5E_TC_FLOW_ESWITCH)
1849+
if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
18501850
flow->esw_attr->match_level = match_level;
1851-
else
1851+
flow->esw_attr->tunnel_match_level = tunnel_match_level;
1852+
} else {
18521853
flow->nic_attr->match_level = match_level;
1854+
}
18531855

18541856
return err;
18551857
}
@@ -2179,6 +2181,7 @@ static bool csum_offload_supported(struct mlx5e_priv *priv,
21792181

21802182
static bool modify_header_match_supported(struct mlx5_flow_spec *spec,
21812183
struct tcf_exts *exts,
2184+
u32 actions,
21822185
struct netlink_ext_ack *extack)
21832186
{
21842187
const struct tc_action *a;
@@ -2188,7 +2191,11 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec,
21882191
u16 ethertype;
21892192
int nkeys, i;
21902193

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+
21922199
ethertype = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ethertype);
21932200

21942201
/* 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,
22452252

22462253
if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
22472254
return modify_header_match_supported(&parse_attr->spec, exts,
2248-
extack);
2255+
actions, extack);
22492256

22502257
return true;
22512258
}

drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,14 @@ netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
387387
num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS);
388388
contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi);
389389
if (unlikely(contig_wqebbs_room < num_wqebbs)) {
390+
#ifdef CONFIG_MLX5_EN_IPSEC
391+
struct mlx5_wqe_eth_seg cur_eth = wqe->eth;
392+
#endif
390393
mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room);
391394
mlx5e_sq_fetch_wqe(sq, &wqe, &pi);
395+
#ifdef CONFIG_MLX5_EN_IPSEC
396+
wqe->eth = cur_eth;
397+
#endif
392398
}
393399

394400
/* fill wqe */

drivers/net/ethernet/mellanox/mlx5/core/eswitch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ struct mlx5_esw_flow_attr {
312312
} dests[MLX5_MAX_FLOW_FWD_VPORTS];
313313
u32 mod_hdr_id;
314314
u8 match_level;
315+
u8 tunnel_match_level;
315316
struct mlx5_fc *counter;
316317
u32 chain;
317318
u16 prio;

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,15 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
160160
MLX5_SET_TO_ONES(fte_match_set_misc, misc,
161161
source_eswitch_owner_vhca_id);
162162

163-
if (attr->match_level == MLX5_MATCH_NONE)
164-
spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS;
165-
else
166-
spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS |
167-
MLX5_MATCH_MISC_PARAMETERS;
168-
169-
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DECAP)
170-
spec->match_criteria_enable |= MLX5_MATCH_INNER_HEADERS;
163+
spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS;
164+
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DECAP) {
165+
if (attr->tunnel_match_level != MLX5_MATCH_NONE)
166+
spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;
167+
if (attr->match_level != MLX5_MATCH_NONE)
168+
spec->match_criteria_enable |= MLX5_MATCH_INNER_HEADERS;
169+
} else if (attr->match_level != MLX5_MATCH_NONE) {
170+
spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;
171+
}
171172

172173
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
173174
flow_act.modify_id = attr->mod_hdr_id;

0 commit comments

Comments
 (0)