DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement actions in transfer flows
@ 2021-11-05 21:54 Ivan Malov
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 1/5] common/sfc_efx/base: refine adding encap action to a set Ivan Malov
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ivan Malov @ 2021-11-05 21:54 UTC (permalink / raw)
  To: dev

Ivan Malov (5):
  common/sfc_efx/base: refine adding encap action to a set
  common/sfc_efx/base: refine adding count action to a set
  common/sfc_efx/base: factor out no-op helper functions
  common/sfc_efx/base: support adding dec. TTL action to a set
  net/sfc: support decrement IP TTL actions in transfer flows

 doc/guides/nics/features/sfc.ini       |   2 +
 doc/guides/nics/sfc_efx.rst            |   4 +
 drivers/common/sfc_efx/base/ef10_nic.c |   9 ++
 drivers/common/sfc_efx/base/efx.h      |  14 +++
 drivers/common/sfc_efx/base/efx_impl.h |   8 ++
 drivers/common/sfc_efx/base/efx_mae.c  | 151 +++++++++++--------------
 drivers/common/sfc_efx/version.map     |   1 +
 drivers/net/sfc/sfc_mae.c              |   8 ++
 8 files changed, 110 insertions(+), 87 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 1/5] common/sfc_efx/base: refine adding encap action to a set
  2021-11-05 21:54 [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement actions in transfer flows Ivan Malov
@ 2021-11-05 21:54 ` Ivan Malov
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 2/5] common/sfc_efx/base: refine adding count " Ivan Malov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ivan Malov @ 2021-11-05 21:54 UTC (permalink / raw)
  To: dev; +Cc: stable, Andrew Rybchenko, Andy Moreton

1) Invalid encap. header ID is always set by default.
   Do not set it again when adding the action.

2) Encap. header ID validity check is missing in the
   action set allocation helper. Introduce it.

Fixes: 3907defa5bf0 ("common/sfc_efx/base: support adding encap action to a set")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/efx_mae.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index 154b6e1cdd..542c345b76 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -1525,16 +1525,13 @@ efx_mae_action_set_add_encap(
 	 * needs to check the order of actions submitted by user ("validate"),
 	 * without actually allocating an action set and inserting a rule.
 	 *
-	 * For now, mark encap. header ID as invalid; the caller will invoke
-	 * efx_mae_action_set_fill_in_eh_id() to override the field prior
-	 * to action set allocation; otherwise, the allocation will fail.
+	 * In order to fill in the encap. header ID, the caller is supposed to
+	 * invoke efx_mae_action_set_fill_in_eh_id(). If they do not do that,
+	 * efx_mae_action_set_alloc() invocation will throw an error.
+	 *
+	 * For now, no more work is supposed to be done.
 	 */
-	spec->ema_rsrc.emar_eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 
-	/*
-	 * As explained above, there are no arguments to handle here.
-	 * efx_mae_action_set_fill_in_eh_id() will take care of them.
-	 */
 	if (arg_size != 0) {
 		rc = EINVAL;
 		goto fail1;
@@ -2582,6 +2579,12 @@ efx_mae_action_set_alloc(
 		goto fail1;
 	}
 
+	if ((spec->ema_actions & (1U << EFX_MAE_ACTION_ENCAP)) != 0 &&
+	    spec->ema_rsrc.emar_eh_id.id == EFX_MAE_RSRC_ID_INVALID) {
+		rc = EINVAL;
+		goto fail2;
+	}
+
 	req.emr_cmd = MC_CMD_MAE_ACTION_SET_ALLOC;
 	req.emr_in_buf = payload;
 	req.emr_in_length = MC_CMD_MAE_ACTION_SET_ALLOC_IN_LEN;
@@ -2659,24 +2662,26 @@ efx_mae_action_set_alloc(
 
 	if (req.emr_rc != 0) {
 		rc = req.emr_rc;
-		goto fail2;
+		goto fail3;
 	}
 
 	if (req.emr_out_length_used < MC_CMD_MAE_ACTION_SET_ALLOC_OUT_LEN) {
 		rc = EMSGSIZE;
-		goto fail3;
+		goto fail4;
 	}
 
 	aset_id.id = MCDI_OUT_DWORD(req, MAE_ACTION_SET_ALLOC_OUT_AS_ID);
 	if (aset_id.id == EFX_MAE_RSRC_ID_INVALID) {
 		rc = ENOENT;
-		goto fail4;
+		goto fail5;
 	}
 
 	aset_idp->id = aset_id.id;
 
 	return (0);
 
+fail5:
+	EFSYS_PROBE(fail5);
 fail4:
 	EFSYS_PROBE(fail4);
 fail3:
-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 2/5] common/sfc_efx/base: refine adding count action to a set
  2021-11-05 21:54 [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement actions in transfer flows Ivan Malov
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 1/5] common/sfc_efx/base: refine adding encap action to a set Ivan Malov
@ 2021-11-05 21:54 ` Ivan Malov
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 3/5] common/sfc_efx/base: factor out no-op helper functions Ivan Malov
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ivan Malov @ 2021-11-05 21:54 UTC (permalink / raw)
  To: dev; +Cc: stable, Andrew Rybchenko, Andy Moreton, Igor Romanov

