Skip to contentSkip to conversation

ice: Add switch recipe reusing feature

PATCH In review Steven Zou 3 participants 5 messages Feb 8, 2024 – Mar 20, 2024 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Steven Zou

author
#0 lore raw

PATCH 1/1 ice: Add switch recipe reusing feature

New E810 firmware supports the corresponding functionality, so the driver allows PFs to subscribe the same switch recipes. Then when the PF is done with a switch recipes, the PF can ask firmware to free that switch recipe.

When users configure a rule to PFn into E810 switch component, if there is no existing recipe matching this rule's pattern, the driver will request firmware to allocate and return a new recipe resource for the rule by calling ice_add_sw_recipe() and ice_alloc_recipe(). If there is an existing recipe matching this rule's pattern with different key value, or this is a same second rule to PFm into switch component, the driver checks out this recipe by calling ice_find_recp(), the driver will tell firmware to share using this same recipe resource by calling ice_subscribable_recp_shared() and ice_subscribe_recipe().

When firmware detects that all subscribing PFs have freed the switch recipe, firmware will free the switch recipe so that it can be reused.

This feature also fixes a problem where all switch recipes would eventually be exhausted because switch recipes could not be freed, as freeing a shared recipe could potentially break other PFs that were using it.

---
 .../net/ethernet/intel/ice/ice_adminq_cmd.h   |   2 +
 drivers/net/ethernet/intel/ice/ice_common.c   |   2 +
 drivers/net/ethernet/intel/ice/ice_switch.c   | 187 ++++++++++++++++--
 drivers/net/ethernet/intel/ice/ice_switch.h   |   1 +
 drivers/net/ethernet/intel/ice/ice_type.h     |   2 +
 5 files changed, 177 insertions(+), 17 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +2 -0
index 5df50a0b7867..b315c734455a 100644
@@ -273,6 +273,8 @@ struct ice_aqc_set_port_params {
 #define ICE_AQC_RES_TYPE_FLAG_SHARED			BIT(7)
 #define ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM		BIT(12)
 #define ICE_AQC_RES_TYPE_FLAG_IGNORE_INDEX		BIT(13)
+#define ICE_AQC_RES_TYPE_FLAG_SUBSCRIBE_SHARED		BIT(14)
+#define ICE_AQC_RES_TYPE_FLAG_SUBSCRIBE_CTL		BIT(15)
 
 #define ICE_AQC_RES_TYPE_FLAG_DEDICATED			0x00
 
drivers/net/ethernet/intel/ice/ice_common.c +2 -0
index d04a057f53fe..090a2b8b5ff2 100644
@@ -1146,6 +1146,8 @@ int ice_init_hw(struct ice_hw *hw)
 	if (status)
 		goto err_unroll_fltr_mgmt_struct;
 	mutex_init(&hw->tnl_lock);
+	ice_init_chk_recipe_reuse_support(hw);
+
 	return 0;
 
 err_unroll_fltr_mgmt_struct:
drivers/net/ethernet/intel/ice/ice_switch.c +170 -17

315 lines not on this page · raw message

drivers/net/ethernet/intel/ice/ice_switch.h +1 -0
index 89e6b18975ef..1e579b866233 100644
@@ -430,5 +430,6 @@ ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u64 *r_assoc,
 int
 ice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u64 r_assoc,
 			     struct ice_sq_cd *cd);
+void ice_init_chk_recipe_reuse_support(struct ice_hw *hw);
 
 #endif /* _ICE_SWITCH_H_ */
drivers/net/ethernet/intel/ice/ice_type.h +2 -0
index 32386aecd6c5..22813186ece0 100644
@@ -849,6 +849,8 @@ struct ice_hw {
 
 	u16 max_burst_size;	/* driver sets this value */
 
+	u8 recp_reuse:1;	/* indicates whether FW supports recipe reuse */
+
 	/* Tx Scheduler values */
 	u8 num_tx_sched_layers;
 	u8 num_tx_sched_phys_layers;

base-commit: ce1833c065c8c9aec8b147dd682b0ddca8c30071

Signature · 1 line
2.31.1

A message that is not in the archive (sent off-list or not yet received): PH0PR11MB5013D1C2AD784512CA70173396212@PH0PR11MB5013.namprd11.prod.outlook.com

#2 lore raw
Quoted 36 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Steven Zou
Sent: Thursday, February 8, 2024 8:49 AM
To: [email protected]
Cc: [email protected]; Zou, Steven <[email protected]>; Staikov, Andrii <[email protected]>; Lobakin, Aleksander <[email protected]>; Nguyen, Anthony L <[email protected]>; Simon Horman <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next] ice: Add switch recipe reusing feature

New E810 firmware supports the corresponding functionality, so the driver allows PFs to subscribe the same switch recipes. Then when the PF is done with a switch recipes, the PF can ask firmware to free that switch recipe.

When users configure a rule to PFn into E810 switch component, if there is no existing recipe matching this rule's pattern, the driver will request firmware to allocate and return a new recipe resource for the rule by calling ice_add_sw_recipe() and ice_alloc_recipe(). If there is an existing recipe matching this rule's pattern with different key value, or this is a same second rule to PFm into switch component, the driver checks out this recipe by calling ice_find_recp(), the driver will tell firmware to share using this same recipe resource by calling ice_subscribable_recp_shared() and ice_subscribe_recipe().

When firmware detects that all subscribing PFs have freed the switch recipe, firmware will free the switch recipe so that it can be reused.

This feature also fixes a problem where all switch recipes would eventually be exhausted because switch recipes could not be freed, as freeing a shared recipe could potentially break other PFs that were using it.

