patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/5] common/sfc_efx/base: refine adding encap action to a set
       [not found] <20211105215409.5706-1-ivan.malov@oktetlabs.ru>
@ 2021-11-05 21:54 ` Ivan Malov
  2021-11-05 21:54 ` [dpdk-stable] [PATCH 2/5] common/sfc_efx/base: refine adding count " Ivan Malov
  1 sibling, 0 replies; 2+ 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] 2+ messages in thread

* [dpdk-stable] [PATCH 2/5] common/sfc_efx/base: refine adding count action to a set
       [not found] <20211105215409.5706-1-ivan.malov@oktetlabs.ru>
  2021-11-05 21:54 ` [dpdk-stable] [PATCH 1/5] common/sfc_efx/base: refine adding encap action to a set Ivan Malov
@ 2021-11-05 21:54 ` Ivan Malov
  1 sibling, 0 replies; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2021-11-05 21:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20211105215409.5706-1-ivan.malov@oktetlabs.ru>
2021-11-05 21:54 ` [dpdk-stable] [PATCH 1/5] common/sfc_efx/base: refine adding encap action to a set Ivan Malov
2021-11-05 21:54 ` [dpdk-stable] [PATCH 2/5] common/sfc_efx/base: refine adding count " Ivan Malov

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).