From 1010d8b2f7e26ee3ae02b6220ca7874fed2214a1 Mon Sep 17 00:00:00 2001
From: Eugene Syromiatnikov <esyr@redhat.com>
Date: Thu, 27 Aug 2020 19:09:24 +0200
Subject: [PATCH 1/5] Revert "[netdrv] ice: Don't reset and rebuild for Tx
timeout on PFC enabled queue"
This reverts commit 963f10c79fa8be5b8560ba3017f549fd83514cd4.
---
drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 58 -------------------------
drivers/net/ethernet/intel/ice/ice_dcb_lib.h | 23 ----------
drivers/net/ethernet/intel/ice/ice_hw_autogen.h | 1 -
drivers/net/ethernet/intel/ice/ice_main.c | 10 -----
drivers/net/ethernet/intel/ice/ice_type.h | 2 -
5 files changed, 94 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
index 3c7f604c0c49..6e1be15ee703 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
@@ -63,64 +63,6 @@ u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg *dcbcfg)
}
/**
- * ice_is_pfc_causing_hung_q
- * @pf: pointer to PF structure
- * @txqueue: Tx queue which is supposedly hung queue
- *
- * find if PFC is causing the hung queue, if yes return true else false
- */
-bool ice_is_pfc_causing_hung_q(struct ice_pf *pf, unsigned int txqueue)
-{
- u8 num_tcs = 0, i, tc, up_mapped_tc, up_in_tc = 0;
- u64 ref_prio_xoff[ICE_MAX_UP];
- struct ice_vsi *vsi;
- u32 up2tc;
-
- vsi = ice_get_main_vsi(pf);
- if (!vsi)
- return false;
-
- ice_for_each_traffic_class(i)
- if (vsi->tc_cfg.ena_tc & BIT(i))
- num_tcs++;
-
- /* first find out the TC to which the hung queue belongs to */
- for (tc = 0; tc < num_tcs - 1; tc++)
- if (ice_find_q_in_range(vsi->tc_cfg.tc_info[tc].qoffset,
- vsi->tc_cfg.tc_info[tc + 1].qoffset,
- txqueue))
- break;
-
- /* Build a bit map of all UPs associated to the suspect hung queue TC,
- * so that we check for its counter increment.
- */
- up2tc = rd32(&pf->hw, PRTDCB_TUP2TC);
- for (i = 0; i < ICE_MAX_UP; i++) {
- up_mapped_tc = (up2tc >> (i * 3)) & 0x7;
- if (up_mapped_tc == tc)
- up_in_tc |= BIT(i);
- }
-
- /* Now that we figured out that hung queue is PFC enabled, still the
- * Tx timeout can be legitimate. So to make sure Tx timeout is
- * absolutely caused by PFC storm, check if the counters are
- * incrementing.
- */
- for (i = 0; i < ICE_MAX_UP; i++)
- if (up_in_tc & BIT(i))
- ref_prio_xoff[i] = pf->stats.priority_xoff_rx[i];
-
- ice_update_dcb_stats(pf);
-
- for (i = 0; i < ICE_MAX_UP; i++)
- if (up_in_tc & BIT(i))
- if (pf->stats.priority_xoff_rx[i] > ref_prio_xoff[i])
- return true;
-
- return false;
-}
-
-/**
* ice_dcb_get_mode - gets the DCB mode
* @port_info: pointer to port info structure
* @host: if set it's HOST if not it's MANAGED
diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h
index 7c42324494d2..37680e815b02 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h
@@ -17,8 +17,6 @@
void ice_dcb_rebuild(struct ice_pf *pf);
u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg *dcbcfg);
u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);
-void ice_vsi_set_dcb_tc_cfg(struct ice_vsi *vsi);
-bool ice_is_pfc_causing_hung_q(struct ice_pf *pf, unsigned int txqueue);
u8 ice_dcb_get_tc(struct ice_vsi *vsi, int queue_index);
int
ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked);
@@ -34,20 +32,6 @@ void
ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf,
struct ice_rq_event_info *event);
void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc);
-
-/**
- * ice_find_q_in_range
- * @low: start of queue range for a TC i.e. offset of TC
- * @high: start of queue for next TC
- * @tx_q: hung_queue/tx_queue
- *
- * finds if queue 'tx_q' falls between the two offsets of any given TC
- */
-static inline bool ice_find_q_in_range(u16 low, u16 high, unsigned int tx_q)
-{
- return (tx_q >= low) && (tx_q < high);
-}
-
static inline void
ice_set_cgd_num(struct ice_tlan_ctx *tlan_ctx, struct ice_ring *ring)
{
@@ -95,13 +79,6 @@ ice_tx_prepare_vlan_flags_dcb(struct ice_ring __always_unused *tx_ring,
return 0;
}
-static inline bool
-ice_is_pfc_causing_hung_q(struct ice_pf __always_unused *pf,
- unsigned int __always_unused txqueue)
-{
- return false;
-}
-
#define ice_update_dcb_stats(pf) do {} while (0)
#define ice_pf_dcb_recfg(pf) do {} while (0)
#define ice_vsi_cfg_dcb_rings(vsi) do {} while (0)
diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
index 2f1c776747a4..43c1258695b5 100644
--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
+++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
@@ -55,7 +55,6 @@
#define PRTDCB_GENS 0x00083020
#define PRTDCB_GENS_DCBX_STATUS_S 0
#define PRTDCB_GENS_DCBX_STATUS_M ICE_M(0x7, 0)
-#define PRTDCB_TUP2TC 0x001D26C0 /* Reset Source: CORER */
#define GL_PREEXT_L2_PMASK0(_i) (0x0020F0FC + ((_i) * 4))
#define GL_PREEXT_L2_PMASK1(_i) (0x0020F108 + ((_i) * 4))
#define GLFLXP_RXDID_FLX_WRD_0(_i) (0x0045c800 + ((_i) * 4))
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 2719d7416e4e..a9ce5720588f 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -5452,16 +5452,6 @@ static void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue)
pf->tx_timeout_count++;
- /* Check if PFC is enabled for the TC to which the queue belongs
- * to. If yes then Tx timeout is not caused by a hung queue, no
- * need to reset and rebuild
- */
- if (ice_is_pfc_causing_hung_q(pf, txqueue)) {
- dev_info(ice_pf_to_dev(pf), "Fake Tx hang detected on queue %u, timeout caused by PFC storm\n",
- txqueue);
- return;
- }
-
/* now that we have an index, find the tx_ring struct */
for (i = 0; i < vsi->num_txq; i++)
if (vsi->tx_rings[i] && vsi->tx_rings[i]->desc)
diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h
index c1ad8622e65c..1dd455006a2c 100644
--- a/drivers/net/ethernet/intel/ice/ice_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_type.h
@@ -661,8 +661,6 @@ struct ice_eth_stats {
u64 tx_errors; /* tepc */
};
-#define ICE_MAX_UP 8
-
/* Statistics collected by the MAC */
struct ice_hw_port_stats {
/* eth stats collected by the port */
--
2.13.6