From patchwork Sun Oct 9 09:10:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 117727 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9BDB1A0542; Sun, 9 Oct 2022 11:15:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CB674114A; Sun, 9 Oct 2022 11:15:52 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 666A8400D5 for ; Sun, 9 Oct 2022 11:15:50 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mlbqv6RY4zHtpY; Sun, 9 Oct 2022 17:10:51 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sun, 9 Oct 2022 17:15:48 +0800 From: Chengwen Feng To: , , CC: , , , , , Subject: [PATCH v11 1/5] ethdev: support get port error handling mode Date: Sun, 9 Oct 2022 09:10:05 +0000 Message-ID: <20221009091009.38978-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221009091009.38978-1-fengchengwen@huawei.com> References: <20220128124831.427-1-kalesh-anakkur.purayil@broadcom.com> <20221009091009.38978-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch support gets port's error handling mode by rte_eth_dev_info_get() API. Currently, the defined modes include: 1) NONE: it means no error handling modes are supported by this port. 2) PASSIVE: passive error handling, after the PMD detect that a reset is required, the PMD reports RTE_ETH_EVENT_INTR_RESET event, and application invoke rte_eth_dev_reset() to recover the port. Signed-off-by: Chengwen Feng Reviewed-by: Andrew Rybchenko --- app/test-pmd/config.c | 2 ++ drivers/net/e1000/igb_ethdev.c | 2 ++ drivers/net/ena/ena_ethdev.c | 2 ++ drivers/net/iavf/iavf_ethdev.c | 2 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 2 ++ drivers/net/txgbe/txgbe_ethdev_vf.c | 2 ++ lib/ethdev/rte_ethdev.h | 22 +++++++++++++++++++++- 7 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 841e8efe78..bd7f2ba257 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -921,6 +921,8 @@ port_infos_display(portid_t port_id) printf("Switch Rx domain: %u\n", dev_info.switch_info.rx_domain); } + if (dev_info.err_handle_mode == RTE_ETH_ERROR_HANDLE_MODE_PASSIVE) + printf("Device error handling mode: passive\n"); } void diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index d6bcc5bf58..8858f975f8 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2341,6 +2341,8 @@ eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_desc_lim = rx_desc_lim; dev_info->tx_desc_lim = tx_desc_lim; + dev_info->err_handle_mode = RTE_ETH_ERROR_HANDLE_MODE_PASSIVE; + return 0; } diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 3e88bcda6c..efcb163027 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -2482,6 +2482,8 @@ static int ena_infos_get(struct rte_eth_dev *dev, dev_info->default_rxportconf.ring_size = ENA_DEFAULT_RING_SIZE; dev_info->default_txportconf.ring_size = ENA_DEFAULT_RING_SIZE; + dev_info->err_handle_mode = RTE_ETH_ERROR_HANDLE_MODE_PASSIVE; + return 0; } diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 782be82c7f..b1958e0474 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1179,6 +1179,8 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .nb_align = IAVF_ALIGN_RING_DESC, }; + dev_info->err_handle_mode = RTE_ETH_ERROR_HANDLE_MODE_PASSIVE; + return 0; } diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index bf70ee041d..fd06ddbe35 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -4056,6 +4056,8 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->rx_desc_lim = rx_desc_lim; dev_info->tx_desc_lim = tx_desc_lim; + dev_info->err_handle_mode = RTE_ETH_ERROR_HANDLE_MODE_PASSIVE; + return 0; } diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c index f52cd8bc19..3b1f7c913b 100644 --- a/drivers/net/txgbe/txgbe_ethdev_vf.c +++ b/drivers/net/txgbe/txgbe_ethdev_vf.c @@ -521,6 +521,8 @@ txgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->rx_desc_lim = rx_desc_lim; dev_info->tx_desc_lim = tx_desc_lim; + dev_info->err_handle_mode = RTE_ETH_ERROR_HANDLE_MODE_PASSIVE; + return 0; } diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index e8d1e1c658..3443bf20e1 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1629,6 +1629,22 @@ enum rte_eth_representor_type { RTE_ETH_REPRESENTOR_PF, /**< representor of Physical Function. */ }; +/** + * @warning + * @b EXPERIMENTAL: this enumeration may change without prior notice. + * + * Ethernet device error handling mode. + */ +enum rte_eth_err_handle_mode { + /** No error handling modes are supported. */ + RTE_ETH_ERROR_HANDLE_MODE_NONE, + /** Passive error handling, after the PMD detect that a reset is + * required, the PMD reports @see RTE_ETH_EVENT_INTR_RESET event, and + * application invoke @see rte_eth_dev_reset to recover the port. + */ + RTE_ETH_ERROR_HANDLE_MODE_PASSIVE, +}; + /** * A structure used to retrieve the contextual information of * an Ethernet device, such as the controlling driver of the @@ -1689,8 +1705,12 @@ struct rte_eth_dev_info { * embedded managed interconnect/switch. */ struct rte_eth_switch_info switch_info; + /** Supported error handling mode. @see enum rte_eth_err_handle_mode */ + uint8_t err_handle_mode; - uint64_t reserved_64s[2]; /**< Reserved for future fields */ + uint8_t reserved_8; /**< Reserved for future fields */ + uint16_t reserved_16s[3]; /**< Reserved for future fields */ + uint64_t reserved_64; /**< Reserved for future fields */ void *reserved_ptrs[2]; /**< Reserved for future fields */ }; From patchwork Sun Oct 9 09:10:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 117728 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 010EBA0542; Sun, 9 Oct 2022 11:16:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E87D427F2; Sun, 9 Oct 2022 11:15:54 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 92D5E410D7 for ; Sun, 9 Oct 2022 11:15:50 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mlbqw2517zHtv7; Sun, 9 Oct 2022 17:10:52 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sun, 9 Oct 2022 17:15:48 +0800 From: Chengwen Feng To: , , CC: , , , , , Subject: [PATCH v11 2/5] ethdev: support proactive error handling mode Date: Sun, 9 Oct 2022 09:10:06 +0000 Message-ID: <20221009091009.38978-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221009091009.38978-1-fengchengwen@huawei.com> References: <20220128124831.427-1-kalesh-anakkur.purayil@broadcom.com> <20221009091009.38978-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Kalesh AP Some PMDs (e.g. hns3) could detect hardware or firmware errors, and try to recover from the errors. In this process, the PMD sets the data path pointers to dummy functions (which will prevent the crash), and also make sure the control path operations failed with retcode -EBUSY. The above error handling mode is known as RTE_ETH_ERROR_HANDLE_MODE_PROACTIVE (proactive error handling mode). In some service scenarios, application needs to be aware of the event to determine whether to migrate services. So three events were introduced: 1) RTE_ETH_EVENT_ERR_RECOVERING: used to notify the application that it detected an error and the recovery is being started. Upon receiving the event, the application should not invoke any control path APIs until receiving RTE_ETH_EVENT_RECOVERY_SUCCESS or RTE_ETH_EVENT_RECOVERY_FAILED event. 2) RTE_ETH_EVENT_RECOVERY_SUCCESS: used to notify the application that it recovers successful from the error, the PMD already re-configures the port, and the effect is the same as that of the restart operation. 3) RTE_ETH_EVENT_RECOVERY_FAILED: used to notify the application that it recovers failed from the error, the port should not usable anymore. The application should close the port. Signed-off-by: Kalesh AP Signed-off-by: Somnath Kotur Signed-off-by: Chengwen Feng Reviewed-by: Ajit Khaparde --- app/test-pmd/config.c | 2 + doc/guides/prog_guide/poll_mode_drv.rst | 38 ++++++++++++++++ doc/guides/rel_notes/release_22_11.rst | 12 +++++ lib/ethdev/rte_ethdev.h | 59 +++++++++++++++++++++++++ 4 files changed, 111 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index bd7f2ba257..e53f2177b6 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -923,6 +923,8 @@ port_infos_display(portid_t port_id) } if (dev_info.err_handle_mode == RTE_ETH_ERROR_HANDLE_MODE_PASSIVE) printf("Device error handling mode: passive\n"); + else if (dev_info.err_handle_mode == RTE_ETH_ERROR_HANDLE_MODE_PROACTIVE) + printf("Device error handling mode: proactive\n"); } void diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst index 9d081b1cba..73941a74bd 100644 --- a/doc/guides/prog_guide/poll_mode_drv.rst +++ b/doc/guides/prog_guide/poll_mode_drv.rst @@ -627,3 +627,41 @@ by application. The PMD itself should not call rte_eth_dev_reset(). The PMD can trigger the application to handle reset event. It is duty of application to handle all synchronization before it calls rte_eth_dev_reset(). + +The above error handling mode is known as ``RTE_ETH_ERROR_HANDLE_MODE_PASSIVE``. + +Proactive Error Handling Mode +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If PMD supports ``RTE_ETH_ERROR_HANDLE_MODE_PROACTIVE``, it means once detect +hardware or firmware errors, the PMD will try to recover from the errors. In +this process, the PMD sets the data path pointers to dummy functions (which +will prevent the crash), and also make sure the control path operations failed +with retcode -EBUSY. + +Also in this process, from the perspective of application, services are +affected. For example, the Rx/Tx bust APIs cannot receive and send packets, +and the control plane API return failure. + +In some service scenarios, application needs to be aware of the event to +determine whether to migrate services. So three events were introduced: + +* RTE_ETH_EVENT_ERR_RECOVERING: used to notify the application that it detected + an error and the recovery is being started. Upon receiving the event, the + application should not invoke any control path APIs until receiving + RTE_ETH_EVENT_RECOVERY_SUCCESS or RTE_ETH_EVENT_RECOVERY_FAILED event. + +* RTE_ETH_EVENT_RECOVERY_SUCCESS: used to notify the application that it + recovers successful from the error, the PMD already re-configures the port, + and the effect is the same as that of the restart operation. + +* RTE_ETH_EVENT_RECOVERY_FAILED: used to notify the application that it + recovers failed from the error, the port should not usable anymore. the + application should close the port. + +.. note:: + * Before the PMD reports the recovery result, the PMD may report the + ``RTE_ETH_EVENT_ERR_RECOVERING`` event again, because a larger error + may occur during the recovery. + * The error handling mode supported by the PMD can be reported through + the ``rte_eth_dev_info_get`` API. diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 10168ffece..b749f51405 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -111,6 +111,18 @@ New Features Added new flow action which allows application to re-route packets directly to the kernel without software involvement. +* **Added proactive error handling mode for ethdev.** + + Added proactive error handling mode for ethdev, and three event were + introduced: + + * Added new event: ``RTE_ETH_EVENT_ERR_RECOVERING`` for the PMD to report + that the port is recovering from an error. + * Added new event: ``RTE_ETH_EVENT_RECOVER_SUCCESS`` for the PMD to report + that the port recover successful from an error. + * Added new event: ``RTE_ETH_EVENT_RECOVER_FAILED`` for the PMD to report + that the prot recover failed from an error. + * **Updated AF_XDP driver.** * Made compatible with libbpf v0.8.0 (when used with libxdp). diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 3443bf20e1..ccdd6c8655 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1643,6 +1643,12 @@ enum rte_eth_err_handle_mode { * application invoke @see rte_eth_dev_reset to recover the port. */ RTE_ETH_ERROR_HANDLE_MODE_PASSIVE, + /** Proactive error handling, after the PMD detect that a reset is + * required, the PMD reports @see RTE_ETH_EVENT_ERR_RECOVERING event, + * and do recovery internally, finally, reports the recovery result + * event (@see RTE_ETH_EVENT_RECOVERY_*). + */ + RTE_ETH_ERROR_HANDLE_MODE_PROACTIVE, }; /** @@ -3824,6 +3830,59 @@ enum rte_eth_event_type { * @see rte_eth_rx_avail_thresh_set() */ RTE_ETH_EVENT_RX_AVAIL_THRESH, + /** Port recovering from a hardware or firmware error. + * If PMD supports proactive error recovery, it should trigger this + * event to notify application that it detected an error and the + * recovery is being started. Upon receiving the event, the application + * should not invoke any control path APIs (such as + * rte_eth_dev_configure/rte_eth_dev_stop...) until receiving + * RTE_ETH_EVENT_RECOVERY_SUCCESS or RTE_ETH_EVENT_RECOVERY_FAILED + * event. + * The PMD will set the data path pointers to dummy functions, and + * re-set the data patch pointers to non-dummy functions before reports + * RTE_ETH_EVENT_RECOVERY_SUCCESS event. It means that the application + * cannot send or receive any packets during this period. + * @note Before the PMD reports the recovery result, the PMD may report + * the RTE_ETH_EVENT_ERR_RECOVERING event again, because a larger error + * may occur during the recovery. + */ + RTE_ETH_EVENT_ERR_RECOVERING, + /** Port recovers successful from the error. + * The PMD already re-configures the port, and the effect is the same as + * that of the restart operation. + * a) the following operation will be retained: (alphabetically) + * - DCB configuration + * - FEC configuration + * - Flow control configuration + * - LRO configuration + * - LSC configuration + * - MTU + * - Mac address (default and those supplied by MAC address array) + * - Promiscuous and allmulticast mode + * - PTP configuration + * - Queue (Rx/Tx) settings + * - Queue statistics mappings + * - RSS configuration by rte_eth_dev_rss_xxx() family + * - Rx checksum configuration + * - Rx interrupt settings + * - Traffic management configuration + * - VLAN configuration (including filtering, tpid, strip, pvid) + * - VMDq configuration + * b) the following configuration maybe retained or not depending on the + * device capabilities: + * - flow rules + * @see RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP + * - shared flow objects + * @see RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP + * c) the other configuration will not be stored and will need to be + * re-configured. + */ + RTE_ETH_EVENT_RECOVERY_SUCCESS, + /** Port recovers failed from the error. + * It means that the port should not usable anymore. The application + * should close the port. + */ + RTE_ETH_EVENT_RECOVERY_FAILED, RTE_ETH_EVENT_MAX /**< max value of this enum */ }; From patchwork Sun Oct 9 09:10:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 117729 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 78BDCA0542; Sun, 9 Oct 2022 11:16:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6620C427FF; Sun, 9 Oct 2022 11:15:55 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id D680940042 for ; Sun, 9 Oct 2022 11:15:50 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mlbqw2RwtzHtvq; Sun, 9 Oct 2022 17:10:52 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sun, 9 Oct 2022 17:15:49 +0800 From: Chengwen Feng To: , , CC: , , , , , Subject: [PATCH v11 3/5] app/testpmd: support error handling mode event Date: Sun, 9 Oct 2022 09:10:07 +0000 Message-ID: <20221009091009.38978-4-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221009091009.38978-1-fengchengwen@huawei.com> References: <20220128124831.427-1-kalesh-anakkur.purayil@broadcom.com> <20221009091009.38978-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Kalesh AP This patch supports error handling mode event process. Signed-off-by: Kalesh AP Signed-off-by: Somnath Kotur Signed-off-by: Chengwen Feng Reviewed-by: Ajit Khaparde --- app/test-pmd/parameters.c | 10 ++++++++-- app/test-pmd/testpmd.c | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 14752f9571..c49681708e 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -166,9 +166,9 @@ usage(char* progname) printf(" --no-rmv-interrupt: disable device removal interrupt.\n"); printf(" --bitrate-stats=N: set the logical core N to perform " "bit-rate calculation.\n"); - printf(" --print-event : " + printf(" --print-event : " "enable print of designated event or all of them.\n"); - printf(" --mask-event : " + printf(" --mask-event : " "disable print of designated event or all of them.\n"); printf(" --flow-isolate-all: " "requests flow API isolated mode on all ports at initialization time.\n"); @@ -452,6 +452,12 @@ parse_event_printing_config(const char *optarg, int enable) mask = UINT32_C(1) << RTE_ETH_EVENT_DESTROY; else if (!strcmp(optarg, "flow_aged")) mask = UINT32_C(1) << RTE_ETH_EVENT_FLOW_AGED; + else if (!strcmp(optarg, "err_recovering")) + mask = UINT32_C(1) << RTE_ETH_EVENT_ERR_RECOVERING; + else if (!strcmp(optarg, "recovery_success")) + mask = UINT32_C(1) << RTE_ETH_EVENT_RECOVERY_SUCCESS; + else if (!strcmp(optarg, "recovery_failed")) + mask = UINT32_C(1) << RTE_ETH_EVENT_RECOVERY_FAILED; else if (!strcmp(optarg, "all")) mask = ~UINT32_C(0); else { diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index bb1c901742..7104e61a2c 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -425,6 +425,9 @@ static const char * const eth_event_desc[] = { [RTE_ETH_EVENT_DESTROY] = "device released", [RTE_ETH_EVENT_FLOW_AGED] = "flow aged", [RTE_ETH_EVENT_RX_AVAIL_THRESH] = "RxQ available descriptors threshold reached", + [RTE_ETH_EVENT_ERR_RECOVERING] = "error recovering", + [RTE_ETH_EVENT_RECOVERY_SUCCESS] = "error recovery successful", + [RTE_ETH_EVENT_RECOVERY_FAILED] = "error recovery failed", [RTE_ETH_EVENT_MAX] = NULL, }; @@ -439,7 +442,10 @@ uint32_t event_print_mask = (UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN) | (UINT32_C(1) << RTE_ETH_EVENT_IPSEC) | (UINT32_C(1) << RTE_ETH_EVENT_MACSEC) | (UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV) | - (UINT32_C(1) << RTE_ETH_EVENT_FLOW_AGED); + (UINT32_C(1) << RTE_ETH_EVENT_FLOW_AGED) | + (UINT32_C(1) << RTE_ETH_EVENT_ERR_RECOVERING) | + (UINT32_C(1) << RTE_ETH_EVENT_RECOVERY_SUCCESS) | + (UINT32_C(1) << RTE_ETH_EVENT_RECOVERY_FAILED); /* * Decide if all memory are locked for performance. */ From patchwork Sun Oct 9 09:10:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 117730 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E380AA0542; Sun, 9 Oct 2022 11:16:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E0ED4281C; Sun, 9 Oct 2022 11:15:57 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 11B5C427EE for ; Sun, 9 Oct 2022 11:15:54 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mlbqz5gc8zHttT; Sun, 9 Oct 2022 17:10:55 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sun, 9 Oct 2022 17:15:49 +0800 From: Chengwen Feng To: , , CC: , , , , , Subject: [PATCH v11 4/5] net/hns3: support proactive error handling mode Date: Sun, 9 Oct 2022 09:10:08 +0000 Message-ID: <20221009091009.38978-5-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221009091009.38978-1-fengchengwen@huawei.com> References: <20220128124831.427-1-kalesh-anakkur.purayil@broadcom.com> <20221009091009.38978-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch supports proactive error handling mode. Signed-off-by: Chengwen Feng Acked-by: Dongdong Liu --- drivers/net/hns3/hns3_common.c | 2 ++ drivers/net/hns3/hns3_intr.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index 14291193cb..7adc6a4972 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -149,6 +149,8 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) info->max_mac_addrs = HNS3_VF_UC_MACADDR_NUM; } + info->err_handle_mode = RTE_ETH_ERROR_HANDLE_MODE_PROACTIVE; + return 0; } diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c index 57679254ee..44a1119415 100644 --- a/drivers/net/hns3/hns3_intr.c +++ b/drivers/net/hns3/hns3_intr.c @@ -1480,6 +1480,27 @@ static const struct hns3_hw_err_type hns3_hw_error_type[] = { } }; +static void +hns3_report_reset_begin(struct hns3_hw *hw) +{ + struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_ERR_RECOVERING, NULL); +} + +static void +hns3_report_reset_success(struct hns3_hw *hw) +{ + struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_RECOVERY_SUCCESS, NULL); +} + +static void +hns3_report_reset_failed(struct hns3_hw *hw) +{ + struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_RECOVERY_FAILED, NULL); +} + static int hns3_config_ncsi_hw_err_int(struct hns3_adapter *hns, bool en) { @@ -2642,6 +2663,7 @@ hns3_reset_pre(struct hns3_adapter *hns) if (hw->reset.stage == RESET_STAGE_NONE) { __atomic_store_n(&hns->hw.reset.resetting, 1, __ATOMIC_RELAXED); hw->reset.stage = RESET_STAGE_DOWN; + hns3_report_reset_begin(hw); ret = hw->reset.ops->stop_service(hns); hns3_clock_gettime(&tv); if (ret) { @@ -2751,6 +2773,7 @@ hns3_reset_post(struct hns3_adapter *hns) hns3_clock_calctime_ms(&tv_delta), tv.tv_sec, tv.tv_usec); hw->reset.level = HNS3_NONE_RESET; + hns3_report_reset_success(hw); } return 0; @@ -2796,6 +2819,7 @@ hns3_reset_fail_handle(struct hns3_adapter *hns) hns3_clock_calctime_ms(&tv_delta), tv.tv_sec, tv.tv_usec); hw->reset.level = HNS3_NONE_RESET; + hns3_report_reset_failed(hw); } /* From patchwork Sun Oct 9 09:10:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 117731 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4D489A0542; Sun, 9 Oct 2022 11:16:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55EE942905; Sun, 9 Oct 2022 11:15:58 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 14555427F1 for ; Sun, 9 Oct 2022 11:15:54 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mlbqz60X6zHtvt; Sun, 9 Oct 2022 17:10:55 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sun, 9 Oct 2022 17:15:49 +0800 From: Chengwen Feng To: , , CC: , , , , , Subject: [PATCH v11 5/5] net/bnxt: support proactive error handling mode Date: Sun, 9 Oct 2022 09:10:09 +0000 Message-ID: <20221009091009.38978-6-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221009091009.38978-1-fengchengwen@huawei.com> References: <20220128124831.427-1-kalesh-anakkur.purayil@broadcom.com> <20221009091009.38978-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Kalesh AP This patch supports proactive error handling mode. Signed-off-by: Kalesh AP Signed-off-by: Somnath Kotur Reviewed-by: Ajit Khaparde Reviewed-by: Chengwen Feng --- drivers/net/bnxt/bnxt_cpr.c | 4 ++++ drivers/net/bnxt/bnxt_ethdev.c | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index 99af0f9e87..5bb376d4d5 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -180,6 +180,10 @@ void bnxt_handle_async_event(struct bnxt *bp, return; } + rte_eth_dev_callback_process(bp->eth_dev, + RTE_ETH_EVENT_ERR_RECOVERING, + NULL); + pthread_mutex_lock(&bp->err_recovery_lock); event_data = data1; /* timestamp_lo/hi values are in units of 100ms */ diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3dfe9efc09..b3de490d36 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1063,6 +1063,8 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->vmdq_pool_base = 0; dev_info->vmdq_queue_base = 0; + dev_info->err_handle_mode = RTE_ETH_ERROR_HANDLE_MODE_PROACTIVE; + return 0; } @@ -4382,13 +4384,18 @@ static void bnxt_dev_recover(void *arg) PMD_DRV_LOG(INFO, "Port: %u Recovered from FW reset\n", bp->eth_dev->data->port_id); pthread_mutex_unlock(&bp->err_recovery_lock); - + rte_eth_dev_callback_process(bp->eth_dev, + RTE_ETH_EVENT_RECOVERY_SUCCESS, + NULL); return; err_start: bnxt_dev_stop(bp->eth_dev); err: bp->flags |= BNXT_FLAG_FATAL_ERROR; bnxt_uninit_resources(bp, false); + rte_eth_dev_callback_process(bp->eth_dev, + RTE_ETH_EVENT_RECOVERY_FAILED, + NULL); if (bp->eth_dev->data->dev_conf.intr_conf.rmv) rte_eth_dev_callback_process(bp->eth_dev, RTE_ETH_EVENT_INTR_RMV, @@ -4560,6 +4567,10 @@ static void bnxt_check_fw_health(void *arg) PMD_DRV_LOG(ERR, "Detected FW dead condition\n"); + rte_eth_dev_callback_process(bp->eth_dev, + RTE_ETH_EVENT_ERR_RECOVERING, + NULL); + if (bnxt_is_primary_func(bp)) wait_msec = info->primary_func_wait_period; else