Blame SOURCES/0001-Revert-netdrv-ice-Don-t-reset-and-rebuild-for-Tx-tim.patch

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