summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/net/mlx5/mlx5.h2
-rw-r--r--drivers/net/mlx5/mlx5_ethdev.c10
-rw-r--r--drivers/net/mlx5/mlx5_stats.c22
3 files changed, 20 insertions, 14 deletions
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 6882460..56270a6 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -226,8 +226,6 @@ struct mlx5_priv {
struct ibv_context *ctx; /* Verbs context. */
struct ibv_device_attr_ex device_attr; /* Device properties. */
struct ibv_pd *pd; /* Protection Domain. */
- char ibdev_name[IBV_SYSFS_NAME_MAX]; /* IB device name. */
- char ibdev_path[IBV_SYSFS_PATH_MAX]; /* IB device path for secondary */
struct ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */
BITFIELD_DECLARE(mac_own, uint64_t, MLX5_MAX_MAC_ADDRESSES);
/* Bit-field of MAC addresses owned by the PMD. */
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 2b83898..0662594 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -138,8 +138,10 @@ mlx5_get_master_ifname(const struct rte_eth_dev *dev,
unsigned int dev_port_prev = ~0u;
char match[IF_NAMESIZE] = "";
+ assert(priv);
+ assert(priv->sh);
{
- MKSTR(path, "%s/device/net", priv->ibdev_path);
+ MKSTR(path, "%s/device/net", priv->sh->ibdev_path);
dir = opendir(path);
if (dir == NULL) {
@@ -159,7 +161,7 @@ mlx5_get_master_ifname(const struct rte_eth_dev *dev,
continue;
MKSTR(path, "%s/device/net/%s/%s",
- priv->ibdev_path, name,
+ priv->sh->ibdev_path, name,
(dev_type ? "dev_id" : "dev_port"));
file = fopen(path, "rb");
@@ -222,7 +224,9 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])
struct mlx5_priv *priv = dev->data->dev_private;
unsigned int ifindex =
priv->nl_socket_rdma >= 0 ?
- mlx5_nl_ifindex(priv->nl_socket_rdma, priv->ibdev_name, 1) : 0;
+ mlx5_nl_ifindex(priv->nl_socket_rdma,
+ priv->sh->ibdev_name,
+ priv->ibv_port) : 0;
if (!ifindex) {
if (!priv->representor)
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;
}
/**