net/mlx5e: Provide the TC filter netdev as parameter to flower callbacks
authorOz Shlomo <ozsh@mellanox.com>
Sun, 28 Oct 2018 07:14:50 +0000 (09:14 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Mon, 10 Dec 2018 23:53:04 +0000 (15:53 -0800)
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>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h

index 06b1c01..88116a4 100644 (file)
@@ -3386,11 +3386,14 @@ static int mlx5e_setup_tc_cls_flower(struct mlx5e_priv *priv,
 {
        switch (cls_flower->command) {
        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:
-               return mlx5e_delete_flower(priv, cls_flower, flags);
+               return mlx5e_delete_flower(priv->netdev, priv, cls_flower,
+                                          flags);
        case TC_CLSFLOWER_STATS:
-               return mlx5e_stats_flower(priv, cls_flower, flags);
+               return mlx5e_stats_flower(priv->netdev, priv, cls_flower,
+                                         flags);
        default:
                return -EOPNOTSUPP;
        }
index 3aab3ce..ab9c7ec 100644 (file)
@@ -1007,11 +1007,14 @@ mlx5e_rep_setup_tc_cls_flower(struct mlx5e_priv *priv,
 {
        switch (cls_flower->command) {
        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:
-               return mlx5e_delete_flower(priv, cls_flower, flags);
+               return mlx5e_delete_flower(priv->netdev, priv, cls_flower,
+                                          flags);
        case TC_CLSFLOWER_STATS:
-               return mlx5e_stats_flower(priv, cls_flower, flags);
+               return mlx5e_stats_flower(priv->netdev, priv, cls_flower,
+                                         flags);
        default:
                return -EOPNOTSUPP;
        }
index cb5bd3e..b614513 100644 (file)
@@ -3178,7 +3178,7 @@ mlx5e_tc_add_flow(struct mlx5e_priv *priv,
        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 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;
 }
 
-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 rhashtable *tc_ht = get_tc_ht(priv);
@@ -3243,7 +3243,7 @@ int mlx5e_delete_flower(struct mlx5e_priv *priv,
        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 rhashtable *tc_ht = get_tc_ht(priv);
index 3785079..004e679 100644 (file)
@@ -51,12 +51,12 @@ void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv);
 int mlx5e_tc_esw_init(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);
-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);
 
-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 mlx5e_encap_entry;