From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7409A0C41; Fri, 5 Nov 2021 22:54:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B0A041101; Fri, 5 Nov 2021 22:54:33 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 1EE2D40DFD; Fri, 5 Nov 2021 22:54:31 +0100 (CET) Received: from bree.oktetlabs.ru (bree.oktetlabs.ru [192.168.34.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPS id C46C07F6D4; Sat, 6 Nov 2021 00:54:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru C46C07F6D4 Authentication-Results: shelob.oktetlabs.ru/C46C07F6D4; dkim=none; dkim-atps=neutral From: Ivan Malov To: dev@dpdk.org Cc: stable@dpdk.org, Andrew Rybchenko , Andy Moreton Date: Sat, 6 Nov 2021 00:54:05 +0300 Message-Id: <20211105215409.5706-2-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211105215409.5706-1-ivan.malov@oktetlabs.ru> References: <20211105215409.5706-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/5] common/sfc_efx/base: refine adding encap action to a set X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- 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