From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30061.outbound.protection.outlook.com [40.107.3.61]) by dpdk.org (Postfix) with ESMTP id 96ED01B2A4; Fri, 19 Jan 2018 11:17:14 +0100 (CET) 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=ApKdrFhybg06TZM+48zXiHhP4fLHgNqk4VL43hPqazk=; b=Ob//kijuQbUBa8Zh7QT2OLKkWy9rl//KhzTUv4FVBWV+HU+/THkjeqArTI3mwnD5RKXSc73XlIaCuSqmMKDyU0ZV0kQNrF6dfTZ6spsN8tpx56DGIyc2Ck8ebD9TMPeH1jQ5jAACBFteVh3QK7hSD3a2iABwotM3hVlxman9ILo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR05MB3205.eurprd05.prod.outlook.com (2603:10a6:6:1a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Fri, 19 Jan 2018 10:17:11 +0000 From: Moti Haimovsky To: adrien.mazarguil@6wind.com Cc: dev@dpdk.org, Moti Haimovsky , stable@dpdk.org Date: Fri, 19 Jan 2018 12:16:49 +0200 Message-Id: <1516357009-15463-1-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516356548-15057-1-git-send-email-motih@mellanox.com> References: <1516356548-15057-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0202CA0026.eurprd02.prod.outlook.com (2603:10a6:803:14::39) To DB6PR05MB3205.eurprd05.prod.outlook.com (2603:10a6:6:1a::31) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab092b2f-4c7b-40a5-5376-08d55f25ce57 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:DB6PR05MB3205; X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3205; 3:9WfTFhd8kVaEsmY9RkTWsECFiTscVw8IfSN1VErhE71QIPDBFDn9iBkf1406kkttAfzDX6Nsmkvss3yoPL7bpdjrth7Chz8E94f+RE4liQwvTsfZpX2qIdUXRbEQGsSeQuC4+r5A3o3EhqjBEGwgaaw7mjml+BIuUCqhYXGJdlv+3wPjEBnw2EizQIwajz05ugTFxZS1W8AAR9n9kcEkGQXryKifhVtxjoP0V//R3tdjokT2lcGwYZ0mIwMoHJhj; 25:KQ5oM9q/0+hFfzhLru4dtsNqMT8FFUTvjGKxeHM4Q8Tdj44SeX+gj530ne8DRdgsNXVX2ka1AM0bSVrwxXr+qKURNTTpMoowgfidsdmWt7lcNcsgW5jDG43XKtmORjv5Ir5Ctd7baQgCKOjblH1edwOb/CKfo/bHGScHaY46JK7yco5uQJq5DavbljhU2VthK5GZ6qck/9JD/R2gWJYWjUf5B99VyKRURQVUOQrQG/PDcHFhWl+HlfX98o2LFkKUC34CoN6l/A7Spp8I6/XlZYTwvQXP6wUYFqlKVaaLbDGWeLwkVluOLHehPTt/ktq5Lt/xJ781W72dQr6vzBW0/w==; 31:J86jtRRzx3bUzg2Fet08PZo0+fZLbXPsg3L2epUR2aeZKjKVnkXPkZbbTKX2QmR3xydBqaTBlew4dl4RQrJamg5ITu0pTbII7tepvt2/TQLgkmlYVDgws8WMhZV4u0VDJCKOww64PI7ljBHWacvNSaxOO/iS9AP8PtpoUf8+WQ7N4wmtglr3tv7tFdp1JjpGpPTjvoKmJI67YGkWi8zrn94qfb+PHw3B2MyNIXGIW8M= X-MS-TrafficTypeDiagnostic: DB6PR05MB3205: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3205; 20:4jlO8KwJMXSSuP/6YhBa+AkQgRb6U02Uh82VkVH+ryGOoqT7rGtHwbwQUygQb/joEpS+ZS5A44hvAgAsEvVj4+UJwtnkH3S6dQhxDEjiTtoHnGyGDWnbG/72hSKPINDgRzc3ZE20tnYdeaXSbUpARQU9K7ZosBZgzPFLfsZA330HF3Wy+3o7PwUH0gvt/SQAw+AuXDSQQu7tB/RA4aLYiwv5h7PJu3URp8u6gejqvsAUFCXVU7UmWmtZExQZaSZ60zEM17ElNS2xdal8hM0rUG0LwykInCDpEGKra36uUYbSkrAZIDbTWQvLz7+YY8RuvIoB8vlVS8GjFseJhwwvbZdRW/o2kd2XrsMQDiWDwk0zB7U76Ft+YJoHenkphQK0T72SQNZ1pdygUOZa27uS6RBoi8Cbhg2fVKGU0y13GGNpFK1nENztSdxGXgEBAY6dJuilH9kixv7TPN4oY2LKJU2x0+4L405aRDAgi1MCFbrHvB87c8UpACyDWqBaTvJX; 4:DT121VJFar4TGLYvCmceZ6iE6nkolYEamyayg7VytEt0qgv6/HHJ46MnR5RaBqF/PAhgrtCYqGTkSEnEdJ1RvD5b9/pWcc56c+4ftxs2YXUtd6oRinPFpSAT25g+m/AX8BeZKTNkKNpiDeWUJxnnMtSM9M49XJDy/0RHZ8oyg5RESuq556p8TKUBbeSYVp2bgdjqBLsVV+sR0LJdTkqmhzyrGmKShtPmHAgBVPjZenqMfu+6D6e8yRLg0qenWt3coVfwu5mu06lp0FsUazeHig== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231023)(2400076)(944501161)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DB6PR05MB3205; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB6PR05MB3205; X-Forefront-PRVS: 0557CBAD84 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(396003)(376002)(346002)(39860400002)(199004)(189003)(6116002)(3846002)(21086003)(69596002)(33026002)(106356001)(2361001)(7736002)(68736007)(81156014)(2351001)(50226002)(386003)(316002)(16526018)(305945005)(4326008)(53936002)(25786009)(55016002)(81166006)(8936002)(26005)(8676002)(16586007)(59450400001)(36756003)(76176011)(478600001)(51416003)(105586002)(7696005)(52116002)(66066001)(47776003)(97736004)(48376002)(50466002)(4720700003)(6916009)(2906002)(6666003)(2950100002)(5660300001)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR05MB3205; 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; DB6PR05MB3205; 23:D5oSRdDmThyz8oDFwYAS7F7Lr6H+dG9M2eZIJ5a9j?= =?us-ascii?Q?urE3Vknrq9l+NRR3p9xz0lRQwJjlWqybhMGxJmhM7pChj09WFcbBJVKyrMQz?= =?us-ascii?Q?lf3ZR1jkckr6iedl/Yo3LO4IL714b9eRRVlzwV+x+BKCC8FEmCvPtDFlr4fv?= =?us-ascii?Q?CdlBnmblbJnmjVxbBxD7dLb5/bezSoxSmX4H9421e9xRTdpKp8Ol8IoYJdqT?= =?us-ascii?Q?jhIEvEwdlmbyKyIBKH0tpJxWd2fP7m31Vy6qVafxtpwnFm0Z2rEP3rtmAUTH?= =?us-ascii?Q?NXFTZ8r8vBY9zib7BOxMY57GocvT37RBp3wLehbYvTzt9PkcetooH1Os2o0x?= =?us-ascii?Q?KJdmq/8kfoysipGfhH/LFjwy4drCzwt+ZE2IDIelGtRThc1V0TtLSa5LNYA6?= =?us-ascii?Q?b0RJMxu+ca40DIImv3mf67gPGQqngO3WZPaorYvs+KVGOvt0/PyZmCYRI0+5?= =?us-ascii?Q?Z/DBmlGEDrzjm5tIYHUMYY19IoWjvYFQEYGop1AMtQaDIJScHP3BNQBdKYLN?= =?us-ascii?Q?MzPic8TK5Q71Pd5e+zxS8JzoPBV8ceDEUKOZuYNYXl2DAkTsESugiV2lwjDa?= =?us-ascii?Q?2GptAIGOY23VXb/TB63e4UPyPK6To2g0lPjX442PSPra16gaaQf23mOUKbz4?= =?us-ascii?Q?e7xVnOGm6SUhZ2qfevTZeoOo9qMb066vDAL54Y2W+gSXc6F7yrVTQfL2iXzw?= =?us-ascii?Q?vsK0DR+RKWBLEpQjsXcAdQs1ac8cIdeUpK8qkaS+fs3vjOI4ARVBgrs66m/U?= =?us-ascii?Q?XLVoafDcf6gcNs+uvZeFFNU5lgNWORAm/WVZ6vkIzK1FsSqhYZbddUjAeP7q?= =?us-ascii?Q?81AKBO+EH+8lAhGT2qgZtDHAPzHgjOlSkZnus3g17jWQVdNjnmfvyK6eoocT?= =?us-ascii?Q?p6JBRGHOIx7VEeXeUcnB8FxiYP4fI0Idh77M6YETLFPAiYmtrq1qbdC7+4Y+?= =?us-ascii?Q?WRng4XOaGdOLnB3nphPc7Ui1myy+A5RWM3++b6o4KFrfVJMSuqqIICt6RQlx?= =?us-ascii?Q?MXwhsh3l3AIKi7qzRvf8xyk70W/14SFxFUSS0ljEwB/JmITiR3+tpmf/Bvtg?= =?us-ascii?Q?jQtnPxtk1BRFblH9H9oj31ViRvY5O5VrkLZAMe3zL/7x95ah8VN9RfEcnIdU?= =?us-ascii?Q?X4y9f+zhCJ40sewJx3gvEBe7VOdFJQkrD9WMTarSJSbjadyFIHvSaTb6Qret?= =?us-ascii?Q?WXzpkpJHjsBLYHhCc5eJkvZH3BZ1yhnbHr8F2OQUBKAravlyqwxVoouJg=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3205; 6:AWql2jdCZSU+QHfXckS7X870R4s+iSCf8nA7VGA/6pn9eJfTx/IcemvqF7iMIwTKlLYyntO+Nzke/tL+EKANtAXbw2YMIqK1f+uofc0Do1hPoK97Rb8nfxmJc2yqpZSmU65Mgmg89UNOI+5SsNLTpfoOCmaPUZG3lz4gr+7LQb6T/9q+isdU9xR7KaMf/tGu/ihSXB2VB19XCiPpEszNa1vWSc1rmFAa8mAwZA59amhpK+LDImMKPjJEGNmiwRHqNtpCs5ct1QKwIxo/20lmt/IR5gZ8/dhradoBtwLY9v6CQja7009b7vSOF15lGKhBk9Hue4wUFDjdJGFgcKJ9drkRV+OPk0C6m2FNd8uRN84=; 5:vv2g4QyXctzKaFeDygx3S9sFGWUMR1psWyzpnt1PMMR1+8ciYqM2TyhA+c2m9etxcXZQcJSzUkxhNvf5QMGnZiIKN1QI/szXO1RkXaiAhTQpw9zRTGKuTDuvqP9hd8IluE5axNumpydZOJfEbhXvPIH9HxYRIgy1XqdFRcIasSU=; 24:/AID7Ig+H0y8lb+jBu41a8XvMrDqV4mNhINem7rH28Tf3kUU7XGSPAiL6yLdcqYcp+N6x93V3PU1DGI6p3fEdzc3mcFcsXtsvyqqbDJlGfs=; 7:wV4nr5LxnPF8towkJG4kkWBaR9Tu7dQGMfU+JbnFctgzp/sUDdTYYy8ogxUKTygW+H17rmj/1K0F605Mw2PyiFpSuxNYoa1FluBpNFkTTSDHwAijWetH+e2t+ZSdwUCJ5iNBFpwerCUvuZ6OdkNSBqnPYnrAVwhoa0U9CQjn9p4atrL1ZADreGR4molHFG8bJfhMiim5eTqOH3IjmjMbavkyVnFDb0Glhl/+E8apd9mgnNxm/y/WP8VPmIeMibgS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 10:17:11.6176 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab092b2f-4c7b-40a5-5376-08d55f25ce57 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR05MB3205 Subject: [dpdk-dev] [PATCH v2] net/mlx4: fix port start fail after device removal 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: Fri, 19 Jan 2018 10:17:14 -0000 In failsafe device start can be called for ports/devices that had been plugged out. This patch fixes mlx4 port start failure when called by the failsafe PMD for removed devices. Fixes: a6e8b01c3c26 ("net/mlx4: compact interrupt functions") Cc: stable@dpdk.org Signed-off-by: Moti Haimovsky --- V2: Fixed commit message. --- drivers/net/mlx4/mlx4.c | 10 ++++++++-- drivers/net/mlx4/mlx4.h | 2 ++ drivers/net/mlx4/mlx4_intr.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 61c5bf4..c67b221 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -108,7 +108,13 @@ struct mlx4_conf { " flow error type %d, cause %p, message: %s", -ret, strerror(-ret), error.type, error.cause, error.message ? error.message : "(unspecified)"); + goto exit; } + ret = mlx4_intr_install(priv); + if (ret) + ERROR("%p: interrupt handler installation failed", + (void *)dev); +exit: return ret; } @@ -141,7 +147,7 @@ struct mlx4_conf { (void *)dev, strerror(-ret)); goto err; } - ret = mlx4_intr_install(priv); + ret = mlx4_intr_enable(priv); if (ret) { ERROR("%p: interrupt handler installation failed", (void *)dev); @@ -187,7 +193,7 @@ struct mlx4_conf { dev->rx_pkt_burst = mlx4_rx_burst_removed; rte_wmb(); mlx4_flow_sync(priv, NULL); - mlx4_intr_uninstall(priv); + mlx4_intr_disable(priv); mlx4_rss_deinit(priv); } diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 99dc335..ab4f396 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -176,6 +176,8 @@ int mlx4_flow_ctrl_set(struct rte_eth_dev *dev, int mlx4_intr_uninstall(struct priv *priv); int mlx4_intr_install(struct priv *priv); +int mlx4_intr_enable(struct priv *priv); +void mlx4_intr_disable(struct priv *priv); int mlx4_rx_intr_disable(struct rte_eth_dev *dev, uint16_t idx); int mlx4_rx_intr_enable(struct rte_eth_dev *dev, uint16_t idx); diff --git a/drivers/net/mlx4/mlx4_intr.c b/drivers/net/mlx4/mlx4_intr.c index 9becee4..eeab625 100644 --- a/drivers/net/mlx4/mlx4_intr.c +++ b/drivers/net/mlx4/mlx4_intr.c @@ -73,6 +73,8 @@ { struct rte_intr_handle *intr_handle = &priv->intr_handle; + if (intr_handle == NULL || intr_handle->intr_vec == NULL) + return; rte_intr_free_epoll_fd(intr_handle); free(intr_handle->intr_vec); intr_handle->nb_efd = 0; @@ -291,7 +293,7 @@ } rte_eal_alarm_cancel((void (*)(void *))mlx4_link_status_alarm, priv); priv->intr_alarm = 0; - mlx4_rx_intr_vec_disable(priv); + mlx4_intr_disable(priv); rte_errno = err; return 0; } @@ -313,8 +315,6 @@ int rc; mlx4_intr_uninstall(priv); - if (intr_conf->rxq && mlx4_rx_intr_vec_enable(priv) < 0) - goto error; if (intr_conf->lsc | intr_conf->rmv) { priv->intr_handle.fd = priv->ctx->async_fd; rc = rte_intr_callback_register(&priv->intr_handle, @@ -395,3 +395,40 @@ } return -ret; } + +/** + * Enable datapath interrupts. + * + * @param priv + * Pointer to private structure. + * + * @return + * 0 on success, negative errno value otherwise and rte_errno is set. + */ +int +mlx4_intr_enable(struct priv *priv) +{ + const struct rte_intr_conf *const intr_conf = + &priv->dev->data->dev_conf.intr_conf; + + if (intr_conf->rxq && mlx4_rx_intr_vec_enable(priv) < 0) + goto error; + return 0; +error: + return -rte_errno; +} + +/** + * Disable datapath interrupts, keeping other interrupts intact. + * + * @param priv + * Pointer to private structure. + */ +void +mlx4_intr_disable(struct priv *priv) +{ + int err = rte_errno; /* Make sure rte_errno remains unchanged. */ + + mlx4_rx_intr_vec_disable(priv); + rte_errno = err; +} -- 1.8.3.1