From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 94623A04DD; Tue, 20 Oct 2020 11:09:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6975FCB34; Tue, 20 Oct 2020 10:50:29 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 2594EAD31 for ; Tue, 20 Oct 2020 10:49:08 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.7.65.61]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 62E146008C for ; Tue, 20 Oct 2020 08:49:06 +0000 (UTC) Received: from us4-mdac16-41.ut7.mdlocal (unknown [10.7.64.23]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 634C78009E for ; Tue, 20 Oct 2020 08:49:06 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.7.65.199]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id E1FF780056 for ; Tue, 20 Oct 2020 08:49:05 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 9877F18005C for ; Tue, 20 Oct 2020 08:49:05 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 20 Oct 2020 09:48:50 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 20 Oct 2020 09:48:50 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 09K8mnWH030802; Tue, 20 Oct 2020 09:48:49 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 973FA1619F5; Tue, 20 Oct 2020 09:48:48 +0100 (BST) From: Andrew Rybchenko To: CC: , Ivan Malov Date: Tue, 20 Oct 2020 09:47:44 +0100 Message-ID: <1603183709-23420-18-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603183709-23420-1-git-send-email-arybchenko@solarflare.com> References: <1603183709-23420-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25736.003 X-TM-AS-Result: No-2.441700-8.000000-10 X-TMASE-MatchedRID: xNyt3d70ywyqfSQfLa/SN6iUivh0j2Pv6VTG9cZxEjIGmHr1eMxt2UAc 6DyoS2rIzFlXLlUThJU2varlbSSzl2owheuziK0qR/j040fRFpIUBI/UWYG7Fm+arpqBxtz8KKb M5Q4DbH9N9XVFzHGStAC5tSYXAMeQvgJhgunlKsvnvg/SfqXd/dnLANiJ9J62VWQnHKxp38hCZn 37VQFgvZ3B/CendwLbRQq6I/z93yVJI5ZUl647UBRFJJyf5BJe3QfwsVk0UbsIoUKaF27lxf2vy Qh3a+J6d60Nxl+VEPhajLI6kawbXbMbby/KWwIgCDir6MaPzzhTJhATzQKBJBOXWNbsga/GnEjm yz4KDiU1Ubs5jKswrQ9cvEd/Et5dVEc5IqztENReYfSkFq6uAb7jE6+wkCSe+rL5VW+ofZc= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10-2.441700-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25736.003 X-MDID: 1603183746-iiW_NrMB4YSB X-PPE-DISP: 1603183746;iiW_NrMB4YSB Subject: [dpdk-dev] [PATCH 17/62] net/sfc: support flow item PHY PORT in MAE backend X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: Ivan Malov Add support for this flow item to MAE-specific RTE flow implementation. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- doc/guides/nics/sfc_efx.rst | 4 +++ drivers/net/sfc/sfc_mae.c | 69 +++++++++++++++++++++++++++++++++++++ drivers/net/sfc/sfc_mae.h | 1 + 3 files changed, 74 insertions(+) diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 7a5aff79f9..b12e93180e 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -188,6 +188,10 @@ Supported actions (***non-transfer*** rules): - MARK (supported only with ef10_essb Rx datapath) +Supported pattern items (***transfer*** rules): + +- PHY_PORT (cannot repeat; conflicts with other traffic source items) + Validating flow rules depends on the firmware variant. The :ref:`flow_isolated_mode` is supported. diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index de2c6b26e4..87d2e15d29 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -163,7 +163,76 @@ sfc_mae_flow_cleanup(struct sfc_adapter *sa, efx_mae_match_spec_fini(sa->nic, spec_mae->match_spec); } +static int +sfc_mae_rule_parse_item_phy_port(const struct rte_flow_item *item, + struct sfc_flow_parse_ctx *ctx, + struct rte_flow_error *error) +{ + struct sfc_mae_parse_ctx *ctx_mae = ctx->mae; + const struct rte_flow_item_phy_port supp_mask = { + .index = 0xffffffff, + }; + const void *def_mask = &rte_flow_item_phy_port_mask; + const struct rte_flow_item_phy_port *spec = NULL; + const struct rte_flow_item_phy_port *mask = NULL; + efx_mport_sel_t mport_v; + int rc; + + if (ctx_mae->match_mport_set) { + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, item, + "Can't handle multiple traffic source items"); + } + + rc = sfc_flow_parse_init(item, + (const void **)&spec, (const void **)&mask, + (const void *)&supp_mask, def_mask, + sizeof(struct rte_flow_item_phy_port), error); + if (rc != 0) + return rc; + + if (mask->index != supp_mask.index) { + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, item, + "Bad mask in the PHY_PORT pattern item"); + } + + /* If "spec" is not set, could be any physical port */ + if (spec == NULL) + return 0; + + rc = efx_mae_mport_by_phy_port(spec->index, &mport_v); + if (rc != 0) { + return rte_flow_error_set(error, rc, + RTE_FLOW_ERROR_TYPE_ITEM, item, + "Failed to convert the PHY_PORT index"); + } + + rc = efx_mae_match_spec_mport_set(ctx_mae->match_spec_action, + &mport_v, NULL); + if (rc != 0) { + return rte_flow_error_set(error, rc, + RTE_FLOW_ERROR_TYPE_ITEM, item, + "Failed to set MPORT for the PHY_PORT"); + } + + ctx_mae->match_mport_set = B_TRUE; + + return 0; +} + static const struct sfc_flow_item sfc_flow_items[] = { + { + .type = RTE_FLOW_ITEM_TYPE_PHY_PORT, + /* + * In terms of RTE flow, this item is a META one, + * and its position in the pattern is don't care. + */ + .prev_layer = SFC_FLOW_ITEM_ANY_LAYER, + .layer = SFC_FLOW_ITEM_ANY_LAYER, + .ctx_type = SFC_FLOW_PARSE_CTX_MAE, + .parse = sfc_mae_rule_parse_item_phy_port, + }, }; int diff --git a/drivers/net/sfc/sfc_mae.h b/drivers/net/sfc/sfc_mae.h index 5727962a0b..1ef582e82b 100644 --- a/drivers/net/sfc/sfc_mae.h +++ b/drivers/net/sfc/sfc_mae.h @@ -48,6 +48,7 @@ struct sfc_flow_spec; struct sfc_mae_parse_ctx { efx_mae_match_spec_t *match_spec_action; + bool match_mport_set; }; int sfc_mae_attach(struct sfc_adapter *sa); -- 2.17.1