From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50088.outbound.protection.outlook.com [40.107.5.88]) by dpdk.org (Postfix) with ESMTP id BEE951B34A; Mon, 29 Jan 2018 09:34:59 +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=QVP1QiuLBt2xlNXkh6KF4KP4Ka2k023iGqh+Zqvpt/E=; b=qvMUmpOA1yNNhNZCyuRC6EQh5/hal9dtXWAEtCUb8M5bnuMI5ywJIulqiQi1sKX3oHPjL0AsK9if3yI+nYAQzhPoVsBdJ5mdU1KqaNoUImnNPYboo+LOwhVkm9HNTpUkgJ49hMYYfR1OQ4JqeoiAycHxxuk+z3SiANC84549rlQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB3212.eurprd05.prod.outlook.com (2603:10a6:7:35::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 08:34:56 +0000 From: Moti Haimovsky To: shahafs@mellanox.com, adrien.mazarguil@6wind.com Cc: dev@dpdk.org, Moti Haimovsky , stable@dpdk.org Date: Mon, 29 Jan 2018 10:34:37 +0200 Message-Id: <1517214877-126768-1-git-send-email-motih@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516357009-15463-1-git-send-email-motih@mellanox.com> References: <1516357009-15463-1-git-send-email-motih@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0102CA0031.eurprd01.prod.exchangelabs.com (2603:10a6:802::44) To HE1PR05MB3212.eurprd05.prod.outlook.com (2603:10a6:7:35::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: eb80c94b-5770-42d6-0cb4-08d566f32df9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:HE1PR05MB3212; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3212; 3:KnW6D9OxnoXLWGVgOymi+boWjsuTYeFD9CGkcJvi43/oXffTrtSY7aJYLaoXae0xP70NYboNat2eF4FGKv30FUstwpiyRkRa7+mVXAQaO4PmUw8AnJTilwg7+uE4rOLy/QND2c+fg1PQaNj1FkXh4mwUzR2d41YEPQbT90FkdI6HlepeAPqjQkZlb6iGBAqbNlnN/3J6ILfkQ4Bp2zDX/jDVTb5FlXjkAnHCI9uIwLKodJ5LqQd8AVcBPtMrqYpK; 25:sBMJR3FRzFOG41x0H+FBO0i57QHuJz9aqqEExBwni/KN0+xvPryvqWAhBsTKhg+BTHEO0hxLcy2kGBFZSA0PyK5OhxYAlwYVWfpwfIYp270KfZe4z6QNyEriQSwwXRf7IOxhsFb6hsXaeBpZ8632o2IQLk/NWw2/3mn9xVcbDD9hEKFVLHG4BN+cZovpFz+yhCSN+9+9G1VpAXpuRos7KD0PC5p0WkBbyPnj1pMVJOO0bORAPQTzMAkpj1QNCHwRo1AL+m+krMfp27jN8MqtV91aa77BEiJzAaR/qGXxSNCSp8cemBx1Zl9Oqw8Pe03uWDqdFNjVwzWfel/UtgPkDw==; 31:LLh4dI7sTpKCevqQq7K4nkRIMJ+O1PA072Lya9LTuNbyHwbzEh6VR/jMKn8IdlU2iNRhpEoBHn5AMlPOsyFIaohoKX8pxVRwVmQYjak9wLhPHRVP4wBscbccsWkjcMqwNOJFaORQxy7gJuk4CdgZP3hGSBi/fLMtmyczUvLBVIiTx5UGsRZ5D17EVjE2vCPLVm3JlhJRLG4UtZFZQTzEjNMhnrFnfKga80MRwVF8Fns= X-MS-TrafficTypeDiagnostic: HE1PR05MB3212: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3212; 20:/owvoEsCB40geNn+Oo65uwxxX1xqCQ5YBk9hU9Fhym38xfCsaVfFIK5urD/DKeaQaFzeP9C/H6XYIxKdzJvowcyJprJzb0Z0m89086X/FaKStwt6rC+CQw5ccknmTZEo4JU5xuwkq1UFcFAIwyc6JzGleOE48iTzOg3Kx8JVRZsX6HeBUSALihpom5Aoqmg1+9vJe71MiKVCV6PLljLaCACCMEDG3Uhc4gjV+YQiIdT64pKiQH7h4SbqVxVPZXxdepVhAWCFh9F/LlManMIzKrlmDIFKrIaoaOJPvQjBhJn6TI1s7iZovIB6vHTyz/xgzC90+50aEau4839QhL1DJpxgKh8MnywdCB+K3ih1up0Phag+grQKN/R5wqUCeE1JI+O3aXIBgMnmq9CZFlKHTn2L49s/tzPyAcZxqWFK7hEJ4ZVeanWl21sbXqMMfVfeuDpUOnoee2ANd7kkJLpWHLa1TP9zj6vIdU0fXbCkhH6L1cLhGwPylpaO0XtH+LuX; 4:ZAFLS5Uo1SmVJgqjzHGjkzTGM+8uRThD1h/14ilCVro741Lzvd1JyeMb7TlNgO1fWeWaX7qrXvVLf5PEexRR96g+0vHFn8xnWAbgN4M88c/iNP9oDddvZ0V68qnfKaw+02dfB2NhPtKHcgCVvJZWI+nV+bVkD8R6Hgjb/nX4XGzBtonF/CQIeLHLM7pvtbYkiFyYtbUa7u3mLBb9DndQ/nTdj6ErqAKQrt2hmwVm9LuQFrTgwUYyTnDR5xD4AOsOPeHGcDKtI49eJE4UCgeXaQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231101)(944501161)(10201501046)(3002001)(6055026)(6041288)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR05MB3212; BCL:0; PCL:0; RULEID:; SRVR:HE1PR05MB3212; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(39380400002)(396003)(366004)(376002)(199004)(189003)(26005)(3846002)(86362001)(6116002)(47776003)(55016002)(8676002)(68736007)(21086003)(305945005)(7736002)(36756003)(2950100002)(478600001)(316002)(2906002)(105586002)(66066001)(16526019)(97736004)(16586007)(69596002)(50466002)(25786009)(5660300001)(50226002)(48376002)(33026002)(8936002)(4326008)(53936002)(7696005)(81166006)(81156014)(6666003)(4720700003)(106356001)(386003)(76176011)(52116002)(51416003); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3212; 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; HE1PR05MB3212; 23:m0R6QR39JZ74o/9sukjXUfRHuAa/T2f7WFCUgcfdb?= =?us-ascii?Q?ktKlRNqveGPDJtZu4c//lsavVOVCN/8o3Ter9n4BFVsD8ccW/MjeH4E/K5Lw?= =?us-ascii?Q?1iui0ANWLviuWY14pxn/TJisLHQon7GUhwlf3Wrqr6pONK+xlP2jBMCyx7Hv?= =?us-ascii?Q?0LCIJe7WOKpRMSmhyjIrwtYFJnDOT9xz0qp3r+6HqtxzA4/RA1vM2iRrGpV1?= =?us-ascii?Q?vIrVfGOXtWCZ1m4vbdFecRdEIZBSmx26SKYf7Ej5ZJgzeyZwdBb9y/4R31GR?= =?us-ascii?Q?I9Z9bPop3yLl/e9R5AqVdrw63FYnYmJF6xtyFc716yMQNtMwmPVtlYEe3ug7?= =?us-ascii?Q?ryAhXdN6Tvf/IN4yU794p8iAmYUylcqInMOxpEQfpwxGSEGlGZ1uEDsmD/uf?= =?us-ascii?Q?58Ooi/dfLkP9oPOhSwbdWibG73gbQ7ZHscY+2BjOGY5f23aDcedGfKRZ0oVl?= =?us-ascii?Q?7K1l7Ld5RWJ9wJBKUmFENXWOnuOGb92q2/YrRO3uFOj+4vNJtNGmxC8Z2T3R?= =?us-ascii?Q?kIqllu06Hv03T8YLjNtjetRTHKefjtMeTx6RI1NNjdotnjhSjBFrA4YEOD9F?= =?us-ascii?Q?9+mN6rNTL05bgnRy5yT/pSBvKijyaqI69IG+FSaCQHnbcy1IznYdG3FuMo6e?= =?us-ascii?Q?OsEOOnmKr9AwLCAcGwIByRNU1aWOaI6aTjwMZmY4fR+OPluLdnzio4D1CMDI?= =?us-ascii?Q?HujJh9nJMFcMQImDyQxmrAcyYX4IgROgGio8PssmnPArzJa8Y5OY/V4OMmUT?= =?us-ascii?Q?4vmuRkIDNajz5vnRY75/AMvW2ymQRlwnUTEQ3G1uxPean8KjpKb+y0dcbht0?= =?us-ascii?Q?9RCVCdK2HZAhLX1c0pAkmme0L1k8kayFg34/lzbI8X8AC/uohFH9jgtEdHrE?= =?us-ascii?Q?R10Cehhy9oB4r4pj8tA2vYwv0YAyc7EIB5ZbuIXy2etl+HZjmNTbtvIMjdFh?= =?us-ascii?Q?2T67pdvXSWRnv203wbsQ3pdkg8YVxG4qFd+uEP6VohyLQy1HlRSKAX0xexSn?= =?us-ascii?Q?iSsOdQfmuZ7Mk7qDtNoXJI6R/JNcuIBHwsz1XykwrS6nxPkAqr+otVnv5g7H?= =?us-ascii?Q?Mn++UwvL2UeNxuuxLH4CWlz0hw97IYsAeoInryJWgQixi/LujcmCmxvy11QF?= =?us-ascii?Q?lUa8XC+3bl6hCwZNIN2eS507oLRf8vE?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3212; 6:S8ru/t5OVDyPl491bE2Tm7KwwTyoOGsbAmIUt+pLzaiAIIhzD+glU0YH2hIBV+vLXzc//eWcdFuObdGCtbOZP2rC29p/pN3PioUt6L88tSh8+8/+TCIieSVgMVtTywj968YT2OENcChO5mHdCS5zicZNmkLikPzA/W0/9SWYGEfUun1f1mDrcXy3m6aBAoLmeOLQI1wiD+d5vVEyHMSXEvOnggX5JBTMd1bsdmlcxCjBXfGwec/VlrbD49ULwldwvo7TAb2VF5MmdIiBvqEkDMeozbF/bwFCpwPe/rkQHjreF20Z1OpVa75QxRmPdxyFf0IchVUdPPqOLBm3wqLPNS7quTtJEodtzqCaSzwXPrU=; 5:gDZUfe4kmoh8WxCumx0xlW2Q2bN7997rHgJ7tT9k2O2++LcciWRYU1Xuv2uVorUqbGMrVKxcE9WW5Cesn0PGEodDZ4luO7Y5v2gEmQoCHAVXhCin9hbmtucXZ83wwRcBAYkpCercsEb4xQHgcIXK7iUEuqBkY4FUgwcCZ0w4anM=; 24:cXq3YguQTld4u8FPcThj6FudBrBGDkVrRNJQrHmonuTmf0kPG3j4YtsTE2xnZRRGO7IY51AleCj2TxHU07982z6Wx5dl0jHWmODlszgFaN0=; 7:VSzICGbJfO2sepNjW1VaVLm2IIlB4z4KGW+mznzGLDL/cPSLDXMpKGutnj97n6Rl1Gs6Fn0IRg3iZ8jrpFW04S53TkgszAwUeC0rlE/N5qPUVTgLYkiwvuUwYevP11Oz39bHw5YhSa6u2oXuPxVXQH1inKWHHEgj9DJldBlR4KuLDpKAHU+Yn2znidli+wrp/8browEKS9OtOfpfc5c3hG4oKXPzFivyj5VFdeu+47DLD/8qV35Lg+5pZTb8xnrW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 08:34:56.6550 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb80c94b-5770-42d6-0cb4-08d566f32df9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3212 Subject: [dpdk-dev] [PATCH v3] net/mlx4: fix dev rmv not detected after port stop 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: Mon, 29 Jan 2018 08:35:00 -0000 In failsafe device start can be called for ports/devices that had been plugged out. The mlx4 PMD detects device removal by listening to the device RMV events, when the mlx4 port is being stopped, the PMD no longer listens to these events causing the PMD to stop detecting device removals. This patch fixes this issue by moving installation of the interrupt handler to device configuration, and toggle only the Rx-queue interrupts on start/stop. Fixes: a6e8b01c3c26 ("net/mlx4: compact interrupt functions") Cc: stable@dpdk.org Signed-off-by: Moti Haimovsky --- V3: Modifications according to review inputs from Shahaf Shuler See: 1516357009-15463-1-git-send-email-motih@mellanox.com V2: Fixed commit message. --- drivers/net/mlx4/mlx4.c | 10 ++++++++-- drivers/net/mlx4/mlx4.h | 2 ++ drivers/net/mlx4/mlx4_intr.c | 41 ++++++++++++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 952dae0..680eca7 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_rxq_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_rxq_intr_disable(priv); mlx4_rss_deinit(priv); } diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 30a544f..d65879f 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -177,6 +177,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_rxq_intr_enable(struct priv *priv); +void mlx4_rxq_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 2ff7218..e522949 100644 --- a/drivers/net/mlx4/mlx4_intr.c +++ b/drivers/net/mlx4/mlx4_intr.c @@ -291,7 +291,7 @@ } rte_eal_alarm_cancel((void (*)(void *))mlx4_link_status_alarm, priv); priv->intr_alarm = 0; - mlx4_rx_intr_vec_disable(priv); + mlx4_rxq_intr_disable(priv); rte_errno = err; return 0; } @@ -313,8 +313,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 +393,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_rxq_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_rxq_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