net/mlx5e: Provide the TC filter netdev as parameter to flower callbacks

Currently the driver controls flower filters that are installed on its
devices. However, with the introduction of the indirect block
notifications platform the driver may receive control events for filters
that are installed on higher level net devices (e.g. tunnel devices).
Therefore, the driver filter control API will not be able to implicitly
assume the filter's net device.

Explicitly specify the filter's net device, no functional change

Signed-off-by: Oz Shlomo <ozsh@mellanox.com>
Reviewed-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
Oz Shlomo 2018-10-28 09:14:50 +02:00 committed by Saeed Mahameed
parent f5bc2c5de1
commit 71d82d2a90
4 changed files with 18 additions and 12 deletions

View File

@ -3386,11 +3386,14 @@ static int mlx5e_setup_tc_cls_flower(struct mlx5e_priv *priv,
{ {
switch (cls_flower->command) { switch (cls_flower->command) {
case TC_CLSFLOWER_REPLACE: case TC_CLSFLOWER_REPLACE:
return mlx5e_configure_flower(priv, cls_flower, flags); return mlx5e_configure_flower(priv->netdev, priv, cls_flower,
flags);
case TC_CLSFLOWER_DESTROY: case TC_CLSFLOWER_DESTROY:
return mlx5e_delete_flower(priv, cls_flower, flags); return mlx5e_delete_flower(priv->netdev, priv, cls_flower,
flags);
case TC_CLSFLOWER_STATS: case TC_CLSFLOWER_STATS:
return mlx5e_stats_flower(priv, cls_flower, flags); return mlx5e_stats_flower(priv->netdev, priv, cls_flower,
flags);
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }

View File

@ -1007,11 +1007,14 @@ mlx5e_rep_setup_tc_cls_flower(struct mlx5e_priv *priv,
{ {
switch (cls_flower->command) { switch (cls_flower->command) {
case TC_CLSFLOWER_REPLACE: case TC_CLSFLOWER_REPLACE:
return mlx5e_configure_flower(priv, cls_flower, flags); return mlx5e_configure_flower(priv->netdev, priv, cls_flower,
flags);
case TC_CLSFLOWER_DESTROY: case TC_CLSFLOWER_DESTROY:
return mlx5e_delete_flower(priv, cls_flower, flags); return mlx5e_delete_flower(priv->netdev, priv, cls_flower,
flags);
case TC_CLSFLOWER_STATS: case TC_CLSFLOWER_STATS:
return mlx5e_stats_flower(priv, cls_flower, flags); return mlx5e_stats_flower(priv->netdev, priv, cls_flower,
flags);
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }

View File

@ -3178,7 +3178,7 @@ mlx5e_tc_add_flow(struct mlx5e_priv *priv,
return err; return err;
} }
int mlx5e_configure_flower(struct mlx5e_priv *priv, int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, int flags) struct tc_cls_flower_offload *f, int flags)
{ {
struct netlink_ext_ack *extack = f->common.extack; struct netlink_ext_ack *extack = f->common.extack;
@ -3224,7 +3224,7 @@ static bool same_flow_direction(struct mlx5e_tc_flow *flow, int flags)
return false; return false;
} }
int mlx5e_delete_flower(struct mlx5e_priv *priv, int mlx5e_delete_flower(struct net_device *dev, struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, int flags) struct tc_cls_flower_offload *f, int flags)
{ {
struct rhashtable *tc_ht = get_tc_ht(priv); struct rhashtable *tc_ht = get_tc_ht(priv);
@ -3243,7 +3243,7 @@ int mlx5e_delete_flower(struct mlx5e_priv *priv,
return 0; return 0;
} }
int mlx5e_stats_flower(struct mlx5e_priv *priv, int mlx5e_stats_flower(struct net_device *dev, struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, int flags) struct tc_cls_flower_offload *f, int flags)
{ {
struct rhashtable *tc_ht = get_tc_ht(priv); struct rhashtable *tc_ht = get_tc_ht(priv);

View File

@ -51,12 +51,12 @@ void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv);
int mlx5e_tc_esw_init(struct rhashtable *tc_ht); int mlx5e_tc_esw_init(struct rhashtable *tc_ht);
void mlx5e_tc_esw_cleanup(struct rhashtable *tc_ht); void mlx5e_tc_esw_cleanup(struct rhashtable *tc_ht);
int mlx5e_configure_flower(struct mlx5e_priv *priv, int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, int flags); struct tc_cls_flower_offload *f, int flags);
int mlx5e_delete_flower(struct mlx5e_priv *priv, int mlx5e_delete_flower(struct net_device *dev, struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, int flags); struct tc_cls_flower_offload *f, int flags);
int mlx5e_stats_flower(struct mlx5e_priv *priv, int mlx5e_stats_flower(struct net_device *dev, struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, int flags); struct tc_cls_flower_offload *f, int flags);
struct mlx5e_encap_entry; struct mlx5e_encap_entry;