[v8,3/4] net/hns3: support error recovery notification event
Checks
Commit Message
This patch supports error recovery notification event:
1. RTE_ETH_EVENT_ERR_RECOVERING: the PMD report this event to nofify
the application that it detected a hardware or firmware error and
tries to recover.
2. RTE_ETH_EVENT_RECOVER_SUCCESS: the PMD report this event to nofify
the application that it has recovered from the error. And PMD already
re-configures the port to the state prior to the error.
3. RTE_ETH_EVENT_RECOVER_FAILED: the PMD report this event to notify
the application that it has failed to recover from the error. The port
may not be usable anymore.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/hns3/hns3_intr.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
@@ -1486,6 +1486,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_RECOVER_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_RECOVER_FAILED, NULL);
+}
+
static int
hns3_config_ncsi_hw_err_int(struct hns3_adapter *hns, bool en)
{
@@ -2645,6 +2666,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) {
@@ -2754,6 +2776,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;
@@ -2799,6 +2822,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);
}
/*