summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_stats.c
diff options
context:
space:
mode:
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>2019-03-27 13:15:40 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-03-29 17:25:32 +0100
commit9c0a9eed37f17c84b92a75071e1df2de3d5d16d6 (patch)
tree3f38d401986102221c49d84a9f4ebdc0e670ab0e /drivers/net/mlx5/mlx5_stats.c
parent17e19bc4dde71079a18b188ab8523035e6df0b3e (diff)
downloaddpdk-9c0a9eed37f17c84b92a75071e1df2de3d5d16d6.zip
dpdk-9c0a9eed37f17c84b92a75071e1df2de3d5d16d6.tar.gz
dpdk-9c0a9eed37f17c84b92a75071e1df2de3d5d16d6.tar.xz
net/mlx5: switch to the names in the shared IB context
The IB device names are moved from device private data to the shared context, code involving the names is updated. The IB port index treatment is added where it is relevant. Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_stats.c')
-rw-r--r--drivers/net/mlx5/mlx5_stats.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 6906dc8..5af199d 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -140,18 +140,22 @@ static inline void
mlx5_read_ib_stat(struct mlx5_priv *priv, const char *ctr_name, uint64_t *stat)
{
FILE *file;
- MKSTR(path, "%s/ports/1/hw_counters/%s",
- priv->ibdev_path,
- ctr_name);
+ if (priv->sh) {
+ MKSTR(path, "%s/ports/%d/hw_counters/%s",
+ priv->sh->ibdev_path,
+ priv->ibv_port,
+ ctr_name);
- file = fopen(path, "rb");
- if (file) {
- int n = fscanf(file, "%" SCNu64, stat);
+ file = fopen(path, "rb");
+ if (file) {
+ int n = fscanf(file, "%" SCNu64, stat);
- fclose(file);
- if (n != 1)
- stat = 0;
+ fclose(file);
+ if (n == 1)
+ return;
+ }
}
+ *stat = 0;
}
/**