From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0086.outbound.protection.outlook.com [104.47.1.86]) by dpdk.org (Postfix) with ESMTP id 91DD81B827; Thu, 8 Feb 2018 17:34:34 +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=br8xdqC2fnijHm9w2q+K4NGx2uQJuEaA8Q6zlfpDNnI=; b=u2i5RJizJZBJ71/VTu1I6dCxMc2sXSYIDFVCqI5fobHh1GPp/+GzQE1LY/vBH89n7p1aiVTg6YL2l0rcKhwIK4/DqT2ZH3jSunv5/PYBWekmvqtw/29nl6xphDxN9vZoPb6wGH9ZvsI4VIbI3c/jPCJsous48EkjkFvl5h8VNWU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR0501MB2664.eurprd05.prod.outlook.com (2603:10a6:4:80::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Thu, 8 Feb 2018 16:34:32 +0000 From: Matan Azrad To: Gaetan Rivet Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 8 Feb 2018 16:34:13 +0000 Message-Id: <1518107653-15466-4-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1518107653-15466-1-git-send-email-matan@mellanox.com> References: <1518092427-4333-1-git-send-email-matan@mellanox.com> <1518107653-15466-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR0102CA0023.eurprd01.prod.exchangelabs.com (2603:10a6:7:14::36) To DB6PR0501MB2664.eurprd05.prod.outlook.com (2603:10a6:4:80::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 238687ac-9e13-4856-0d33-08d56f11d591 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:DB6PR0501MB2664; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2664; 3:L20usod8aIr2lr6az3U1v5xcA5YWxt19e4Xph+Yy2T7zbaNFUPMzkpkWOWQ7sO3ip1L0WSiZ6H4Xhd4FAUzuxIJWdyq7RcaufA/C82KCQaffK++OrqwOq75S+O2Ce4ME6qc9hdYUmK8dl7aLc3eZphTxTXxXaL3zMNlLg7bqXabvrFAi5M7Pd11SsAVRKZ2K7IqsKJnTb6ljjE0e8bzLPfAuPcWhoPdIRByt12qyKVG9iqrCM8A9RRa+ya9SpWKA; 25:lypBpIvIsNfkcNfRieSD2T7YYnFZVh75miWWPGYiW3sJVyE+WZm7nrzvUMLLo2GurZdmHq5f2MtQXhIEpDpgbwqgj05Itk3On+FuUg9neBor81zNALf24r/KgX2CqZaZ6qg4AGQi27LwXd9MEcT9zTsjH6rZgoOMwVxW9dFqCSc43PV0xzhUay1mK1Otn5Jd+Ro2ki9YCzekDBo1AHORXeKQtSXWK9ig6lbmSHqzS5KVfXt/eFchWIrlOpw/WC5SwjnKBc1Ss9JCylE+2eBo111jINdGLiK5kFVDDuBioOIrQYlTIqTG/m4NhsI9fBAUagMQOCexv5KFdftfhvhFUQ==; 31:/4HPPmpainPhYtR24OZnt9bJ6u6feDtZAZwLTR643IrEZTtqXKiXZDaj9K7RzWAueOL7xfa/JdDTu2Y3j266zieHgFPIy6hup89kl2BT3ZCebKMX6eQOT/dxV+NUR6Y2C8/cA9DtfvBEAfDmnwsr9inGpAWUKRKSXvUMdQIs8abEhJXTfm8lWCyn0HxLryRV1I9UatcAkodHa6VypTqEcCJhoaR8KbGKUqcbc6p0OTI= X-MS-TrafficTypeDiagnostic: DB6PR0501MB2664: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2664; 20:aXf+CkYZNDrIFQUT3qGN5XxShV3f5QW8yuNUiM+W+U8L66GBix1m58P3MURL3l7B070rq0M8O4KF94zccHw+Pq+QZtaTMlciKHGdg1ZuisUkVzvSkeF6YzmY+NqsvTlvV/UYVgofP+BeYOUJa8UlAZrjvRYNsooRgC7OGFIiW7lz9m5uQvjp4zjrP1tnypaD8KxhkR5RprPjna4ovWUUAY+4dEsJiJsaWOWEKpY9+82TLqQLXADKljn2//NcJqrLVXjm2OibRyxGMIExtTo6XS+aBBs5wiqUbEEe6hMq0ZRGvPYGl6jlh7eZZIz3QYfv+i+K/JsXdbFS/JchC0iIN+/M7wcPwZnke2/EVxlbkxGG96hZdHs6HNmJIXK06g8aXd1SMhoSY5oN2YkWwdcGrANmQw1aGiz2SIoE6XHqfU9ps7Pf2310SGmVsdzMv3icuMa/m2N4r0ANxb/jhE2zBaOlZ4TIPErn+wojyLHJHvaAkcpFCfzC6+3zzv/wkGg7; 4:GwYH0/wJaHzKNm9Vp3gwW3hqoEKrXf4+tvwSt+MZyZFhNSYNDbAZCg7BZDNieu0CXHxpk2B4JbsW9mfAPNlv3LVFwa8L6EhHOPssQIiigF89/Qsmm6BoVdP/paRwI+9TCmu4eAVzAREY7vW2dJ7iuiePaJ5R3xRpdIRh8xRRt/5VDElu7GfqprADvP4yb51w1hZaNn7/VzfgjPluioxjEnUXC36DBaCaClI/QOHC4fTSe8cOJb4Q5jPAZrHveZlFdMRuJcYG0vTsxQ+upZemXg== 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)(3231101)(2400082)(944501161)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041288)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB6PR0501MB2664; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2664; X-Forefront-PRVS: 0577AD41D6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(39380400002)(376002)(346002)(39860400002)(189003)(199004)(316002)(6916009)(2950100002)(105586002)(3846002)(6116002)(4720700003)(6666003)(478600001)(25786009)(47776003)(5660300001)(2906002)(106356001)(16526019)(16586007)(66066001)(186003)(33026002)(8676002)(81156014)(50226002)(21086003)(86362001)(36756003)(69596002)(26005)(8936002)(50466002)(48376002)(386003)(305945005)(81166006)(97736004)(55016002)(51416003)(52116002)(53936002)(68736007)(7736002)(7696005)(59450400001)(76176011)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2664; 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; DB6PR0501MB2664; 23:ZNdpgOrRf+Oyx+Q3MqReo2Sp85SCJzxCwby7MS2?= =?us-ascii?Q?Z7gq4Uml7bbW1Ju/FZtdi3kjx5h+ZXF0TDJ8BndBisyjnVq4J5MHX4tEDyye?= =?us-ascii?Q?kagj3KBMBxqdsApo8kfdF4gZv+/FS4o5HjslA/eBHSp6tHq/r67Q/7zlhB7T?= =?us-ascii?Q?MNoYtxMiz14KCfr4EwYOAtOABaDIyaatOrjnxrQHSyiR7A2skq4yGoPUlBHw?= =?us-ascii?Q?IVBD21FLlqwkpY8NXwPu7/MJO1pVSrOt6QJ/WGN84f097027/PsS9/o5d+XQ?= =?us-ascii?Q?kcYaDdx5At6KZiNKXR1/F55+VUkuLrxkwgNdWD6FP6FrHOf8hOrVXUGnfX8w?= =?us-ascii?Q?GlEtsHIsWkNkWpvG/127l/s8IXBSUaxmCahamU1MQl/Ljao2HzYAEC0SeIK3?= =?us-ascii?Q?V0M93t8urfBPFyvoad8QJrPXU44lcL01br/DDUp0RWDMHKws/5nSkfTMPxzK?= =?us-ascii?Q?3/geA5ABNMqpnGtMCgQUE6YnSQVjxT8+jLrh/rrfyYCcoYIqoyfyJC+5TsAa?= =?us-ascii?Q?osteAv2Fj8yCW0H0LcAZ1OMnUwJlFYHDg4Y6NWdnPrNNAxCnxkQaPdNpTZOe?= =?us-ascii?Q?g1Hdu32lZ+Z20bz6Bsb/htHvYOFb+HKCJqLNpqz1laSBqkVJO5tHbKeT0z4u?= =?us-ascii?Q?DcfeoCC+gX4ZWChOLOm7Lc8GLzLWDjzhZGsICpu/Usej3B+xXgZbVgBVtcAH?= =?us-ascii?Q?o7w6OMeT60Sl7j9amHkpK/K7CeedHtCNN95OrEvIl6aDoOCC8yWRTgirXnfv?= =?us-ascii?Q?KzvjJgxDbo/+MJJNbH0SJ4r8H54pjuBqtGHU1XLcxaghakwzvSWRsa7BYkea?= =?us-ascii?Q?/7M4k/QOnUfiRfsxi9SdDfmQyF0FHE6RsPGLWn6fud7d5tQ2b9a+m6Sp7GmK?= =?us-ascii?Q?yRBcqut6Mrck/JMGBvo43zoyYNlhtP2TOMBO/ec+KpMOVPB5IDUS/aqLTBDv?= =?us-ascii?Q?I1HYx3ZxmJZ3cq9lF/kYY2gqLZS1APDYKuBUeE4zHS/DRZTPTQYtUv9Vi34M?= =?us-ascii?Q?O8AwSLKpe4rUuNSmW6qsQQWbFWERAR36ePOMYv5Ms43yoXWHu/+Vs4/6WsJr?= =?us-ascii?Q?R+oC9kiUaQtttH+Kbpdg+qimYqVC0jp3PZ2tIngP/GCBq/g5wwsCoySfQ5bP?= =?us-ascii?Q?9Xig62DavICyOAwMf7zuDQt9zme1R7IOIW53V47ohImnQGgdQElv+ARc47GR?= =?us-ascii?Q?9oWfBHCPYj8Us3uu6IsE+cjYoSqhx9vKbD2HW?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2664; 6:qCWAPB//9+yPKjYZ/JhnR2JphK0yewKLZatKJV3t1H6qZ7p7BgU9GMrM0uF2AAguh8dpjmk/IcnLFDs6PaYRoGINZuxD6J7KdeaWf3sHoPSop1fVtoK3bagZVMp8+INktxRWb5CrluUb2bgdrBjNsOC6ODFwOT9J+QIWZFtH5DlMNuWkiDw6bJVixwvSEe+kGsIvNSIx5tEcngF1WXAT7fkepPZtpr7558e8jL0lYiLhxwe7Ueq4utJFojNWrhVOHI+4MW69jeJBoPViuygxdVmjfhole7E5Ih1EvuHm3rfhN+0ej5Vjo2snZ1Czt4qVV35uPlX7OqmHkf4w/wdZM0YTCySUqP50RcxDnOWHMdY=; 5:rQ8+jojOKfdg0gGdM0LQo5NcULpmvJq74doZX/viOAIwRNMn9lFavlNQ3ELFOY77Hxqc8pPim3LOzuXXDHbFKh7VxbT8RPuGzVQb29RF7PTQIPKVWQpVdjoX6y23VkBGCY+0xOXCcLxecdGqn66Icz6k14Zer2CyCusbhYztiJo=; 24:0PYcehTh7bsabvtiRUBDwabhvnL2qAEvA+/UcanDcWGcyrSm1/DTpeoLiCaJW7efZDuAtn/QFwzIeZJNVtsJBlTzI1xH/Jyd55dq9DZOo5o=; 7:kwj0j3m8vR4UF656/5Plm4RlyD+w8yYNiV+yetKVUjcCD/bao/5/HOfmXZnfyFpmDbOk5V7soCvz6+pmm/tTO/oYLQbw1eQYFzcmpWSu3MV7We5nFc//ukc4819ODXlX++cq2d/ux+K55oKA5HH5xQWHVf+2gpWpuWZMUK26C6CSljbBFmmrSzbJ4RykSF6PIwHDaDuOjmoQGfHKIE1HrGzRiRdHI6yJb6yNWBtgZwTrtonDQK+pc0Ze64hX1EYf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2018 16:34:32.2379 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 238687ac-9e13-4856-0d33-08d56f11d591 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2664 Subject: [dpdk-dev] [PATCH v5 3/3] net/failsafe: fix calling device during RMV events 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, 08 Feb 2018 16:34:34 -0000 Following are the failure steps: 1. The physical device is removed due to change in one of PF parameters (e.g. MTU) 2. The interrupt thread flags the device 3. Within 2 seconds Interrupt thread initializes the actual device removal, then every 2 seconds it tries to re-sync (plug in) the device. The trials fail as long as VF parameter mismatches the PF parameter. 4. A control thread initiates a control operation on failsafe which initiates this operation on the device. 5. A race condition occurs between the control thread and interrupt thread when accessing the device data structures. This patch mitigates the race condition in step 5. Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") Cc: stable@dpdk.org Signed-off-by: Matan Azrad --- drivers/net/failsafe/failsafe.c | 2 +- drivers/net/failsafe/failsafe_eal.c | 2 +- drivers/net/failsafe/failsafe_ether.c | 2 +- drivers/net/failsafe/failsafe_ops.c | 26 +++++++++++++++++-------- drivers/net/failsafe/failsafe_private.h | 34 ++++++++++++++++++++++++++------- 5 files changed, 48 insertions(+), 18 deletions(-) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 7b2cdbb..6cdefd0 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -187,7 +187,7 @@ * If MAC address was provided as a parameter, * apply to all probed slaves. */ - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) { + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_PROBED) { ret = rte_eth_dev_default_mac_addr_set(PORT_ID(sdev), mac); if (ret) { diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index c3d6731..b3b9c32 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -126,7 +126,7 @@ int sdev_ret; int ret = 0; - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) { + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_PROBED) { sdev_ret = rte_eal_hotplug_remove(sdev->bus->name, sdev->dev->name); if (sdev_ret) { diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index ca42376..f2a52c9 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -325,7 +325,7 @@ struct sub_device *sdev; uint8_t i; - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_ACTIVE) if (sdev->remove && fs_rxtx_clean(sdev)) { fs_dev_stats_save(sdev); fs_dev_remove(sdev); diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index a7c2dba..3d2cb32 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -181,6 +181,9 @@ FOREACH_SUBDEV(sdev, i, dev) { if (sdev->state != DEV_ACTIVE) continue; + if (sdev->remove == 1 && PRIV(dev)->state < DEV_STARTED) + /* Application shouldn't start removed sub-devices. */ + continue; DEBUG("Starting sub_device %d", i); ret = rte_eth_dev_start(PORT_ID(sdev)); if (ret) { @@ -265,10 +268,17 @@ uint8_t i; failsafe_hotplug_alarm_cancel(dev); - if (PRIV(dev)->state == DEV_STARTED) + if (PRIV(dev)->state == DEV_STARTED) { + /* + * Clean remove flags to allow stop for all sub-devices because + * there is not hot-plug alarm to stop the removed sub-devices. + */ + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_STARTED) + sdev->remove = 0; dev->dev_ops->dev_stop(dev); + } PRIV(dev)->state = DEV_ACTIVE - 1; - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Closing sub_device %d", i); rte_eth_dev_close(PORT_ID(sdev)); sdev->state = DEV_ACTIVE - 1; @@ -309,7 +319,7 @@ if (rxq->event_fd > 0) close(rxq->event_fd); dev = rxq->priv->dev; - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_ACTIVE) SUBOPS(sdev, rx_queue_release) (ETH(sdev)->data->rx_queues[rxq->qid]); dev->data->rx_queues[rxq->qid] = NULL; @@ -376,7 +386,7 @@ return ret; rxq->event_fd = intr_handle.efds[0]; dev->data->rx_queues[rx_queue_id] = rxq; - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_ACTIVE) { ret = rte_eth_rx_queue_setup(PORT_ID(sdev), rx_queue_id, nb_rx_desc, socket_id, @@ -493,7 +503,7 @@ return; txq = queue; dev = txq->priv->dev; - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_ACTIVE) SUBOPS(sdev, tx_queue_release) (ETH(sdev)->data->tx_queues[txq->qid]); dev->data->tx_queues[txq->qid] = NULL; @@ -548,7 +558,7 @@ txq->info.nb_desc = nb_tx_desc; txq->priv = PRIV(dev); dev->data->tx_queues[tx_queue_id] = txq; - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_ACTIVE) { ret = rte_eth_tx_queue_setup(PORT_ID(sdev), tx_queue_id, nb_tx_desc, socket_id, @@ -663,7 +673,7 @@ int ret; rte_memcpy(stats, &PRIV(dev)->stats_accumulator, sizeof(*stats)); - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_ACTIVE) { struct rte_eth_stats *snapshot = &sdev->stats_snapshot.stats; uint64_t *timestamp = &sdev->stats_snapshot.timestamp; @@ -746,7 +756,7 @@ rx_offload_capa = default_infos.rx_offload_capa; rxq_offload_capa = default_infos.rx_queue_offload_capa; - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) { + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, DEV_PROBED) { rte_eth_dev_info_get(PORT_ID(sdev), &PRIV(dev)->infos); rx_offload_capa &= PRIV(dev)->infos.rx_offload_capa; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index f3be152..7ddd63a 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -244,16 +244,31 @@ int failsafe_eth_lsc_event_callback(uint16_t port_id, ((sdev)->sid) /** - * Stateful iterator construct over fail-safe sub-devices: + * Stateful iterator construct over fail-safe sub-devices, + * including the removed sub-devices: + * s: (struct sub_device *), iterator + * i: (uint8_t), increment + * dev: (struct rte_eth_dev *), fail-safe ethdev + * state: (enum dev_state), minimum acceptable device state + */ + +#define FOREACH_SUBDEV_STATE_UNSAFE(s, i, dev, state) \ + for (s = fs_find_next((dev), 0, state, 0, &i); \ + s != NULL; \ + s = fs_find_next((dev), i + 1, state, 0, &i)) + +/** + * Stateful iterator construct over fail-safe sub-devices, + * except the removed sub-devices: * s: (struct sub_device *), iterator * i: (uint8_t), increment * dev: (struct rte_eth_dev *), fail-safe ethdev * state: (enum dev_state), minimum acceptable device state */ #define FOREACH_SUBDEV_STATE(s, i, dev, state) \ - for (s = fs_find_next((dev), 0, state, &i); \ + for (s = fs_find_next((dev), 0, state, 1, &i); \ s != NULL; \ - s = fs_find_next((dev), i + 1, state, &i)) + s = fs_find_next((dev), i + 1, state, 1, &i)) /** * Iterator construct over fail-safe sub-devices: @@ -262,7 +277,7 @@ int failsafe_eth_lsc_event_callback(uint16_t port_id, * dev: (struct rte_eth_dev *), fail-safe ethdev */ #define FOREACH_SUBDEV(s, i, dev) \ - FOREACH_SUBDEV_STATE(s, i, dev, DEV_UNDEFINED) + FOREACH_SUBDEV_STATE_UNSAFE(s, i, dev, DEV_UNDEFINED) /* dev: (struct rte_eth_dev *) fail-safe device */ #define PREFERRED_SUBDEV(dev) \ @@ -328,6 +343,7 @@ int failsafe_eth_lsc_event_callback(uint16_t port_id, fs_find_next(struct rte_eth_dev *dev, uint8_t sid, enum dev_state min_state, + uint8_t check_remove, uint8_t *sid_out) { struct sub_device *subs; @@ -336,8 +352,12 @@ int failsafe_eth_lsc_event_callback(uint16_t port_id, subs = PRIV(dev)->subs; tail = PRIV(dev)->subs_tail; while (sid < tail) { - if (subs[sid].state >= min_state) - break; + if (subs[sid].state >= min_state) { + if (check_remove == 0) + break; + if (PRIV(dev)->subs[sid].remove == 0) + break; + } sid++; } *sid_out = sid; @@ -376,7 +396,7 @@ int failsafe_eth_lsc_event_callback(uint16_t port_id, uint8_t i; /* Using acceptable device */ - FOREACH_SUBDEV_STATE(sdev, i, dev, req_state) { + FOREACH_SUBDEV_STATE_UNSAFE(sdev, i, dev, req_state) { if (sdev == banned) continue; DEBUG("Switching tx_dev to sub_device %d", -- 1.8.3.1