Quoted 8 lines
---
 .../net/ethernet/intel/ice/ice_adminq_cmd.h   |   2 +
 drivers/net/ethernet/intel/ice/ice_common.c   |   2 +
 drivers/net/ethernet/intel/ice/ice_switch.c   | 187 ++++++++++++++++--
 drivers/net/ethernet/intel/ice/ice_switch.h   |   1 +
 drivers/net/ethernet/intel/ice/ice_type.h     |   2 +
 5 files changed, 177 insertions(+), 17 deletions(-)

We are seeing following kernel compilation error while compiling next kernel:

"error: dereferencing pointer to incomplete type 'struct dpll_pin'"

Regards,
Mayank Sharma

#3 lore raw
Quoted 44 lines · Mayank
Quoted 36 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Steven Zou
Sent: Thursday, February 8, 2024 8:49 AM
To: [email protected]
Cc: [email protected]; Zou, Steven <[email protected]>; Staikov, Andrii <[email protected]>; Lobakin, Aleksander <[email protected]>; Nguyen, Anthony L <[email protected]>; Simon Horman <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next] ice: Add switch recipe reusing feature

New E810 firmware supports the corresponding functionality, so the driver allows PFs to subscribe the same switch recipes. Then when the PF is done with a switch recipes, the PF can ask firmware to free that switch recipe.

When users configure a rule to PFn into E810 switch component, if there is no existing recipe matching this rule's pattern, the driver will request firmware to allocate and return a new recipe resource for the rule by calling ice_add_sw_recipe() and ice_alloc_recipe(). If there is an existing recipe matching this rule's pattern with different key value, or this is a same second rule to PFm into switch component, the driver checks out this recipe by calling ice_find_recp(), the driver will tell firmware to share using this same recipe resource by calling ice_subscribable_recp_shared() and ice_subscribe_recipe().

When firmware detects that all subscribing PFs have freed the switch recipe, firmware will free the switch recipe so that it can be reused.

This feature also fixes a problem where all switch recipes would eventually be exhausted because switch recipes could not be freed, as freeing a shared recipe could potentially break other PFs that were using it.

Quoted 8 lines
---
  .../net/ethernet/intel/ice/ice_adminq_cmd.h   |   2 +
  drivers/net/ethernet/intel/ice/ice_common.c   |   2 +
  drivers/net/ethernet/intel/ice/ice_switch.c   | 187 ++++++++++++++++--
  drivers/net/ethernet/intel/ice/ice_switch.h   |   1 +
  drivers/net/ethernet/intel/ice/ice_type.h     |   2 +
  5 files changed, 177 insertions(+), 17 deletions(-)
Quoted 3 lines

We are seeing following kernel compilation error while compiling next kernel:

"error: dereferencing pointer to incomplete type 'struct dpll_pin'"

Thanks Mayank!
The patch does not touch 'stuct dpll_pin', I do not think this is caused by the patch changes.
And the patch is based on the base-commit: ce1833c065c8c9aec8b147dd682b0ddca8c30071 that I built and loaded the ice.ko successfully before I submitted the patch.

Hi Tony,
Do you have any suggestion about this compilation issue?

Quoted 4 lines

Regards,
Mayank Sharma

Best Regards,
Steven

maintainer
#4 lore raw
Quoted 11 lines · Steven
Quoted 3 lines

We are seeing following kernel compilation error while compiling next kernel:

"error: dereferencing pointer to incomplete type 'struct dpll_pin'"

Thanks Mayank!
The patch does not touch 'stuct dpll_pin', I do not think this is caused by the patch changes.
And the patch is based on the base-commit:
ce1833c065c8c9aec8b147dd682b0ddca8c30071 that I built and loaded the ice.ko successfully before I submitted the patch.

Quoted 2 lines

Hi Tony,
Do you have any suggestion about this compilation issue?

net-next tree currently has this problem. You can try merging in net which has the fix (it will propagate to net-next on Thursday). Or try changing the compiler, newer Clang and GCC do not generate this error.

Tested-by
#5 lore raw
In reply to a message not in the archive
Quoted 36 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Steven Zou
Sent: Thursday, February 8, 2024 8:49 AM
To: [email protected]
Cc: [email protected]; Zou, Steven <[email protected]>; Staikov, Andrii <[email protected]>; Lobakin, Aleksander <[email protected]>; Nguyen, Anthony L <[email protected]>; Simon Horman <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next] ice: Add switch recipe reusing feature

New E810 firmware supports the corresponding functionality, so the driver allows PFs to subscribe the same switch recipes. Then when the PF is done with a switch recipes, the PF can ask firmware to free that switch recipe.

When users configure a rule to PFn into E810 switch component, if there is no existing recipe matching this rule's pattern, the driver will request firmware to allocate and return a new recipe resource for the rule by calling ice_add_sw_recipe() and ice_alloc_recipe(). If there is an existing recipe matching this rule's pattern with different key value, or this is a same second rule to PFm into switch component, the driver checks out this recipe by calling ice_find_recp(), the driver will tell firmware to share using this same recipe resource by calling ice_subscribable_recp_shared() and ice_subscribe_recipe().

When firmware detects that all subscribing PFs have freed the switch recipe, firmware will free the switch recipe so that it can be reused.

This feature also fixes a problem where all switch recipes would eventually be exhausted because switch recipes could not be freed, as freeing a shared recipe could potentially break other PFs that were using it.

Quoted 7 lines
---
 .../net/ethernet/intel/ice/ice_adminq_cmd.h   |   2 +
 drivers/net/ethernet/intel/ice/ice_common.c   |   2 +
 drivers/net/ethernet/intel/ice/ice_switch.c   | 187 ++++++++++++++++--
 drivers/net/ethernet/intel/ice/ice_switch.h   |   1 +
 drivers/net/ethernet/intel/ice/ice_type.h     |   2 +
 5 files changed, 177 insertions(+), 17 deletions(-)