From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D9566A04B5; Wed, 28 Oct 2020 00:42:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6C2AFC8B2; Wed, 28 Oct 2020 00:25:37 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 413B937B4 for ; Wed, 28 Oct 2020 00:24:02 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from ophirmu@nvidia.com) with SMTP; 28 Oct 2020 01:23:57 +0200 Received: from nvidia.com (pegasus05.mtr.labs.mlnx [10.210.16.100]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09RNNrrw026642; Wed, 28 Oct 2020 01:23:57 +0200 From: Ophir Munk To: dev@dpdk.org, Raslan Darawsheh Cc: Ophir Munk , Matan Azrad , Tal Shnaiderman , Thomas Monjalon Date: Tue, 27 Oct 2020 23:23:09 +0000 Message-Id: <20201027232335.31427-47-ophirmu@nvidia.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20201027232335.31427-1-ophirmu@nvidia.com> References: <20201027232335.31427-1-ophirmu@nvidia.com> Subject: [dpdk-dev] [PATCH v1 46/72] net/mlx5/windows: support get mac X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Tal Shnaiderman This commits implements API mlx5_get_mac(). It returns the MAC address saved in the device context since its creation. Signed-off-by: Tal Shnaiderman --- drivers/net/mlx5/windows/meson.build | 1 + drivers/net/mlx5/windows/mlx5_ethdev_os.c | 43 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 drivers/net/mlx5/windows/mlx5_ethdev_os.c diff --git a/drivers/net/mlx5/windows/meson.build b/drivers/net/mlx5/windows/meson.build index f87dcb1..b5d9f0e 100644 --- a/drivers/net/mlx5/windows/meson.build +++ b/drivers/net/mlx5/windows/meson.build @@ -5,5 +5,6 @@ includes += include_directories('.') sources += files( 'mlx5_os.c', 'mlx5_mp_os.c', + 'mlx5_ethdev_os.c', ) diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c new file mode 100644 index 0000000..0662c09 --- /dev/null +++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/** + * Get MAC address by querying netdevice. + * + * @param[in] dev + * Pointer to Ethernet device. + * @param[out] mac + * MAC address output buffer. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]) +{ + struct mlx5_priv *priv; + mlx5_context_st *context_obj; + + if (!dev) { + rte_errno = EINVAL; + return -rte_errno; + } + priv = dev->data->dev_private; + context_obj = (mlx5_context_st *)priv->sh->ctx; + memcpy(mac, context_obj->mlx5_dev.eth_mac, RTE_ETHER_ADDR_LEN); + return 0; +} -- 2.8.4