Skip to contentSkip to conversation

net/sfc: offer indirect VXLAN encap action in transfer flows

PATCH In review Ivan Malov 3 participants 6 messages Aug 10, 2023 – Sep 22, 2023 Network drivers

lore
Share & tools
lore

Ivan Malov

author
#0 lore raw

PATCH 1/2 net/sfc: offer indirect VXLAN encap action in transfer flows

Parsing inline action VXLAN_ENCAP repeating in many flows is expensive, so offer support for its indirect version. Query operation is not supported for this action. The next patch will add a means to update the encapsulation header data.

---
 .mailmap                               |  2 +-
 doc/guides/rel_notes/release_23_11.rst |  4 ++
 drivers/net/sfc/sfc_flow.h             |  1 +
 drivers/net/sfc/sfc_mae.c              | 51 ++++++++++++++++++++++++++
 drivers/net/sfc/sfc_mae.h              |  1 +
 5 files changed, 58 insertions(+), 1 deletion(-)
.mailmap +1 -1
index 864d33ee46..ec31ab8bd0 100644
@@ -106,7 +106,7 @@ Andriy Berestovskyy <[email protected]> <[email protected]>
 Andrzej Ostruszka <[email protected]> <[email protected]>
 Andy Gospodarek <[email protected]> <[email protected]>
 Andy Green <[email protected]>
-Andy Moreton <[email protected]> <[email protected]>
+Andy Moreton <[email protected]> <[email protected]> <[email protected]>
 Andy Pei <[email protected]>
 Anirudh Venkataramanan <[email protected]>
 Ankur Dwivedi <[email protected]> <[email protected]> <[email protected]>
doc/guides/rel_notes/release_23_11.rst +4 -0
index 6b4dd21fd0..dd10110fff 100644
@@ -55,6 +55,10 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Updated Solarflare network PMD.**
+
+  * Added support for transfer flow action INDIRECT with subtype VXLAN_ENCAP.
+
 
 Removed Items
 -------------
drivers/net/sfc/sfc_flow.h +1 -0
index 601f93e540..95fcb5abe0 100644
@@ -98,6 +98,7 @@ struct rte_flow_action_handle {
 	enum rte_flow_action_type		type;
 
 	union {
+		struct sfc_mae_encap_header	*encap_header;
 		struct sfc_mae_counter		*counter;
 	};
 };
drivers/net/sfc/sfc_mae.c +51 -0

93 lines not on this page · raw message

