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 E56F4A0093; Thu, 13 Oct 2022 14:48:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6BF842F96; Thu, 13 Oct 2022 14:48:19 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 225E242F3A for ; Thu, 13 Oct 2022 14:48:14 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mp8Sn0tytzHv9j; Thu, 13 Oct 2022 20:48:09 +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:11 +0800 From: Chengwen Feng To: , , CC: , , , , , Subject: [PATCH v13 4/5] net/hns3: support proactive error handling mode Date: Thu, 13 Oct 2022 12:42:26 +0000 Message-ID: <20221013124227.40123-5-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 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); } /* -- 2.17.1