net/mlx5e: Some cleanup in mlx5e_tc_stats_matchall()
authorAmir Tzin <amirtz@nvidia.com>
Wed, 6 Sep 2023 10:40:38 +0000 (13:40 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 15 Nov 2023 19:34:29 +0000 (11:34 -0800)
Function mlx5e_tc_stats_matchall() is only called from one file:
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
Move it there and make it static as exposing it is unnecessary. Also
variable cur_stats is redundant. Remove it and avoid superfluous copy.

This patch does not change functionality.

Reviewed-by: Patrisious Haddad <phaddad@nvidia.com>
Signed-off-by: Amir Tzin <amirtz@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h

index b12fe3c5a2585bc8dfec7bb0f04b4b7eb2f09e28..a55452c69f06cc31b5363a94b64a1d30cf347851 100644 (file)
@@ -147,6 +147,20 @@ mlx5e_rep_setup_tc_cls_flower(struct mlx5e_priv *priv,
        }
 }
 
+static void mlx5e_tc_stats_matchall(struct mlx5e_priv *priv,
+                                   struct tc_cls_matchall_offload *ma)
+{
+       struct mlx5e_rep_priv *rpriv = priv->ppriv;
+       u64 dbytes;
+       u64 dpkts;
+
+       dpkts = priv->stats.rep_stats.vport_rx_packets - rpriv->prev_vf_vport_stats.rx_packets;
+       dbytes = priv->stats.rep_stats.vport_rx_bytes - rpriv->prev_vf_vport_stats.rx_bytes;
+       mlx5e_stats_copy_rep_stats(&rpriv->prev_vf_vport_stats, &priv->stats.rep_stats);
+       flow_stats_update(&ma->stats, dbytes, dpkts, 0, jiffies,
+                         FLOW_ACTION_HW_STATS_DELAYED);
+}
+
 static
 int mlx5e_rep_setup_tc_cls_matchall(struct mlx5e_priv *priv,
                                    struct tc_cls_matchall_offload *ma)
index 9a5a5c2c7da9e10fe123b7cc2911f6b775dae50a..25743a7eda2693e51cefd46306679e5ef1d95a5b 100644 (file)
@@ -5007,22 +5007,6 @@ int mlx5e_tc_delete_matchall(struct mlx5e_priv *priv,
        return apply_police_params(priv, 0, extack);
 }
 
-void mlx5e_tc_stats_matchall(struct mlx5e_priv *priv,
-                            struct tc_cls_matchall_offload *ma)
-{
-       struct mlx5e_rep_priv *rpriv = priv->ppriv;
-       struct rtnl_link_stats64 cur_stats;
-       u64 dbytes;
-       u64 dpkts;
-
-       mlx5e_stats_copy_rep_stats(&cur_stats, &priv->stats.rep_stats);
-       dpkts = cur_stats.rx_packets - rpriv->prev_vf_vport_stats.rx_packets;
-       dbytes = cur_stats.rx_bytes - rpriv->prev_vf_vport_stats.rx_bytes;
-       rpriv->prev_vf_vport_stats = cur_stats;
-       flow_stats_update(&ma->stats, dbytes, dpkts, 0, jiffies,
-                         FLOW_ACTION_HW_STATS_DELAYED);
-}
-
 static void mlx5e_tc_hairpin_update_dead_peer(struct mlx5e_priv *priv,
                                              struct mlx5e_priv *peer_priv)
 {
index adb39e30f90f089644d2e2ee6ffb24b92b90c3cb..c24bda56b2b5d21369c826967afe3f8599d28a12 100644 (file)
@@ -203,8 +203,6 @@ int mlx5e_tc_configure_matchall(struct mlx5e_priv *priv,
                                struct tc_cls_matchall_offload *f);
 int mlx5e_tc_delete_matchall(struct mlx5e_priv *priv,
                             struct tc_cls_matchall_offload *f);
-void mlx5e_tc_stats_matchall(struct mlx5e_priv *priv,
-                            struct tc_cls_matchall_offload *ma);
 
 struct mlx5e_encap_entry;
 void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,