From mboxrd@z Thu Jan 1 00:00:00 1970 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) 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=KLTo86bEjwiPZOs3HnQ/yGZMDqQASuBDhHpEGWPhGgk=; b=a/tbUfTyTnTZ/aFiiWRbpGS5m20P4HS8sydwXIBDogkJggH2OIQB51n0ucySXoMz0w By4oNsFZvzY7YGwBPf/6zZUJF9t3tODYQ1DnMZDiI1d2udVK7OFREfCCROrvPASADcay csFpsNeb1Y256PBT6bAmFe6Y73pKbREN7WDygJzHNDvwtr4NAE/bJSfV16tcg8HdVJ3e 9p2GF0evCCJqPHfYGULOdChYRn61h7mEbFJvfhG8eet5MR0uo4uTFGTE1FiL8Ftj78ev 56jR8hJ0UP2KW3ME08swMERg69wMM+5H6vIHhiMyCcXdcoB8tpRLBG+WRsAWBEmnDsAe s39w== 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=KLTo86bEjwiPZOs3HnQ/yGZMDqQASuBDhHpEGWPhGgk=; b=FnYr+dU+OiUwtY42PN6Sv/zB/rwfKKyWYsZN+jZFWkNhHusB1tKokslB75xdJ5hyev 15RnwMy4CRoCS7LWJHkTG5s7C0pWlp0n/x/9p8aQTaHqLM/BbvIarZiOGkye0ZBwgqPv HL1VVnVO6lt7MLkigCh6mfgXVSwaBJtiGuIdpnYyJvlkLHgULarAFfps4ol2SXHNdZrQ jXY8bEzpOtEG4hUvYh9m8youj56X4KlNeClZpWmE5w9wVyN7msxyLbzEa+MbmGSgQi4W tdMTXdoeB4ztFwI2VZF6mgMkLgGBmkejM1Uy8E4dXGyNv+5Cd1D3Bb1EUqooDCXy8DMx 3uuw== X-Gm-Message-State: AD7BkJJ4d+wCwtBF8hYeQiOGotSXE0/vij9sIVVEn4rOvxfJIZz7st6p7XI1mfjzLg27XlQI X-Received: by 10.28.103.3 with SMTP id b3mr5857038wmc.65.1457015278164; Thu, 03 Mar 2016 06:27:58 -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 a128sm9233453wmh.6.2016.03.03.06.27.57 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Mar 2016 06:27:57 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Thu, 3 Mar 2016 15:27:35 +0100 Message-Id: <1457015260-3041-3-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457015260-3041-1-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> Subject: [dpdk-dev] [PATCH v2 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: Thu, 03 Mar 2016 14:27:58 -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 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