Commit d11afc26 authored by Oz Shlomo's avatar Oz Shlomo Committed by Saeed Mahameed

net/mlx5e: Propagate the filter's net device to mlx5e structures

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: default avatarOz Shlomo <ozsh@mellanox.com>
Reviewed-by: default avatarEli Britstein <elibr@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 71d82d2a
...@@ -96,6 +96,7 @@ struct mlx5e_tc_flow { ...@@ -96,6 +96,7 @@ struct mlx5e_tc_flow {
struct mlx5e_tc_flow_parse_attr { struct mlx5e_tc_flow_parse_attr {
struct ip_tunnel_info tun_info; struct ip_tunnel_info tun_info;
struct net_device *filter_dev;
struct mlx5_flow_spec spec; struct mlx5_flow_spec spec;
int num_mod_hdr_actions; int num_mod_hdr_actions;
void *mod_hdr_actions; void *mod_hdr_actions;
...@@ -3054,10 +3055,6 @@ mlx5e_alloc_flow(struct mlx5e_priv *priv, int attr_size, ...@@ -3054,10 +3055,6 @@ mlx5e_alloc_flow(struct mlx5e_priv *priv, int attr_size,
flow->flags = flow_flags; flow->flags = flow_flags;
flow->priv = priv; flow->priv = priv;
err = parse_cls_flower(priv, flow, &parse_attr->spec, f);
if (err)
goto err_free;
*__flow = flow; *__flow = flow;
*__parse_attr = parse_attr; *__parse_attr = parse_attr;
...@@ -3073,6 +3070,7 @@ static int ...@@ -3073,6 +3070,7 @@ static int
mlx5e_add_fdb_flow(struct mlx5e_priv *priv, mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, struct tc_cls_flower_offload *f,
u16 flow_flags, u16 flow_flags,
struct net_device *filter_dev,
struct mlx5e_tc_flow **__flow) struct mlx5e_tc_flow **__flow)
{ {
struct netlink_ext_ack *extack = f->common.extack; struct netlink_ext_ack *extack = f->common.extack;
...@@ -3086,6 +3084,11 @@ mlx5e_add_fdb_flow(struct mlx5e_priv *priv, ...@@ -3086,6 +3084,11 @@ mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
&parse_attr, &flow); &parse_attr, &flow);
if (err) if (err)
goto out; 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->chain = f->common.chain_index;
flow->esw_attr->prio = TC_H_MAJ(f->common.prio) >> 16; flow->esw_attr->prio = TC_H_MAJ(f->common.prio) >> 16;
...@@ -3116,6 +3119,7 @@ static int ...@@ -3116,6 +3119,7 @@ static int
mlx5e_add_nic_flow(struct mlx5e_priv *priv, mlx5e_add_nic_flow(struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, struct tc_cls_flower_offload *f,
u16 flow_flags, u16 flow_flags,
struct net_device *filter_dev,
struct mlx5e_tc_flow **__flow) struct mlx5e_tc_flow **__flow)
{ {
struct netlink_ext_ack *extack = f->common.extack; struct netlink_ext_ack *extack = f->common.extack;
...@@ -3134,6 +3138,11 @@ mlx5e_add_nic_flow(struct mlx5e_priv *priv, ...@@ -3134,6 +3138,11 @@ mlx5e_add_nic_flow(struct mlx5e_priv *priv,
if (err) if (err)
goto out; 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); err = parse_tc_nic_actions(priv, f->exts, parse_attr, flow, extack);
if (err) if (err)
goto err_free; goto err_free;
...@@ -3159,6 +3168,7 @@ static int ...@@ -3159,6 +3168,7 @@ static int
mlx5e_tc_add_flow(struct mlx5e_priv *priv, mlx5e_tc_add_flow(struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, struct tc_cls_flower_offload *f,
int flags, int flags,
struct net_device *filter_dev,
struct mlx5e_tc_flow **flow) struct mlx5e_tc_flow **flow)
{ {
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
...@@ -3171,9 +3181,11 @@ mlx5e_tc_add_flow(struct mlx5e_priv *priv, ...@@ -3171,9 +3181,11 @@ mlx5e_tc_add_flow(struct mlx5e_priv *priv,
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (esw && esw->mode == SRIOV_OFFLOADS) 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 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; return err;
} }
...@@ -3196,7 +3208,7 @@ int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv, ...@@ -3196,7 +3208,7 @@ int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv,
goto out; goto out;
} }
err = mlx5e_tc_add_flow(priv, f, flags, &flow); err = mlx5e_tc_add_flow(priv, f, flags, dev, &flow);
if (err) if (err)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment