From f32557f95533821b67997d63b6fbafe61348fa71 Mon Sep 17 00:00:00 2001 From: Rasesh Mody Date: Sat, 29 Sep 2018 08:14:28 +0000 Subject: [PATCH] net/qede/base: check for EDPM enabled in DB recovery Add a check for EDPM enabled before flushing doorbell recovery queue. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore.h | 2 ++ drivers/net/qede/base/ecore_dev.c | 10 +++++++++- drivers/net/qede/base/ecore_int.c | 20 +++++++++++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index 8982214c01..4607a80a9b 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -962,6 +962,8 @@ void ecore_db_recovery_dp(struct ecore_hwfn *p_hwfn); void ecore_db_recovery_execute(struct ecore_hwfn *p_hwfn, enum ecore_db_rec_exec); +bool ecore_edpm_enabled(struct ecore_hwfn *p_hwfn); + /* amount of resources used in qm init */ u8 ecore_init_qm_get_num_tcs(struct ecore_hwfn *p_hwfn); u16 ecore_init_qm_get_num_vfs(struct ecore_hwfn *p_hwfn); diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index b83f003809..f09f77130b 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -1974,6 +1974,14 @@ enum ECORE_ROCE_EDPM_MODE { ECORE_ROCE_EDPM_MODE_DISABLE = 2, }; +bool ecore_edpm_enabled(struct ecore_hwfn *p_hwfn) +{ + if (p_hwfn->dcbx_no_edpm || p_hwfn->db_bar_no_edpm) + return false; + + return true; +} + static enum _ecore_status_t ecore_hw_init_pf_doorbell_bar(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt) @@ -2061,7 +2069,7 @@ ecore_hw_init_pf_doorbell_bar(struct ecore_hwfn *p_hwfn, DP_INFO(p_hwfn, " dpi_size=%d, dpi_count=%d, roce_edpm=%s\n", p_hwfn->dpi_size, p_hwfn->dpi_count, - ((p_hwfn->dcbx_no_edpm) || (p_hwfn->db_bar_no_edpm)) ? + (!ecore_edpm_enabled(p_hwfn)) ? "disabled" : "enabled"); /* Check return codes from above calls */ diff --git a/drivers/net/qede/base/ecore_int.c b/drivers/net/qede/base/ecore_int.c index d41107d49b..c9acc72b8c 100644 --- a/drivers/net/qede/base/ecore_int.c +++ b/drivers/net/qede/base/ecore_int.c @@ -431,9 +431,8 @@ ecore_general_attention_35(struct ecore_hwfn *p_hwfn) #define ECORE_DB_REC_COUNT 10 #define ECORE_DB_REC_INTERVAL 100 -/* assumes sticky overflow indication was set for this PF */ -static enum _ecore_status_t ecore_db_rec_attn(struct ecore_hwfn *p_hwfn, - struct ecore_ptt *p_ptt) +static enum _ecore_status_t ecore_db_rec_flush_queue(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt) { u8 count = ECORE_DB_REC_COUNT; u32 usage = 1; @@ -461,6 +460,21 @@ static enum _ecore_status_t ecore_db_rec_attn(struct ecore_hwfn *p_hwfn, return ECORE_TIMEOUT; } + return ECORE_SUCCESS; +} + +/* assumes sticky overflow indication was set for this PF */ +static enum _ecore_status_t ecore_db_rec_attn(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt) +{ + enum _ecore_status_t rc; + + if (ecore_edpm_enabled(p_hwfn)) { + rc = ecore_db_rec_flush_queue(p_hwfn, p_ptt); + if (rc != ECORE_SUCCESS) + return rc; + } + /* flush any pedning (e)dpm as they may never arrive */ ecore_wr(p_hwfn, p_ptt, DORQ_REG_DPM_FORCE_ABORT, 0x1); -- 2.20.1