From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 26F005588 for ; Mon, 22 Feb 2016 19:19:05 +0100 (CET) Received: by mail-wm0-f51.google.com with SMTP id c200so185125810wme.0 for ; Mon, 22 Feb 2016 10:19:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kKy/dr8XN5IP3OH1UYAZzi35+/9fEummzSsYydvv5K0=; b=XMbBzQniOZnLyXwsvRU/KzQc78ovw+OwDHiFsK9JdoUH8fgMGz0BIbvRWkoVmBCyPC aIy1sI6lqrXTnPXMIdmpilgm0wyEUruNRQGgtgwMT3dtsKARzDmI08EUpMqJKv8En/ML 9fEWRwRSqydMVlNYWdEwYrbeM1fZTHpxSoDrKwlNvC6AjNCrF9MBTGW0bqmCyToogSZH bcxrZkMtxBCtJ6QkXU90zbsI/iN9eKN8oumELJcCTKZk9Xq4nTluCGpuKK9Nrv5ssaXt ptR9DGCbVjpO9gioKFZBfWbCo07+i/Iq+bccki66IPoA0pk2YNU2crSFwbJMuRIQS5xP k0SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kKy/dr8XN5IP3OH1UYAZzi35+/9fEummzSsYydvv5K0=; b=lKVJBzWVGstrixrZ9XEoA75eVg6NU4B8wCv/42m1tdT2LRho5Bz7dW4d2I6A7kdx3F lBZ2jJ66aSUviAtastZzHgLL4YQfeP36VHyC1q83OB6evqqyZW5TFxYJq89frgb++vXU I19nbXiJgs/1DVnZhcYqDWT4ATpVH4s0IH/GQOa0slAy4inKSzkIZRdCc8aYlgH/jbPZ 1hTxz7/AlxZZuLR86g0brwEF9uV0mDduibewr35dmVtpcp99ErEHso7KGBq524DpFrEg BkkeJ7+oAu0V1FTHykeZ3vBFQyrhPFqMha2XlzplcProv0epsMJRD3yyPtnV1L8Cue5e d5YQ== X-Gm-Message-State: AG10YOT/DfUurVDzScstJIf8pPm1aq1XtBTWoSjRt+UIRVz+TkxJk2kpiDPD1Eyj/xrb6qlZ X-Received: by 10.28.32.147 with SMTP id g141mr13892501wmg.19.1456165144956; Mon, 22 Feb 2016 10:19:04 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id m63sm22294247wmc.3.2016.02.22.10.19.04 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Feb 2016 10:19:04 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Mon, 22 Feb 2016 19:18:38 +0100 Message-Id: <1456165123-28365-3-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> References: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 2/7] mlx5: check if port is configured as Ethernet device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2016 18:19:05 -0000 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 09afff9..ab7c64d 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -146,6 +146,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