diff mbox series

[02/10] common/sfc_efx/base: add API to set RECIRC ID in outer rules

Message ID 20210929205730.775-3-ivan.malov@oktetlabs.ru (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series net/sfc: add support for tunnel offload | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Ivan Malov Sept. 29, 2021, 8:57 p.m. UTC
When an outer rule is hit, it can pass recirculation ID down
to action rule lookup, and action rules can match on this ID
instead of matching on the outer rule allocation handle.
By default, recirculation ID is assumed to be zero.

Add an API to set recirculation ID in outer rules.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/common/sfc_efx/base/efx.h      |  9 +++++++++
 drivers/common/sfc_efx/base/efx_impl.h |  1 +
 drivers/common/sfc_efx/base/efx_mae.c  | 24 ++++++++++++++++++++++++
 drivers/common/sfc_efx/version.map     |  1 +
 4 files changed, 35 insertions(+)

Comments

Kinsella, Ray Sept. 30, 2021, 9:53 a.m. UTC | #1
On 29/09/2021 21:57, Ivan Malov wrote:
> When an outer rule is hit, it can pass recirculation ID down
> to action rule lookup, and action rules can match on this ID
> instead of matching on the outer rule allocation handle.
> By default, recirculation ID is assumed to be zero.
> 
> Add an API to set recirculation ID in outer rules.
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
>  drivers/common/sfc_efx/base/efx.h      |  9 +++++++++
>  drivers/common/sfc_efx/base/efx_impl.h |  1 +
>  drivers/common/sfc_efx/base/efx_mae.c  | 24 ++++++++++++++++++++++++
>  drivers/common/sfc_efx/version.map     |  1 +
>  4 files changed, 35 insertions(+)
> 
Acked-by: Ray Kinsella <mdr@ashroe.eu>
diff mbox series

Patch

diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index bed1029f59..ca747de7a4 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -4385,6 +4385,15 @@  typedef struct efx_mae_rule_id_s {
 	uint32_t id;
 } efx_mae_rule_id_t;
 
+/*
+ * Set the initial recirculation ID. It goes to action rule (AR) lookup.
+ */
+LIBEFX_API
+extern	__checkReturn			efx_rc_t
+efx_mae_outer_rule_recirc_id_set(
+	__in				efx_mae_match_spec_t *spec,
+	__in				uint8_t recirc_id);
+
 LIBEFX_API
 extern	__checkReturn		efx_rc_t
 efx_mae_outer_rule_insert(
diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h
index 992edbabe3..45dc7803db 100644
--- a/drivers/common/sfc_efx/base/efx_impl.h
+++ b/drivers/common/sfc_efx/base/efx_impl.h
@@ -1727,6 +1727,7 @@  struct efx_mae_match_spec_s {
 					    MAE_FIELD_MASK_VALUE_PAIRS_V2_LEN];
 		uint8_t			outer[MAE_ENC_FIELD_PAIRS_LEN];
 	} emms_mask_value_pairs;
+	uint8_t				emms_outer_rule_recirc_id;
 };
 
 typedef enum efx_mae_action_e {
diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index c22206e227..c37e90831f 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -1945,6 +1945,27 @@  efx_mae_match_specs_class_cmp(
 
 fail2:
 	EFSYS_PROBE(fail2);
+fail1:
+	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	return (rc);
+}
+
+	__checkReturn			efx_rc_t
+efx_mae_outer_rule_recirc_id_set(
+	__in				efx_mae_match_spec_t *spec,
+	__in				uint8_t recirc_id)
+{
+	efx_rc_t rc;
+
+	if (spec->emms_type != EFX_MAE_RULE_OUTER) {
+		rc = EINVAL;
+		goto fail1;
+	}
+
+	spec->emms_outer_rule_recirc_id = recirc_id;
+
+	return (0);
+
 fail1:
 	EFSYS_PROBE1(fail1, efx_rc_t, rc);
 	return (rc);
@@ -2023,6 +2044,9 @@  efx_mae_outer_rule_insert(
 	memcpy(payload + offset, spec->emms_mask_value_pairs.outer,
 	    MAE_ENC_FIELD_PAIRS_LEN);
 
+	MCDI_IN_SET_BYTE(req, MAE_OUTER_RULE_INSERT_IN_RECIRC_ID,
+	    spec->emms_outer_rule_recirc_id);
+
 	efx_mcdi_execute(enp, &req);
 
 	if (req.emr_rc != 0) {
diff --git a/drivers/common/sfc_efx/version.map b/drivers/common/sfc_efx/version.map
index 0c5bcdfa84..d4878dfb9a 100644
--- a/drivers/common/sfc_efx/version.map
+++ b/drivers/common/sfc_efx/version.map
@@ -127,6 +127,7 @@  INTERNAL {
 	efx_mae_mport_by_pcie_function;
 	efx_mae_mport_by_phy_port;
 	efx_mae_outer_rule_insert;
+	efx_mae_outer_rule_recirc_id_set;
 	efx_mae_outer_rule_remove;
 
 	efx_mcdi_fini;