]> git.droids-corp.org - dpdk.git/commitdiff
net/mlx5: fix device name size on Windows
authorTal Shnaiderman <talshn@nvidia.com>
Mon, 28 Dec 2020 12:32:57 +0000 (14:32 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 15:03:08 +0000 (16:03 +0100)
Windows Devx interface name is the same as device name with
different size then IF_NAMESIZE. To support it MLX5_NAMESIZE
is defined with IF_NAMESIZE value for Linux and MLX5_FS_NAME_MAX
value for Windows.

Fixes: e9c0b96e3526 ("net/mlx5: move Linux ifname function")
Cc: stable@dpdk.org
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/linux/mlx5_ethdev_os.c
drivers/net/mlx5/linux/mlx5_os.c
drivers/net/mlx5/linux/mlx5_os.h
drivers/net/mlx5/mlx5.h
drivers/net/mlx5/windows/mlx5_ethdev_os.c
drivers/net/mlx5/windows/mlx5_os.c
drivers/net/mlx5/windows/mlx5_os.h

index 128845cb5217fce1509bdd906363e99aa263d279..e36a78091cb46b2a6b68d1ae7b9aa4477473c7da 100644 (file)
@@ -143,7 +143,7 @@ struct ethtool_link_settings {
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])
+mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[MLX5_NAMESIZE])
 {
        struct mlx5_priv *priv = dev->data->dev_private;
        unsigned int ifindex;
@@ -151,7 +151,7 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])
        MLX5_ASSERT(priv);
        MLX5_ASSERT(priv->sh);
        if (priv->bond_ifindex > 0) {
-               memcpy(ifname, priv->bond_name, IF_NAMESIZE);
+               memcpy(ifname, priv->bond_name, MLX5_NAMESIZE);
                return 0;
        }
        ifindex = mlx5_ifindex(dev);
index 8353ac22e05ff07424cf44a8a406455baa019aa9..6812a1f2152a6093b8950ccf09901d255732b40d 100644 (file)
@@ -1411,7 +1411,7 @@ err_secondary:
                mac.addr_bytes[4], mac.addr_bytes[5]);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
        {
-               char ifname[IF_NAMESIZE];
+               char ifname[MLX5_NAMESIZE];
 
                if (mlx5_get_ifname(eth_dev, &ifname) == 0)
                        DRV_LOG(DEBUG, "port %u ifname is \"%s\"",
index f38c2f301556a7d48cffe179ead716f21e371e21..6100a130e05d2cbf8bcd816f3c5df5bba3a839a4 100644 (file)
@@ -14,11 +14,9 @@ enum {
        MLX5_FS_PATH_MAX = IBV_SYSFS_PATH_MAX + 1
 };
 
+#define MLX5_NAMESIZE IF_NAMESIZE
+
 #define PCI_DRV_FLAGS  (RTE_PCI_DRV_INTR_LSC | \
                        RTE_PCI_DRV_INTR_RMV | \
                        RTE_PCI_DRV_PROBE_AGAIN)
-
-/* mlx5_ethdev_os.c */
-
-int mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE]);
 #endif /* RTE_PMD_MLX5_OS_H_ */
index 0cb907c599e02ff63bd7e2d48feecb891f3ddd82..41034f5d197b931b3da9f27f056982bb117ee5a1 100644 (file)
@@ -950,7 +950,7 @@ struct mlx5_priv {
        int32_t pf_bond; /* >=0 means PF index in bonding configuration. */
        unsigned int if_index; /* Associated kernel network device index. */
        uint32_t bond_ifindex; /**< Bond interface index. */
-       char bond_name[IF_NAMESIZE]; /**< Bond interface name. */
+       char bond_name[MLX5_NAMESIZE]; /**< Bond interface name. */
        /* RX/TX queues. */
        unsigned int rxqs_n; /* RX queues array size. */
        unsigned int txqs_n; /* TX queues array size. */
@@ -1067,6 +1067,8 @@ int mlx5_dev_configure_rss_reta(struct rte_eth_dev *dev);
 
 /* mlx5_ethdev_os.c */
 
+int mlx5_get_ifname(const struct rte_eth_dev *dev,
+                       char (*ifname)[MLX5_NAMESIZE]);
 unsigned int mlx5_ifindex(const struct rte_eth_dev *dev);
 int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]);
 int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu);
index f4ec85530213421eeba1774c0851a2066c158f90..076c6886991dcae3411aac79fd0b3c6c93aaba31 100644 (file)
@@ -56,7 +56,7 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])
+mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[MLX5_NAMESIZE])
 {
        struct mlx5_priv *priv;
        mlx5_context_st *context_obj;
@@ -67,7 +67,7 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])
        }
        priv = dev->data->dev_private;
        context_obj = (mlx5_context_st *)priv->sh->ctx;
-       strncpy(*ifname, context_obj->mlx5_dev.name, IF_NAMESIZE);
+       strncpy(*ifname, context_obj->mlx5_dev.name, MLX5_NAMESIZE);
        return 0;
 }
 
index 4fbd8893cf3423fdbe31bb490b77ab3a9ba2639d..fdd69fd3c193416c8aebe3cb1a486633a9d5bbb9 100644 (file)
@@ -550,7 +550,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
                mac.addr_bytes[4], mac.addr_bytes[5]);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
        {
-               char ifname[IF_NAMESIZE];
+               char ifname[MLX5_NAMESIZE];
 
                if (mlx5_get_ifname(eth_dev, &ifname) == 0)
                        DRV_LOG(DEBUG, "port %u ifname is \"%s\"",
index b94f5884610ed66119e58eddad8117229f12bc28..7fe41d4e9054a9dfe2790bb8001c7077e139e907 100644 (file)
@@ -14,4 +14,6 @@ enum {
 
 #define PCI_DRV_FLAGS 0
 
+#define MLX5_NAMESIZE MLX5_FS_NAME_MAX
+
 #endif /* RTE_PMD_MLX5_OS_H_ */