From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: [PATCH] mlx4: check if port is configured for Ethernet Date: Tue, 22 Mar 2016 11:34:26 +0100 Message-ID: <1458642866-28746-1-git-send-email-adrien.mazarguil@6wind.com> To: dev@dpdk.org Return-path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id C4F1FB62 for ; Tue, 22 Mar 2016 11:34:45 +0100 (CET) Received: by mail-wm0-f41.google.com with SMTP id r129so86042980wmr.1 for ; Tue, 22 Mar 2016 03:34:45 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id j18sm16748452wmd.2.2016.03.22.03.34.44 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 22 Mar 2016 03:34:44 -0700 (PDT) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Notify user otherwise. A similar check has already been added to mlx5 in commit "mlx5: check port is configured as ethernet device". Signed-off-by: Adrien Mazarguil --- drivers/net/mlx4/mlx4.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index cc4e9aa..fbbabf6 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -5463,6 +5463,13 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) ERROR("port query failed: %s", strerror(err)); goto port_error; } + + if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) { + ERROR("port %d is not configured in Ethernet mode", + port); + goto port_error; + } + if (port_attr.state != IBV_PORT_ACTIVE) DEBUG("port %d is not active: \"%s\" (%d)", port, ibv_port_state_str(port_attr.state), -- 2.1.4