From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10074.outbound.protection.outlook.com [40.107.1.74]) by dpdk.org (Postfix) with ESMTP id B5CF01B2CB for ; Thu, 18 Jan 2018 12:27:47 +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=I5jQYLw7ucQRigJucFHTjSokTaWU79sfe8jdq+saNus=; b=p0FoA2uVG3Lu6bEXECTCfun2hurloElMXA5Fj5BW9AsEX8Du2bRpy8mYopGaMwwloqan+9jVsFkHK3eehrJb5SpRNVVcebk7PfoviFuxbQHg3ZlIyQtsA+g1oNCulG4195bsVz7nIYYfVqCnRgmHXOuelpXfoXSZME0xNES+VQA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Thu, 18 Jan 2018 11:27:45 +0000 From: Matan Azrad To: Ferruh Yigit , Adrien Mazarguil , Gaetan Rivet Cc: Thomas Monjalon , dev@dpdk.org Date: Thu, 18 Jan 2018 11:27:14 +0000 Message-Id: <1516274834-19755-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516274834-19755-1-git-send-email-matan@mellanox.com> References: <1516220357-13013-1-git-send-email-matan@mellanox.com> <1516274834-19755-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR0102CA0042.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::19) To AM6PR0502MB3797.eurprd05.prod.outlook.com (2603:10a6:209:a::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62e3650a-52e7-4188-c32d-08d55e667f9c X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3797; X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 3:8136G1EWcg23x62aSnsM/vcOKjLnLLhDGANleZHCGw1z8hpCx+Gy65HxUnw3JIVE1fuO/LtDadsEl5QNbBsHKikYmC8uP24EAK6GAqd825cfoPLt2rEsWxm+ml6TAtDrW1dnSYs6RA0gwbTH4rGFM7r03yXpyCSrIKSTx1ZzJhqokP+PCVb7bC2Ed/ZuRx8Dz5YuM/HVvEpj3gGBIx3Kg00Ob93SD7rfm5+Y8XjFouIs/PvT46sI+Pl+4uwrJYI5; 25:6FBSO2tUB+D8nrIBrvmJI/OeJX7IFUGTJatPhjqg5i3FlA3s+arcSUdFBb6q2um0T5r/K+uT+gQ8pCVZ/3a1umMKk1hm2CY4Ml1AON2nBVnA7nJAsaelb5M/9kkzSAJ/8e8Onlr9kxtStVIMhd+Z8HKA+uzbXszHy0EIiUXtIYeaKlCfQCS3Q4y4UX38CL6JFxwKixmuwk0M6uyzGwT9RLbwwCcma0atsEZUfO9I2ZHqS4+wtWSRrjdrGfXhaaMcnLGYdaWKxbcHKtEAb8+irnyeXOhRYf68FZvlgiPYXdLvimoaPvBwBKXsg0mNHXxHp3ppXG3ZVj3w93R+P7Tcrg==; 31:jGWpFxvnlowCL8NT5FL3P0ErFa8eQrmoRksgIWBXLPtlD9fZbK2Ga6Uvil1ftZoXu1W1Bg8GyAHVf/emaHkZZ23OXQLF37FMvLig4nsZ9TxalGF5aXtOEhBFw8hDV53uqhnPsFSlRd9ti/E/pHSrYc5vHPtXQ0uqUvAZ+H26OUG5y2raf/2u2J5MiydiR8JCDMkelZZljEdE1uVIEltSlDRQ2Dfg8UfPjeyN0T+e7RM= X-MS-TrafficTypeDiagnostic: AM6PR0502MB3797: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 20:uAKAv1idrgzhgAty+nEUvMGfxduCFsRrFxDKAcVuo40vwVmC14maXxppx+IUQK/1czelUxNssZnVXYXD1MkMxGjWR4jeAstwLNR+SdNtXyQIEE07/QVf+LzwJ55NoaUNHnTPVneUneoay7Xc6A8itHy8+ehqcEk8dsEvWrOFI87KtUboB0FkLkjKcCnZirswEE92NracQTHkwwqixB/lYeLfapZ4RxqR6WYVSlDmiAwMCwrf1FZxyULrqu8jKzO/icP5CaXJitUuCmoNRwUTSPwV5egtPdtK3T+V+x/w0o6yZzU55IqgDWEa4qEnDt9SNerE1x6QA6082dgYPpbDAIhu9MxQ92hUAyopVZa62xwQ722t4WAO4Pw8mlim7zihNq1chL7O+0hvbFAN3XrA8ihjLR2dOGGlm7JtFQ2CySc2fy5aPwnqHijLQmLTlSGYxlBxFaoPVG6MZqmfmlrIycpHxL8G7HTPM/xDRgksYi/kINxGSFxEW1Zsya8rof+u; 4:7oH+Av0gOhb49UfbHemu2sYikgDHob/U5QYIs6KK6FpRC8KO2VJpq6Pa6kPS7pzEOznVO1b86Hgl48knStj9xSYqi10myqDKBlh6MnLslfnQau1moe0v8jqcUILHOETJmbXHYKB0C/9sOQ1JlM/49Qdl8m4qkhzN5PW0+siNBWpB0Cs24fEmd53fnnuB0X48XW6CdKI56OrLgLygUAxggGMpAvh4RqRxITe0DHD3QnZLh7seW0u+rTAl9lGZ16Hfdc77OoI4yTCRmEJIqi9lfxwykJgOOBYZWoYdd2VoFv55woVqDJ0scjfcH0uYIepT 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)(93006095)(93001095)(3002001)(3231023)(2400060)(944501161)(10201501046)(6055026)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:AM6PR0502MB3797; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3797; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(346002)(39380400002)(396003)(199004)(189003)(53936002)(6116002)(76176011)(386003)(4720700003)(59450400001)(26005)(7736002)(305945005)(50466002)(66066001)(2906002)(47776003)(16586007)(8676002)(110136005)(478600001)(316002)(25786009)(21086003)(2950100002)(48376002)(6666003)(51416003)(52116002)(7696005)(81156014)(8936002)(81166006)(4326008)(86362001)(16526018)(97736004)(68736007)(36756003)(50226002)(5660300001)(105586002)(69596002)(3846002)(106356001)(33026002)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3797; 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; AM6PR0502MB3797; 23:DY2xeWqoWJwcxA+F6yVOZA9fcEcrtK5rRVHtGhf?= =?us-ascii?Q?e897Xb6yMISrpIERsIihe6tGV7B2WwvDDTP0CxnoA8OzMnf29bLidzfLo/RO?= =?us-ascii?Q?C6/Fnc+Q4w034KVVjy84YE1SzhOx8zjVxYfvuHph6UT8Al/Uf+v/NNlsli6N?= =?us-ascii?Q?JFfpzh93HAcKnxT0x9tEazWg54idJEUzI0KkgKyPZN/YIREtLBXmhlyZu1IO?= =?us-ascii?Q?Vb4hgsywfQVI2kUkdboh/wZVU5iWygeNWYfljQE0Mdyimr7s5y8dPuq00pTs?= =?us-ascii?Q?wYtsEjh/aD9Mzhds20tGjobVnuES369Uet8dZIZo+rUlMJT6vy1E+c3eC++z?= =?us-ascii?Q?vf8K3qykCAW5ZbRzyX/ovIY3ZEWMRaeLZgbrj8KkzKfrTwGFjNt2YIM+f+RW?= =?us-ascii?Q?kEyTWd/SIIMuhyQwRasZCQsFGsoPzGXTLEDNfAc9NmeqL3+3viL+ycRgG1G1?= =?us-ascii?Q?p7ObRPLulJTTweaepPZbWKyZPCklU1d1RsrIV/iVmNPLsuhRCHmZ9aedj+Fd?= =?us-ascii?Q?llrUGnv4ve83aYXYoFkSxqjR9qylKPmMBZJHZaJX0lJ8q766pq5/fkqYC1cm?= =?us-ascii?Q?MLiXrvHIUg1nGhH/XX62e64AcJhrRMI1bzS7jRIyQINYJBg6y7qgbK6jsHeh?= =?us-ascii?Q?10CNomNN9SDUAiXFFg0GH5/uZobsecpmlHhFzinLP6hVIhud5qrBmPLX9SCI?= =?us-ascii?Q?Vnf3OWFBLOpLUL8mApBFindCtuLRbonPjfRoLGc4R+Ma442p00Vqd4H1o/5v?= =?us-ascii?Q?Ky8nMqU7e7RG0pM62GKACSC/nppFG4fl0haDYh3WQAd6PpYr21lboHaVSFVW?= =?us-ascii?Q?01l43QZ+dUzlLffJe1DKBo2iNrRqwj1urxOMzAYG5H7Kr2oNoMWDI93vZy6K?= =?us-ascii?Q?pY17EsA1jsAHnThdq9DN+oeT6GnygFHsmit/2pkovJj+D70Hg0615NYwVd7f?= =?us-ascii?Q?iczrQge3yOQLkgbK/t8f4ippPGoZb7GsS52K6/KFRWbThH7hWIi3oZAUPv4A?= =?us-ascii?Q?eiAcDOmuV0Ua/EcRfWYPmLloaQC32fzNs7KJNX9Exd56f/RlBKw6z6Up4+yZ?= =?us-ascii?Q?wG73KxTHetNDoJiNrrIF3s/101snGeJGYTJSMtIqkF0aujU/torj9J5EYirh?= =?us-ascii?Q?VAjbGQfspRd5vbWDywm78XgV6T937aep08K+9dXJ+LRichBkDbH+iPfQpUjK?= =?us-ascii?Q?KKn/cw7MvatRlPU4=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM6PR0502MB3797; 6:oVZJp+vQ/3kasmo3alEKywyRLFSJxGR5Q/W7IWQMgRmIN/cr+olp5wV7T3gBP5j/oCJYUrE2CnAz5asR3+HKmN5pALt+lpFNXlK2K1D7rv/7OgisqwmAHNmavnIuou90yzN8FhZ6PitOlctwFcoV/S1qXkTB840R1lMngnhgWqPTnqL9kGOK5PJHavyffz3sBRIREkYiS67wxPWX+7WOTaxLDInc7chdDSCObSktXXncRXeodCseWe1jnkgs9gZQfAqEJ+CRw23ZvMqNbGsMWoy2EfKUYX5vQ2YskITErAMt+TNKGZwRD4oZyloFP4+v3PJN7efVXhwW4IhAVgeu1m4wVSQcF/LD2kQ5q/F2Isw=; 5:Y/EVGZsFJMIIZGduUR+TFCxyqVOOPKW0Tekx/llbt/clsqxplL+9+wvMBMlbLztDZu1blMfR8dxZYh/CFzLfsFThHU4Ud50qeFYKZGJNzeFW2y+DzXJuIc1VoRf+z/TAaqTV+mT7O3L30dUvlo3wn6RUNkg6XpNacevBikGCXC0=; 24:4py2hMO6kmKoedD3D7W9fk4rM6B6h2pJjuUHY6PWlhG4oBdOkP4G5yvDXke15pmxkCquubTmoMnxt9gDQ85HkxmtWJtjtv34fJvV8G/meg0=; 7:/W3DJ2crnGmSFPZJ1Jb9LKI92gplBCJuxoeGzbhXyObSDlx+7zXVVvYK7bRhNBQIrypePrXsnR1q6qpgx0mdPGRM3J/DPQfPxdtpUt6mO8IDlrynuqGvq/wpdBTHRX/Npof5Q0UDuJNaNXY55V5aEoLTb5UoD2QPODqAhBShSJB8Mx89Vw8kSL1TkvYYNl2k8/sS2e1bSE1hBEGfbFZL0DtxEfPyvpeOJc02i2xdee2OQmB8OTbPThTMG/jIO0ku SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 11:27:45.3917 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62e3650a-52e7-4188-c32d-08d55e667f9c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3797 Subject: [dpdk-dev] [PATCH v6 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: Thu, 18 Jan 2018 11:27:48 -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 Acked-by: Gaetan Rivet --- 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