From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10073.outbound.protection.outlook.com [40.107.1.73]) by dpdk.org (Postfix) with ESMTP id ABA0E1B2C0 for ; Wed, 17 Jan 2018 21:20:00 +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=V0hmMbCD+cQAEnfJ4e3B6TzQyMoq5+cpOphy9BVODTA=; b=Axpoi8gRS4IsXbxi0KWD1XhgfW9r+/hK+KkDQkIsJzuLNlTFz0NFVmyvB06WA50UorRbJXeM7/YgFxnaTufXyNc1IQI9VfyqCkiARKMwoNTKg3ONSmWTMkvBjVPlrvSZwma7vQV/xkZRzKnb5CzpWW7YVdUCPQJyMqxHY4vezXU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3799.eurprd05.prod.outlook.com (2603:10a6:209:a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Wed, 17 Jan 2018 20:19:58 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org Date: Wed, 17 Jan 2018 20:19:17 +0000 Message-Id: <1516220357-13013-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516220357-13013-1-git-send-email-matan@mellanox.com> References: <1515587465-9304-1-git-send-email-matan@mellanox.com> <1516220357-13013-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR06CA0129.eurprd06.prod.outlook.com (2603:10a6:7:16::16) To AM6PR0502MB3799.eurprd05.prod.outlook.com (2603:10a6:209:a::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1752a6bf-2fad-4972-0fbd-08d55de7aee2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3799; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 3:LRdP1tN0n1ARNyf8DMfRaCSKPXWxlKZ+hQRJ9XB91tYVaFKy7jcs2hjTLkEOdq4au7zQ6OofWFDRV6EZA3RbKZ3EN5QXciZjDybQDF2HWr+cCKYaxapaiqbmj0ZhrRdE/CXZOgtRmu0VrYYvzDsAH0EmBDS0108zW7gS2LdIyMeok1WBrUq21ZwhRdAvBG609J9eoa2TZ1i83ZrW7aI9IfGcDViyhFNn77AxaznMN8lqAoFMiQsB9th/Vqr+Wsnw; 25:9CghXHRtbEmVrgCfvxDE1veQ6l2gXwwZU8I+Zjk4CU5vKyWtrmUXdwXoWTN7wQ6AUixXSyCAeITHslvRvGSlJBlm9rrBb/1sfsYzl5h8/0xZAbWpgrfJdX0du++dGeQqOlOKGK/hH92deWOOzJRDuKVSHJR07XASjXu12q5/wCcXJh3Hh8kSheppEvvwWCYHzknP2C1x+4zreLAkFVXdicMawOtC4OckmVSQ6px2dCsmgUopw7P94oSNHVvd9tZxswhkkGx1GU3RzcfM6PjijaF1airH+Is94S2xfopCQ4uXCTfE36CYP1g0gEbg7RbPgeWsKHyII4iP3p4V79lL/Q==; 31:xjRvNFzqNhaJPmdXSTbmNh7lqew7SSdSfZId74CgVMnHBuIm06xQzJTgSujehLjlEMyKu6XCfmt770iA4WObcEVJUplV5IUN19oMT7y/AgX2nWrXlDi5/wpziipvdYXQpvVm4+Mf46EFvFJr5sojIr6qq7bKXMwedoUYys3Un5i2Ax7o3ZU+iIQHhpVEAFKbEIVBeyn114IaBNcQx2pu3++eALf81tV8ObnKTQehDBw= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3799: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 20:idsesaO4SNbwLuAYRSFV/d/GG72oYNuMPnaY/W5PBpTLeUBAarBk6zktQ4pphuSEXnxwDp9wRAk0cG4QbDEOvA35+IBRCv04jytCuYO6U+Q0Fh4yVXNloQTAThE+miCv9zMpHxtPI0AVaJhw7kefk5nazi91R3ysPNI0ZbBUOW5ptmclMlPcbPZmZqhzdgYNBAlnzptITkGHeW2pmt+0T0NSQNJwfL397HzWAElcaVAO1RET7o0Hrm2Emhorz8mAO8XNRvuv4LBK0/MIEb7XB9A8c/J56hA/cE7DxAbIwO67Fx/13Jwm4dKPkW8pLTOCzTsOeVy2hE/5q4XWQT9ZGLC1YauqY3AcJhcOwUaZvqiu0SbAZxeWOW0QPyDpwu8DAm6brMBtzQF7NbgqMiUkgC0i2Hbh5USL3Vw3Dop4P7bNsejqF5pvCmVjUAHehTnEkGtTKlj+GFour290YWx7uVQI9RZy3nfaQnv99879y5HfhrSqNuYabEBLUXIWqMlN; 4:MaKxXW8VNPjS0ULfG3gbmU+WI8in2m/MLipUXDksDv6OLErillkmTIbb1ZSl2w9/qbXd8AppHKJ/18LEw5NazyXiUSTd4Pa1xJfjN+0WL9nSm18ZUy+LKsCl8j7kJM/8qQOUHqTmx0xYreCO5mNS5ljrIOvA4dISUQWpFfa+1gVGACt6VucOoeHpwHuI+XJ3ozowvJNqpFZY8r2URhXuG2hA9Aoqz6rq0KeqpkubusCsxQAu1nF//++EMPJ9ne16BpjOZSIME+eN5lBNPLOUm6sPPVTfWE2AMaZ7rDIGyxy6IyVqvXv0C3c9AlP1sTyK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231023)(944501161)(6055026)(6041268)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0502MB3799; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3799; X-Forefront-PRVS: 0555EC8317 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(39380400002)(39860400002)(396003)(199004)(189003)(51416003)(6666003)(50226002)(53936002)(68736007)(106356001)(55016002)(21086003)(47776003)(16526018)(2906002)(66066001)(105586002)(97736004)(4720700003)(2950100002)(59450400001)(478600001)(52116002)(305945005)(48376002)(50466002)(33026002)(5660300001)(76176011)(69596002)(86362001)(3846002)(7696005)(7736002)(8936002)(81156014)(8676002)(110136005)(16586007)(25786009)(386003)(36756003)(6116002)(81166006)(316002)(26005)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3799; 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; AM6PR0502MB3799; 23:tTuPMeS2PnDsFYNgFRiC8odwF9J84yFnvQOE0Eu?= =?us-ascii?Q?emBSxWJOSNzKj7ONMEt0g/d/qtXAqhRkfSRPZObDbG+6GFJTSKDEjii2PoTa?= =?us-ascii?Q?0jftEStLiDCCT5kTlYdiS20okKLqxY+FHUhm+vnu7DyuupZcZv0mvbQiTXyY?= =?us-ascii?Q?Pn6U3naeDkR+F6MUrD6ary0KWDqO1PYTRwmJ+NI5KnneZU4t03sGX2FV1x3O?= =?us-ascii?Q?HsCs8l13tcI8fs7cVBzCUx1S09Tfcle/C4kaBYw5vJI0i01nkG9LA/IDzt0Z?= =?us-ascii?Q?yJPv+05JtO42mMTZVz+67pMupeBWYopjCVceZYoEeVaQ3/EdIzhYDuXuxFV6?= =?us-ascii?Q?WTUSVeMdk0YSlgNCmKrcPBzge2MLZHh2ntQhK698DhbJWScwHrFjDBKCrsVg?= =?us-ascii?Q?79p+MIIOytSydz5pfBa3U+EHAKhgwl4kO3prpgPSYWpdcn854/XelcCk/kg3?= =?us-ascii?Q?g2MXWR+YeJr86rBi1MKYW5k4yzPR+7ArTFGdkKocr5RIoYtCYj05lkVHfsZN?= =?us-ascii?Q?dGYkzvsyCSRSQuSeF+9w2s5nrfQugtOHt4RBOYVbo0A0O/GNqO6x4hqVuQZP?= =?us-ascii?Q?LtWJnu4tZaftqaIkqHk+OEOByJOmhL5wh8y4Zv9VseQxMvwLzL33HgfLcu18?= =?us-ascii?Q?/x6qj/0Y4eGTN/516GrDZp+wUOm0B3wS8fEL2QaZChJj3kY+NJ7KFVVo7PmP?= =?us-ascii?Q?jwHViwk0p524iaz4d07M2wFI7SMJ9eXKhk3x+JDxT7ZWESMkgeVR+lddqP8g?= =?us-ascii?Q?S3QtMPOmRY1Ekqz9ZyXyMn9i8Cl92dTL9sm23o0Lm2/qRJqI6JeF7AGxQFPc?= =?us-ascii?Q?E5XYgNR929qRRfFjfmxa1e9Nlfu5Cunv5cvqr6UEaKmQxdxsbdh4oPAg1FFv?= =?us-ascii?Q?h8QqR+tsc7p2FHL8kaUmDrSN4dlhiz+5FX+OMXnSzOZb9ur9r0gM0fD8asJo?= =?us-ascii?Q?qzfhnJh/XtimIkSZ/kMQq1+Mpn1Kkr0T6MYoIvRVaO/oMm7l2rS75LpnDlBf?= =?us-ascii?Q?5SsyXzacZ9UtbK2SScljUJf1o4m1uMH5MxrVSKCpunGZVV7owfxql9B4wc6G?= =?us-ascii?Q?s2dWxxelt+V3hx4qvGSPlywJGD6DcX7t//P1yx1FUi5g917k0pytHjGIdm/h?= =?us-ascii?Q?oKN+OWIZ6ada4yGvgQP5gDwknJWhmg+GwYcAGVx6RgThRdMce7zYdMmtogrE?= =?us-ascii?Q?Exn2/i3GPf/BEhV4=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3799; 6:ZfhzKhnfgQq7ns3QfRp7jbhDpbOsOCHxZvkLkFH5Bvp78DQg7DA+MkYGTJO6Dh0HoBWUW6mcwoH0UXaxMdhujYdMtE1bwhZa2VV25PjSpdBb/Xo3w0Ka4oev6USX8I6Lz1Yu9vy2+2Uo+WMFHfw+Wp2aZ3ellSrT0TbRgms1vbG8TwYyjC9Ow1W7U3XfGzORdhFxablIWAeJrHgo9fJMgaS1Ux74QkBCdtFSz3MhGiqKbW7Or0dMqSLVsCWZD7GF1LSNsZ1bjjxDkovC2iHqN6Sk6KuGpG3N8Uz5PSsfr5z6R42slx/kKcWGEl1p89u4x00mYMnEAolSL/FW9QJRRuTjmK38Kj8dALPFF/0Xd2s=; 5:YkmrkX66k3Nft9VtIO+URKTHNLNqDliNbHSdOrRQo+Cj5MGks7L4hlb2EZYelBOvh0DMqFvlP99Ir98OAeZHHMqM6gkquD5ENy+BUpBLo3xfUR2A1xG9v50h16EZUkCGenpCcukECC0PJkcsI+SauKvqTiTMGZsx7GNhl715sQI=; 24:r90f5q6ld7X9GmJ2j8lUOx9F+hi/apHF8Bif/7k5OVL51DYyagSpDEBq0RdE854nS5v5TxnO9v5ARN+OAged8xYhLWs24A7ssR+BKgSUQak=; 7:Ny16xh6R36mSo5rW4qfjBcTze/tlbqJFbC796WtpKWZHhe4fAJhsl1KKsNDFBEJvcdMnymRDeQ2PfdlXZvYvr9STSyvSZ8fztVCKf+rw4uVyTH2CKwfNIbUuWdmix+JPsRoI7rrxI8YqJt4WAUqQ3s7MjqLPESgzgzJLOv9zVcpzZ3dfww62vMvQCovo06NmgrHS0pQRtvda61p/zyrQNhsjaKvmHAJafUMuVVR4b2LktcmiZzE/48Hn/k/i1ybI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2018 20:19:58.6453 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1752a6bf-2fad-4972-0fbd-08d55de7aee2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3799 Subject: [dpdk-dev] [PATCH v5 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: Wed, 17 Jan 2018 20:20:01 -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. 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 | 11 +++++++++++ 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c index 153ceee..c072d1e 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 ((ret = fs_err(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_err(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 ((local_ret = fs_err(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 ((ret = fs_err(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 ((ret = fs_err(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 ((ret = fs_err(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 fe957ad..0976745 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_err(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_err(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 ((ret = fs_err(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 ((ret = fs_err(sdev, ret))) { ERROR("Operation rte_eth_dev_set_link_down failed for sub_device %d" " with error %d", i, ret); return ret; @@ -301,7 +306,7 @@ rx_queue_id, nb_rx_desc, socket_id, rx_conf, mb_pool); - if (ret) { + if ((ret = fs_err(sdev, ret))) { ERROR("RX queue setup failed for sub_device %d", i); goto free_rxq; } @@ -367,7 +372,7 @@ tx_queue_id, nb_tx_desc, socket_id, tx_conf); - if (ret) { + if ((ret = fs_err(sdev, ret))) { ERROR("TX queue setup failed for sub_device %d", i); goto free_txq; } @@ -446,7 +451,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; @@ -470,6 +476,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; @@ -479,14 +486,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_err(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; @@ -599,7 +612,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 ((ret = fs_err(sdev, ret))) { ERROR("Operation rte_eth_dev_set_mtu failed for sub_device %d with error %d", i, ret); return ret; @@ -618,7 +631,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 ((ret = fs_err(sdev, ret))) { ERROR("Operation rte_eth_dev_vlan_filter failed for sub_device %d" " with error %d", i, ret); return ret; @@ -652,7 +665,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 ((ret = fs_err(sdev, ret))) { ERROR("Operation rte_eth_dev_flow_ctrl_set failed for sub_device %d" " with error %d", i, ret); return ret; @@ -689,7 +702,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 ((ret = fs_err(sdev, ret))) { ERROR("Operation rte_eth_dev_mac_addr_add failed for sub_device %" PRIu8 " with error %d", i, ret); return ret; @@ -731,7 +744,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 ((ret = fs_err(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 54b5b91..5cfb327 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -376,4 +376,15 @@ int failsafe_eth_lsc_event_callback(uint16_t port_id, rte_wmb(); } +/* + * Adjust error value and rte_errno to the fail-safe actual error value. + */ +static inline int +fs_err(struct sub_device *sdev, int err) +{ + /* A device removal shouldn't be reported as an error. */ + if (sdev->remove == 1 || err == -EIO) + return rte_errno = 0; + return err; +} #endif /* _RTE_ETH_FAILSAFE_PRIVATE_H_ */ -- 1.8.3.1