From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20056.outbound.protection.outlook.com [40.107.2.56]) by dpdk.org (Postfix) with ESMTP id 017FD7CA3; Sun, 13 Aug 2017 14:26:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UPDJKO4EuhcbyNNMd2I7c1X97F0LC4fTxYIKoa9Q/Rs=; b=gXkn9dGJ+Tsa9CutUubao4xEb/yEeqvxSyZ4eH0MfqDaAxYIqmTWCdKgrL1EET+uqi/+nbVR+wzTA1plJPaCTylHJ10ClvysYuYGpy+Ld7oebLKTeX07KwslWzokdeS/FTO9qSnkq/UJYMIrrkJPyqM7fS/ZjPz39qiTk8KWisE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR0502MB3047.eurprd05.prod.outlook.com (2603:10a6:4:9f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1341.17; Sun, 13 Aug 2017 12:25:58 +0000 From: Matan Azrad To: Adrien Mazarguil , Nelio Laranjeiro Cc: dev@dpdk.org, stable@dpdk.org Date: Sun, 13 Aug 2017 15:25:12 +0300 Message-Id: <1502627112-53405-2-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502627112-53405-1-git-send-email-matan@mellanox.com> References: <1502627112-53405-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR08CA0114.eurprd08.prod.outlook.com (2603:10a6:800:d4::16) To DB6PR0502MB3047.eurprd05.prod.outlook.com (2603:10a6:4:9f::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0391c272-d5de-4250-40fb-08d4e246744f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DB6PR0502MB3047; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0502MB3047; 3:hAGHsUewKoXVB27jeYFaEnTcR27uZF/ZYEP3XA/kZj95n7/fsWcs9Pwtr8jP0nV88UwJGQQHxq8pBbzoazeFVVJ3W4STKqjggspHg4nylHxZnmGVI60e1BAG5+xXrjvO2FZoMkXi6Q0M74hH/IXVQRlxsb0yBvj6jNPEOZp6lySG44LzIuYEdhLmW3EyHuLMw1dZclq3XXxL3zl9TKUGYNT5wemh0htoFcf06JSOCJBqalkcQ4T94geJwhKVGIe9; 25:UwW+mywTBkQr/yddsmG97N2QAaoJrA/799chLFvUPCiPEvep6VTLoegygAjvMppPwEyMhzBu/icttZEBsW12l7BqEefgQFkVhGdXCudqtJ3C8PTIb9q2yv/Htx2dNpt0PNCOeUZTKfa4463eHn0QXXWjWI+bl6UsL889q7drFrw08XkY23ZlOR+FIr/TzJshVSF+OkGxB2l7Web1IokpFl/gsNyG/GFO+zES6vZglyZUJP3zGWU9v34l2OXL6laRNaqL5VlmS5ALfDQ6JlaJXV4q2DtppAuuWXwY9lMQfGrJPRhkOUWczVmVAJTC3OJlzXw+tAT1PE2/cFZlsMdpYQ==; 31:i3D2yU4K+9NcjhrFaIUI64b803e96vvYGNzrSQ3t0mlzOjaeKK1JtkY5UZnxwPcvs8z2Ln54liBVY469oOULXhDqRcK48uAtyB1rXkBV12GgkfaBjAd/jl2wTlC0JvXxDVGMfauypBszZgBD8/QUou5MRGNQJsuQqnRRnNJ/FKYwGwDS/rCWRpr9SjCOuuDX36ShqBgWsC+g8/NJVwlUSsD1xfJS9Ute/d6N697p2sY= X-MS-TrafficTypeDiagnostic: DB6PR0502MB3047: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB6PR0502MB3047; 20:fnh1QBU3yByx/znoMn72A/14z/VGDXSk9Ibv6oXAu2on3Xq6ovEIoWGMY0bimqaogaler2lHKgOJBXl/XRIKW+2LRYxj9Y3hjquGm8LbXogmmSHx0s4QM0B3Ac0RlyxfL8MK2mOBEpHu3R+sawiyploBBqAFKSEyVBB45HQloym/8BtOBYQjJjD0LYUSnvEnQOSNT8/ivfeCeEGXVSrxpi1Lyc6ge9Wb0n4CWOijBKE8n58gODeZOJFndZkXIrrwJnNnUlU4lqZtfsJ8ITIB3L+TX6OxXpej1TKOPF3d9YFCHvimndHi2GIUYn34lMDLJQmJBzMk1FdeF6Q3nb//vq8oOefwJ4lgxtoHiCAdmKjETJoCc1F/ch86hEiEZsejD99WZun6AdCT94hcK3uM7h6wXUwrJMXwLuZJPes/G+7Dd5X/s0E8t+tfqkkysUMkZ7phhLcXWgkFrfKn0i4hN3l+78kpRE4Aj49EJedqKgMganN31BR4D4EysbvCZoCw; 4:Ik87376Vwbtzz4s9smhZ3HjZB+MRfw+zDi1jNYynOxTn1jNKTYgjRxCINT/efrn04AcxFKxs1dtmOITh6aXARw/L27rfEfm4JC/MkRVmx/06jQ59ikfgPxsUpoUQavIVKvTFFcBqDXjfUOfsNVw/g5pO/oXoraJkxaHmnJi7SWkQeXSYYnxq9BGpzlxPOsI2m8sS21w2Mnogyu2S/zNUVqnHbPCJdE5BnB4dzglTS6Y/aGwZrhIQLQUcLFsrnli1 X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6055026)(6041248)(20161123564025)(20161123560025)(20161123558100)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR0502MB3047; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR0502MB3047; X-Forefront-PRVS: 03982FDC1D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(6116002)(3846002)(68736007)(5660300001)(76176999)(50986999)(47776003)(36756003)(7350300001)(101416001)(6666003)(53936002)(21086003)(33646002)(55016002)(25786009)(478600001)(105586002)(106356001)(2950100002)(33026002)(97736004)(4326008)(42186005)(189998001)(69596002)(81166006)(81156014)(50226002)(86362001)(8676002)(48376002)(305945005)(5003940100001)(50466002)(2906002)(66066001)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0502MB3047; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0502MB3047; 23:ogKRXi56X9h5CS4s/KDjYLc3k6q2LH9TLq1x/4x?= =?us-ascii?Q?HAMCVLLldhHsBfSg6MNcsjH8Ce4K8AbTEiKAKPDP1F8NOzNJCYArdwFXszz/?= =?us-ascii?Q?dL/eTsy7+6nQXpLv+GH/agPisms7SW6100PO+8v5wEM4Vs4wXgtzMaTt/eHg?= =?us-ascii?Q?ZbWBXe2Cq57/vz3WxPPh94LC8MA9VzqNapoJMuTGICguyiRMQNZdHTtmlI9E?= =?us-ascii?Q?4qJkpw4eTSk3GoxeDbzbUj+VNDJ1hozKtAKDFTeOGT9shG99PFk6+NBn6WdJ?= =?us-ascii?Q?662uqs2/t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XEMWPZdgKJu2bP5sXM5lqLHCvbw7P1y4FZ+shmxchJdXnO3WdyYBI31yfhR9nb0ditLYOztfkKiW4T3YxnwUPEpY6u5v+Y0E+GyFw9+onh81/YCCjplx70KO1tLn2kPEQZehC7KShh6qnqMdsdU2Z3yLZEnEzTDuzH5OahnOv5SgVmGmXcyiWhO+iPyEs1I1qXkeP5hkuFzHYQieNaatEc8Pwl/zqZeTI/W2Ef3pSOrHFMnOy7xVO/ywogQaEVdm8wKjep2o+B3EnVtss31uEdKS64vLI3MvnaqGVNP3LKJIQWc0gacE9vBlFg==; 5:cUcoIjHuGzxktzVt0I9xWKKJVxdeIAlpP1MzDSAE55s9a/jRULb8Obk9vqca9ZWepM6KAbmyZfq0/onqnglB0i6ODsDo0JaZHpOUPQ7C1hNcel8QCVzUpRKxnUIVxvvBRQq9+aUyfLuRX/TDonVSiA==; 24:7KcwXwjk1BZthxJgqX5eoyaB7zm7Fwy0SguSwWz3iABIKWkT6wtKJZzbLrNIG12KAjGWYsccjufhdHyiwePEJhXOeTGN43rMBFDqc9E69cU=; 7:W6KAqb/XSGZVEdo/brerKeDRFq6Ejbhz+z5ZjOEbZK2KZa4D3JTKjSia7nvp1OVKgUFceQTmQ48MVjWrfcyFHmhoEH6duLHN3hMLUrYYC1MrB2zO2enH4IMtMYf8SUSX5KFhSVj0pwDYsBFkAi8ac1c+PArmZXgsohT71+4kKGW3m5W+aBZluOQf6rSxfcJZaHTE4vyLmNHYjfuGhX0ZGDPWKF5dWugqSZwxLzaJp20= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2017 12:25:58.3802 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0502MB3047 Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: fix probe failure report 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: , X-List-Received-Date: Sun, 13 Aug 2017 12:26:01 -0000 The corrupted code doesn't return error when probe function fails due to error in device mac address getting. By this way, the probe function may return success even if the ETH dev is not allocated. Hence, the probe caller, for example failsafe PMD, fails when it tries to get ETH dev after the device was plugged out while mlx5 was probing it. The fix adds error report to the probe caller when priv_get_mac fails and in all other failure options which are missing it. By this way, it prevents the unexpected behavior to miss ETH device after the device was probed successfully. This bug was already present in the original code taken from mlx4. Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters") Fixes: 1371f4df16bc ("mlx5: check port is configured as ethernet device") Signed-off-by: Matan Azrad Cc: stable@dpdk.org --- drivers/net/mlx5/mlx5.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 1a3d7f1..99a2fb3 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -579,8 +579,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) DEBUG("using port %u (%08" PRIx32 ")", port, test); ctx = ibv_open_device(ibv_dev); - if (ctx == NULL) + if (ctx == NULL) { + err = ENODEV; goto port_error; + } /* Check port status. */ err = ibv_query_port(ctx, port, &port_attr); @@ -592,6 +594,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) { ERROR("port %d is not configured in Ethernet mode", port); + err = EINVAL; goto port_error; } @@ -640,6 +643,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) mlx5_args_assign(priv, &args); if (ibv_exp_query_device(ctx, &exp_device_attr)) { ERROR("ibv_exp_query_device() failed"); + err = ENODEV; goto port_error; } @@ -728,6 +732,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) if (priv_get_mac(priv, &mac.addr_bytes)) { ERROR("cannot get MAC address, is mlx5_en loaded?" " (errno: %s)", strerror(errno)); + err = ENODEV; goto port_error; } INFO("port %u MAC address is %02x:%02x:%02x:%02x:%02x:%02x", -- 2.7.4