Skip to contentSkip to conversation

net/sfc: support packet replay in transfer flows

RFC Superseded Ivan Malov 3 participants 8 messages Aug 10, 2023 – Oct 2, 2023 Network drivers

lore
Share & tools
lore

Ivan Malov

author
#0 lore raw

RFC 1/1 net/sfc: support packet replay in transfer flows

Packet replay enables users to leverage multiple counters in one flow and allows to request delivery to multiple ports.

A given flow rule may use either one inline count action and multiple indirect counters or just multiple indirect counters. The inline count action (if any) must come before the first delivery action or before the first indirect count action, whichever comes earlier.

These are some testpmd examples of supported
multi-count and mirroring use cases:

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions port_representor port_id 0 / port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions count / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions indirect 239 / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

and the likes.

---
 doc/guides/rel_notes/release_23_11.rst |   2 +
 drivers/common/sfc_efx/base/efx.h      |  32 ++
 drivers/common/sfc_efx/base/efx_mae.c  | 175 ++++++
 drivers/common/sfc_efx/version.map     |   3 +
 drivers/net/sfc/sfc_mae.c              | 712 +++++++++++++++++++++----
 drivers/net/sfc/sfc_mae.h              |  37 ++
 6 files changed, 870 insertions(+), 91 deletions(-)
doc/guides/rel_notes/release_23_11.rst +2 -0
index dd10110fff..066495c622 100644
@@ -59,6 +59,8 @@ New Features
 
   * Added support for transfer flow action INDIRECT with subtype VXLAN_ENCAP.
 
+  * Supported packet replay (multi-count / multi-delivery) in transfer flows.
+
 
 Removed Items
 -------------
drivers/common/sfc_efx/base/efx.h +32 -0
index b4d8cfe9d8..3312c2fa8f 100644
@@ -5327,6 +5327,38 @@ efx_table_entry_delete(
 	__in_bcount(data_size)		uint8_t *entry_datap,
 	__in				unsigned int data_size);
 
+/*
+ * Clone the given MAE action set specification
+ * and drop actions COUNT and DELIVER from it.
+ */
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_replay(
+	__in			efx_nic_t *enp,
+	__in			const efx_mae_actions_t *spec_orig,
+	__out			efx_mae_actions_t **spec_clonep);
+
+/*
+ * The actual limit may be lower than this.
+ * This define merely limits the number of
+ * entries in a single allocation request.
+ */
+#define EFX_MAE_ACTION_SET_LIST_MAX_NENTRIES	254
+
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_list_alloc(
+	__in			efx_nic_t *enp,
+	__in			unsigned int n_asets,
+	__in_ecount(n_asets)	const efx_mae_aset_id_t *aset_ids,
+	__out			efx_mae_aset_list_id_t *aset_list_idp);
+
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_list_free(
+	__in			efx_nic_t *enp,
+	__in			const efx_mae_aset_list_id_t *aset_list_idp);
+
 #ifdef	__cplusplus
 }
 #endif
drivers/common/sfc_efx/base/efx_mae.c +175 -0

179 lines not on this page · raw message

