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 06b1c0172a7bd2c4596ceb5ea76570225e7c5ec6..88116a4750b054464d81c57a78a9943718581afd 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 3aab3ce9119d6f1716867452b03e7935ac436860..ab9c7ec77520c198f27993eeb4f6f92147380d08 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 cb5bd3eaf7387e97771f3f1da651759f8780aa30..b614513df127d825b8a1392a92e336abf7721459 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 378507988a32b2c5260dfbb52e697e0526873070..004e679a4f531c4a62e79c361021b620ecbfca65 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;