From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50049.outbound.protection.outlook.com [40.107.5.49]) by dpdk.org (Postfix) with ESMTP id 7660C90F3 for ; Wed, 16 Aug 2017 09:54:16 +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=HEHrK2Vykqq2SilVG5YbK5c+sUqWaKEUhjoknSshFb4=; b=OMxedUdtaRts9JP4e+OVnhnPIIrpT2MMZPEYt59Dcan1PQWbvL+Nr59HtbyswwFFYVzqUl5ZjhLf4u/Kv5LNLwfPrWrHeIVgNEPealf0IRnZGXVvtcDCUbU4/XgF2AP9auMIhaNoSPhapiYIjSwKcpxlaKBsUyfEd1eHHjvjv/A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0502MB3050.eurprd05.prod.outlook.com (2603:10a6:3:d9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1341.21; Wed, 16 Aug 2017 07:54:14 +0000 From: Matan Azrad To: Yuanhan Liu Cc: stable@dpdk.org Date: Wed, 16 Aug 2017 10:53:54 +0300 Message-Id: <1502870034-54324-1-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR08CA0156.eurprd08.prod.outlook.com (2603:10a6:800:d5::34) To HE1PR0502MB3050.eurprd05.prod.outlook.com (2603:10a6:3:d9::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 055d6498-02ce-4543-2590-08d4e47bfd64 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:HE1PR0502MB3050; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3050; 3:yc8AiwXHhhNtGYLLmJ2owOQmc2lEOWd7Ud8QiWx0LvXwFOkuYvRBn4dimRrM4+YHi67UXMUK69YBZOo4eJqjJcGN/pV7wjsMoh05p62Hrp/rBpF+U5ZqeCXfzI4fCKkMc9c/Qe096bu3I7XLpBQy8rwrYI+zbl0XWpaNV4Erc4emV/NsX1PYqJEt4krkX4miSUxWTjm+aGgYc/9Z8NUTODeT7m0gs4Z9NjMwDNINV7onOo6MO7D7gIdX2hXE7D2q; 25:ubMGiuEWriqvBSQV6u/3Tz2sWR1kvig1cfixS/b5tRW1bzkHUWSttr5Y4hz5KDCePihUUZZpjV+j9bKd6Z70Hopp70GwKavu58wYsa+T8OP3/T0sf9e3VGb60udl8g1OJySdGh2VgyZNUbrhHzmwh0FJls86EpTm7mXAMJrgB+9hhDfUY4elmUgU/emzkL1hZjLpzuZmv5uJAHWZFfuG/uFeJP4k7gCfR455/oENNdK4cf7CmJQEcEEg1QFWdLmOmdkqkm1yb5t8m/ykbcBXaA5T7/VAhfgaZMSkCYqNM8zF/03NEZIwaRwHOsSnqh4FH1uXIQlZewuKcmTcoidJZw==; 31:JFmKdIZAfgszNFZhauMVt8wWTKLYX3annzQhN6Tx8TJw5/f4wTJbyGQ2QR/nM636kPW1BKDHryHflFSgBSgHMIFYV6it3ujBpzplseq48L5qT6GlhVnO3ircpLC7gjhUcalGRz08QwpECEFCM+Hv7eu5JfRoCxi4VvtW/lV13KjpuGUL1IdErHN9UqCtLbgCvMc3fFBJDhoPi0Zwx0jClQw+X7Pm4cL6tXPRFzAnTJ0= X-MS-TrafficTypeDiagnostic: HE1PR0502MB3050: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3050; 20:3a6B5wrDAf/2poeTePCb34HsjnxfGiR1AFnMPgXnRU9l86PGQJ0NLVDyyneBFxJw7OFyMO0TadYt2aW80/x6fbm/9a8vBUWGdO/UfBcSjmSRpGeVGfk36Lp+MhK/T7s3i3Vp5AH7+XwR0Vt7jQ7nKK2IzDxKv66v8vFfj3j2PgKklbxAPGuxoGeJuirPYgx4uVTlyvrNSMycwtO3+cUD+tGAlpZqVW7KsruJaXDhiIGPbJpqShV1/EDo7CWwKx6DwGiRDzh+r2aTdFm4HI5SgMdKRz4BzuufJeN2okWgyxCrNlghlKsaoCSsbmuB7aThCIVIjZtZVCmYnTuR3BfDIx+Iho9OkZ0CAFTkwn2MROnxJfP5xEGs5dt54BuwuNzo1hbeeDdHmPwY2Sm6G1lqdUBqb8M/cTSsj+MlL6RUqezFWz1yZVo16TVKtuszPeyA5fhJ8AYh1ihtcJ31mw+PxHMKxL5UotbEo82wBgtmLFVohxRUXZnKFudPvFuVRGbp; 4:xnpdkhDP0tlHfkaqEbgdc61JSzhUG8N6Fgsqag5JeAMcQt5H1Mt4IRjTw3lNKnCk22aoMNLw6ZadNGl7NNpQDNY5ZEw2Uh02DJ+ZgA9owwuXaIyKm8Wg6+Q2o+yYz8DB/s3QyY6Xri/er4/XzVrN+iFLwxt00vJZhfnduph99f/praDu+n/fbRqShzUcGes8ZifEKHAoalFEgCTqCikSF8ont67IZMeUmHjn+r+zb7+nf1hYFdOJz+Hsp1HuqwKF 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)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR0502MB3050; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR0502MB3050; X-Forefront-PRVS: 0401647B7F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(189002)(199003)(55016002)(53936002)(6916009)(189998001)(33026002)(110136004)(5003940100001)(25786009)(3846002)(6116002)(2906002)(5660300001)(48376002)(50466002)(69596002)(42186005)(101416001)(33646002)(478600001)(66066001)(50226002)(7350300001)(21086003)(86362001)(575784001)(6666003)(47776003)(97736004)(81166006)(36756003)(81156014)(68736007)(50986999)(305945005)(105586002)(106356001)(8676002)(7736002)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0502MB3050; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; HE1PR0502MB3050; 23:+O8yJSUcNgg2AY4EKl2EWzjuXPDkckuRvKOuP3d?= =?us-ascii?Q?NOhz0sl2Y7Zqd/QLkA/0ovrpJQit3Se0cBut/qkoxrOqjsXl++YutxGuWjLE?= =?us-ascii?Q?2j8n0QMQXWy84iG86HNpvTJCV1cgpjbuIZJvj4c1qxJoDmUcl6N3bpSrFSbM?= =?us-ascii?Q?4Hr756sW57tnhcAw/6SG+kb3MchMPWg3etG2c/qTeHD6kHklbICu5+YHpylD?= =?us-ascii?Q?RiJhX+p3g6ZR0PV8XHAbxBPL+isCCyXW8BA0w1MwlOoFSJV4JGzDnXA4Gk0N?= =?us-ascii?Q?OhcWQpaJM6bli30Ko17hWuE0IxCZplrp6MeOiByfDfYmYspHEZfJzF14C+4U?= =?us-ascii?Q?PgRxUyZuIqRQogmeecf5QTRWBL8RCxllhRJZh8wtTW9dySrvTCutJ/tfI11Q?= =?us-ascii?Q?q1naNSg/EdSKY0EZvyxTu4F9zbAShojHwu0SN9SbeH1u7Sol0thtMDaJv3TQ?= =?us-ascii?Q?ki4fYgEtWrQWMKUuV+Amf8h6H5L5KA7scaDQ8fD0uCFfM57ozL05wYfKTXCe?= =?us-ascii?Q?qvGloA7No76Uti+8Dc66rCTadiEMMxemny26u6bcnnLk6D9WiEVzoIGCtnnW?= =?us-ascii?Q?h7QglRF7UA4nYGXHKyn2kv2y9F1W84oRXGnmUfEwcitn0J33/0rdqY/XI0qH?= =?us-ascii?Q?jSpLcLNPMTAXqzKHaQFiu5lbRPeTKRpbD/g8rTcR39g3MXZLg/Nc5+bsHWKr?= =?us-ascii?Q?n3g4a21xM+LzqchKnr6PBn76SvVH8dMMvEaxTZjqwn7907iyEQivX1It6en7?= =?us-ascii?Q?k5D8S6Azy1LUzSwdPi8hkgt5HvyULUK9DJT0CE7ky914c97zGPwGmBr81F6d?= =?us-ascii?Q?ZjNsavxuS25n/I1J97DFuDwDPcRQI9N+87Os28ptec9OX5y+ywikrMFKR+RA?= =?us-ascii?Q?lJJQCi+YcgxNoJ1KBLNkurt9N24tOPsv0lCf2IgLlzy9TIkfF1Uy7Cj4dtxF?= =?us-ascii?Q?d1dWLRWoi1li3wb7fXoG60JupPOqMN2vpHNmNuXnKESGrFAzUzEobio+zQfQ?= =?us-ascii?Q?u3sfTUowoHWjYgm2ZZHcHmzJz7oGX92QHAb+HHQPvSXoEMqRB1vg6BLDHhid?= =?us-ascii?Q?7d9Ge+cBa/nF9dVBqWg4G0pLNc4ppjdfI0c7m9h5H/d7HoedZfVpL1T5Q8yW?= =?us-ascii?Q?FjWNRmQE3Cp4=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3050; 6:p321BBdeElGQlJ68e06E4wPXbwWlYx/47XwhcqCvxPGzrim99wQ8HJOCtD5SxhkHJRRVJAMOxxLRzOzY7PiRqWML4+ex98FD8gEXAyb5QDNsp6Ju6YDpTYH2388MLjFOR4qDiLN+KwcK7jmIS11s+2Mnf46Qeyq9wtRrlwJ4R1PXEbnfC39L6VMeuGjeeI2kRUdaZ2WYUgytrsis6VMdlAnIbnHQjRX/tgd88ex6qgi8uObvnd6p+ELh2e5Gi05O4a356nz/W98w73SISeG+wJyOrOMRrM2k5aZW/4lrv5OqGl5OwnCAUwluaJsFTGZLzj+ytI0pfj4NjGWrYYdL8w==; 5:BfzTWgFptiThGevqcDwIa++IueQXcUVeBJ0VfrxNF0YB8wSYLt0Bq2vIorVQUz+cIHkEnYdQ70B/A/3aU/ruUqJWBna7oj0ybj/Zb9CWKYFpA72TVqX7yqjJQOC2pfhIDLQUyyEXIaDSWOvq8fEirQ==; 24:07C01DkrIBUo2ggB1wedi09wen/qXNGsbskZbZmDNfhfR3kpfMjYTw/0/glX5mN7sjHl3PSJ1bXXCFojlokUXFrZvWz62e1uxsLP/fY9dEA=; 7:Z4kZbyvQT2+xzo8ZLbortnVXh9l+bt7vf/4VBro/W86RR9VI3TYYZ6CGFRbu0Q4VXnGIGls/O94sD38dMZpQB/Ra2rc9poh5NJvvS50F6N5N+o2uuNpMbv2plbrJ8tnIpQxl490JNVgT5xKJnHb7FdidAxlVdNw882Pb5Fq+O+oEfD4mykidp+FKKPpuzWkHVv45K6B7Rbr9jMdEpzhfj/enkm2m5EOF17JFkbcTz3E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2017 07:54:14.3141 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3050 Subject: [dpdk-stable] [PATCH] net/mlx4: fix probe failure report X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 07:54:16 -0000 [ backported from upstream commit 8d0f80167d43949bd24374bcf294a149246dfd1c ] 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 mlx4 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. Fixes: 7fae69eeff13 ("mlx4: new poll mode driver") Fixes: 7b0661539229 ("mlx4: check if port is configured for ethernet") Fixes: fec3608673e6 ("mlx4: query netdevice to get initial MAC address") Cc: stable@dpdk.org Signed-off-by: Matan Azrad Acked-by: Adrien Mazarguil --- drivers/net/mlx4/mlx4.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index f682413..4a03d34 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -5625,8 +5625,10 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) ibv_dev = list[i]; DEBUG("device opened"); - if (ibv_query_device(attr_ctx, &device_attr)) + if (ibv_query_device(attr_ctx, &device_attr)) { + err = EINVAL; goto error; + } INFO("%u port(s) detected", device_attr.phys_port_cnt); for (i = 0; i < device_attr.phys_port_cnt; i++) { @@ -5652,19 +5654,23 @@ mlx4_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); if (err) { ERROR("port query failed: %s", strerror(err)); + err = ENODEV; goto port_error; } if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) { ERROR("port %d is not configured in Ethernet mode", port); + err = EINVAL; goto port_error; } @@ -5701,6 +5707,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) #ifdef HAVE_EXP_QUERY_DEVICE if (ibv_exp_query_device(ctx, &exp_device_attr)) { ERROR("ibv_exp_query_device() failed"); + err = ENODEV; goto port_error; } #ifdef RSS_SUPPORT @@ -5776,6 +5783,7 @@ mlx4_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 mlx4_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