net/mlx5: fix HW counters path in switchdev mode
authorShy Shyman <shys@mellanox.com>
Wed, 15 Jul 2020 10:50:55 +0000 (13:50 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Jul 2020 13:46:30 +0000 (15:46 +0200)
commit038e7fc085746167f8a50c1612acada5a78fc7da
tree2b1c113373494291564566e9ac5e2241773d2a51
parent161d103b231c98ce569e5504d68a3561aa82cab0
net/mlx5: fix HW counters path in switchdev mode

When debugging performance of a DPDK application the user may
need to view the different statistics of DPDK (for example out_of_buffer)
This can be enabled by using testpmd command 'show port xstats
<port_id>' for example.

The current implementation assumes legacy mode in which the counters
are at <ibdev_path>/<port_id>/hw_counters/<file_name>.
In switchdev mode the counters file is located right after the device
name, hence resides at <ibdev_path>/hw_counters.

The fix tries to open the path in the second location after a failure
to open the file from the first location.

Fixes: 9c0a9eed37f1 ("net/mlx5: switch to the names in the shared IB context")
Cc: stable@dpdk.org
Signed-off-by: Shy Shyman <shys@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
drivers/net/mlx5/linux/mlx5_os.c