From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: [PATCH v2 2/7] mlx5: check if port is configured as Ethernet device Date: Thu, 3 Mar 2016 15:27:35 +0100 Message-ID: <1457015260-3041-3-git-send-email-adrien.mazarguil@6wind.com> References: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> <1457015260-3041-1-git-send-email-adrien.mazarguil@6wind.com> To: dev@dpdk.org Return-path: Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 4906B2C27 for ; Thu, 3 Mar 2016 15:27:58 +0100 (CET) Received: by mail-wm0-f53.google.com with SMTP id n186so134183397wmn.1 for ; Thu, 03 Mar 2016 06:27:58 -0800 (PST) In-Reply-To: <1457015260-3041-1-git-send-email-adrien.mazarguil@6wind.com> 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" From: Or Ami If the port link layer is not Ethernet, notify the user. Signed-off-by: Or Ami --- doc/guides/rel_notes/release_16_04.rst | 5 +++++ drivers/net/mlx5/mlx5.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 953eaa1..73d0cfc 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -154,6 +154,11 @@ Drivers A crash could occur when failing to allocate private device context. +* **mlx5: Added port type check.** + + Done to prevent port initialization on non-Ethernet link layers and + to report an error. + Libraries ~~~~~~~~~ diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 41dcbbf..ae2576f 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -348,6 +348,13 @@ mlx5_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