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 B7D6142492; Thu, 26 Jan 2023 14:19:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 160C042D52; Thu, 26 Jan 2023 14:18:54 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2054.outbound.protection.outlook.com [40.107.100.54]) by mails.dpdk.org (Postfix) with ESMTP id 55A2240695 for ; Thu, 26 Jan 2023 14:18:52 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SBY8QM8/KALCLpICuowM8KzEAQHrNze7HNn1hRlHA731nkmGBzhlqxRaGWW59ceS57fAcUhSR0qC1q/AY0bo0yHYarex1Mn1qdFk5LnLCg3tpQCHB811oOjT9Z/bH1iPhKhJVv2C6huUz+K3lQ4E6Mm7WbzEXX4RGaWptQ+h8HpvIhOwwnxYWd3s+9up7dUqTBcylPPPLBuo5u1qrDMnJJo+FDMX9umRTp3HNbNgzwMjcbviaJHaM0wQjckVGK6bVyVFboeFekqlr2KX01i5TWkrbSzUkZIVIssYRVWUeRXhmhFH4TSyqVM6ZBW22tioKMToS9BMZMhqx2TuO1IKfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Err7Hx6lL8q7Z+Z4iywDiqi9VwyA4dIn1W+oXHiJj5E=; b=ZzDMGOmr4JdwpTpr1+yIFIsnvSiiHBCLiBektyyd/VzaTcYhlb1tA0h+sFMUJKg0IKieBOQxnvPE+4qK2oxKTbJlZ/p3jTzW5eS7NFQNIIrgTtbkof+hJdyP+MkAy8YiPe0gS8dOG9gxsRBkyhuia4H7nD3qwTq/omUtuNfWTOUSLTAsvbGpZTFXDnE2Fo0IdEfOX/WJuhuYO+ccK7/hJ8xeY2g1CQKWc3atimHWv7Nx3YSkaVvKTFbyYLD2nS+ebVBVhQHFtkZwGSmIcoL8kquuConqbCfPsNbp5tZ5PBjuleR7cFreYvjzyRNrhF2r9VMQOiKbbSVdT5/bGZzhdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=monjalon.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Err7Hx6lL8q7Z+Z4iywDiqi9VwyA4dIn1W+oXHiJj5E=; b=wxZU5dWIc1NP4WypNKC+UzvcQjjkpMS/yvHujpxQ5ig/YNEsmVTpmKTyl4XRQL4eLBT+0ol8HvjiDckeEchAsUd9ojpYZJvsyfaDZNskTuvFNi/AMqFvMKhtNgcTNUllIdumy27J7UQlhkaZ6hV5X6jSqR4kmLOyxTy0iXT/SF8= Received: from BN9PR03CA0493.namprd03.prod.outlook.com (2603:10b6:408:130::18) by PH7PR12MB8178.namprd12.prod.outlook.com (2603:10b6:510:2b3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22; Thu, 26 Jan 2023 13:18:47 +0000 Received: from BN8NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:408:130:cafe::ed) by BN9PR03CA0493.outlook.office365.com (2603:10b6:408:130::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Thu, 26 Jan 2023 13:18:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT078.mail.protection.outlook.com (10.13.176.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.21 via Frontend Transport; Thu, 26 Jan 2023 13:18:46 +0000 Received: from telcodpdk.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 26 Jan 2023 07:18:44 -0600 From: Ferruh Yigit To: Thomas Monjalon , Wisam Jaddo , Ori Kam , Aman Singh , Yuying Zhang , Beilei Xing , Jingjing Wu , Qiming Yang , Qi Zhang , Matan Azrad , Viacheslav Ovsiienko , Andrew Rybchenko CC: David Marchand , Subject: [PATCH v4 5/8] ethdev: use GTP protocol struct for flow matching Date: Thu, 26 Jan 2023 13:17:56 +0000 Message-ID: <20230126131759.3887632-6-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126131759.3887632-1-ferruh.yigit@amd.com> References: <20221025214410.715864-1-thomas@monjalon.net> <20230126131759.3887632-1-ferruh.yigit@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT078:EE_|PH7PR12MB8178:EE_ X-MS-Office365-Filtering-Correlation-Id: a3c4a22e-a07d-4ad3-7d82-08daff9fdac6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B0iaHx2iXBg2QKRSvGD32/oUKdbpqg15+2984kjlqzQVV2BMuhr8Vsgx+vU69SGgvFnK8aawTba1+Z3upuOBJ0QtLVSOLibT2nF1y4+snbv9vYOaZdcLA5mEbn2egJda6uZukuGPm63O8irJT3xC2klRAQK+rZl+HdQgJGLuVEb2AtD8AvxlmvpICTJUg2hfEkXD6CJiF1ld8CihUd4xG2ij4u04mY1PtAFcrYYPHmcMw2mvMn0f+Hq1btKDYUlouT7njnCo419at6gLmijmoesHWJJsS7CYKkABRWGB0NPZbOsSSV6tpxwnPZb4VJz3jZGEs3IXvhaNCY/VbpaN8uS2fPXRJr1RqtYSTDc5zuEPfTKLaO156DAt8HgbIGpztDcXSBX3BgRp0O1vJOhYRikv7wTlzv6qkiMsr3SUT5BRj4R0EPfAUAWIrMleyiStNmLAwDinmHqNxGPIEfqiZ5Ou5M0WzZ7oGW6pGX4CKSaknD4/aTxMi7qgq9kREuR3YalWA6I8mZoDvXedgu+QcNLWtkh8/wA6p2pty83jp3IIDmfP6YgN17ijHJZAXDZ7NnefmQJCoSW3EK1TDfWWkLnJidH5ax0UYUV94mcYhp/35coieLb9mSOwMGTg7GKkTluCbWSlccBvARuDUPVyT3DD7CYmrroOcyUsq9P/NoG4bqI1C7GZi0q6RkfreFUJk3TNNWfwI54ejyLilOCNAL4I8hib3rmgwfPuijRaAgaVWo6lfkJqnq235EAgjrqlGTzCIzSt0SXQSpIExMQGlYW8mTHx081N+y9bBqql0InGpZPTe+fdvhyPgXY7xczC X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230025)(4636009)(136003)(396003)(346002)(376002)(39860400002)(451199018)(40470700004)(36840700001)(46966006)(8936002)(26005)(6666004)(47076005)(36860700001)(426003)(41300700001)(83380400001)(921005)(40480700001)(86362001)(356005)(81166007)(40460700003)(82740400003)(36756003)(82310400005)(54906003)(110136005)(7696005)(70206006)(70586007)(4326008)(8676002)(316002)(2616005)(16526019)(43170500006)(336012)(186003)(478600001)(1076003)(44832011)(7416002)(2906002)(5660300002)(30864003)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2023 13:18:46.1202 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3c4a22e-a07d-4ad3-7d82-08daff9fdac6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8178 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 From: Thomas Monjalon As announced in the deprecation notice, flow item structures should re-use the protocol header definitions from the directory lib/net/. The protocol struct is added in an unnamed union, keeping old field names. The GTP header struct members are used in apps and drivers instead of the redundant fields in the flow items. Signed-off-by: Thomas Monjalon --- app/test-flow-perf/items_gen.c | 4 ++-- app/test-pmd/cmdline_flow.c | 8 +++---- doc/guides/prog_guide/rte_flow.rst | 10 ++------- doc/guides/rel_notes/deprecation.rst | 1 - drivers/net/i40e/i40e_fdir.c | 14 ++++++------ drivers/net/i40e/i40e_flow.c | 20 ++++++++--------- drivers/net/iavf/iavf_fdir.c | 8 +++---- drivers/net/ice/ice_fdir_filter.c | 10 ++++----- drivers/net/ice/ice_switch_filter.c | 12 +++++----- drivers/net/mlx5/hws/mlx5dr_definer.c | 14 ++++++------ drivers/net/mlx5/mlx5_flow_dv.c | 20 ++++++++--------- lib/ethdev/rte_flow.h | 32 ++++++++++++++++++--------- 12 files changed, 78 insertions(+), 75 deletions(-) diff --git a/app/test-flow-perf/items_gen.c b/app/test-flow-perf/items_gen.c index 0f19e5e53648..55eb6f5cf009 100644 --- a/app/test-flow-perf/items_gen.c +++ b/app/test-flow-perf/items_gen.c @@ -213,10 +213,10 @@ add_gtp(struct rte_flow_item *items, __rte_unused struct additional_para para) { static struct rte_flow_item_gtp gtp_spec = { - .teid = RTE_BE32(TEID_VALUE), + .hdr.teid = RTE_BE32(TEID_VALUE), }; static struct rte_flow_item_gtp gtp_mask = { - .teid = RTE_BE32(0xffffffff), + .hdr.teid = RTE_BE32(0xffffffff), }; items[items_counter].type = RTE_FLOW_ITEM_TYPE_GTP; diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 0e115956514c..dd6da9d98d9b 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -4137,19 +4137,19 @@ static const struct token token_list[] = { .help = "GTP flags", .next = NEXT(item_gtp, NEXT_ENTRY(COMMON_UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY(struct rte_flow_item_gtp, - v_pt_rsv_flags)), + hdr.gtp_hdr_info)), }, [ITEM_GTP_MSG_TYPE] = { .name = "msg_type", .help = "GTP message type", .next = NEXT(item_gtp, NEXT_ENTRY(COMMON_UNSIGNED), item_param), - .args = ARGS(ARGS_ENTRY(struct rte_flow_item_gtp, msg_type)), + .args = ARGS(ARGS_ENTRY(struct rte_flow_item_gtp, hdr.msg_type)), }, [ITEM_GTP_TEID] = { .name = "teid", .help = "tunnel endpoint identifier", .next = NEXT(item_gtp, NEXT_ENTRY(COMMON_UNSIGNED), item_param), - .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp, teid)), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp, hdr.teid)), }, [ITEM_GTPC] = { .name = "gtpc", @@ -11224,7 +11224,7 @@ cmd_set_raw_parsed(const struct buffer *in) goto error; } gtp = item->spec; - if ((gtp->v_pt_rsv_flags & 0x07) != 0x04) { + if (gtp->hdr.s == 1 || gtp->hdr.pn == 1) { /* Only E flag should be set. */ fprintf(stderr, "Error - GTP unsupported flags\n"); diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 603e1b866be3..ec2e335fac3d 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1064,12 +1064,7 @@ Note: GTP, GTPC and GTPU use the same structure. GTPC and GTPU item are defined for a user-friendly API when creating GTP-C and GTP-U flow rules. -- ``v_pt_rsv_flags``: version (3b), protocol type (1b), reserved (1b), - extension header flag (1b), sequence number flag (1b), N-PDU number - flag (1b). -- ``msg_type``: message type. -- ``msg_len``: message length. -- ``teid``: tunnel endpoint identifier. +- ``hdr``: header definition (``rte_gtp.h``). - Default ``mask`` matches teid only. Item: ``ESP`` @@ -1235,8 +1230,7 @@ Item: ``GTP_PSC`` Matches a GTP PDU extension header with type 0x85. -- ``pdu_type``: PDU type. -- ``qfi``: QoS flow identifier. +- ``hdr``: header definition (``rte_gtp.h``). - Default ``mask`` matches QFI only. Item: ``PPPOES``, ``PPPOED`` diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 80bf7209065a..b89450b239ef 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -68,7 +68,6 @@ Deprecation Notices - ``rte_flow_item_e_tag`` - ``rte_flow_item_geneve`` - ``rte_flow_item_geneve_opt`` - - ``rte_flow_item_gtp`` - ``rte_flow_item_icmp6`` - ``rte_flow_item_icmp6_nd_na`` - ``rte_flow_item_icmp6_nd_ns`` diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index afcaa593eb58..47f79ecf11cc 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -761,26 +761,26 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, gtp = (struct rte_flow_item_gtp *) ((unsigned char *)udp + sizeof(struct rte_udp_hdr)); - gtp->msg_len = + gtp->hdr.plen = rte_cpu_to_be_16(I40E_FDIR_GTP_DEFAULT_LEN); - gtp->teid = fdir_input->flow.gtp_flow.teid; - gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0X01; + gtp->hdr.teid = fdir_input->flow.gtp_flow.teid; + gtp->hdr.msg_type = I40E_FDIR_GTP_MSG_TYPE_0X01; /* GTP-C message type is not supported. */ if (cus_pctype->index == I40E_CUSTOMIZED_GTPC) { udp->dst_port = rte_cpu_to_be_16(I40E_FDIR_GTPC_DST_PORT); - gtp->v_pt_rsv_flags = + gtp->hdr.gtp_hdr_info = I40E_FDIR_GTP_VER_FLAG_0X32; } else { udp->dst_port = rte_cpu_to_be_16(I40E_FDIR_GTPU_DST_PORT); - gtp->v_pt_rsv_flags = + gtp->hdr.gtp_hdr_info = I40E_FDIR_GTP_VER_FLAG_0X30; } if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4) { - gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; + gtp->hdr.msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; gtp_ipv4 = (struct rte_ipv4_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); @@ -794,7 +794,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, sizeof(struct rte_ipv4_hdr); } else if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6) { - gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; + gtp->hdr.msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; gtp_ipv6 = (struct rte_ipv6_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 2855b14fe679..3c550733f2bb 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2135,10 +2135,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, gtp_mask = item->mask; if (gtp_spec && gtp_mask) { - if (gtp_mask->v_pt_rsv_flags || - gtp_mask->msg_type || - gtp_mask->msg_len || - gtp_mask->teid != UINT32_MAX) { + if (gtp_mask->hdr.gtp_hdr_info || + gtp_mask->hdr.msg_type || + gtp_mask->hdr.plen || + gtp_mask->hdr.teid != UINT32_MAX) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -2147,7 +2147,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, } filter->input.flow.gtp_flow.teid = - gtp_spec->teid; + gtp_spec->hdr.teid; filter->input.flow_ext.customized_pctype = true; cus_proto = item_type; } @@ -3570,10 +3570,10 @@ i40e_flow_parse_gtp_pattern(struct rte_eth_dev *dev, return -rte_errno; } - if (gtp_mask->v_pt_rsv_flags || - gtp_mask->msg_type || - gtp_mask->msg_len || - gtp_mask->teid != UINT32_MAX) { + if (gtp_mask->hdr.gtp_hdr_info || + gtp_mask->hdr.msg_type || + gtp_mask->hdr.plen || + gtp_mask->hdr.teid != UINT32_MAX) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -3586,7 +3586,7 @@ i40e_flow_parse_gtp_pattern(struct rte_eth_dev *dev, else if (item_type == RTE_FLOW_ITEM_TYPE_GTPU) filter->tunnel_type = I40E_TUNNEL_TYPE_GTPU; - filter->tenant_id = rte_be_to_cpu_32(gtp_spec->teid); + filter->tenant_id = rte_be_to_cpu_32(gtp_spec->hdr.teid); break; default: diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c index a6c88cb55b88..811a10287b70 100644 --- a/drivers/net/iavf/iavf_fdir.c +++ b/drivers/net/iavf/iavf_fdir.c @@ -1277,16 +1277,16 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPU_IP); if (gtp_spec && gtp_mask) { - if (gtp_mask->v_pt_rsv_flags || - gtp_mask->msg_type || - gtp_mask->msg_len) { + if (gtp_mask->hdr.gtp_hdr_info || + gtp_mask->hdr.msg_type || + gtp_mask->hdr.plen) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid GTP mask"); return -rte_errno; } - if (gtp_mask->teid == UINT32_MAX) { + if (gtp_mask->hdr.teid == UINT32_MAX) { input_set |= IAVF_INSET_GTPU_TEID; VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, GTPU_IP, TEID); } diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 5d297afc290e..480b369af816 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -2341,9 +2341,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, if (!(gtp_spec && gtp_mask)) break; - if (gtp_mask->v_pt_rsv_flags || - gtp_mask->msg_type || - gtp_mask->msg_len) { + if (gtp_mask->hdr.gtp_hdr_info || + gtp_mask->hdr.msg_type || + gtp_mask->hdr.plen) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -2351,10 +2351,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, return -rte_errno; } - if (gtp_mask->teid == UINT32_MAX) + if (gtp_mask->hdr.teid == UINT32_MAX) input_set_o |= ICE_INSET_GTPU_TEID; - filter->input.gtpu_data.teid = gtp_spec->teid; + filter->input.gtpu_data.teid = gtp_spec->hdr.teid; break; case RTE_FLOW_ITEM_TYPE_GTP_PSC: tunnel_type = ICE_FDIR_TUNNEL_TYPE_GTPU_EH; diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 7cb20fa0b4f8..110d8895fea3 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1405,9 +1405,9 @@ ice_switch_parse_pattern(const struct rte_flow_item pattern[], return false; } if (gtp_spec && gtp_mask) { - if (gtp_mask->v_pt_rsv_flags || - gtp_mask->msg_type || - gtp_mask->msg_len) { + if (gtp_mask->hdr.gtp_hdr_info || + gtp_mask->hdr.msg_type || + gtp_mask->hdr.plen) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -1415,13 +1415,13 @@ ice_switch_parse_pattern(const struct rte_flow_item pattern[], return false; } input = &outer_input_set; - if (gtp_mask->teid) + if (gtp_mask->hdr.teid) *input |= ICE_INSET_GTPU_TEID; list[t].type = ICE_GTP; list[t].h_u.gtp_hdr.teid = - gtp_spec->teid; + gtp_spec->hdr.teid; list[t].m_u.gtp_hdr.teid = - gtp_mask->teid; + gtp_mask->hdr.teid; input_set_byte += 4; t++; } diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c index 3a438f2c9d12..127cebcf3e11 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -145,9 +145,9 @@ struct mlx5dr_definer_conv_data { X(SET_BE16, tcp_src_port, v->hdr.src_port, rte_flow_item_tcp) \ X(SET_BE16, tcp_dst_port, v->hdr.dst_port, rte_flow_item_tcp) \ X(SET, gtp_udp_port, RTE_GTPU_UDP_PORT, rte_flow_item_gtp) \ - X(SET_BE32, gtp_teid, v->teid, rte_flow_item_gtp) \ - X(SET, gtp_msg_type, v->msg_type, rte_flow_item_gtp) \ - X(SET, gtp_ext_flag, !!v->v_pt_rsv_flags, rte_flow_item_gtp) \ + X(SET_BE32, gtp_teid, v->hdr.teid, rte_flow_item_gtp) \ + X(SET, gtp_msg_type, v->hdr.msg_type, rte_flow_item_gtp) \ + X(SET, gtp_ext_flag, !!v->hdr.gtp_hdr_info, rte_flow_item_gtp) \ X(SET, gtp_next_ext_hdr, GTP_PDU_SC, rte_flow_item_gtp_psc) \ X(SET, gtp_ext_hdr_pdu, v->hdr.type, rte_flow_item_gtp_psc) \ X(SET, gtp_ext_hdr_qfi, v->hdr.qfi, rte_flow_item_gtp_psc) \ @@ -830,12 +830,12 @@ mlx5dr_definer_conv_item_gtp(struct mlx5dr_definer_conv_data *cd, if (!m) return 0; - if (m->msg_len || m->v_pt_rsv_flags & ~MLX5DR_DEFINER_GTP_EXT_HDR_BIT) { + if (m->hdr.plen || m->hdr.gtp_hdr_info & ~MLX5DR_DEFINER_GTP_EXT_HDR_BIT) { rte_errno = ENOTSUP; return rte_errno; } - if (m->teid) { + if (m->hdr.teid) { if (!(cd->caps->flex_protocols & MLX5_HCA_FLEX_GTPU_TEID_ENABLED)) { rte_errno = ENOTSUP; return rte_errno; @@ -847,7 +847,7 @@ mlx5dr_definer_conv_item_gtp(struct mlx5dr_definer_conv_data *cd, fc->byte_off = cd->caps->format_select_gtpu_dw_1 * DW_SIZE; } - if (m->v_pt_rsv_flags) { + if (m->hdr.gtp_hdr_info) { if (!(cd->caps->flex_protocols & MLX5_HCA_FLEX_GTPU_DW_0_ENABLED)) { rte_errno = ENOTSUP; return rte_errno; @@ -861,7 +861,7 @@ mlx5dr_definer_conv_item_gtp(struct mlx5dr_definer_conv_data *cd, } - if (m->msg_type) { + if (m->hdr.msg_type) { if (!(cd->caps->flex_protocols & MLX5_HCA_FLEX_GTPU_DW_0_ENABLED)) { rte_errno = ENOTSUP; return rte_errno; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2b9c2ba6a4b5..bdd56cf0f9ae 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -2458,9 +2458,9 @@ flow_dv_validate_item_gtp(struct rte_eth_dev *dev, const struct rte_flow_item_gtp *spec = item->spec; const struct rte_flow_item_gtp *mask = item->mask; const struct rte_flow_item_gtp nic_mask = { - .v_pt_rsv_flags = MLX5_GTP_FLAGS_MASK, - .msg_type = 0xff, - .teid = RTE_BE32(0xffffffff), + .hdr.gtp_hdr_info = MLX5_GTP_FLAGS_MASK, + .hdr.msg_type = 0xff, + .hdr.teid = RTE_BE32(0xffffffff), }; if (!priv->sh->cdev->config.hca_attr.tunnel_stateless_gtp) @@ -2478,7 +2478,7 @@ flow_dv_validate_item_gtp(struct rte_eth_dev *dev, "no outer UDP layer found"); if (!mask) mask = &rte_flow_item_gtp_mask; - if (spec && spec->v_pt_rsv_flags & ~MLX5_GTP_FLAGS_MASK) + if (spec && spec->hdr.gtp_hdr_info & ~MLX5_GTP_FLAGS_MASK) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "Match is supported for GTP" @@ -2529,8 +2529,8 @@ flow_dv_validate_item_gtp_psc(const struct rte_flow_item *item, gtp_mask = gtp_item->mask ? gtp_item->mask : &rte_flow_item_gtp_mask; /* GTP spec and E flag is requested to match zero. */ if (gtp_spec && - (gtp_mask->v_pt_rsv_flags & - ~gtp_spec->v_pt_rsv_flags & MLX5_GTP_EXT_HEADER_FLAG)) + (gtp_mask->hdr.gtp_hdr_info & + ~gtp_spec->hdr.gtp_hdr_info & MLX5_GTP_EXT_HEADER_FLAG)) return rte_flow_error_set (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "GTP E flag must be 1 to match GTP PSC"); @@ -9320,7 +9320,7 @@ flow_dv_translate_item_vxlan_gpe(void *key, const struct rte_flow_item *item, const uint64_t pattern_flags, uint32_t key_type) { - static const struct rte_flow_item_vxlan_gpe dummy_vxlan_gpe_hdr = {0, }; + static const struct rte_flow_item_vxlan_gpe dummy_vxlan_gpe_hdr = {{{0}}}; const struct rte_flow_item_vxlan_gpe *vxlan_m = item->mask; const struct rte_flow_item_vxlan_gpe *vxlan_v = item->spec; /* The item was validated to be on the outer side */ @@ -10358,11 +10358,11 @@ flow_dv_translate_item_gtp(void *key, const struct rte_flow_item *item, MLX5_ITEM_UPDATE(item, key_type, gtp_v, gtp_m, &rte_flow_item_gtp_mask); MLX5_SET(fte_match_set_misc3, misc3_v, gtpu_msg_flags, - gtp_v->v_pt_rsv_flags & gtp_m->v_pt_rsv_flags); + gtp_v->hdr.gtp_hdr_info & gtp_m->hdr.gtp_hdr_info); MLX5_SET(fte_match_set_misc3, misc3_v, gtpu_msg_type, - gtp_v->msg_type & gtp_m->msg_type); + gtp_v->hdr.msg_type & gtp_m->hdr.msg_type); MLX5_SET(fte_match_set_misc3, misc3_v, gtpu_teid, - rte_be_to_cpu_32(gtp_v->teid & gtp_m->teid)); + rte_be_to_cpu_32(gtp_v->hdr.teid & gtp_m->hdr.teid)); } /** diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 3ae89e367c16..85ca73d1dc04 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -1149,23 +1149,33 @@ static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask = { * * Matches a GTPv1 header. */ +RTE_STD_C11 struct rte_flow_item_gtp { - /** - * Version (3b), protocol type (1b), reserved (1b), - * Extension header flag (1b), - * Sequence number flag (1b), - * N-PDU number flag (1b). - */ - uint8_t v_pt_rsv_flags; - uint8_t msg_type; /**< Message type. */ - rte_be16_t msg_len; /**< Message length. */ - rte_be32_t teid; /**< Tunnel endpoint identifier. */ + union { + struct { + /* + * These are old fields kept for compatibility. + * Please prefer hdr field below. + */ + /** + * Version (3b), protocol type (1b), reserved (1b), + * Extension header flag (1b), + * Sequence number flag (1b), + * N-PDU number flag (1b). + */ + uint8_t v_pt_rsv_flags; + uint8_t msg_type; /**< Message type. */ + rte_be16_t msg_len; /**< Message length. */ + rte_be32_t teid; /**< Tunnel endpoint identifier. */ + }; + struct rte_gtp_hdr hdr; /**< GTP header definition. */ + }; }; /** Default mask for RTE_FLOW_ITEM_TYPE_GTP. */ #ifndef __cplusplus static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { - .teid = RTE_BE32(0xffffffff), + .hdr.teid = RTE_BE32(UINT32_MAX), }; #endif -- 2.25.1