1) Invalid counter ID is always set by default.
   Do not set it again when adding the action.

2) Counter ID validity check is missing in the
   action set allocation helper. Introduce it.

Fixes: 238306cf9aff ("common/sfc_efx/base: support counter in action set")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/efx_mae.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index 542c345b76..c93fe9bdfc 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -1567,13 +1567,14 @@ efx_mae_action_set_add_count(
 	 * two steps: first add this action to the action spec, and then
 	 * add the counter ID to the spec. This allows validity checking
 	 * and resource allocation to be done separately.
-	 * Mark the counter ID as invalid in the spec to ensure that the
-	 * caller must also invoke efx_mae_action_set_fill_in_counter_id()
-	 * before action set allocation.
+	 *
+	 * In order to fill in the counter ID, the caller is supposed to invoke
+	 * efx_mae_action_set_fill_in_counter_id(). If they do not do that,
+	 * efx_mae_action_set_alloc() invocation will throw an error.
+	 *
+	 * For now, no arguments are supposed to be handled.
 	 */
-	spec->ema_rsrc.emar_counter_id.id = EFX_MAE_RSRC_ID_INVALID;
 
-	/* Nothing else is supposed to take place over here. */
 	if (arg_size != 0) {
 		rc = EINVAL;
 		goto fail1;
@@ -2585,6 +2586,12 @@ efx_mae_action_set_alloc(
 		goto fail2;
 	}
 
+	if (spec->ema_n_count_actions == 1 &&
+	    spec->ema_rsrc.emar_counter_id.id == EFX_MAE_RSRC_ID_INVALID) {
+		rc = EINVAL;
+		goto fail3;
+	}
+
 	req.emr_cmd = MC_CMD_MAE_ACTION_SET_ALLOC;
 	req.emr_in_buf = payload;
 	req.emr_in_length = MC_CMD_MAE_ACTION_SET_ALLOC_IN_LEN;
@@ -2662,24 +2669,26 @@ efx_mae_action_set_alloc(
 
 	if (req.emr_rc != 0) {
 		rc = req.emr_rc;
-		goto fail3;
+		goto fail4;
 	}
 
 	if (req.emr_out_length_used < MC_CMD_MAE_ACTION_SET_ALLOC_OUT_LEN) {
 		rc = EMSGSIZE;
-		goto fail4;
+		goto fail5;
 	}
 
 	aset_id.id = MCDI_OUT_DWORD(req, MAE_ACTION_SET_ALLOC_OUT_AS_ID);
 	if (aset_id.id == EFX_MAE_RSRC_ID_INVALID) {
 		rc = ENOENT;
-		goto fail5;
+		goto fail6;
 	}
 
 	aset_idp->id = aset_id.id;
 
 	return (0);
 
+fail6:
+	EFSYS_PROBE(fail6);
 fail5:
 	EFSYS_PROBE(fail5);
 fail4:
-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 3/5] common/sfc_efx/base: factor out no-op helper functions
  2021-11-05 21:54 [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement actions in transfer flows Ivan Malov
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 1/5] common/sfc_efx/base: refine adding encap action to a set Ivan Malov
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 2/5] common/sfc_efx/base: refine adding count " Ivan Malov
@ 2021-11-05 21:54 ` Ivan Malov
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 4/5] common/sfc_efx/base: support adding dec. TTL action to a set Ivan Malov
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ivan Malov @ 2021-11-05 21:54 UTC (permalink / raw)
  To: dev; +Cc: Andrew Rybchenko, Andy Moreton

When an action gets added to an action set, a special helper is
used to handle its arguments. There are actions which have no
arguments, and the corresponding helpers are duplicates in
fact. Use a unified no-op helper instead of them.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/efx_mae.c | 80 ++-------------------------
 1 file changed, 4 insertions(+), 76 deletions(-)

diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index c93fe9bdfc..41444e1926 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -1406,7 +1406,7 @@ efx_mae_action_set_spec_fini(
 }
 
 static	__checkReturn			efx_rc_t
-efx_mae_action_set_add_decap(
+efx_mae_action_set_no_op(
 	__in				efx_mae_actions_t *spec,
 	__in				size_t arg_size,
 	__in_bcount(arg_size)		const uint8_t *arg)
@@ -1510,47 +1510,6 @@ efx_mae_action_set_add_vlan_push(
 	return (rc);
 }
 
-static	__checkReturn			efx_rc_t
-efx_mae_action_set_add_encap(
-	__in				efx_mae_actions_t *spec,
-	__in				size_t arg_size,
-	__in_bcount(arg_size)		const uint8_t *arg)
-{
-	efx_rc_t rc;
-
-	/*
-	 * Adding this specific action to an action set spec and setting encap.
-	 * header ID in the spec are two individual steps. This design allows
-	 * the client driver to avoid encap. header allocation when it simply
-	 * needs to check the order of actions submitted by user ("validate"),
-	 * without actually allocating an action set and inserting a rule.
-	 *
-	 * In order to fill in the encap. header ID, the caller is supposed to
-	 * invoke efx_mae_action_set_fill_in_eh_id(). If they do not do that,
-	 * efx_mae_action_set_alloc() invocation will throw an error.
-	 *
-	 * For now, no more work is supposed to be done.
-	 */
-
-	if (arg_size != 0) {
-		rc = EINVAL;
-		goto fail1;
-	}
-
-	if (arg != NULL) {
-		rc = EINVAL;
-		goto fail2;
-	}
-
-	return (0);
-
-fail2:
-	EFSYS_PROBE(fail2);
-fail1:
-	EFSYS_PROBE1(fail1, efx_rc_t, rc);
-	return (rc);
-}
-
 static	__checkReturn			efx_rc_t
 efx_mae_action_set_add_count(
 	__in				efx_mae_actions_t *spec,
@@ -1596,37 +1555,6 @@ efx_mae_action_set_add_count(
 	return (rc);
 }
 
-static	__checkReturn			efx_rc_t
-efx_mae_action_set_add_flag(
-	__in				efx_mae_actions_t *spec,
-	__in				size_t arg_size,
-	__in_bcount(arg_size)		const uint8_t *arg)
-{
-	efx_rc_t rc;
-
-	_NOTE(ARGUNUSED(spec))
-
-	if (arg_size != 0) {
-		rc = EINVAL;
-		goto fail1;
-	}
-
-	if (arg != NULL) {
-		rc = EINVAL;
-		goto fail2;
-	}
-
-	/* This action does not have any arguments, so do nothing here. */
-
-	return (0);
-
-fail2:
-	EFSYS_PROBE(fail2);
-fail1:
-	EFSYS_PROBE1(fail1, efx_rc_t, rc);
-	return (rc);
-}
-
 static	__checkReturn			efx_rc_t
 efx_mae_action_set_add_mark(
 	__in				efx_mae_actions_t *spec,
@@ -1693,7 +1621,7 @@ typedef struct efx_mae_action_desc_s {
 
 static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = {
 	[EFX_MAE_ACTION_DECAP] = {
-		.emad_add = efx_mae_action_set_add_decap
+		.emad_add = efx_mae_action_set_no_op
 	},
 	[EFX_MAE_ACTION_VLAN_POP] = {
 		.emad_add = efx_mae_action_set_add_vlan_pop
@@ -1702,13 +1630,13 @@ static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = {
 		.emad_add = efx_mae_action_set_add_vlan_push
 	},
 	[EFX_MAE_ACTION_ENCAP] = {
-		.emad_add = efx_mae_action_set_add_encap
+		.emad_add = efx_mae_action_set_no_op
 	},
 	[EFX_MAE_ACTION_COUNT] = {
 		.emad_add = efx_mae_action_set_add_count
 	},
 	[EFX_MAE_ACTION_FLAG] = {
-		.emad_add = efx_mae_action_set_add_flag
+		.emad_add = efx_mae_action_set_no_op
 	},
 	[EFX_MAE_ACTION_MARK] = {
 		.emad_add = efx_mae_action_set_add_mark
-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 4/5] common/sfc_efx/base: support adding dec. TTL action to a set
  2021-11-05 21:54 [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement actions in transfer flows Ivan Malov
                   ` (2 preceding siblings ...)
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 3/5] common/sfc_efx/base: factor out no-op helper functions Ivan Malov
@ 2021-11-05 21:54 ` Ivan Malov
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 5/5] net/sfc: support decrement IP TTL actions in transfer flows Ivan Malov
  2021-11-08 15:32 ` [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement " Ferruh Yigit
  5 siblings, 0 replies; 7+ messages in thread
From: Ivan Malov @ 2021-11-05 21:54 UTC (permalink / raw)
  To: dev; +Cc: Andrew Rybchenko, Andy Moreton, Ray Kinsella

Affects the outermost header, taking prior action DECAP into
account. Takes care to also update IPv4 checksum accordingly.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/ef10_nic.c |  9 +++++++
 drivers/common/sfc_efx/base/efx.h      | 14 +++++++++++
 drivers/common/sfc_efx/base/efx_impl.h |  8 ++++++
 drivers/common/sfc_efx/base/efx_mae.c  | 35 ++++++++++++++++++++++++++
 drivers/common/sfc_efx/version.map     |  1 +
 5 files changed, 67 insertions(+)

diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c
index bbc59811ec..72d2caadb8 100644
--- a/drivers/common/sfc_efx/base/ef10_nic.c
+++ b/drivers/common/sfc_efx/base/ef10_nic.c
@@ -1452,6 +1452,15 @@ ef10_get_datapath_caps(
 		encp->enc_mae_supported = B_FALSE;
 		encp->enc_mae_admin = B_FALSE;
 	}
+
+	/*
+	 * Check support for MAE action set v2 features.
+	 * These provide support for packet edits.
+	 */
+	if (CAP_FLAGS3(req, MAE_ACTION_SET_ALLOC_V2_SUPPORTED))
+		encp->enc_mae_aset_v2_supported = B_TRUE;
+	else
+		encp->enc_mae_aset_v2_supported = B_FALSE;
 #else
 	encp->enc_mae_supported = B_FALSE;
 	encp->enc_mae_admin = B_FALSE;
diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index 60533881c2..f08a004536 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -1625,6 +1625,8 @@ typedef struct efx_nic_cfg_s {
 	 * destination (a MAE client or network port).
 	 */
 	boolean_t		enc_mae_admin;
+	/* NIC support for MAE action set v2 features. */
+	boolean_t		enc_mae_aset_v2_supported;
 	/* Firmware support for "FLAG" and "MARK" filter actions */
 	boolean_t		enc_filter_action_flag_supported;
 	boolean_t		enc_filter_action_mark_supported;
@@ -4435,6 +4437,18 @@ extern	__checkReturn			efx_rc_t
 efx_mae_action_set_populate_vlan_pop(
 	__in				efx_mae_actions_t *spec);
 
+/*
+ * This always amends the outermost header. This way, for a tunnel
+ * packet, if action DECAP is not requested, this will affect the
+ * outer header; otherwise, the inner header will be updated.
+ *
+ * This will also take care to update IPv4 checksum accordingly.
+ */
+LIBEFX_API
+extern	__checkReturn			efx_rc_t
+efx_mae_action_set_populate_decr_ip_ttl(
+	__in				efx_mae_actions_t *spec);
+
 LIBEFX_API
 extern	__checkReturn			efx_rc_t
 efx_mae_action_set_populate_vlan_push(
diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h
index 5dcdb9c78d..eda41b4be0 100644
--- a/drivers/common/sfc_efx/base/efx_impl.h
+++ b/drivers/common/sfc_efx/base/efx_impl.h
@@ -1740,6 +1740,7 @@ typedef enum efx_mae_action_e {
 	/* These actions are strictly ordered. */
 	EFX_MAE_ACTION_DECAP,
 	EFX_MAE_ACTION_VLAN_POP,
+	EFX_MAE_ACTION_DECR_IP_TTL,
 	EFX_MAE_ACTION_VLAN_PUSH,
 	EFX_MAE_ACTION_COUNT,
 	EFX_MAE_ACTION_ENCAP,
@@ -1793,6 +1794,13 @@ struct efx_mae_actions_s {
 	 * to make sure that resource IDs are not compared.
 	 */
 	efx_mae_actions_rsrc_t		ema_rsrc;
+
+	/*
+	 * A copy of encp->enc_mae_aset_v2_supported.
+	 * It is set by efx_mae_action_set_spec_init().
+	 * This value is ignored on spec comparisons.
+	 */
+	boolean_t			ema_v2_is_supported;
 };
 
 #endif /* EFSYS_OPT_MAE */
diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index 41444e1926..756c35788e 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -1376,6 +1376,7 @@ efx_mae_action_set_spec_init(
 	__in				efx_nic_t *enp,
 	__out				efx_mae_actions_t **specp)
 {
+	const efx_nic_cfg_t *encp = efx_nic_cfg_get(enp);
 	efx_mae_actions_t *spec;
 	efx_rc_t rc;
 
@@ -1388,6 +1389,12 @@ efx_mae_action_set_spec_init(
 	spec->ema_rsrc.emar_eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 	spec->ema_rsrc.emar_counter_id.id = EFX_MAE_RSRC_ID_INVALID;
 
+	/*
+	 * Helpers which populate v2 actions must reject them when v2 is not
+	 * supported. As they have no EFX NIC argument, save v2 status here.
+	 */
+	spec->ema_v2_is_supported = encp->enc_mae_aset_v2_supported;
+
 	*specp = spec;
 
 	return (0);
@@ -1626,6 +1633,9 @@ static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = {
 	[EFX_MAE_ACTION_VLAN_POP] = {
 		.emad_add = efx_mae_action_set_add_vlan_pop
 	},
+	[EFX_MAE_ACTION_DECR_IP_TTL] = {
+		.emad_add = efx_mae_action_set_no_op
+	},
 	[EFX_MAE_ACTION_VLAN_PUSH] = {
 		.emad_add = efx_mae_action_set_add_vlan_push
 	},
@@ -1649,6 +1659,7 @@ static const efx_mae_action_desc_t efx_mae_actions[EFX_MAE_NACTIONS] = {
 static const uint32_t efx_mae_action_ordered_map =
 	(1U << EFX_MAE_ACTION_DECAP) |
 	(1U << EFX_MAE_ACTION_VLAN_POP) |
+	(1U << EFX_MAE_ACTION_DECR_IP_TTL) |
 	(1U << EFX_MAE_ACTION_VLAN_PUSH) |
 	/*
 	 * HW will conduct action COUNT after
@@ -1767,6 +1778,25 @@ efx_mae_action_set_populate_vlan_pop(
 	    EFX_MAE_ACTION_VLAN_POP, 0, NULL));
 }
 
+	__checkReturn			efx_rc_t
+efx_mae_action_set_populate_decr_ip_ttl(
+	__in				efx_mae_actions_t *spec)
+{
+	efx_rc_t rc;
+
+	if (spec->ema_v2_is_supported == B_FALSE) {
+		rc = ENOTSUP;
+		goto fail1;
+	}
+
+	return (efx_mae_action_set_spec_populate(spec,
+	    EFX_MAE_ACTION_DECR_IP_TTL, 0, NULL));
+
+fail1:
+	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	return (rc);
+}
+
 	__checkReturn			efx_rc_t
 efx_mae_action_set_populate_vlan_push(
 	__in				efx_mae_actions_t *spec,
@@ -2542,6 +2572,11 @@ efx_mae_action_set_alloc(
 	MCDI_IN_SET_DWORD_FIELD(req, MAE_ACTION_SET_ALLOC_IN_FLAGS,
 	    MAE_ACTION_SET_ALLOC_IN_VLAN_POP, spec->ema_n_vlan_tags_to_pop);
 
+	if ((spec->ema_actions & (1U << EFX_MAE_ACTION_DECR_IP_TTL)) != 0) {
+		MCDI_IN_SET_DWORD_FIELD(req, MAE_ACTION_SET_ALLOC_IN_FLAGS,
+		    MAE_ACTION_SET_ALLOC_IN_DO_DECR_IP_TTL, 1);
+	}
+
 	if (spec->ema_n_vlan_tags_to_push > 0) {
 		unsigned int outer_tag_idx;
 
diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map
index ec862200ab..765ca39332 100644
--- a/drivers/common/sfc_efx/version.map
+++ b/drivers/common/sfc_efx/version.map
@@ -95,6 +95,7 @@ INTERNAL {
 	efx_mae_action_set_get_nb_count;
 	efx_mae_action_set_populate_count;
 	efx_mae_action_set_populate_decap;
+	efx_mae_action_set_populate_decr_ip_ttl;
 	efx_mae_action_set_populate_deliver;
 	efx_mae_action_set_populate_drop;
 	efx_mae_action_set_populate_encap;
-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH 5/5] net/sfc: support decrement IP TTL actions in transfer flows
  2021-11-05 21:54 [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement actions in transfer flows Ivan Malov
                   ` (3 preceding siblings ...)
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 4/5] common/sfc_efx/base: support adding dec. TTL action to a set Ivan Malov
@ 2021-11-05 21:54 ` Ivan Malov
  2021-11-08 15:32 ` [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement " Ferruh Yigit
  5 siblings, 0 replies; 7+ messages in thread
From: Ivan Malov @ 2021-11-05 21:54 UTC (permalink / raw)
  To: dev; +Cc: Andrew Rybchenko, Andy Moreton

These actions map to MAE action DECR_IP_TTL. It affects
the outermost header in the current processing state of
the packet, which might have been decapsulated by prior
action DECAP. It also updates IPv4 checksum accordingly.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 doc/guides/nics/features/sfc.ini | 2 ++
 doc/guides/nics/sfc_efx.rst      | 4 ++++
 drivers/net/sfc/sfc_mae.c        | 8 ++++++++
 3 files changed, 14 insertions(+)

diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini
index 0d785f4765..1ce2dc46ba 100644
--- a/doc/guides/nics/features/sfc.ini
+++ b/doc/guides/nics/features/sfc.ini
@@ -62,10 +62,12 @@ vxlan                = Y
 
 [rte_flow actions]
 count                = Y
+dec_ttl              = Y
 drop                 = Y
 flag                 = Y
 jump                 = P
 mark                 = Y
+of_dec_nw_ttl        = Y
 of_pop_vlan          = Y
 of_push_vlan         = Y
 of_set_vlan_pcp      = Y
diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 960e25bf98..00b95a4f58 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -234,6 +234,10 @@ Supported actions (***transfer*** rules):
 
 - OF_VLAN_SET_PCP
 
+- OF_DEC_NW_TTL
+
+- DEC_TTL
+
 - VXLAN_DECAP
 
 - VXLAN_ENCAP
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index 411f2ac27e..93cce60a3e 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -3587,6 +3587,14 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa,
 				       bundle->actions_mask);
 		rc = efx_mae_action_set_populate_vlan_pop(spec);
 		break;
+	case RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL:
+	case RTE_FLOW_ACTION_TYPE_DEC_TTL:
+		SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
+				       bundle->actions_mask);
+		SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_DEC_TTL,
+				       bundle->actions_mask);
+		rc = efx_mae_action_set_populate_decr_ip_ttl(spec);
+		break;
 	case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
 		SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
 				       bundle->actions_mask);
-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement actions in transfer flows
  2021-11-05 21:54 [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement actions in transfer flows Ivan Malov
                   ` (4 preceding siblings ...)
  2021-11-05 21:54 ` [dpdk-dev] [PATCH 5/5] net/sfc: support decrement IP TTL actions in transfer flows Ivan Malov
@ 2021-11-08 15:32 ` Ferruh Yigit
  5 siblings, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2021-11-08 15:32 UTC (permalink / raw)
  To: Ivan Malov, dev

On 11/5/2021 9:54 PM, Ivan Malov wrote:
> Ivan Malov (5):
>    common/sfc_efx/base: refine adding encap action to a set
>    common/sfc_efx/base: refine adding count action to a set
>    common/sfc_efx/base: factor out no-op helper functions
>    common/sfc_efx/base: support adding dec. TTL action to a set
>    net/sfc: support decrement IP TTL actions in transfer flows
> 

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-08 15:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 21:54 [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement actions in transfer flows Ivan Malov
2021-11-05 21:54 ` [dpdk-dev] [PATCH 1/5] common/sfc_efx/base: refine adding encap action to a set Ivan Malov
2021-11-05 21:54 ` [dpdk-dev] [PATCH 2/5] common/sfc_efx/base: refine adding count " Ivan Malov
2021-11-05 21:54 ` [dpdk-dev] [PATCH 3/5] common/sfc_efx/base: factor out no-op helper functions Ivan Malov
2021-11-05 21:54 ` [dpdk-dev] [PATCH 4/5] common/sfc_efx/base: support adding dec. TTL action to a set Ivan Malov
2021-11-05 21:54 ` [dpdk-dev] [PATCH 5/5] net/sfc: support decrement IP TTL actions in transfer flows Ivan Malov
2021-11-08 15:32 ` [dpdk-dev] [PATCH 0/5] net/sfc: support IP TTL decrement " Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).