Skip to content

Commit

Permalink
net/mlx5e: Propagate the filter's net device to mlx5e structures
Browse files Browse the repository at this point in the history
Propagate the filter's net_device parameter to the tc flower parsed
attributes structure so that it can later be used in tunnel decap
offloading sequences.

Pre-step for replacing egdev logic with the indirect block
notification mechanism.

Signed-off-by: Oz Shlomo <ozsh@mellanox.com>
Reviewed-by: Eli Britstein <elibr@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
  • Loading branch information
Oz Shlomo authored and Saeed Mahameed committed Dec 10, 2018
1 parent 71d82d2 commit d11afc2
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct mlx5e_tc_flow {

struct mlx5e_tc_flow_parse_attr {
struct ip_tunnel_info tun_info;
struct net_device *filter_dev;
struct mlx5_flow_spec spec;
int num_mod_hdr_actions;
void *mod_hdr_actions;
Expand Down Expand Up @@ -3054,10 +3055,6 @@ mlx5e_alloc_flow(struct mlx5e_priv *priv, int attr_size,
flow->flags = flow_flags;
flow->priv = priv;

err = parse_cls_flower(priv, flow, &parse_attr->spec, f);
if (err)
goto err_free;

*__flow = flow;
*__parse_attr = parse_attr;

Expand All @@ -3073,6 +3070,7 @@ static int
mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f,
u16 flow_flags,
struct net_device *filter_dev,
struct mlx5e_tc_flow **__flow)
{
struct netlink_ext_ack *extack = f->common.extack;
Expand All @@ -3086,6 +3084,11 @@ mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
&parse_attr, &flow);
if (err)
goto out;
parse_attr->filter_dev = filter_dev;
flow->esw_attr->parse_attr = parse_attr;
err = parse_cls_flower(flow->priv, flow, &parse_attr->spec, f);
if (err)
goto err_free;

flow->esw_attr->chain = f->common.chain_index;
flow->esw_attr->prio = TC_H_MAJ(f->common.prio) >> 16;
Expand Down Expand Up @@ -3116,6 +3119,7 @@ static int
mlx5e_add_nic_flow(struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f,
u16 flow_flags,
struct net_device *filter_dev,
struct mlx5e_tc_flow **__flow)
{
struct netlink_ext_ack *extack = f->common.extack;
Expand All @@ -3134,6 +3138,11 @@ mlx5e_add_nic_flow(struct mlx5e_priv *priv,
if (err)
goto out;

parse_attr->filter_dev = filter_dev;
err = parse_cls_flower(flow->priv, flow, &parse_attr->spec, f);
if (err)
goto err_free;

err = parse_tc_nic_actions(priv, f->exts, parse_attr, flow, extack);
if (err)
goto err_free;
Expand All @@ -3159,6 +3168,7 @@ static int
mlx5e_tc_add_flow(struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f,
int flags,
struct net_device *filter_dev,
struct mlx5e_tc_flow **flow)
{
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
Expand All @@ -3171,9 +3181,11 @@ mlx5e_tc_add_flow(struct mlx5e_priv *priv,
return -EOPNOTSUPP;

if (esw && esw->mode == SRIOV_OFFLOADS)
err = mlx5e_add_fdb_flow(priv, f, flow_flags, flow);
err = mlx5e_add_fdb_flow(priv, f, flow_flags,
filter_dev, flow);
else
err = mlx5e_add_nic_flow(priv, f, flow_flags, flow);
err = mlx5e_add_nic_flow(priv, f, flow_flags,
filter_dev, flow);

return err;
}
Expand All @@ -3196,7 +3208,7 @@ int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv,
goto out;
}

err = mlx5e_tc_add_flow(priv, f, flags, &flow);
err = mlx5e_tc_add_flow(priv, f, flags, dev, &flow);
if (err)
goto out;

Expand Down

0 comments on commit d11afc2

Please sign in to comment.