+++ /dev/null
-From 88164cd4365dd53a8c522454c94da23923f4cd7b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 Aug 2018 06:29:44 -0700
-Subject: ice: Rework flex descriptor programming
-
-From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
-
-[ Upstream commit 22ef683b48182f4d6125a2fb2725eb8a141514ff ]
-
-The driver can support two flex descriptor profiles, ICE_RXDID_FLEX_NIC
-and ICE_RXDID_FLEX_NIC_2. This patch reworks the current flex programming
-logic to add support for the latter profile.
-
-Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
-Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
-Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-Stable-dep-of: 00bf63122459 ("bpf: report RCU QS in cpumap kthread")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/intel/ice/ice_common.c | 102 ++++++++++++++----
- .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 24 +++--
- 2 files changed, 92 insertions(+), 34 deletions(-)
-
-diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
-index f8d00263d9019..72a6f22ee423f 100644
---- a/drivers/net/ethernet/intel/ice/ice_common.c
-+++ b/drivers/net/ethernet/intel/ice/ice_common.c
-@@ -7,16 +7,16 @@
-
- #define ICE_PF_RESET_WAIT_COUNT 200
-
--#define ICE_NIC_FLX_ENTRY(hw, mdid, idx) \
-- wr32((hw), GLFLXP_RXDID_FLX_WRD_##idx(ICE_RXDID_FLEX_NIC), \
-+#define ICE_PROG_FLEX_ENTRY(hw, rxdid, mdid, idx) \
-+ wr32((hw), GLFLXP_RXDID_FLX_WRD_##idx(rxdid), \
- ((ICE_RX_OPC_MDID << \
- GLFLXP_RXDID_FLX_WRD_##idx##_RXDID_OPCODE_S) & \
- GLFLXP_RXDID_FLX_WRD_##idx##_RXDID_OPCODE_M) | \
- (((mdid) << GLFLXP_RXDID_FLX_WRD_##idx##_PROT_MDID_S) & \
- GLFLXP_RXDID_FLX_WRD_##idx##_PROT_MDID_M))
-
--#define ICE_NIC_FLX_FLG_ENTRY(hw, flg_0, flg_1, flg_2, flg_3, idx) \
-- wr32((hw), GLFLXP_RXDID_FLAGS(ICE_RXDID_FLEX_NIC, idx), \
-+#define ICE_PROG_FLG_ENTRY(hw, rxdid, flg_0, flg_1, flg_2, flg_3, idx) \
-+ wr32((hw), GLFLXP_RXDID_FLAGS(rxdid, idx), \
- (((flg_0) << GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_S) & \
- GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_M) | \
- (((flg_1) << GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_1_S) & \
-@@ -290,30 +290,85 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
- }
-
- /**
-- * ice_init_flex_parser - initialize rx flex parser
-+ * ice_init_flex_flags
- * @hw: pointer to the hardware structure
-+ * @prof_id: Rx Descriptor Builder profile ID
- *
-- * Function to initialize flex descriptors
-+ * Function to initialize Rx flex flags
- */
--static void ice_init_flex_parser(struct ice_hw *hw)
-+static void ice_init_flex_flags(struct ice_hw *hw, enum ice_rxdid prof_id)
- {
- u8 idx = 0;
-
-- ICE_NIC_FLX_ENTRY(hw, ICE_RX_MDID_HASH_LOW, 0);
-- ICE_NIC_FLX_ENTRY(hw, ICE_RX_MDID_HASH_HIGH, 1);
-- ICE_NIC_FLX_ENTRY(hw, ICE_RX_MDID_FLOW_ID_LOWER, 2);
-- ICE_NIC_FLX_ENTRY(hw, ICE_RX_MDID_FLOW_ID_HIGH, 3);
-- ICE_NIC_FLX_FLG_ENTRY(hw, ICE_RXFLG_PKT_FRG, ICE_RXFLG_UDP_GRE,
-- ICE_RXFLG_PKT_DSI, ICE_RXFLG_FIN, idx++);
-- ICE_NIC_FLX_FLG_ENTRY(hw, ICE_RXFLG_SYN, ICE_RXFLG_RST,
-- ICE_RXFLG_PKT_DSI, ICE_RXFLG_PKT_DSI, idx++);
-- ICE_NIC_FLX_FLG_ENTRY(hw, ICE_RXFLG_PKT_DSI, ICE_RXFLG_PKT_DSI,
-- ICE_RXFLG_EVLAN_x8100, ICE_RXFLG_EVLAN_x9100,
-- idx++);
-- ICE_NIC_FLX_FLG_ENTRY(hw, ICE_RXFLG_VLAN_x8100, ICE_RXFLG_TNL_VLAN,
-- ICE_RXFLG_TNL_MAC, ICE_RXFLG_TNL0, idx++);
-- ICE_NIC_FLX_FLG_ENTRY(hw, ICE_RXFLG_TNL1, ICE_RXFLG_TNL2,
-- ICE_RXFLG_PKT_DSI, ICE_RXFLG_PKT_DSI, idx);
-+ /* Flex-flag fields (0-2) are programmed with FLG64 bits with layout:
-+ * flexiflags0[5:0] - TCP flags, is_packet_fragmented, is_packet_UDP_GRE
-+ * flexiflags1[3:0] - Not used for flag programming
-+ * flexiflags2[7:0] - Tunnel and VLAN types
-+ * 2 invalid fields in last index
-+ */
-+ switch (prof_id) {
-+ /* Rx flex flags are currently programmed for the NIC profiles only.
-+ * Different flag bit programming configurations can be added per
-+ * profile as needed.
-+ */
-+ case ICE_RXDID_FLEX_NIC:
-+ case ICE_RXDID_FLEX_NIC_2:
-+ ICE_PROG_FLG_ENTRY(hw, prof_id, ICE_RXFLG_PKT_FRG,
-+ ICE_RXFLG_UDP_GRE, ICE_RXFLG_PKT_DSI,
-+ ICE_RXFLG_FIN, idx++);
-+ /* flex flag 1 is not used for flexi-flag programming, skipping
-+ * these four FLG64 bits.
-+ */
-+ ICE_PROG_FLG_ENTRY(hw, prof_id, ICE_RXFLG_SYN, ICE_RXFLG_RST,
-+ ICE_RXFLG_PKT_DSI, ICE_RXFLG_PKT_DSI, idx++);
-+ ICE_PROG_FLG_ENTRY(hw, prof_id, ICE_RXFLG_PKT_DSI,
-+ ICE_RXFLG_PKT_DSI, ICE_RXFLG_EVLAN_x8100,
-+ ICE_RXFLG_EVLAN_x9100, idx++);
-+ ICE_PROG_FLG_ENTRY(hw, prof_id, ICE_RXFLG_VLAN_x8100,
-+ ICE_RXFLG_TNL_VLAN, ICE_RXFLG_TNL_MAC,
-+ ICE_RXFLG_TNL0, idx++);
-+ ICE_PROG_FLG_ENTRY(hw, prof_id, ICE_RXFLG_TNL1, ICE_RXFLG_TNL2,
-+ ICE_RXFLG_PKT_DSI, ICE_RXFLG_PKT_DSI, idx);
-+ break;
-+
-+ default:
-+ ice_debug(hw, ICE_DBG_INIT,
-+ "Flag programming for profile ID %d not supported\n",
-+ prof_id);
-+ }
-+}
-+
-+/**
-+ * ice_init_flex_flds
-+ * @hw: pointer to the hardware structure
-+ * @prof_id: Rx Descriptor Builder profile ID
-+ *
-+ * Function to initialize flex descriptors
-+ */
-+static void ice_init_flex_flds(struct ice_hw *hw, enum ice_rxdid prof_id)
-+{
-+ enum ice_flex_rx_mdid mdid;
-+
-+ switch (prof_id) {
-+ case ICE_RXDID_FLEX_NIC:
-+ case ICE_RXDID_FLEX_NIC_2:
-+ ICE_PROG_FLEX_ENTRY(hw, prof_id, ICE_RX_MDID_HASH_LOW, 0);
-+ ICE_PROG_FLEX_ENTRY(hw, prof_id, ICE_RX_MDID_HASH_HIGH, 1);
-+ ICE_PROG_FLEX_ENTRY(hw, prof_id, ICE_RX_MDID_FLOW_ID_LOWER, 2);
-+
-+ mdid = (prof_id == ICE_RXDID_FLEX_NIC_2) ?
-+ ICE_RX_MDID_SRC_VSI : ICE_RX_MDID_FLOW_ID_HIGH;
-+
-+ ICE_PROG_FLEX_ENTRY(hw, prof_id, mdid, 3);
-+
-+ ice_init_flex_flags(hw, prof_id);
-+ break;
-+
-+ default:
-+ ice_debug(hw, ICE_DBG_INIT,
-+ "Field init for profile ID %d not supported\n",
-+ prof_id);
-+ }
- }
-
- /**
-@@ -494,7 +549,8 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
- if (status)
- goto err_unroll_fltr_mgmt_struct;
-
-- ice_init_flex_parser(hw);
-+ ice_init_flex_flds(hw, ICE_RXDID_FLEX_NIC);
-+ ice_init_flex_flds(hw, ICE_RXDID_FLEX_NIC_2);
-
- return 0;
-
-diff --git a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h
-index 068dbc740b766..94504023d86e2 100644
---- a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h
-+++ b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h
-@@ -188,23 +188,25 @@ struct ice_32b_rx_flex_desc_nic {
- * with a specific metadata (profile 7 reserved for HW)
- */
- enum ice_rxdid {
-- ICE_RXDID_START = 0,
-- ICE_RXDID_LEGACY_0 = ICE_RXDID_START,
-- ICE_RXDID_LEGACY_1,
-- ICE_RXDID_FLX_START,
-- ICE_RXDID_FLEX_NIC = ICE_RXDID_FLX_START,
-- ICE_RXDID_FLX_LAST = 63,
-- ICE_RXDID_LAST = ICE_RXDID_FLX_LAST
-+ ICE_RXDID_LEGACY_0 = 0,
-+ ICE_RXDID_LEGACY_1 = 1,
-+ ICE_RXDID_FLEX_NIC = 2,
-+ ICE_RXDID_FLEX_NIC_2 = 6,
-+ ICE_RXDID_HW = 7,
-+ ICE_RXDID_LAST = 63,
- };
-
- /* Receive Flex Descriptor Rx opcode values */
- #define ICE_RX_OPC_MDID 0x01
-
- /* Receive Descriptor MDID values */
--#define ICE_RX_MDID_FLOW_ID_LOWER 5
--#define ICE_RX_MDID_FLOW_ID_HIGH 6
--#define ICE_RX_MDID_HASH_LOW 56
--#define ICE_RX_MDID_HASH_HIGH 57
-+enum ice_flex_rx_mdid {
-+ ICE_RX_MDID_FLOW_ID_LOWER = 5,
-+ ICE_RX_MDID_FLOW_ID_HIGH,
-+ ICE_RX_MDID_SRC_VSI = 19,
-+ ICE_RX_MDID_HASH_LOW = 56,
-+ ICE_RX_MDID_HASH_HIGH,
-+};
-
- /* Rx Flag64 packet flag bits */
- enum ice_rx_flg64_bits {
---
-2.43.0
-
+++ /dev/null
-From 7f8ef8fa7550564abba9bdeaf20658d97938cf49 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 19 Mar 2024 13:44:34 -0700
-Subject: rcu: add a helper to report consolidated flavor QS
-
-From: Yan Zhai <yan@cloudflare.com>
-
-[ Upstream commit 1a77557d48cff187a169c2aec01c0dd78a5e7e50 ]
-
-When under heavy load, network processing can run CPU-bound for many
-tens of seconds. Even in preemptible kernels (non-RT kernel), this can
-block RCU Tasks grace periods, which can cause trace-event removal to
-take more than a minute, which is unacceptably long.
-
-This commit therefore creates a new helper function that passes through
-both RCU and RCU-Tasks quiescent states every 100 milliseconds. This
-hard-coded value suffices for current workloads.
-
-Suggested-by: Paul E. McKenney <paulmck@kernel.org>
-Reviewed-by: Jesper Dangaard Brouer <hawk@kernel.org>
-Signed-off-by: Yan Zhai <yan@cloudflare.com>
-Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
-Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
-Link: https://lore.kernel.org/r/90431d46ee112d2b0af04dbfe936faaca11810a5.1710877680.git.yan@cloudflare.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 00bf63122459 ("bpf: report RCU QS in cpumap kthread")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/rcupdate.h | 31 +++++++++++++++++++++++++++++++
- 1 file changed, 31 insertions(+)
-
-diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
-index cf139d6e5c1d3..38a9730b685b9 100644
---- a/include/linux/rcupdate.h
-+++ b/include/linux/rcupdate.h
-@@ -196,6 +196,37 @@ do { \
- cond_resched(); \
- } while (0)
-
-+/**
-+ * rcu_softirq_qs_periodic - Report RCU and RCU-Tasks quiescent states
-+ * @old_ts: jiffies at start of processing.
-+ *
-+ * This helper is for long-running softirq handlers, such as NAPI threads in
-+ * networking. The caller should initialize the variable passed in as @old_ts
-+ * at the beginning of the softirq handler. When invoked frequently, this macro
-+ * will invoke rcu_softirq_qs() every 100 milliseconds thereafter, which will
-+ * provide both RCU and RCU-Tasks quiescent states. Note that this macro
-+ * modifies its old_ts argument.
-+ *
-+ * Because regions of code that have disabled softirq act as RCU read-side
-+ * critical sections, this macro should be invoked with softirq (and
-+ * preemption) enabled.
-+ *
-+ * The macro is not needed when CONFIG_PREEMPT_RT is defined. RT kernels would
-+ * have more chance to invoke schedule() calls and provide necessary quiescent
-+ * states. As a contrast, calling cond_resched() only won't achieve the same
-+ * effect because cond_resched() does not provide RCU-Tasks quiescent states.
-+ */
-+#define rcu_softirq_qs_periodic(old_ts) \
-+do { \
-+ if (!IS_ENABLED(CONFIG_PREEMPT_RT) && \
-+ time_after(jiffies, (old_ts) + HZ / 10)) { \
-+ preempt_disable(); \
-+ rcu_softirq_qs(); \
-+ preempt_enable(); \
-+ (old_ts) = jiffies; \
-+ } \
-+} while (0)
-+
- /*
- * Infrastructure to implement the synchronize_() primitives in
- * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
---
-2.43.0
-