drivers/net/sfc/sfc_mae.h +1 -0
index 059718e383..4b928f876b 100644
@@ -60,6 +60,7 @@ TAILQ_HEAD(sfc_mae_mac_addrs, sfc_mae_mac_addr);
 struct sfc_mae_encap_header {
 	TAILQ_ENTRY(sfc_mae_encap_header)	entries;
 	unsigned int				refcnt;
+	bool					indirect;
 	uint8_t					*buf;
 	size_t					size;
 	efx_tunnel_protocol_t			type;
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 2/2 net/sfc: support updating indirect VXLAN encap action

Such updates are helpful as they let applications avoid costly flow re-insertions when the header data changes.

---
 drivers/common/sfc_efx/base/efx.h     |  9 +++
 drivers/common/sfc_efx/base/efx_mae.c | 80 ++++++++++++++++++++++++
 drivers/common/sfc_efx/version.map    |  1 +
 drivers/net/sfc/sfc_flow.c            | 35 +++++++++++
 drivers/net/sfc/sfc_mae.c             | 88 +++++++++++++++++++++++++++
 drivers/net/sfc/sfc_mae.h             |  5 ++
 6 files changed, 218 insertions(+)
drivers/common/sfc_efx/base/efx.h +9 -0
index efefea717f..b4d8cfe9d8 100644
@@ -4811,6 +4811,15 @@ efx_mae_encap_header_alloc(
 	__in				size_t header_size,
 	__out				efx_mae_eh_id_t *eh_idp);
 
+LIBEFX_API
+extern	__checkReturn			efx_rc_t
+efx_mae_encap_header_update(
+	__in				efx_nic_t *enp,
+	__in				efx_mae_eh_id_t *eh_idp,
+	__in				efx_tunnel_protocol_t encap_type,
+	__in_bcount(header_size)	const uint8_t *header_data,
+	__in				size_t header_size);
+
 LIBEFX_API
 extern	__checkReturn			efx_rc_t
 efx_mae_encap_header_free(
drivers/common/sfc_efx/base/efx_mae.c +80 -0

86 lines not on this page · raw message

drivers/common/sfc_efx/version.map +1 -0
index 40c97ad2b4..43e8e52ab9 100644
@@ -123,6 +123,7 @@ INTERNAL {
 	efx_mae_counters_stream_stop;
 	efx_mae_encap_header_alloc;
 	efx_mae_encap_header_free;
+	efx_mae_encap_header_update;
 	efx_mae_fini;
 	efx_mae_get_limits;
 	efx_mae_init;
drivers/net/sfc/sfc_flow.c +35 -0
index a35f20770d..1b50aefe5c 100644
@@ -2864,6 +2864,40 @@ sfc_flow_action_handle_destroy(struct rte_eth_dev *dev,
 	return rc;
 }
 
+static int
+sfc_flow_action_handle_update(struct rte_eth_dev *dev,
+			      struct rte_flow_action_handle *handle,
+			      const void *update, struct rte_flow_error *error)
+{
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
+	struct rte_flow_action_handle *entry;
+	int rc = EINVAL;
+
+	sfc_adapter_lock(sa);
+
+	TAILQ_FOREACH(entry, &sa->flow_indir_actions, entries) {
+		if (entry != handle)
+			continue;
+
+		if (entry->transfer) {
+			rc = sfc_mae_indir_action_update(sa, handle,
+							 update, error);
+		} else {
+			SFC_ASSERT(B_FALSE);
+		}
+
+		goto exit;
+	}
+
+	rc = rte_flow_error_set(error, ENOENT,
+				RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+				"indirect action handle not found");
+
+exit:
+	sfc_adapter_unlock(sa);
+	return rc;
+}
+
 static int
 sfc_flow_action_handle_query(struct rte_eth_dev *dev,
 			     const struct rte_flow_action_handle *handle,
@@ -2907,6 +2941,7 @@ const struct rte_flow_ops sfc_flow_ops = {
 	.isolate = sfc_flow_isolate,
 	.action_handle_create = sfc_flow_action_handle_create,
 	.action_handle_destroy = sfc_flow_action_handle_destroy,
+	.action_handle_update = sfc_flow_action_handle_update,
 	.action_handle_query = sfc_flow_action_handle_query,
 	.tunnel_decap_set = sfc_ft_decap_set,
 	.tunnel_match = sfc_ft_match,
drivers/net/sfc/sfc_mae.c +88 -0

100 lines not on this page · raw message

drivers/net/sfc/sfc_mae.h +5 -0
index 4b928f876b..7f4c3324bd 100644
@@ -422,6 +422,11 @@ int sfc_mae_indir_action_destroy(struct sfc_adapter *sa,
 				 const struct rte_flow_action_handle *handle,
 				 struct rte_flow_error *error);
 
+int sfc_mae_indir_action_update(struct sfc_adapter *sa,
+				struct rte_flow_action_handle *handle,
+				const void *update,
+				struct rte_flow_error *error);
+
 int sfc_mae_indir_action_query(struct sfc_adapter *sa,
 			       const struct rte_flow_action_handle *handle,
 			       void *data, struct rte_flow_error *error);
Signature · 1 line
2.31.1
#3 lore raw
In reply to Ivan Malov
Quoted 8 lines · Ivan Malov

Parsing inline action VXLAN_ENCAP repeating in many flows is expensive, so offer support for its indirect version. Query operation is not supported for this action. The next patch will add a means to update the encapsulation header data.

Hi Andrew,

Are you planning to review the set, or do you want me proceed with Andy's review. Please advise how to progress.

#5 lore raw
Quoted 6 lines · Andrew Rybchenko
Quoted 5 lines · Ivan Malov

Parsing inline action VXLAN_ENCAP repeating in many flows is expensive, so offer support for its indirect version. Query operation is not supported for this action. The next patch will add a means to update the encapsulation header data.

Quoted 6 lines
Quoted 2 lines

Series applied to dpdk-next-net/main, thanks.