From 0e9c6de362dc80e7fc7a92eae9e411efd156d207 Mon Sep 17 00:00:00 2001 From: Rasesh Mody Date: Wed, 29 Mar 2017 13:36:34 -0700 Subject: [PATCH] net/qede/base: prevent transmitter stuck condition Change OOO TC properly to prevent transmitter stuck condition due to credit underruns. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore.h | 4 +--- drivers/net/qede/base/ecore_dcbx.c | 6 ++---- drivers/net/qede/base/ecore_dev.c | 19 ++++++++++++++----- drivers/net/qede/base/mcp_public.h | 12 ++++++++---- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index 479a9918a1..c9b1b5aa17 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -358,9 +358,6 @@ struct ecore_hw_info { u8 num_active_tc; - /* Traffic class used for tcp out of order traffic */ - u8 ooo_tc; - /* The traffic class used by PF for it's offloaded protocol */ u8 offload_tc; @@ -441,6 +438,7 @@ struct ecore_qm_info { u16 num_vf_pqs; u8 num_vports; u8 max_phys_tcs_per_port; + u8 ooo_tc; bool pf_rl_en; bool pf_wfq_en; bool vport_rl_en; diff --git a/drivers/net/qede/base/ecore_dcbx.c b/drivers/net/qede/base/ecore_dcbx.c index 102774d811..0e11927d69 100644 --- a/drivers/net/qede/base/ecore_dcbx.c +++ b/drivers/net/qede/base/ecore_dcbx.c @@ -129,11 +129,8 @@ ecore_dcbx_set_params(struct ecore_dcbx_results *p_data, p_data->arr[type].update = DONT_UPDATE_DCB_DSCP; /* QM reconf data */ - if (p_hwfn->hw_info.personality == personality) { + if (p_hwfn->hw_info.personality == personality) p_hwfn->hw_info.offload_tc = tc; - if (personality == ECORE_PCI_ISCSI) - p_hwfn->hw_info.ooo_tc = DCBX_ISCSI_OOO_TC; - } } /* Update app protocol data and hw_info fields with the TLV info */ @@ -317,6 +314,7 @@ ecore_dcbx_process_mib_info(struct ecore_hwfn *p_hwfn) p_info->num_active_tc = ECORE_MFW_GET_FIELD(p_ets->flags, DCBX_ETS_MAX_TCS); + p_hwfn->qm_info.ooo_tc = ECORE_MFW_GET_FIELD(p_ets->flags, DCBX_OOO_TC); data.pf_id = p_hwfn->rel_pf_id; data.dcbx_enabled = !!dcbx_version; diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index 21fec587c0..0840d49fc1 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -291,6 +291,7 @@ u16 ecore_init_qm_get_num_pqs(struct ecore_hwfn *p_hwfn) static void ecore_init_qm_params(struct ecore_hwfn *p_hwfn) { struct ecore_qm_info *qm_info = &p_hwfn->qm_info; + bool four_port; /* pq and vport bases for this PF */ qm_info->start_pq = (u16)RESC_START(p_hwfn, ECORE_PQ); @@ -300,10 +301,19 @@ static void ecore_init_qm_params(struct ecore_hwfn *p_hwfn) qm_info->vport_rl_en = 1; qm_info->vport_wfq_en = 1; + /* TC config is different for AH 4 port */ + four_port = p_hwfn->p_dev->num_ports_in_engines == MAX_NUM_PORTS_K2; + /* in AH 4 port we have fewer TCs per port */ - qm_info->max_phys_tcs_per_port = - p_hwfn->p_dev->num_ports_in_engines == MAX_NUM_PORTS_K2 ? - NUM_PHYS_TCS_4PORT_K2 : NUM_OF_PHYS_TCS; + qm_info->max_phys_tcs_per_port = four_port ? NUM_PHYS_TCS_4PORT_K2 : + NUM_OF_PHYS_TCS; + + /* unless MFW indicated otherwise, ooo_tc should be 3 for AH 4 port and + * 4 otherwise + */ + if (!qm_info->ooo_tc) + qm_info->ooo_tc = four_port ? DCBX_TCP_OOO_K2_4PORT_TC : + DCBX_TCP_OOO_TC; } /* initialize qm vport params */ @@ -532,8 +542,7 @@ static void ecore_init_qm_ooo_pq(struct ecore_hwfn *p_hwfn) return; ecore_init_qm_set_idx(p_hwfn, PQ_FLAGS_OOO, qm_info->num_pqs); - ecore_init_qm_pq(p_hwfn, qm_info, DCBX_ISCSI_OOO_TC, - PQ_INIT_SHARE_VPORT); + ecore_init_qm_pq(p_hwfn, qm_info, qm_info->ooo_tc, PQ_INIT_SHARE_VPORT); } static void ecore_init_qm_pure_ack_pq(struct ecore_hwfn *p_hwfn) diff --git a/drivers/net/qede/base/mcp_public.h b/drivers/net/qede/base/mcp_public.h index 28909fb438..bd3455788a 100644 --- a/drivers/net/qede/base/mcp_public.h +++ b/drivers/net/qede/base/mcp_public.h @@ -294,16 +294,20 @@ struct dcbx_ets_feature { #define DCBX_ETS_CBS_SHIFT 3 #define DCBX_ETS_MAX_TCS_MASK 0x000000f0 #define DCBX_ETS_MAX_TCS_SHIFT 4 -#define DCBX_ISCSI_OOO_TC_MASK 0x00000f00 -#define DCBX_ISCSI_OOO_TC_SHIFT 8 +#define DCBX_OOO_TC_MASK 0x00000f00 +#define DCBX_OOO_TC_SHIFT 8 /* Entries in tc table are orginized that the left most is pri 0, right most is * prio 7 */ u32 pri_tc_tbl[1]; -#define DCBX_ISCSI_OOO_TC (4) +/* Fixed TCP OOO TC usage is deprecated and used only for driver backward + * compatibility + */ +#define DCBX_TCP_OOO_TC (4) +#define DCBX_TCP_OOO_K2_4PORT_TC (3) -#define NIG_ETS_ISCSI_OOO_CLIENT_OFFSET (DCBX_ISCSI_OOO_TC + 1) +#define NIG_ETS_ISCSI_OOO_CLIENT_OFFSET (DCBX_TCP_OOO_TC + 1) #define DCBX_CEE_STRICT_PRIORITY 0xf /* Entries in tc table are orginized that the left most is pri 0, right most is * prio 7 -- 2.20.1