drivers/common/sfc_efx/version.map +3 -0
index 43e8e52ab9..b2b90f5512 100644
@@ -97,6 +97,8 @@ INTERNAL {
 	efx_mae_action_set_fill_in_src_mac_id;
 	efx_mae_action_set_free;
 	efx_mae_action_set_get_nb_count;
+	efx_mae_action_set_list_alloc;
+	efx_mae_action_set_list_free;
 	efx_mae_action_set_populate_count;
 	efx_mae_action_set_populate_decap;
 	efx_mae_action_set_populate_decr_ip_ttl;
@@ -111,6 +113,7 @@ INTERNAL {
 	efx_mae_action_set_populate_set_src_mac;
 	efx_mae_action_set_populate_vlan_pop;
 	efx_mae_action_set_populate_vlan_push;
+	efx_mae_action_set_replay;
 	efx_mae_action_set_spec_fini;
 	efx_mae_action_set_spec_init;
 	efx_mae_action_set_specs_equal;
drivers/net/sfc/sfc_mae.c +621 -91

994 lines not on this page · raw message

drivers/net/sfc/sfc_mae.h +37 -0
index 7f4c3324bd..d5509b0582 100644
@@ -27,6 +27,7 @@ struct sfc_mae_fw_rsrc {
 	unsigned int			refcnt;
 	RTE_STD_C11
 	union {
+		efx_mae_aset_list_id_t	aset_list_id;
 		efx_counter_t		counter_id;
 		efx_mae_aset_id_t	aset_id;
 		efx_mae_rule_id_t	rule_id;
@@ -106,12 +107,27 @@ struct sfc_mae_action_set {
 
 TAILQ_HEAD(sfc_mae_action_sets, sfc_mae_action_set);
 
+/** Action set list registry entry */
+struct sfc_mae_action_set_list {
+	TAILQ_ENTRY(sfc_mae_action_set_list)	entries;
+	unsigned int				refcnt;
+	unsigned int				nb_action_sets;
+	struct sfc_mae_action_set		**action_sets;
+	struct sfc_mae_fw_rsrc			fw_rsrc;
+};
+
+TAILQ_HEAD(sfc_mae_action_set_lists, sfc_mae_action_set_list);
+
 /** Action rule registry entry */
 struct sfc_mae_action_rule {
 	TAILQ_ENTRY(sfc_mae_action_rule)	entries;
 	uint32_t				ct_mark;
 	struct sfc_mae_outer_rule		*outer_rule;
+	/*
+	 * When action_set_list != NULL, action_set is NULL, and vice versa.
+	 */
 	struct sfc_mae_action_set		*action_set;
+	struct sfc_mae_action_set_list		*action_set_list;
 	efx_mae_match_spec_t			*match_spec;
 	struct sfc_mae_fw_rsrc			fw_rsrc;
 	unsigned int				refcnt;
@@ -205,6 +221,18 @@ struct sfc_mae_counter_registry {
 	} polling;
 };
 
+/* Entry format for the action parsing bounce buffer */
+struct sfc_mae_aset_ctx {
+	struct sfc_mae_encap_header	*encap_header;
+	struct sfc_mae_counter		*counter;
+	struct sfc_mae_mac_addr		*dst_mac;
+	struct sfc_mae_mac_addr		*src_mac;
+
+	bool				fate_set;
+
+	efx_mae_actions_t		*spec;
+};
+
 struct sfc_mae {
 	/** Assigned switch domain identifier */
 	uint16_t			switch_domain_id;
@@ -226,10 +254,19 @@ struct sfc_mae {
 	struct sfc_mae_mac_addrs	mac_addrs;
 	/** Action set registry */
 	struct sfc_mae_action_sets	action_sets;
+	/** Action set list registry */
+	struct sfc_mae_action_set_lists	action_set_lists;
 	/** Action rule registry */
 	struct sfc_mae_action_rules	action_rules;
 	/** Encap. header bounce buffer */
 	struct sfc_mae_bounce_eh	bounce_eh;
+	/**
+	 * Action parsing bounce buffers
+	 */
+	struct sfc_mae_action_set	**bounce_aset_ptrs;
+	struct sfc_mae_aset_ctx		*bounce_aset_ctxs;
+	efx_mae_aset_id_t		*bounce_aset_ids;
+	unsigned int			nb_bounce_asets;
 	/** Flag indicating whether counter-only RxQ is running */
 	bool				counter_rxq_running;
 	/** Counter record registry */
Signature · 1 line
2.17.1
author
#1 lore raw

RFC v2 1/1 net/sfc: support packet replay in transfer flows

Packet replay enables users to leverage multiple counters in one flow and allows to request delivery to multiple ports.

A given flow rule may use either one inline count action and multiple indirect counters or just multiple indirect counters. The inline count action (if any) must come before the first delivery action or before the first indirect count action, whichever comes earlier.

These are some testpmd examples of supported
multi-count and mirroring use cases:

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions port_representor port_id 0 / port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions count / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions indirect 239 / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

and the likes.

---
Changes in v2:
* Fixed an assertion bug that had been found by Denis

 doc/guides/rel_notes/release_23_11.rst |   2 +
 drivers/common/sfc_efx/base/efx.h      |  32 ++
 drivers/common/sfc_efx/base/efx_mae.c  | 175 ++++++
 drivers/common/sfc_efx/version.map     |   3 +
 drivers/net/sfc/sfc_mae.c              | 724 +++++++++++++++++++++----
 drivers/net/sfc/sfc_mae.h              |  37 ++
 6 files changed, 882 insertions(+), 91 deletions(-)
doc/guides/rel_notes/release_23_11.rst +2 -0
index dd10110fff..066495c622 100644
@@ -59,6 +59,8 @@ New Features
 
   * Added support for transfer flow action INDIRECT with subtype VXLAN_ENCAP.
 
+  * Supported packet replay (multi-count / multi-delivery) in transfer flows.
+
 
 Removed Items
 -------------
drivers/common/sfc_efx/base/efx.h +32 -0
index b4d8cfe9d8..3312c2fa8f 100644
@@ -5327,6 +5327,38 @@ efx_table_entry_delete(
 	__in_bcount(data_size)		uint8_t *entry_datap,
 	__in				unsigned int data_size);
 
+/*
+ * Clone the given MAE action set specification
+ * and drop actions COUNT and DELIVER from it.
+ */
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_replay(
+	__in			efx_nic_t *enp,
+	__in			const efx_mae_actions_t *spec_orig,
+	__out			efx_mae_actions_t **spec_clonep);
+
+/*
+ * The actual limit may be lower than this.
+ * This define merely limits the number of
+ * entries in a single allocation request.
+ */
+#define EFX_MAE_ACTION_SET_LIST_MAX_NENTRIES	254
+
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_list_alloc(
+	__in			efx_nic_t *enp,
+	__in			unsigned int n_asets,
+	__in_ecount(n_asets)	const efx_mae_aset_id_t *aset_ids,
+	__out			efx_mae_aset_list_id_t *aset_list_idp);
+
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_list_free(
+	__in			efx_nic_t *enp,
+	__in			const efx_mae_aset_list_id_t *aset_list_idp);
+
 #ifdef	__cplusplus
 }
 #endif
drivers/common/sfc_efx/base/efx_mae.c +175 -0

179 lines not on this page · raw message

drivers/common/sfc_efx/version.map +3 -0
index 43e8e52ab9..b2b90f5512 100644
@@ -97,6 +97,8 @@ INTERNAL {
 	efx_mae_action_set_fill_in_src_mac_id;
 	efx_mae_action_set_free;
 	efx_mae_action_set_get_nb_count;
+	efx_mae_action_set_list_alloc;
+	efx_mae_action_set_list_free;
 	efx_mae_action_set_populate_count;
 	efx_mae_action_set_populate_decap;
 	efx_mae_action_set_populate_decr_ip_ttl;
@@ -111,6 +113,7 @@ INTERNAL {
 	efx_mae_action_set_populate_set_src_mac;
 	efx_mae_action_set_populate_vlan_pop;
 	efx_mae_action_set_populate_vlan_push;
+	efx_mae_action_set_replay;
 	efx_mae_action_set_spec_fini;
 	efx_mae_action_set_spec_init;
 	efx_mae_action_set_specs_equal;
drivers/net/sfc/sfc_mae.c +633 -91

1,009 lines not on this page · raw message

drivers/net/sfc/sfc_mae.h +37 -0
index 7f4c3324bd..d5509b0582 100644
@@ -27,6 +27,7 @@ struct sfc_mae_fw_rsrc {
 	unsigned int			refcnt;
 	RTE_STD_C11
 	union {
+		efx_mae_aset_list_id_t	aset_list_id;
 		efx_counter_t		counter_id;
 		efx_mae_aset_id_t	aset_id;
 		efx_mae_rule_id_t	rule_id;
@@ -106,12 +107,27 @@ struct sfc_mae_action_set {
 
 TAILQ_HEAD(sfc_mae_action_sets, sfc_mae_action_set);
 
+/** Action set list registry entry */
+struct sfc_mae_action_set_list {
+	TAILQ_ENTRY(sfc_mae_action_set_list)	entries;
+	unsigned int				refcnt;
+	unsigned int				nb_action_sets;
+	struct sfc_mae_action_set		**action_sets;
+	struct sfc_mae_fw_rsrc			fw_rsrc;
+};
+
+TAILQ_HEAD(sfc_mae_action_set_lists, sfc_mae_action_set_list);
+
 /** Action rule registry entry */
 struct sfc_mae_action_rule {
 	TAILQ_ENTRY(sfc_mae_action_rule)	entries;
 	uint32_t				ct_mark;
 	struct sfc_mae_outer_rule		*outer_rule;
+	/*
+	 * When action_set_list != NULL, action_set is NULL, and vice versa.
+	 */
 	struct sfc_mae_action_set		*action_set;
+	struct sfc_mae_action_set_list		*action_set_list;
 	efx_mae_match_spec_t			*match_spec;
 	struct sfc_mae_fw_rsrc			fw_rsrc;
 	unsigned int				refcnt;
@@ -205,6 +221,18 @@ struct sfc_mae_counter_registry {
 	} polling;
 };
 
+/* Entry format for the action parsing bounce buffer */
+struct sfc_mae_aset_ctx {
+	struct sfc_mae_encap_header	*encap_header;
+	struct sfc_mae_counter		*counter;
+	struct sfc_mae_mac_addr		*dst_mac;
+	struct sfc_mae_mac_addr		*src_mac;
+
+	bool				fate_set;
+
+	efx_mae_actions_t		*spec;
+};
+
 struct sfc_mae {
 	/** Assigned switch domain identifier */
 	uint16_t			switch_domain_id;
@@ -226,10 +254,19 @@ struct sfc_mae {
 	struct sfc_mae_mac_addrs	mac_addrs;
 	/** Action set registry */
 	struct sfc_mae_action_sets	action_sets;
+	/** Action set list registry */
+	struct sfc_mae_action_set_lists	action_set_lists;
 	/** Action rule registry */
 	struct sfc_mae_action_rules	action_rules;
 	/** Encap. header bounce buffer */
 	struct sfc_mae_bounce_eh	bounce_eh;
+	/**
+	 * Action parsing bounce buffers
+	 */
+	struct sfc_mae_action_set	**bounce_aset_ptrs;
+	struct sfc_mae_aset_ctx		*bounce_aset_ctxs;
+	efx_mae_aset_id_t		*bounce_aset_ids;
+	unsigned int			nb_bounce_asets;
 	/** Flag indicating whether counter-only RxQ is running */
 	bool				counter_rxq_running;
 	/** Counter record registry */
Signature · 1 line
2.17.1
author
#2 lore raw

RFC v3 1/1 net/sfc: support packet replay in transfer flows

In reply to Ivan Malov

Packet replay enables users to leverage multiple counters in one flow and allows to request delivery to multiple ports.

A given flow rule may use either one inline count action and multiple indirect counters or just multiple indirect counters. The inline count action (if any) must come before the first delivery action or before the first indirect count action, whichever comes earlier.

These are some testpmd examples of supported
multi-count and mirroring use cases:

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions port_representor port_id 0 / port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions count / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions indirect 239 / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

and the likes.

---
Changes in v2:
* Fixed an assertion bug that had been found by Denis

Changes in v3:
* Reworked after internal review feedback

 doc/guides/rel_notes/release_23_11.rst |   2 +
 drivers/common/sfc_efx/base/efx.h      |  32 +
 drivers/common/sfc_efx/base/efx_mae.c  | 175 +++++
 drivers/common/sfc_efx/version.map     |   3 +
 drivers/net/sfc/sfc_mae.c              | 858 +++++++++++++++++++++----
 drivers/net/sfc/sfc_mae.h              |  37 ++
 6 files changed, 969 insertions(+), 138 deletions(-)
doc/guides/rel_notes/release_23_11.rst +2 -0
index dd10110fff..066495c622 100644
@@ -59,6 +59,8 @@ New Features
 
   * Added support for transfer flow action INDIRECT with subtype VXLAN_ENCAP.
 
+  * Supported packet replay (multi-count / multi-delivery) in transfer flows.
+
 
 Removed Items
 -------------
drivers/common/sfc_efx/base/efx.h +32 -0
index b4d8cfe9d8..3312c2fa8f 100644
@@ -5327,6 +5327,38 @@ efx_table_entry_delete(
 	__in_bcount(data_size)		uint8_t *entry_datap,
 	__in				unsigned int data_size);
 
+/*
+ * Clone the given MAE action set specification
+ * and drop actions COUNT and DELIVER from it.
+ */
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_replay(
+	__in			efx_nic_t *enp,
+	__in			const efx_mae_actions_t *spec_orig,
+	__out			efx_mae_actions_t **spec_clonep);
+
+/*
+ * The actual limit may be lower than this.
+ * This define merely limits the number of
+ * entries in a single allocation request.
+ */
+#define EFX_MAE_ACTION_SET_LIST_MAX_NENTRIES	254
+
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_list_alloc(
+	__in			efx_nic_t *enp,
+	__in			unsigned int n_asets,
+	__in_ecount(n_asets)	const efx_mae_aset_id_t *aset_ids,
+	__out			efx_mae_aset_list_id_t *aset_list_idp);
+
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_list_free(
+	__in			efx_nic_t *enp,
+	__in			const efx_mae_aset_list_id_t *aset_list_idp);
+
 #ifdef	__cplusplus
 }
 #endif
drivers/common/sfc_efx/base/efx_mae.c +175 -0

179 lines not on this page · raw message

drivers/common/sfc_efx/version.map +3 -0
index 43e8e52ab9..b2b90f5512 100644
@@ -97,6 +97,8 @@ INTERNAL {
 	efx_mae_action_set_fill_in_src_mac_id;
 	efx_mae_action_set_free;
 	efx_mae_action_set_get_nb_count;
+	efx_mae_action_set_list_alloc;
+	efx_mae_action_set_list_free;
 	efx_mae_action_set_populate_count;
 	efx_mae_action_set_populate_decap;
 	efx_mae_action_set_populate_decr_ip_ttl;
@@ -111,6 +113,7 @@ INTERNAL {
 	efx_mae_action_set_populate_set_src_mac;
 	efx_mae_action_set_populate_vlan_pop;
 	efx_mae_action_set_populate_vlan_push;
+	efx_mae_action_set_replay;
 	efx_mae_action_set_spec_fini;
 	efx_mae_action_set_spec_init;
 	efx_mae_action_set_specs_equal;
drivers/net/sfc/sfc_mae.c +720 -138

1,138 lines not on this page · raw message

drivers/net/sfc/sfc_mae.h +37 -0
index 7f4c3324bd..d5509b0582 100644
@@ -27,6 +27,7 @@ struct sfc_mae_fw_rsrc {
 struct sfc_mae_fw_rsrc {
 	unsigned int			refcnt;
 	union {
+		efx_mae_aset_list_id_t	aset_list_id;
 		efx_counter_t		counter_id;
 		efx_mae_aset_id_t	aset_id;
 		efx_mae_rule_id_t	rule_id;
@@ -106,12 +107,27 @@ struct sfc_mae_action_set {
 
 TAILQ_HEAD(sfc_mae_action_sets, sfc_mae_action_set);
 
+/** Action set list registry entry */
+struct sfc_mae_action_set_list {
+	TAILQ_ENTRY(sfc_mae_action_set_list)	entries;
+	unsigned int				refcnt;
+	unsigned int				nb_action_sets;
+	struct sfc_mae_action_set		**action_sets;
+	struct sfc_mae_fw_rsrc			fw_rsrc;
+};
+
+TAILQ_HEAD(sfc_mae_action_set_lists, sfc_mae_action_set_list);
+
 /** Action rule registry entry */
 struct sfc_mae_action_rule {
 	TAILQ_ENTRY(sfc_mae_action_rule)	entries;
 	uint32_t				ct_mark;
 	struct sfc_mae_outer_rule		*outer_rule;
+	/*
+	 * When action_set_list != NULL, action_set is NULL, and vice versa.
+	 */
 	struct sfc_mae_action_set		*action_set;
+	struct sfc_mae_action_set_list		*action_set_list;
 	efx_mae_match_spec_t			*match_spec;
 	struct sfc_mae_fw_rsrc			fw_rsrc;
 	unsigned int				refcnt;
@@ -205,6 +221,18 @@ struct sfc_mae_counter_registry {
 	} polling;
 };
 
+/* Entry format for the action parsing bounce buffer */
+struct sfc_mae_aset_ctx {
+	struct sfc_mae_encap_header	*encap_header;
+	struct sfc_mae_counter		*counter;
+	struct sfc_mae_mac_addr		*dst_mac;
+	struct sfc_mae_mac_addr		*src_mac;
+
+	bool				fate_set;
+
+	efx_mae_actions_t		*spec;
+};
+
 struct sfc_mae {
 	/** Assigned switch domain identifier */
 	uint16_t			switch_domain_id;
@@ -226,10 +254,19 @@ struct sfc_mae {
 	struct sfc_mae_mac_addrs	mac_addrs;
 	/** Action set registry */
 	struct sfc_mae_action_sets	action_sets;
+	/** Action set list registry */
+	struct sfc_mae_action_set_lists	action_set_lists;
 	/** Action rule registry */
 	struct sfc_mae_action_rules	action_rules;
 	/** Encap. header bounce buffer */
 	struct sfc_mae_bounce_eh	bounce_eh;
+	/**
+	 * Action parsing bounce buffers
+	 */
+	struct sfc_mae_action_set	**bounce_aset_ptrs;
+	struct sfc_mae_aset_ctx		*bounce_aset_ctxs;
+	efx_mae_aset_id_t		*bounce_aset_ids;
+	unsigned int			nb_bounce_asets;
 	/** Flag indicating whether counter-only RxQ is running */
 	bool				counter_rxq_running;
 	/** Counter record registry */
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH 1/1 net/sfc: support packet replay in transfer flows

In reply to Ivan Malov

Packet replay enables users to leverage multiple counters in one flow and allows to request delivery to multiple ports.

A given flow rule may use either one inline count action and multiple indirect counters or just multiple indirect counters. The inline count action (if any) must come before the first delivery action or before the first indirect count action, whichever comes earlier.

These are some testpmd examples of supported
multi-count and mirroring use cases:

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions port_representor port_id 0 / port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions count / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions indirect 239 / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

and the likes.

---
RFC: https://patches.dpdk.org/project/dpdk/list/?series=29397

 doc/guides/rel_notes/release_23_11.rst |   2 +
 drivers/common/sfc_efx/base/efx.h      |  32 +
 drivers/common/sfc_efx/base/efx_mae.c  | 175 +++++
 drivers/common/sfc_efx/version.map     |   3 +
 drivers/net/sfc/sfc_mae.c              | 858 +++++++++++++++++++++----
 drivers/net/sfc/sfc_mae.h              |  37 ++
 6 files changed, 969 insertions(+), 138 deletions(-)
doc/guides/rel_notes/release_23_11.rst +2 -0
index dd10110fff..066495c622 100644
@@ -59,6 +59,8 @@ New Features
 
   * Added support for transfer flow action INDIRECT with subtype VXLAN_ENCAP.
 
+  * Supported packet replay (multi-count / multi-delivery) in transfer flows.
+
 
 Removed Items
 -------------
drivers/common/sfc_efx/base/efx.h +32 -0
index b4d8cfe9d8..3312c2fa8f 100644
@@ -5327,6 +5327,38 @@ efx_table_entry_delete(
 	__in_bcount(data_size)		uint8_t *entry_datap,
 	__in				unsigned int data_size);
 
+/*
+ * Clone the given MAE action set specification
+ * and drop actions COUNT and DELIVER from it.
+ */
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_replay(
+	__in			efx_nic_t *enp,
+	__in			const efx_mae_actions_t *spec_orig,
+	__out			efx_mae_actions_t **spec_clonep);
+
+/*
+ * The actual limit may be lower than this.
+ * This define merely limits the number of
+ * entries in a single allocation request.
+ */
+#define EFX_MAE_ACTION_SET_LIST_MAX_NENTRIES	254
+
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_list_alloc(
+	__in			efx_nic_t *enp,
+	__in			unsigned int n_asets,
+	__in_ecount(n_asets)	const efx_mae_aset_id_t *aset_ids,
+	__out			efx_mae_aset_list_id_t *aset_list_idp);
+
+LIBEFX_API
+extern	__checkReturn		efx_rc_t
+efx_mae_action_set_list_free(
+	__in			efx_nic_t *enp,
+	__in			const efx_mae_aset_list_id_t *aset_list_idp);
+
 #ifdef	__cplusplus
 }
 #endif
drivers/common/sfc_efx/base/efx_mae.c +175 -0

179 lines not on this page · raw message

drivers/common/sfc_efx/version.map +3 -0
index 43e8e52ab9..b2b90f5512 100644
@@ -97,6 +97,8 @@ INTERNAL {
 	efx_mae_action_set_fill_in_src_mac_id;
 	efx_mae_action_set_free;
 	efx_mae_action_set_get_nb_count;
+	efx_mae_action_set_list_alloc;
+	efx_mae_action_set_list_free;
 	efx_mae_action_set_populate_count;
 	efx_mae_action_set_populate_decap;
 	efx_mae_action_set_populate_decr_ip_ttl;
@@ -111,6 +113,7 @@ INTERNAL {
 	efx_mae_action_set_populate_set_src_mac;
 	efx_mae_action_set_populate_vlan_pop;
 	efx_mae_action_set_populate_vlan_push;
+	efx_mae_action_set_replay;
 	efx_mae_action_set_spec_fini;
 	efx_mae_action_set_spec_init;
 	efx_mae_action_set_specs_equal;
drivers/net/sfc/sfc_mae.c +720 -138

1,138 lines not on this page · raw message

drivers/net/sfc/sfc_mae.h +37 -0
index 7f4c3324bd..d5509b0582 100644
@@ -27,6 +27,7 @@ struct sfc_mae_fw_rsrc {
 struct sfc_mae_fw_rsrc {
 	unsigned int			refcnt;
 	union {
+		efx_mae_aset_list_id_t	aset_list_id;
 		efx_counter_t		counter_id;
 		efx_mae_aset_id_t	aset_id;
 		efx_mae_rule_id_t	rule_id;
@@ -106,12 +107,27 @@ struct sfc_mae_action_set {
 
 TAILQ_HEAD(sfc_mae_action_sets, sfc_mae_action_set);
 
+/** Action set list registry entry */
+struct sfc_mae_action_set_list {
+	TAILQ_ENTRY(sfc_mae_action_set_list)	entries;
+	unsigned int				refcnt;
+	unsigned int				nb_action_sets;
+	struct sfc_mae_action_set		**action_sets;
+	struct sfc_mae_fw_rsrc			fw_rsrc;
+};
+
+TAILQ_HEAD(sfc_mae_action_set_lists, sfc_mae_action_set_list);
+
 /** Action rule registry entry */
 struct sfc_mae_action_rule {
 	TAILQ_ENTRY(sfc_mae_action_rule)	entries;
 	uint32_t				ct_mark;
 	struct sfc_mae_outer_rule		*outer_rule;
+	/*
+	 * When action_set_list != NULL, action_set is NULL, and vice versa.
+	 */
 	struct sfc_mae_action_set		*action_set;
+	struct sfc_mae_action_set_list		*action_set_list;
 	efx_mae_match_spec_t			*match_spec;
 	struct sfc_mae_fw_rsrc			fw_rsrc;
 	unsigned int				refcnt;
@@ -205,6 +221,18 @@ struct sfc_mae_counter_registry {
 	} polling;
 };
 
+/* Entry format for the action parsing bounce buffer */
+struct sfc_mae_aset_ctx {
+	struct sfc_mae_encap_header	*encap_header;
+	struct sfc_mae_counter		*counter;
+	struct sfc_mae_mac_addr		*dst_mac;
+	struct sfc_mae_mac_addr		*src_mac;
+
+	bool				fate_set;
+
+	efx_mae_actions_t		*spec;
+};
+
 struct sfc_mae {
 	/** Assigned switch domain identifier */
 	uint16_t			switch_domain_id;
@@ -226,10 +254,19 @@ struct sfc_mae {
 	struct sfc_mae_mac_addrs	mac_addrs;
 	/** Action set registry */
 	struct sfc_mae_action_sets	action_sets;
+	/** Action set list registry */
+	struct sfc_mae_action_set_lists	action_set_lists;
 	/** Action rule registry */
 	struct sfc_mae_action_rules	action_rules;
 	/** Encap. header bounce buffer */
 	struct sfc_mae_bounce_eh	bounce_eh;
+	/**
+	 * Action parsing bounce buffers
+	 */
+	struct sfc_mae_action_set	**bounce_aset_ptrs;
+	struct sfc_mae_aset_ctx		*bounce_aset_ctxs;
+	efx_mae_aset_id_t		*bounce_aset_ids;
+	unsigned int			nb_bounce_asets;
 	/** Flag indicating whether counter-only RxQ is running */
 	bool				counter_rxq_running;
 	/** Counter record registry */
Signature · 1 line
2.17.1
#4 lore raw
Quoted 27 lines · Ivan Malov

Packet replay enables users to leverage multiple counters in one flow and allows to request delivery to multiple ports.

A given flow rule may use either one inline count action and multiple indirect counters or just multiple indirect counters. The inline count action (if any) must come before the first delivery action or before the first indirect count action, whichever comes earlier.

These are some testpmd examples of supported
multi-count and mirroring use cases:

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions port_representor port_id 0 / port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions count / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

Quoted 9 lines

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions indirect 239 / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

and the likes.

Hi Andrew, Reminder of this patch waiting for review.

Acked-by on v1 1/1
#5 lore raw
In reply to Ivan Malov
Quoted 27 lines · Ivan Malov

Packet replay enables users to leverage multiple counters in one flow and allows to request delivery to multiple ports.

A given flow rule may use either one inline count action and multiple indirect counters or just multiple indirect counters. The inline count action (if any) must come before the first delivery action or before the first indirect count action, whichever comes earlier.

These are some testpmd examples of supported
multi-count and mirroring use cases:

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions port_representor port_id 0 / port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions count / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

Quoted 8 lines

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions indirect 239 / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

and the likes.

author
#6 lore raw
Quoted 32 lines · Andrew Rybchenko
Quoted 31 lines · Ivan Malov

Packet replay enables users to leverage multiple counters in one flow and allows to request delivery to multiple ports.

A given flow rule may use either one inline count action and multiple indirect counters or just multiple indirect counters. The inline count action (if any) must come before the first delivery action or before the first indirect count action, whichever comes earlier.

These are some testpmd examples of supported
multi-count and mirroring use cases:

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions port_representor port_id 0 / port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions count / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
actions indirect 239 / port_representor port_id 0 / indirect 239 / \
port_representor port_id 1 / end

Quoted 7 lines
Quoted 4 lines

and the likes.

Thank you.

Applied
#7 lore raw
In reply to Andrew Rybchenko
Quoted 35 lines · Andrew Rybchenko
Quoted 34 lines · Ivan Malov

Packet replay enables users to leverage multiple counters in one flow and allows to request delivery to multiple ports.

A given flow rule may use either one inline count action and multiple indirect counters or just multiple indirect counters. The inline count action (if any) must come before the first delivery action or before the first indirect count action, whichever comes earlier.

These are some testpmd examples of supported
multi-count and mirroring use cases:

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
  actions port_representor port_id 0 / port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
  actions count / port_representor port_id 0 / indirect 239 / \
  port_representor port_id 1 / end

or

flow indirect_action 0 create action_id 239 transfer action count / end

flow create 0 transfer pattern represented_port ethdev_port_id is 0 / end \
  actions indirect 239 / port_representor port_id 0 / indirect 239 / \
  port_representor port_id 1 / end

Quoted 8 lines
Quoted 4 lines

and the likes.

Applied to dpdk-next-net/main, thanks.