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 365B31B018 for ; Tue, 19 Dec 2017 18:10:49 +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=uJdF9CBECf/FqrCUekUP0khX6sAzADOsYzkB/RIQjns=; b=E6fLeVwj76JGyc/HM75fRU0WIn3DuaPMNzChOK0f+EkjtxFHuuDunYXisb9Kz8JLKU9/+qdZryoaiMfEKCLdlfAHwGm0hK9DtyBrEK4x+YDE6oRjUDFJyDq9FObKYlP0s2JTcV4DWQyvWm9yFw4j021pNzdGrTCC5PWy22o2jco= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3655.eurprd05.prod.outlook.com (2603:10a6:209:9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Tue, 19 Dec 2017 17:10:47 +0000 From: Matan Azrad To: Adrien Mazarguil , Thomas Monjalon , Gaetan Rivet Cc: dev@dpdk.org Date: Tue, 19 Dec 2017 17:10:15 +0000 Message-Id: <1513703415-29145-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513703415-29145-1-git-send-email-matan@mellanox.com> References: <1513175370-16583-1-git-send-email-matan@mellanox.com> <1513703415-29145-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: DB3PR0202CA0017.eurprd02.prod.outlook.com (2603:10a6:8:1::30) To AM6PR0502MB3655.eurprd05.prod.outlook.com (2603:10a6:209:9::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: caf0f591-3ef7-44d9-2c68-08d54703730a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307); SRVR:AM6PR0502MB3655; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3655; 3:sQxV/u+E8dVkJC0KJDEbPAebqhxhf11WuomGPoSsJ8BA5BKt/gtHYE70UOeOwkc8BusS1yEs2H3TcxrdtGBFuyKLb0cEUWxquiONL9vDoRnDjPoF2HFfmOYUV/28W7zeRuemJmYesipusAlgQtBPclCKjUgoGK0KKCkv6uRrWss8Frbbj061v6pq5g5Dk3PXgyIkSbew7uViH3iFZ/NV8J8VrWQTveUVxQsakM9lL60cs/xthMDbBdYS7sIVrw+n; 25:NrPyx8TtLq6q6H5t0XafsGo22LSp67XG9JrZ6zT6ktEMNU1ceFhbG7ejQPygAMuKrnFAtiFNSRKT8+g4ksyFQSknY3Msm0cfEEiilU83tLCg1PMlCTTBmbgl8tE2wOOlBNUXcIgG7puWr9Pf9dQJBu2ZnVL3kkiMlW5ViDBD3MRmkO/yZ1Ws1L6RiBqBb2IB0GQsI8l4fIchha3iHh/uq5agf39Exznx2unSsJw9R9cdKt8v5v8PZGPkgRPXxFns9nQ0TAmO0rFkUd1AAf2lUMcygJo0kVUkR5CRfGSAPwJu6ckjf4vAtGwZy0vsY8mt+ECC0dDYJYKUOJxn1DwGag==; 31:rXRbjaeYITdSMwFfzOni3Lf7uJmp2vz65pKxKQJGRszf8LOIgLF+QY04zAbEXZJVQrhyjX8qLjoqtgSzc8VM1itDhxFhPQqZ09qO4cAd1uxzz56okYslR8lLqWMHr4uIFuMCZS+QOpXWBN1cEpu8EPqdGUPUxpLd9JgRJV7qLzZBJX4HFCqF5sJj9bPqHyAyIebak7+Sv6bRHQUfnx+fSa09y/HYQpl1JhUUdw1rjXI= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3655: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3655; 20:EE1NjvNq3Ku7Lrbtk3ia2VqIuT4pdAib8QBMwkLZSczXv2nxMMlQ/HuaDcPdLyC3qzh/BSHvDP3D6b4k36+uivJt9AFxlSIz/f+3FH2m+xTP7wwbK1h2/fvbAdY4y2n+HLYHpY3G1hpPRK7h3smXtTbF1NjUVga40jeBQ8nXz2zyKndYWYt3JDOmrcBvrIUw4W9dBoEbCufjLVdlRu/tWDz+AM1I4kukmiz5X7I1KD1uDefvu7O4h+WY+AGOLMe/lCJQoyRYG2aPYWbTbG8hLU672V6k8G+5QnDjGJVJC7/YWeIRGq7CZcymDIeoYC9+hXSzT48EfllP7VFAPNJ1/QxRF94VUC2KL4HYds6/OWgytZxfKCI4Bcthp0XFnMBRK8MGqA/R/WQMgU/o0mW2jexbQDMwUAalPGGwBVfWZjkNAzCZBZPZ3lxYEwlfc+j6Jk4lzQh/Ka9CJ4bsJ11qftyj3PiPzd/YcySq6L1lTZOv3taY/NKUYLkoMuzpeV5o; 4:l2kvQwwJqU3WMI3uwXtiOA5/uZsub+ZEoElWCqdaHw9OjE1uengzz7DlBgp7HQISyTB4KWvAB4Eys/4bCek80SW77+UcMs44IX7mBLGKyAKZQFb7S27V/+Gia/jfQ/WcHngVLRecBU8SgjB3XcVvgIBDa1+THgTp0gMt23EEnqxTq2l/NgmtA2EnH7wwGm9twydwOtiBoGRXnYHGL2aLROTkHzJO9L6KeTEj7eI6GDSYPgM+P4rmSG+iEKRV7bBvOrankTVVO/pucclLkGP7W4CnPoU8EQNCzoF4HbGNgLpB/uUeNLOa9MU9Y8e2HMLh X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(6055026)(6041248)(20161123558100)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0502MB3655; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3655; X-Forefront-PRVS: 052670E5A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(346002)(39860400002)(376002)(366004)(189003)(199004)(52116002)(47776003)(81166006)(69596002)(66066001)(7696005)(305945005)(2906002)(5660300001)(7736002)(55016002)(478600001)(51416003)(59450400001)(4720700003)(33026002)(6666003)(386003)(2950100002)(16586007)(16526018)(110136005)(316002)(48376002)(8936002)(106356001)(105586002)(50226002)(50466002)(76176011)(36756003)(68736007)(21086003)(8676002)(81156014)(53936002)(3846002)(25786009)(97736004)(86362001)(4326008)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3655; 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; AM6PR0502MB3655; 23:7/Jje/5H/bNQmVerBw9SaA9uPhoHx/HOgZG0sd1?= =?us-ascii?Q?4nAVhwEU6iyHh27d2ufTsdNw3OVxvidyf+k3uFYRRHWgw3eaFWETHf7z/moN?= =?us-ascii?Q?Vl1zf1fWax/XenxLtl6jUdOM8SIrGFtQjvFTQdyaWvczYrfXTWJ92pRNGgH3?= =?us-ascii?Q?zovcLg1FxRdrn7d4kCePOyNZFKHDpAZdlbn/4qY7otYS19Mb+786P2+9fgbM?= =?us-ascii?Q?vW4XUPfvEwlVXjHAoRHeWRENGEeOPkOi5/3HlsbHDgaED93LfPOo3gXOsO86?= =?us-ascii?Q?oJNE+PTQFBStadVnD2rCtZUq4Om+QULnAQMbHp8cPt3wfTI0YKd5j4xxarKf?= =?us-ascii?Q?hQkZLgWhJGMiXHuySVpcd5kgszAhagQtgwfM8v/LodGk/n7NheCQmZG/FQ0M?= =?us-ascii?Q?EkMfdR13FJG1RKbZSxF4ekOCbbKD2H8pY1mPTndCpvcwZnjLqkzD9TEl4G4z?= =?us-ascii?Q?s3Cx02FbNhM994OQzk4j7tVnacZU6fyXKcj0Re5hMSan4pYiPMK/hj8jqzhf?= =?us-ascii?Q?0ndwEQ3qq3m3Szb5tz/vXTw1IlC2Nh15BVIpR9XYYQLRc3MlRzstqc+GySlk?= =?us-ascii?Q?66bM601YF4AyopV/wk1HxjNJjFK8qkv//ukcDkfx6t8jUuNgaiGc1Pc2EX5n?= =?us-ascii?Q?RjdYUhdNKO8tBJHNUlQaA0w8p8yLBlq3FAAPKmKSVc7TblvnTTP+J86aM89c?= =?us-ascii?Q?JZ/G7YTOn3i62vWDsUuqtreVBKDG+HT3QqIls5wSe6a5ZT55jS72nu9AKujD?= =?us-ascii?Q?yEmK8uj0UeESETVAiuvwB+n4lNy7xdl3NclSu6vKU052FcwfZ1qQdeAb+Ocj?= =?us-ascii?Q?m1tnRU9pRMaDy/b9eZoQ/L5w3oDrRfiVR70062ElYkbi7PvLYxQOo1g2VFM9?= =?us-ascii?Q?7POsTDTnQHxX5R2W15r1mZOeyRQcdBkyxpE7PAU0uVv1pS9nWgbbKqgYBBCu?= =?us-ascii?Q?TgH2v/1kCMIJ93JKuz0bNbZwlDtvm7mcvA+nDzcraTiykJ4vgpLbmTFAsVvN?= =?us-ascii?Q?exuhohq8cOl1Uo6U6BobEyVxEBrJrv/knyV0Z4wGmgTlvYtsNAbWp2pJMb1l?= =?us-ascii?Q?ckDxYGmiU11Ex5qWLzjIsFCvqotarHuyZWZ7p8SL1Evw3Eyz8QB4aMgjn6TH?= =?us-ascii?Q?rh+cZJH8zIbCzAwlvQD0DObrlknZLcks5?= X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3655; 6:tIzUl0HiU+UFkpfJXIr5W7B42GQTXP11Cs6S76AtxC5/eIlf2uc6kRRtIRCZLrzl4kmIlOwDUKMMMp1ErHDP746bndCUdi1DG0t9V2jHy5Doyk9XEjcFZayqTP1kCDISsCrebjEOCcXwpAqX+UeJXnQbF9xj1pRm9wn+oHrLgJhVl88kKBAcuPHbVsIXqTwfnN2XumOrxXHE9MCP3bTVf8ecsQ/QTP/6HAKZVMd5RJj2ZTtV+h9mYXAQGq6qYZJTHe8Uij2ObLuCDiZ5nFAJqLLzyJHUmka8zfCmxsaJJGZs9BWdvx0qHIIaGidvZiZHwfgvC/sXfohq1oK51/jGRUYhiBIgDre0iIuIjgSd3no=; 5:bowlvvJbyzSRQTXJ5yL1CbwZwlst21oSjDO++UZ0lp9RvDewT4YouBn+fy6tC0HMyWe3e+1QVII0CJTNcRzntQfl2HoFC4jOCaaJeHUXLU2gF2vwR1f8kIUWYzdq2WYhHxt3kpyUpKkw3//LZCMI5gOiOsx3sOi5r8LF/BRVeSc=; 24:VuyW69MbjFKU9q52mLTWKcwVN6f8RP6Hy1sJPYGIaGsxU425x5j9QZ4XdRSzthlMTZOkEBXRlhkTa6N1bEZ9pYg4I5Gn6sKq8cvZghzwHao=; 7:usAyz8Z8DcfnPnje4iQNBAYsNp5fW8VL5uQg8hKKMF85Puu2WQhtIP2zwQTwqFJqc1fF/Y5qm3cmt7HJ9PVmCiOGt96QevIOpJ54apRsTo95n648nBgkvViGu167QsrGFn6PGLxtiKjPUIZQnJ7vMV55l9ClAr4axbOxnYnONlfCHj+20puk9LmyEdqHr5aNmxm1Skd/8pYedalqmH9XB2j08g9z9i7DyC8ZyxvOSVAsLEsoM9odWQCbzGvNQIHG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2017 17:10:47.5188 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: caf0f591-3ef7-44d9-2c68-08d54703730a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3655 Subject: [dpdk-dev] [PATCH v3 6/6] net/failsafe: fix removed device handling 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: Tue, 19 Dec 2017 17:10:50 -0000 There is time between the physical removal of the device until sub-device PMDs get a RMV interrupt. At this time DPDK PMDs and applications still don't know about the removal and may call sub-device control operation which should return an error. In previous code this error is reported to the application contrary to fail-safe principle that the app should not be aware of device removal. Add an removal check in each relevant control command error flow and prevent an error report to application when the sub-device is removed. Fixes: a46f8d5 ("net/failsafe: add fail-safe PMD") Fixes: b737a1e ("net/failsafe: support flow API") Signed-off-by: Matan Azrad --- drivers/net/failsafe/failsafe_flow.c | 18 ++++++++++------- drivers/net/failsafe/failsafe_ops.c | 35 ++++++++++++++++++++++----------- drivers/net/failsafe/failsafe_private.h | 12 +++++++++++ 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c index 153ceee..123acb4 100644 --- a/drivers/net/failsafe/failsafe_flow.c +++ b/drivers/net/failsafe/failsafe_flow.c @@ -87,7 +87,7 @@ DEBUG("Calling rte_flow_validate on sub_device %d", i); ret = rte_flow_validate(PORT_ID(sdev), attr, patterns, actions, error); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_flow_validate failed for sub_device %d" " with error %d", i, ret); return ret; @@ -111,7 +111,7 @@ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { flow->flows[i] = rte_flow_create(PORT_ID(sdev), attr, patterns, actions, error); - if (flow->flows[i] == NULL) { + if (flow->flows[i] == NULL && fs_is_error(sdev, -rte_errno)) { ERROR("Failed to create flow on sub_device %d", i); goto err; @@ -150,7 +150,7 @@ continue; local_ret = rte_flow_destroy(PORT_ID(sdev), flow->flows[i], error); - if (local_ret) { + if (fs_is_error(sdev, local_ret)) { ERROR("Failed to destroy flow on sub_device %d: %d", i, local_ret); if (ret == 0) @@ -175,7 +175,7 @@ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Calling rte_flow_flush on sub_device %d", i); ret = rte_flow_flush(PORT_ID(sdev), error); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_flow_flush failed for sub_device %d" " with error %d", i, ret); return ret; @@ -199,8 +199,12 @@ sdev = TX_SUBDEV(dev); if (sdev != NULL) { - return rte_flow_query(PORT_ID(sdev), - flow->flows[SUB_ID(sdev)], type, arg, error); + int ret = rte_flow_query(PORT_ID(sdev), + flow->flows[SUB_ID(sdev)], + type, arg, error); + + if (fs_is_error(sdev, ret)) + return ret; } WARN("No active sub_device to query about its flow"); return -1; @@ -223,7 +227,7 @@ WARN("flow isolation mode of sub_device %d in incoherent state.", i); ret = rte_flow_isolate(PORT_ID(sdev), set, error); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_flow_isolate failed for sub_device %d" " with error %d", i, ret); return ret; diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index e16a590..313ea2f 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -121,6 +121,8 @@ dev->data->nb_tx_queues, &dev->data->dev_conf); if (ret) { + if (!fs_is_error(sdev, ret)) + continue; ERROR("Could not configure sub_device %d", i); return ret; } @@ -163,8 +165,11 @@ continue; DEBUG("Starting sub_device %d", i); ret = rte_eth_dev_start(PORT_ID(sdev)); - if (ret) + if (ret) { + if (!fs_is_error(sdev, ret)) + continue; return ret; + } sdev->state = DEV_STARTED; } if (PRIV(dev)->state < DEV_STARTED) @@ -196,7 +201,7 @@ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Calling rte_eth_dev_set_link_up on sub_device %d", i); ret = rte_eth_dev_set_link_up(PORT_ID(sdev)); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_eth_dev_set_link_up failed for sub_device %d" " with error %d", i, ret); return ret; @@ -215,7 +220,7 @@ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Calling rte_eth_dev_set_link_down on sub_device %d", i); ret = rte_eth_dev_set_link_down(PORT_ID(sdev)); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_eth_dev_set_link_down failed for sub_device %d" " with error %d", i, ret); return ret; @@ -300,7 +305,7 @@ rx_queue_id, nb_rx_desc, socket_id, rx_conf, mb_pool); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("RX queue setup failed for sub_device %d", i); goto free_rxq; } @@ -366,7 +371,7 @@ tx_queue_id, nb_tx_desc, socket_id, tx_conf); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("TX queue setup failed for sub_device %d", i); goto free_txq; } @@ -445,7 +450,8 @@ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Calling link_update on sub_device %d", i); ret = (SUBOPS(sdev, link_update))(ETH(sdev), wait_to_complete); - if (ret && ret != -1) { + if (ret && ret != -1 && sdev->remove == 0 && + rte_eth_dev_is_removed(PORT_ID(sdev)) == 0) { ERROR("Link update failed for sub_device %d with error %d", i, ret); return ret; @@ -469,6 +475,7 @@ fs_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { + struct rte_eth_stats backup; struct sub_device *sdev; uint8_t i; int ret; @@ -478,14 +485,20 @@ struct rte_eth_stats *snapshot = &sdev->stats_snapshot.stats; uint64_t *timestamp = &sdev->stats_snapshot.timestamp; + rte_memcpy(&backup, snapshot, sizeof(backup)); ret = rte_eth_stats_get(PORT_ID(sdev), snapshot); if (ret) { + if (!fs_is_error(sdev, ret)) { + rte_memcpy(snapshot, &backup, sizeof(backup)); + goto inc; + } ERROR("Operation rte_eth_stats_get failed for sub_device %d with error %d", i, ret); *timestamp = 0; return ret; } *timestamp = rte_rdtsc(); +inc: failsafe_stats_increment(stats, snapshot); } return 0; @@ -598,7 +611,7 @@ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Calling rte_eth_dev_set_mtu on sub_device %d", i); ret = rte_eth_dev_set_mtu(PORT_ID(sdev), mtu); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_eth_dev_set_mtu failed for sub_device %d with error %d", i, ret); return ret; @@ -617,7 +630,7 @@ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Calling rte_eth_dev_vlan_filter on sub_device %d", i); ret = rte_eth_dev_vlan_filter(PORT_ID(sdev), vlan_id, on); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_eth_dev_vlan_filter failed for sub_device %d" " with error %d", i, ret); return ret; @@ -651,7 +664,7 @@ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Calling rte_eth_dev_flow_ctrl_set on sub_device %d", i); ret = rte_eth_dev_flow_ctrl_set(PORT_ID(sdev), fc_conf); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_eth_dev_flow_ctrl_set failed for sub_device %d" " with error %d", i, ret); return ret; @@ -688,7 +701,7 @@ RTE_ASSERT(index < FAILSAFE_MAX_ETHADDR); FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { ret = rte_eth_dev_mac_addr_add(PORT_ID(sdev), mac_addr, vmdq); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_eth_dev_mac_addr_add failed for sub_device %" PRIu8 " with error %d", i, ret); return ret; @@ -730,7 +743,7 @@ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Calling rte_eth_dev_filter_ctrl on sub_device %d", i); ret = rte_eth_dev_filter_ctrl(PORT_ID(sdev), type, op, arg); - if (ret) { + if (fs_is_error(sdev, ret)) { ERROR("Operation rte_eth_dev_filter_ctrl failed for sub_device %d" " with error %d", i, ret); return ret; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index d81cc3c..585b554 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -34,6 +34,7 @@ #ifndef _RTE_ETH_FAILSAFE_PRIVATE_H_ #define _RTE_ETH_FAILSAFE_PRIVATE_H_ +#include #include #include @@ -375,4 +376,15 @@ int failsafe_eth_lsc_event_callback(uint16_t port_id, rte_wmb(); } +/* + * Check if error should be reported to the user. + */ +static inline bool +fs_is_error(struct sub_device *sdev, int err) +{ + /* A device removal shouldn't be reported as an error. */ + if (err == 0 || sdev->remove == 1 || err == -EIO) + return false; + return true; +} #endif /* _RTE_ETH_FAILSAFE_PRIVATE_H_ */ -- 1.8.3.1