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 0D12442493; Thu, 26 Jan 2023 17:20:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 876CE42D54; Thu, 26 Jan 2023 17:19:37 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2070.outbound.protection.outlook.com [40.107.96.70]) by mails.dpdk.org (Postfix) with ESMTP id D9FC842D68 for ; Thu, 26 Jan 2023 17:19:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nzo6nLFEFQgxAyAGmZUnffPcu0SPVAWR3cvjyIEgpRVWtiqTAxWMltibcBAFVzE1vxC7nWVeaha9qfy0gWjNyfCjwGZHJbHtHRnQCHAfXWhleimbnDNU6GvVcuyQt0aM53ZQ70yqsw9GQ4iRHAxvqHtn2Z/gehM2qlfMbW1cJamBydkZu+twBj9mJZJpKGJmsze3DGM709nGOawWXPGOsgO8lkHW6N1sal62flhiF2im0kfZe1tROPMdqTvg6UhfuNb6CQVErXi+z6B3MG/lKNp/DCtG8Kfb3KuNdcH3r/JU3t6NkZopo9zW1kxO1EoGdiL67Fex6y+lSHPBa89Jdw== 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=JJ+uer7evRSSRSWjJqB9/YVH2BLaj+gZCJ99Fxdrd5P30D4v404adGC9ruE6GybkfFWEiVKcbaYrV0KGZzA8+Z5wx7S+dDUD6UDRDym3XIOWf9cpwDAeHCEk6oOV/6cNo/mfoWaTVwjwytRufsYBnQZ2oFHC7FmJATb91xC/SSeiwRLRtdjJsoJwysIJ7EyBoRgi4QpHA9NZkRQjjMmQvWzDc+jpyAKi/Q3JMQcxPAiUsW9I8DiJqBhru4WTCGTOQT7I6XDTCnDD7LOAsEKOTCxznPk8ijbfrjD3szTvWWjqLWIyEuBX4SVUn2rMMduI2LngTtfRIG46vrLJdFmaeg== 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=ZEYZynf4NlxMT2tRz6+dWoCgoUo4yvg8Tq2tP6LuR5QJMr5XNTmvvfzKwVA+qMMJNmKRoYgmaEw20oSP+ZiNMf/AJ66AMZftAyXqJbOfwHdLS0SdxNxJMonuE+plR26CplgPT1mvsUcKwtRSJYa4ETiJXD59FW0snc8PAqXfpAc= Received: from BN9PR03CA0095.namprd03.prod.outlook.com (2603:10b6:408:fd::10) by IA1PR12MB6483.namprd12.prod.outlook.com (2603:10b6:208:3a8::14) 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 16:19:33 +0000 Received: from BN8NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fd:cafe::de) by BN9PR03CA0095.outlook.office365.com (2603:10b6:408:fd::10) 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 16:19:33 +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 BN8NAM11FT064.mail.protection.outlook.com (10.13.176.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6043.17 via Frontend Transport; Thu, 26 Jan 2023 16:19:32 +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 10:19:30 -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 v5 5/8] ethdev: use GTP protocol struct for flow matching Date: Thu, 26 Jan 2023 16:19:01 +0000 Message-ID: <20230126161904.864517-6-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126161904.864517-1-ferruh.yigit@amd.com> References: <20221025214410.715864-1-thomas@monjalon.net> <20230126161904.864517-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: BN8NAM11FT064:EE_|IA1PR12MB6483:EE_ X-MS-Office365-Filtering-Correlation-Id: d4c0568f-1bb7-4c77-97db-08daffb91bcb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QRvu4X77iB01O7rqfZKdvhlos8cGy9DkrJINQiJRn/ziN/QFakiKier9/yFfJD0LHXC7GID/VphUu928nUSN7ShpziZv1BS6bOzRhvGaq0UWbLV85Y+52bz3MS94osc0N2qMW31V7KtXihe0z3nc8mIyTXTzlA0D+89flHN1DD13vWgV0ZcUY6YBnV+BMIqWha/ruBR2M/tGysWGepQSf/xZcNf7op4cux1CeA58Oo3uw16QTYLq0zVFfGw/YGnZDWwQGliUUyHDQBWZ7p54tUVxuUisXnK3Tbw4o9dl/eOTFxSTittH4P00BbH93/aEce2OTGCR28k1uOYYMtFwf2K+igOAIAtcMGQvsc+ycg/S941Wt+wJlnXp9THTYv3ox571j6196JQY/LT5VeNcDoddieNiZf7PTH1NYiU/lDMzwNG9IC9Lw8wF9YE3sN2wgMdIzl5dwF4ZkrSdNIGACafMbGN2QeZq/TJMZbbDifWrnh26R1fMx5mYlxV1PKrROC+o3Y75QmgfH1viD+uyEueHnyydmjOQZOjIm86bkE+VutxSxoKfaoEIcAP2nXQp21ghklGCzxJEysq7B+LbEw31wvwkcwnVZr2oUxrycfYm8iNFnQ7mpBvbL5UiHqdt52bKEkTb3LIGR3qyLsS+wZa0eHVzPt3Qd30JCdJT74tc8FLfR4fUstCVfugoVoV000UYO6vIf7yz3xsBEzPYf5c20NCow47trC92useAcQDkkweu/vsYovokB4ZjTqlov8dqdygI2HO+p7KdzNkqlEZOs86yz3NRWpV0MSdUonXToid+2LjZX4k/tfNXjA4L 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)(346002)(376002)(136003)(396003)(39860400002)(451199018)(40470700004)(46966006)(36840700001)(82310400005)(81166007)(356005)(1076003)(2616005)(36860700001)(921005)(40460700003)(44832011)(2906002)(110136005)(316002)(478600001)(82740400003)(54906003)(36756003)(8936002)(41300700001)(7696005)(86362001)(40480700001)(43170500006)(426003)(83380400001)(186003)(16526019)(26005)(6666004)(336012)(70586007)(4326008)(5660300002)(70206006)(8676002)(7416002)(47076005)(30864003)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2023 16:19:32.6237 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4c0568f-1bb7-4c77-97db-08daffb91bcb 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: BN8NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6483 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