From patchwork Tue Jul 6 12:37:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 95380 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 053A7A0C47; Tue, 6 Jul 2021 14:37:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 76B4D41262; Tue, 6 Jul 2021 14:37:32 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id B11684120E; Tue, 6 Jul 2021 14:37:30 +0200 (CEST) Received: from localhost.localdomain (unknown [188.242.7.54]) (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 ESMTPSA id 1E83E7F504; Tue, 6 Jul 2021 15:37:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 1E83E7F504 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1625575050; bh=KTCkCNu1hLaMLZMGXd+/ulhTzdidocKwLWx06geRp2k=; h=From:To:Cc:Subject:Date; b=nFHE2CD+f7jYVVzTmWKpAxKSPPHQzlv+h+7A6BIrYrpBnOZqVA10+kA3lhc5A6uHw vcHOlTqz+qDU+scVfsaDB7Ef2f6reYIZSot+lHavYFkI9dpWh1bTvKihtSluay4FQk iIZHBsSO5EdheIczVq/H0+1WdhUqY3KYuQcQebgs= From: Ivan Malov To: dev@dpdk.org Cc: stable@dpdk.org, Andrew Rybchenko , Andy Moreton Date: Tue, 6 Jul 2021 15:37:26 +0300 Message-Id: <20210706123726.12914-1-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/sfc: fix outer match in MAE backend of RTE flow support 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" The current code doesn't use match on invalid outer rule ID in action rules of non-encap. flows. This is wrong and must be fixed. Do that and explain correct behaviour in the code. Fixes: dadff137931c ("net/sfc: support encap flow items in transfer rules") Cc: stable@dpdk.org Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_mae.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index a2c0aa143..89f719648 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -1838,12 +1838,12 @@ sfc_mae_rule_process_outer(struct sfc_adapter *sa, struct sfc_mae_outer_rule **rulep, struct rte_flow_error *error) { - struct sfc_mae_outer_rule *rule; + efx_mae_rule_id_t invalid_rule_id = { .id = EFX_MAE_RSRC_ID_INVALID }; int rc; if (ctx->encap_type == EFX_TUNNEL_PROTOCOL_NONE) { *rulep = NULL; - return 0; + goto no_or_id; } SFC_ASSERT(ctx->match_spec_outer != NULL); @@ -1871,21 +1871,27 @@ sfc_mae_rule_process_outer(struct sfc_adapter *sa, /* The spec has now been tracked by the outer rule entry. */ ctx->match_spec_outer = NULL; +no_or_id: /* - * Depending on whether we reuse an existing outer rule or create a - * new one (see above), outer rule ID is either a valid value or - * EFX_MAE_RSRC_ID_INVALID. Set it in the action rule match - * specification (and the full mask, too) in order to have correct - * class comparisons of the new rule with existing ones. - * Also, action rule match specification will be validated shortly, - * and having the full mask set for outer rule ID indicates that we - * will use this field, and support for this field has to be checked. + * In MAE, lookup sequence comprises outer parse, outer rule lookup, + * inner parse (when some outer rule is hit) and action rule lookup. + * If the currently processed flow does not come with an outer rule, + * its action rule must be available only for packets which miss in + * outer rule table. Set OR_ID match field to 0xffffffff/0xffffffff + * in the action rule specification; this ensures correct behaviour. + * + * If, on the other hand, this flow does have an outer rule, its ID + * may be unknown at the moment (not yet allocated), but OR_ID mask + * has to be set to 0xffffffff anyway for correct class comparisons. + * When the outer rule has been allocated, this match field will be + * overridden by sfc_mae_outer_rule_enable() to use the right value. */ - rule = *rulep; rc = efx_mae_match_spec_outer_rule_id_set(ctx->match_spec_action, - &rule->fw_rsrc.rule_id); + &invalid_rule_id); if (rc != 0) { - sfc_mae_outer_rule_del(sa, *rulep); + if (*rulep != NULL) + sfc_mae_outer_rule_del(sa, *rulep); + *rulep = NULL; return rte_flow_error_set(error, rc,