From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0072.outbound.protection.outlook.com [104.47.1.72]) by dpdk.org (Postfix) with ESMTP id 78CF01B2F2 for ; Fri, 19 Jan 2018 11:09:23 +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=CwdNMSqsRVbXkIOir+8hA5bm1XohADKOD9aEqHAYfjs=; b=x3gk8mD5YWKZDZIk2le6Y1D1nvi04539vtjwKG6TYn30l9DBIPctIF8cGGEvb5XP26DHs6w46yS5rIAa2HB+GymV9qFLY1+hGcrYOg33kcUQREsBygNPY+mcE65G5Dq4ZRCIw0Itnrqoi9jLYfhjJ0iOE74AeW75HUoFej1BEU8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM4PR05MB3202.eurprd05.prod.outlook.com (2603:10a6:205:3::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:09:20 +0000 From: Moti Haimovsky To: adrien.mazarguil@6wind.com Cc: dev@dpdk.org, Moti Haimovsky Date: Fri, 19 Jan 2018 12:09:08 +0200 Message-Id: <1516356548-15057-1-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: AM0PR0102CA0051.eurprd01.prod.exchangelabs.com (2603:10a6:208::28) To AM4PR05MB3202.eurprd05.prod.outlook.com (2603:10a6:205:3::31) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 518b0002-329f-4aff-c323-08d55f24b525 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:AM4PR05MB3202; X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3202; 3:QeDa3KtnQ7kFXeSYbjY9PX9oECRu0RT19R26ranoKpzJyJepErzZk3D+IXA57UsQJ4cBU5pteYbQXSm6q6MYKGZ8lvA6EOaJD7ZzDEW4ZyI9WoxAgo8bLUCqXLrH7V0DC5VBKzPoeWX7miWzGkIxyfPUYR/akTPI+kvhaefQTHV1q5sJtvu8OLZpQxh4esn4ktyg7Gf8EUepoo5pb0f9sS9QoSzn6MTXj4aykst7C7ZvMCE9Z3imx+cb1BvoL+Us; 25:eBnsweaol16IwVyIrNCl+w9xDVJ+ktl1gq7KH8LcD9Ua8gEuAdjDMWesdOeBwXylH8a13nsk0HNyn8gO3FbgSK/sBN2yclu62icUusty3KGJnT8KTbZr6nQhbp7l+V4GtksrRqvc/bYRIOrkDJznfP3/xU+Rxgq8YrukEn01MXm9QFQ6SdTIIB8VijXUwRZJCzufciloHM4Rl2gfdB5E5wGhbphRyqOokCz/hdzrh5WhMWtZ2gplkdGq2+mDwn392CcVvdkQpGjzgp6JRWlP/92XHhdKTejCPn3QVDoqVeM3Q47Q+s8dzuCv2MbaTJBJPNdWsiz8U6kA7WIlBqr8fA==; 31:23Wx8sHY+SzscGCnR3TC/gvmPlSze1Gx3nUCDH1Y3HeSIhV5zEr35r2dDxtZu0ygQvcLqhir+PyBnPJJgiaQs+oHgkqQtAqur7u/YtLk0Kjy8oCveEOuXffCZZpT/qAD5VwWXx8lx7bk5R1Xp1lSAqv3ert61yTVeIHILutvZ02aXDk04x/V9GKdjvL6Q25nU9h4+0SZXhOJ9nu6pxPVw18hHHjQKeXlO2/P6GtcT+Q= X-MS-TrafficTypeDiagnostic: AM4PR05MB3202: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3202; 20:xp3C3HfQal2bi5skOLT6MTG8EGm1MMC/aQTSptzygEm7eOy4yw0M40PjFKs8Iw5udg4fLDPumHzpqMNX4HVojZ35DopLwhBxOV/AbXCRRO/mEyTf4mq2/T05LpvqPMNSfwFg75bZWF5PvUO2qu5+3sCwX0SoOtZ9VgoL2RFOWtUs9IH+Fpuk5rkrBvOBXlAA+BSPzFbZLFRbLNwujvGbWBWdD/7sBlpzNy8isZxC9/fTRfhoDpcUVxkIbUAcZwWOzx++gkRNupyplR3XJN1wcDdq5zRRpnLtyn4dc75bsAELK99vS8BwWEgltnyNI1sOz4ukHRvBxKv521smbpsFOvorZlvwKY3FLcnAvh2EbIAdrVBTe2auy2ztokVQ8qhPmhYKXCbXr1WsGr4wxT/l4eJVRJBnRLYVaMfFdL17S6v4vuAasDWsTohykUC0g+8a7J8DmCZgatRpBvFMqYKzQBHxD43lw5P5NYt3chGGzNdkShflREiN1lI1Mu/xxbV0; 4:hHV56jM9e4LggpmHtWddRp1TA5+VuohE7LXnTXpho+71FISVts+VCCcrb1l9hxmItx0HynxlP7wmTHQq6zZqLpK+rBXHKOpITOITz5kLWSL8++eue5KUKR/sLJpHYovyHP6SYN6ic/ZrqkM62775AWQtIhtQgbWsigYoRiJuCovKauNdGFie+3jfYWsBPebdRVgiPxg9cQQ8k3ciczU1GUXSkbLe9TMTGFvXBavakWtB0NCPij1VmVNW6+d8H2TdYGguirVeVvarvMULaS8HXw== 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)(3002001)(93006095)(93001095)(10201501046)(3231023)(2400075)(944501161)(6055026)(6041268)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:AM4PR05MB3202; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM4PR05MB3202; X-Forefront-PRVS: 0557CBAD84 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(346002)(39860400002)(376002)(39380400002)(189003)(199004)(2361001)(4326008)(33026002)(5660300001)(4720700003)(107886003)(86362001)(6916009)(6666003)(36756003)(69596002)(2351001)(52116002)(50466002)(48376002)(47776003)(106356001)(66066001)(478600001)(105586002)(7696005)(51416003)(59450400001)(50226002)(8936002)(21086003)(68736007)(16526018)(81156014)(316002)(97736004)(8676002)(16586007)(55016002)(26005)(3846002)(25786009)(81166006)(305945005)(6116002)(7736002)(2906002)(386003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3202; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:3; 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; AM4PR05MB3202; 23:BfCevQ+CLObZEdvwkaLm5ySx8KInPRvcYrpYsSldj?= =?us-ascii?Q?Rp3mHbKSt6pWGNznI1wr9PNYiNvQuNYWoKtbq/woMdiIpyuo51ZxzI9om1JG?= =?us-ascii?Q?+ZGOsbEuZetPEx1kreV8nUrvnrhV7ZKQ6W25HI8Y03HIK2P8BOvhoKrela2I?= =?us-ascii?Q?KGSxN1XFAOw8L06rYKucVBI3Q41OU54/Lddn6uqonj0o8UJMtqe+VB93kfnL?= =?us-ascii?Q?PGzJGeGxtAbCTxK7+hyU9m24/k2ElXz/1IxZGCtO3J1n7UKiuaR8Cd8CUvtl?= =?us-ascii?Q?L55qwJJFyANQ66lXlBMXlsxzTt+EkppabtGzyu+hEyLDSXCf73ALCYAebTiY?= =?us-ascii?Q?JvtH/c4qfop9BGbqqTjXI8Hi/cM9rYKnlV21GfaTt0UDdaagL7KxKKLNX9SH?= =?us-ascii?Q?U6uFnN7taQ4OjeqylCLZ6zWdZT0g29Bn6vzhDbMaOEeV78FNrRrZ7/hYyRdU?= =?us-ascii?Q?1OLvmiTNx690cELOiM/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YbIK1oSfInYO4g9d0Tyicx13a0ZVMq6zJscsHE/qwv4J4jmzWpLIv4M17bovX3SGUfBQRFaSgN0aKydTvwp6kv8WyRLcH0NRoPrJGD/Mprz4yzhKCm5QSzZKxvhN9ZXk11oZACDFEABE1xogGkAO4FYv5CfB9CICIhs5l/1Y17qUeWzKf9F9tbQM1SoWLdQPMkqarqn9u6bGKrpXEBd5bhHfRfCSt2G8=; 5:FfDYmC/xfKTdpk7OHR6l1OwqvysB3XSfFl1TGejTeul3jU9ELaecb4qH+pDegFsp8Pm5J/sheJTxpfDMBePJ0Qd2ubdAQPhfttZ94QHFoNUbniHUIquSiF98HiJtSJq8IGVWC2zpb/Y3cWjkudj+qrLmtyivpHoKFVMwdWDqclI=; 24:WbV3+3f1nAuin9d3i76hfLCR7Bn6QxweadJOBWCOS6YzXSphsPDemOgD53jZxz1wKtkU/re4YWfurxRTMenLG6WTs4+kZekw22mWAggLSz4=; 7:hZGhBlxV4IdV+numlxdzcjut2SODMfTvnBandf/ERl2NX7oT99Xpw+ABKm0z3zofJuI/HWkvOAuHFThuR2fkJc2mhGM1gNj2CKlbtCyD+O1CwWKAiySoNo3BFDLd8CaT6i1cuyu87qGJz3a/nf0TTM6XtFUHvYaDW7/NkpMOaXGD0YNPnb7TPlekvMUTTts36KKufoj3Yzr+Vmo87g8nlug89C2etjs6L5YuYRCZtSE9DKb1JVutSA/9ErP8PKH+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 10:09:20.1499 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 518b0002-329f-4aff-c323-08d55f24b525 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3202 Subject: [dpdk-dev] [PATCH] net/mlx4: port start failure 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:09:23 -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") Signed-off-by: Moti Haimovsky --- 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