#include <rte_io.h>
#include <rte_malloc.h>
-#include "hns3_ethdev.h"
+#include "hns3_common.h"
#include "hns3_logs.h"
#include "hns3_intr.h"
#include "hns3_regs.h"
/* configure TM QCN hw errors */
hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_TM_QCN_MEM_INT_CFG, false);
- if (en)
+ desc.data[0] = rte_cpu_to_le_32(HNS3_TM_QCN_ERR_INT_TYPE);
+ if (en) {
+ desc.data[0] |= rte_cpu_to_le_32(HNS3_TM_QCN_FIFO_INT_EN);
desc.data[1] = rte_cpu_to_le_32(HNS3_TM_QCN_MEM_ERR_INT_EN);
+ }
ret = hns3_cmd_send(hw, &desc, 1);
if (ret)
{
struct hns3_hw *hw = &hns->hw;
- if (hns3_dev_ras_imp_supported(hw)) {
+ if (hns3_dev_get_support(hw, RAS_IMP)) {
hns3_handle_hw_error_v2(hw);
hns3_schedule_reset(hns);
} else {
static bool
hns3_reset_err_handle(struct hns3_adapter *hns)
{
-#define MAX_RESET_FAIL_CNT 5
+#define MAX_RESET_FAIL_CNT 30
struct hns3_hw *hw = &hns->hw;
static int
hns3_reset_post(struct hns3_adapter *hns)
{
-#define TIMEOUT_RETRIES_CNT 5
+#define TIMEOUT_RETRIES_CNT 30
struct hns3_hw *hw = &hns->hw;
struct timeval tv_delta;
struct timeval tv;
return -EIO;
}
+static void
+hns3_reset_fail_handle(struct hns3_adapter *hns)
+{
+ struct hns3_hw *hw = &hns->hw;
+ struct timeval tv_delta;
+ struct timeval tv;
+
+ hns3_clear_reset_level(hw, &hw->reset.pending);
+ if (hns3_reset_err_handle(hns)) {
+ hw->reset.stage = RESET_STAGE_PREWAIT;
+ hns3_schedule_reset(hns);
+ return;
+ }
+
+ rte_spinlock_lock(&hw->lock);
+ if (hw->reset.mbuf_deferred_free) {
+ hns3_dev_release_mbufs(hns);
+ hw->reset.mbuf_deferred_free = false;
+ }
+ rte_spinlock_unlock(&hw->lock);
+ __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED);
+ hw->reset.stage = RESET_STAGE_NONE;
+ hns3_clock_gettime(&tv);
+ timersub(&tv, &hw->reset.start_time, &tv_delta);
+ hns3_warn(hw, "%s reset fail delta %" PRIu64 " ms time=%ld.%.6ld",
+ reset_string[hw->reset.level],
+ hns3_clock_calctime_ms(&tv_delta),
+ tv.tv_sec, tv.tv_usec);
+ hw->reset.level = HNS3_NONE_RESET;
+}
+
/*
* There are three scenarios as follows:
* When the reset is not in progress, the reset process starts.
hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level)
{
struct hns3_hw *hw = &hns->hw;
- struct timeval tv_delta;
struct timeval tv;
int ret;
if (ret == -EAGAIN)
return ret;
err:
- hns3_clear_reset_level(hw, &hw->reset.pending);
- if (hns3_reset_err_handle(hns)) {
- hw->reset.stage = RESET_STAGE_PREWAIT;
- hns3_schedule_reset(hns);
- } else {
- rte_spinlock_lock(&hw->lock);
- if (hw->reset.mbuf_deferred_free) {
- hns3_dev_release_mbufs(hns);
- hw->reset.mbuf_deferred_free = false;
- }
- rte_spinlock_unlock(&hw->lock);
- __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED);
- hw->reset.stage = RESET_STAGE_NONE;
- hns3_clock_gettime(&tv);
- timersub(&tv, &hw->reset.start_time, &tv_delta);
- hns3_warn(hw, "%s reset fail delta %" PRIu64 " ms time=%ld.%.6ld",
- reset_string[hw->reset.level],
- hns3_clock_calctime_ms(&tv_delta),
- tv.tv_sec, tv.tv_usec);
- hw->reset.level = HNS3_NONE_RESET;
- }
+ hns3_reset_fail_handle(hns);
return -EIO;
}