From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 50DE7A0093; Thu, 13 Oct 2022 14:48:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24EF742F76; Thu, 13 Oct 2022 14:48:16 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 0242542DC7 for ; Thu, 13 Oct 2022 14:48:12 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Mp8MV56Ntz1P7KT; Thu, 13 Oct 2022 20:43:34 +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; Thu, 13 Oct 2022 20:48:10 +0800 From: Chengwen Feng To: , , CC: , , , , , Subject: [PATCH v13 1/5] ethdev: add error handling mode to device info Date: Thu, 13 Oct 2022 12:42:23 +0000 Message-ID: <20221013124227.40123-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221013124227.40123-1-fengchengwen@huawei.com> References: <20220128124831.427-1-kalesh-anakkur.purayil@broadcom.com> <20221013124227.40123-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 adds error handling mode to device info, currently, the defined error handling 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 | 12 ++++++++++++ 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 | 18 ++++++++++++++++++ 7 files changed, 40 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index dec16a9049..4cddcd0bf7 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -921,6 +921,18 @@ port_infos_display(portid_t port_id) printf("Switch Rx domain: %u\n", dev_info.switch_info.rx_domain); } + printf("Device error handling mode: "); + switch (dev_info.err_handle_mode) { + case RTE_ETH_ERROR_HANDLE_MODE_NONE: + printf("none\n"); + break; + case RTE_ETH_ERROR_HANDLE_MODE_PASSIVE: + printf("passive\n"); + break; + default: + printf("unknown\n"); + break; + } } 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 d43a638aff..5de8e13866 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1686,6 +1686,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 @@ -1753,6 +1769,8 @@ struct rte_eth_dev_info { * embedded managed interconnect/switch. */ struct rte_eth_switch_info switch_info; + /** Supported error handling mode. */ + enum rte_eth_err_handle_mode err_handle_mode; uint64_t reserved_64s[2]; /**< Reserved for future fields */ void *reserved_ptrs[2]; /**< Reserved for future fields */ -- 2.17.1