[v2,09/41] net/mlx5: get the FreeBSD interface name
Checks
Commit Message
Using the dev structure, mlx5_get_ifname can get the MLX
interface name
Signed-off-by: Srikanth Kaka <srikanth.k@oneconvergence.com>
Signed-off-by: Vag Singh <vag.singh@oneconvergence.com>
Signed-off-by: Anand Thulasiram <avelu@juniper.net>
---
drivers/net/mlx5/freebsd/mlx5_ethdev_os.c | 33 +++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 drivers/net/mlx5/freebsd/mlx5_ethdev_os.c
new file mode 100644
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2015 6WIND S.A.
+ * Copyright 2015 Mellanox Technologies, Ltd
+ */
+
+#include <stdio.h>
+
+#include <ethdev_driver.h>
+
+#include <mlx5_common.h>
+
+#include "mlx5.h"
+
+/**
+ * Get interface name from private structure.
+ *
+ * @param[in] dev
+ * Pointer to Ethernet device.
+ * @param[out] ifname
+ * Interface name output buffer.
+ *
+ * @return
+ * 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)[MLX5_NAMESIZE])
+{
+ struct mlx5_priv *priv = dev->data->dev_private;
+
+ MLX5_ASSERT(priv);
+ MLX5_ASSERT(priv->sh);
+ return mlx5_get_ifname_sysfs(priv->sh->ibdev_path, *ifname);
+}