Commit 930821e3 authored by Or Gerlitz's avatar Or Gerlitz Committed by Leon Romanovsky

net/mlx5: Use flow counter pointer as input to the query function

This allows to un-expose the details of struct mlx5_fc and keep it
internal to the core driver.
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent ab741b2e
...@@ -2104,21 +2104,18 @@ static int mlx5_eswitch_query_vport_drop_stats(struct mlx5_core_dev *dev, ...@@ -2104,21 +2104,18 @@ static int mlx5_eswitch_query_vport_drop_stats(struct mlx5_core_dev *dev,
struct mlx5_vport *vport = &esw->vports[vport_idx]; struct mlx5_vport *vport = &esw->vports[vport_idx];
u64 rx_discard_vport_down, tx_discard_vport_down; u64 rx_discard_vport_down, tx_discard_vport_down;
u64 bytes = 0; u64 bytes = 0;
u16 idx = 0;
int err = 0; int err = 0;
if (!vport->enabled || esw->mode != SRIOV_LEGACY) if (!vport->enabled || esw->mode != SRIOV_LEGACY)
return 0; return 0;
if (vport->egress.drop_counter) { if (vport->egress.drop_counter)
idx = vport->egress.drop_counter->id; mlx5_fc_query(dev, vport->egress.drop_counter,
mlx5_fc_query(dev, idx, &stats->rx_dropped, &bytes); &stats->rx_dropped, &bytes);
}
if (vport->ingress.drop_counter) { if (vport->ingress.drop_counter)
idx = vport->ingress.drop_counter->id; mlx5_fc_query(dev, vport->ingress.drop_counter,
mlx5_fc_query(dev, idx, &stats->tx_dropped, &bytes); &stats->tx_dropped, &bytes);
}
if (!MLX5_CAP_GEN(dev, receive_discard_vport_down) && if (!MLX5_CAP_GEN(dev, receive_discard_vport_down) &&
!MLX5_CAP_GEN(dev, transmit_discard_vport_down)) !MLX5_CAP_GEN(dev, transmit_discard_vport_down))
......
...@@ -233,7 +233,7 @@ void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev, ...@@ -233,7 +233,7 @@ void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev,
unsigned long delay); unsigned long delay);
void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev, void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev,
unsigned long interval); unsigned long interval);
int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id, int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
u64 *packets, u64 *bytes); u64 *packets, u64 *bytes);
int mlx5_init_fs(struct mlx5_core_dev *dev); int mlx5_init_fs(struct mlx5_core_dev *dev);
......
...@@ -312,10 +312,10 @@ void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev) ...@@ -312,10 +312,10 @@ void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev)
} }
} }
int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id, int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
u64 *packets, u64 *bytes) u64 *packets, u64 *bytes)
{ {
return mlx5_cmd_fc_query(dev, id, packets, bytes); return mlx5_cmd_fc_query(dev, counter->id, packets, bytes);
} }
void mlx5_fc_query_cached(struct mlx5_fc *counter, void mlx5_fc_query_cached(struct mlx5_fc *counter,
......
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