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 4A113A0C4D; Wed, 13 Oct 2021 02:25:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CACC24116C; Wed, 13 Oct 2021 02:24:38 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id E1BFE4067C for ; Wed, 13 Oct 2021 02:24:30 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.120.72]) (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 9C2627F6FC; Wed, 13 Oct 2021 03:24:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 9C2627F6FC DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1634084670; bh=HZh6TAOYjgPvFP545MhhZGrE8kBaD1+zQL3J9WwaOpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Aiu/ZldsGKbTSsQYK0VTSo24LzObJWWydDxF7RzmlKpKIEQ6XlzP4Y4x8MRrTHCh3 xkpqgrQydjt8qngNTHwmHvP5rb9ncLHGn83eqqaPg8fT7nR2Pv9ov7eGxVuSWd41dU mTx6vT9rf3Jv8A2a5gZUJr0Eyq6SKJR75EyiqtXY= From: Ivan Malov To: dev@dpdk.org Cc: Ferruh Yigit , Andrew Rybchenko Date: Wed, 13 Oct 2021 03:24:13 +0300 Message-Id: <20211013002415.24453-9-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211013002415.24453-1-ivan.malov@oktetlabs.ru> References: <20210929205730.775-1-ivan.malov@oktetlabs.ru> <20211013002415.24453-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 08/10] net/sfc: use action rules in tunnel offload JUMP rules 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" By design, JUMP flows should be represented solely by the outer rules. But the HW/FW hasn't got support for setting Rx mark from RECIRC_ID on outer rule lookup yet. Neither does it support outer rule counters. As a workaround, an action rule of lower priority is used to do the job. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko --- drivers/net/sfc/sfc_flow.c | 11 +++++--- drivers/net/sfc/sfc_mae.c | 55 ++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 51bf0992d6..82733b817a 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -2563,17 +2563,20 @@ sfc_flow_parse_rte_to_mae(struct rte_eth_dev *dev, if (spec_mae->ft_rule_type == SFC_FT_RULE_JUMP) { /* - * This flow is represented solely by the outer rule. - * It is supposed to mark and count matching packets. + * By design, this flow should be represented solely by the + * outer rule. But the HW/FW hasn't got support for setting + * Rx mark from RECIRC_ID on outer rule lookup yet. Neither + * does it support outer rule counters. As a workaround, an + * action rule of lower priority is used to do the job. + * + * So don't skip sfc_mae_rule_parse_actions() below. */ - goto skip_action_rule; } rc = sfc_mae_rule_parse_actions(sa, actions, spec_mae, error); if (rc != 0) goto fail; -skip_action_rule: if (spec_mae->ft != NULL) { if (spec_mae->ft_rule_type == SFC_FT_RULE_JUMP) spec_mae->ft->jump_rule_is_set = B_TRUE; diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index c972c2e3f2..2ebf8cf43b 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -2597,6 +2597,7 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa, struct rte_flow_error *error) { struct sfc_mae_parse_ctx ctx_mae; + unsigned int priority_shift = 0; struct sfc_flow_parse_ctx ctx; int rc; @@ -2608,13 +2609,32 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa, switch (ctx_mae.ft_rule_type) { case SFC_FT_RULE_JUMP: - /* No action rule */ - break; + /* + * By design, this flow should be represented solely by the + * outer rule. But the HW/FW hasn't got support for setting + * Rx mark from RECIRC_ID on outer rule lookup yet. Neither + * does it support outer rule counters. As a workaround, an + * action rule of lower priority is used to do the job. + */ + priority_shift = 1; + + /* FALLTHROUGH */ case SFC_FT_RULE_GROUP: + if (ctx_mae.priority != 0) { + /* + * Because of the above workaround, deny the + * use of priorities to JUMP and GROUP rules. + */ + rc = rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, NULL, + "tunnel offload: priorities are not supported"); + goto fail_priority_check; + } + /* FALLTHROUGH */ case SFC_FT_RULE_NONE: rc = efx_mae_match_spec_init(sa->nic, EFX_MAE_RULE_ACTION, - spec->priority, + spec->priority + priority_shift, &ctx_mae.match_spec_action); if (rc != 0) { rc = rte_flow_error_set(error, rc, @@ -2689,6 +2709,7 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa, efx_mae_match_spec_fini(sa->nic, ctx_mae.match_spec_action); fail_init_match_spec_action: +fail_priority_check: return rc; } @@ -3138,11 +3159,14 @@ sfc_mae_rule_parse_action_vxlan_encap( static int sfc_mae_rule_parse_action_mark(struct sfc_adapter *sa, const struct rte_flow_action_mark *conf, + const struct sfc_flow_spec_mae *spec_mae, efx_mae_actions_t *spec) { int rc; - if (conf->id > SFC_FT_USER_MARK_MASK) { + if (spec_mae->ft_rule_type == SFC_FT_RULE_JUMP) { + /* Workaround. See sfc_flow_parse_rte_to_mae() */ + } else if (conf->id > SFC_FT_USER_MARK_MASK) { sfc_err(sa, "the mark value is too large"); return EINVAL; } @@ -3307,11 +3331,12 @@ static const char * const action_names[] = { static int sfc_mae_rule_parse_action(struct sfc_adapter *sa, const struct rte_flow_action *action, - const struct sfc_mae_outer_rule *outer_rule, + const struct sfc_flow_spec_mae *spec_mae, struct sfc_mae_actions_bundle *bundle, efx_mae_actions_t *spec, struct rte_flow_error *error) { + const struct sfc_mae_outer_rule *outer_rule = spec_mae->outer_rule; const uint64_t rx_metadata = sa->negotiated_rx_metadata; bool custom_error = B_FALSE; int rc = 0; @@ -3375,9 +3400,10 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa, case RTE_FLOW_ACTION_TYPE_MARK: SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_MARK, bundle->actions_mask); - if ((rx_metadata & RTE_ETH_RX_METADATA_USER_MARK) != 0) { + if ((rx_metadata & RTE_ETH_RX_METADATA_USER_MARK) != 0 || + spec_mae->ft_rule_type == SFC_FT_RULE_JUMP) { rc = sfc_mae_rule_parse_action_mark(sa, action->conf, - spec); + spec_mae, spec); } else { rc = rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, @@ -3411,6 +3437,12 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa, bundle->actions_mask); rc = efx_mae_action_set_populate_drop(spec); break; + case RTE_FLOW_ACTION_TYPE_JUMP: + if (spec_mae->ft_rule_type == SFC_FT_RULE_JUMP) { + /* Workaround. See sfc_flow_parse_rte_to_mae() */ + break; + } + /* FALLTHROUGH */ default: return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, NULL, @@ -3500,7 +3532,7 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa, if (rc != 0) goto fail_rule_parse_action; - rc = sfc_mae_rule_parse_action(sa, action, spec_mae->outer_rule, + rc = sfc_mae_rule_parse_action(sa, action, spec_mae, &bundle, spec, error); if (rc != 0) goto fail_rule_parse_action; @@ -3524,6 +3556,12 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa, switch (spec_mae->ft_rule_type) { case SFC_FT_RULE_NONE: break; + case SFC_FT_RULE_JUMP: + /* Workaround. See sfc_flow_parse_rte_to_mae() */ + rc = sfc_mae_rule_parse_action_pf_vf(sa, NULL, spec); + if (rc != 0) + goto fail_workaround_jump_delivery; + break; case SFC_FT_RULE_GROUP: /* * Packets that go to the rule's AR have FT mark set (from the @@ -3553,6 +3591,7 @@ sfc_mae_rule_parse_actions(struct sfc_adapter *sa, return 0; fail_action_set_add: +fail_workaround_jump_delivery: fail_nb_count: sfc_mae_encap_header_del(sa, encap_header); -- 2.20.1