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 2A8E0A0C52; Mon, 25 Oct 2021 13:04:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EAF8D41145; Mon, 25 Oct 2021 13:04:31 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id DAD43410E2 for ; Mon, 25 Oct 2021 13:04:23 +0200 (CEST) Received: from localhost.localdomain (unknown [5.144.121.149]) (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 AF9FF7F523; Mon, 25 Oct 2021 14:04:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru AF9FF7F523 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1635159863; bh=CBKnKE/FaBOfZeOD/ZjQLCur47w2tO3zx0zTHe48rMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=x+KU/pOMQZTnMOjPN/CBfV7yQstd09UO0SZ3lyhsz1j1+kDT5jHZzaAH5ctlGbAt9 HczWWcuDTNSzZU3mCzB2jK70uNCWJADndWUfrYbdHb63zOHdAYmdXHkobfs+bhPSEn gbctKrKO14EBQCjVA1dwUZdL6T2doOtSErhOVTUY= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko Date: Mon, 25 Oct 2021 14:04:14 +0300 Message-Id: <20211025110415.20683-6-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211025110415.20683-1-ivan.malov@oktetlabs.ru> References: <20211025110415.20683-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 6/7] net/sfc: support port representor related flow actions 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" Add support for actions PORT_REPRESENTOR and REPRESENTED_PORT. The former should be used instead of ambiguous PORT_ID. The latter sends traffic to the entity represented by the given ethdev (network port or VF). Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko --- doc/guides/nics/features/sfc.ini | 2 + doc/guides/nics/sfc_efx.rst | 4 ++ drivers/net/sfc/sfc_mae.c | 66 ++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini index c830426eb2..0d785f4765 100644 --- a/doc/guides/nics/features/sfc.ini +++ b/doc/guides/nics/features/sfc.ini @@ -73,6 +73,8 @@ of_set_vlan_vid = Y pf = Y phy_port = Y port_id = Y +port_representor = Y +represented_port = Y queue = Y rss = Y vf = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 8dbd250b3c..960e25bf98 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -248,6 +248,10 @@ Supported actions (***transfer*** rules): - VF +- PORT_REPRESENTOR + +- REPRESENTED_PORT + - PORT_ID - COUNT diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 8ec4036275..411f2ac27e 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -3488,6 +3488,58 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa, return rc; } +static int +sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa, + const struct rte_flow_action_ethdev *conf, + efx_mae_actions_t *spec) +{ + struct sfc_mae *mae = &sa->mae; + efx_mport_sel_t mport; + int rc; + + rc = sfc_mae_switch_get_ethdev_mport(mae->switch_domain_id, + conf->port_id, &mport); + if (rc != 0) { + sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", + conf->port_id, strerror(rc)); + return rc; + } + + rc = efx_mae_action_set_populate_deliver(spec, &mport); + if (rc != 0) { + sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", + mport.sel, strerror(rc)); + } + + return rc; +} + +static int +sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa, + const struct rte_flow_action_ethdev *conf, + efx_mae_actions_t *spec) +{ + struct sfc_mae *mae = &sa->mae; + efx_mport_sel_t mport; + int rc; + + rc = sfc_mae_switch_get_entity_mport(mae->switch_domain_id, + conf->port_id, &mport); + if (rc != 0) { + sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", + conf->port_id, strerror(rc)); + return rc; + } + + rc = efx_mae_action_set_populate_deliver(spec, &mport); + if (rc != 0) { + sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", + mport.sel, strerror(rc)); + } + + return rc; +} + static const char * const action_names[] = { [RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = "VXLAN_DECAP", [RTE_FLOW_ACTION_TYPE_OF_POP_VLAN] = "OF_POP_VLAN", @@ -3501,6 +3553,8 @@ static const char * const action_names[] = { [RTE_FLOW_ACTION_TYPE_PF] = "PF", [RTE_FLOW_ACTION_TYPE_VF] = "VF", [RTE_FLOW_ACTION_TYPE_PORT_ID] = "PORT_ID", + [RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR] = "PORT_REPRESENTOR", + [RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT] = "REPRESENTED_PORT", [RTE_FLOW_ACTION_TYPE_DROP] = "DROP", [RTE_FLOW_ACTION_TYPE_JUMP] = "JUMP", }; @@ -3609,6 +3663,18 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa, bundle->actions_mask); rc = sfc_mae_rule_parse_action_port_id(sa, action->conf, spec); break; + case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR: + SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR, + bundle->actions_mask); + rc = sfc_mae_rule_parse_action_port_representor(sa, + action->conf, spec); + break; + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: + SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT, + bundle->actions_mask); + rc = sfc_mae_rule_parse_action_represented_port(sa, + action->conf, spec); + break; case RTE_FLOW_ACTION_TYPE_DROP: SFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_DROP, bundle->actions_mask); -- 2.20.1