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 6E443A0542; Sun, 9 Oct 2022 13:05:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11986400D5; Sun, 9 Oct 2022 13:05:37 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 44FB940042 for ; Sun, 9 Oct 2022 13:05:35 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MlfGS3RqxzHtwC; Sun, 9 Oct 2022 19:00:32 +0800 (CST) Received: from [10.67.103.235] (10.67.103.235) by kwepemi500017.china.huawei.com (7.221.188.110) 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 19:05:29 +0800 Subject: Re: [PATCH v11 4/5] net/hns3: support proactive error handling mode To: Chengwen Feng , , , References: <20220128124831.427-1-kalesh-anakkur.purayil@broadcom.com> <20221009091009.38978-1-fengchengwen@huawei.com> <20221009091009.38978-5-fengchengwen@huawei.com> CC: , , , , , From: Dongdong Liu Message-ID: <17fe3c0f-8f02-ecb3-7475-2ba9fc639661@huawei.com> Date: Sun, 9 Oct 2022 19:05:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20221009091009.38978-5-fengchengwen@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.103.235] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) 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 On 2022/10/9 17:10, Chengwen Feng wrote: > 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); > } > > /* >