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 48E81A09FF; Mon, 28 Dec 2020 13:38:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 85CFBCAD0; Mon, 28 Dec 2020 13:34:00 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 2476ECA3E for ; Mon, 28 Dec 2020 13:33:37 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from talshn@nvidia.com) with SMTP; 28 Dec 2020 14:33:33 +0200 Received: from nvidia.com (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0BSCXWnR001295; Mon, 28 Dec 2020 14:33:33 +0200 From: Tal Shnaiderman To: dev@dpdk.org Cc: thomas@monjalon.net, matan@nvidia.com, rasland@nvidia.com, ophirmu@nvidia.com Date: Mon, 28 Dec 2020 14:32:39 +0200 Message-Id: <20201228123302.3608-13-talshn@nvidia.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20201228123302.3608-1-talshn@nvidia.com> References: <20201217173037.11396-2-talshn@nvidia.com> <20201228123302.3608-1-talshn@nvidia.com> Subject: [dpdk-dev] [PATCH v2 12/35] net/mlx5/windows: support get mtu 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" This commit implements API mlx5_get_mtu(). It returns the MTU size as saved in the device context since its creation. Signed-off-by: Tal Shnaiderman Acked-by: Matan Azrad --- drivers/net/mlx5/windows/mlx5_ethdev_os.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c index 1b68a7b6e8..614322b9f9 100644 --- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c @@ -43,6 +43,33 @@ mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]) return 0; } +/** + * Get device MTU. + * + * @param dev + * Pointer to Ethernet device. + * @param[out] mtu + * MTU value output buffer. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu) +{ + 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; + *mtu = context_obj->mlx5_dev.mtu_bytes; + return 0; +} + /** * Set device MTU. * -- 2.16.1.windows.4