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 D56BA41BBE; Fri, 3 Feb 2023 17:49:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F072142D32; Fri, 3 Feb 2023 17:49:29 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2087.outbound.protection.outlook.com [40.107.101.87]) by mails.dpdk.org (Postfix) with ESMTP id BAADE42D30 for ; Fri, 3 Feb 2023 17:49:27 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NnSb+a1jEy7Ovz+7zWYpoGZmBA5lUfMKE8I7886zwICUS5fsllCDJEG4sPi//S37B/J44msKUMs2uqkD9JM114GRfbPqDpPg6Sdj31bzFa9EHEUwc5eVOqMMmgAc7p2wDRAz+K3Q2FK0r4qwwErSgCrD/QYHoB0L+9/TUd7v3ajB39XEuqT5doB7FJh9wAmRNz1U2q+mUjMUOVYZXAV7lvZuON3J07h6J4FPdPJL5qkTLzpqJj5yifvWqu54/fgW2PJI+qw+ed6hFH72Jqo9z9VAEAVuAT5PrX9EXsAcUxLTMtijYx4qXtGRcu1dxv3SGkl4XCqyFsL6ujhBu8SUeg== 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=K4TmFFabRhdcz6plccBP9RSQo8RvH/f8rScPjqVe3iE=; b=MWsep1NDOEaCvb7cCzzBWMGH6GAczw7aa5I974yEd1BmLzz82WkJW6AWK3Pd7DZ4g7Noxog5pnOurR7l+mlaWE1aTFU+oUhnlnMEB7mYYaig8oX91TIvAqWVZNO5ztPlvcxW+za3Rw4wmNwRfs6BVIe9iJqyHLC/CmK47UcVM8lQIejFCAelToY1u5Noh+Th0yvchRtfwx+LL4Fkio86pOBrtnLAPuL8clT2vMp/dUZRoOFGqTIyYECR3t66UCICsR/ETX8aQQUsOtMugzKgDFRjdzcC0y/a/W9Qd2GM96Ildtk+vh4gewdQTx9/Z01qRza6Vr/eECUhdTg05BzpNQ== 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=K4TmFFabRhdcz6plccBP9RSQo8RvH/f8rScPjqVe3iE=; b=SLKz4/UNtYzHy2Z4Hdz8/uMh2ElwkDx8wqjto6btIHdATsCenGaqd0fMPhiXI8AT4OXGXX+Hp2/kjTh7KYO3tXaTTmLSJMrAGQTiHiN18126bQP0XP3lSvmGomjz3OhS4misn3+TLHgZXmaEAC7de/Qtas51HIriBWns3Kx0IIo= Received: from DS7PR03CA0050.namprd03.prod.outlook.com (2603:10b6:5:3b5::25) by CH2PR12MB5001.namprd12.prod.outlook.com (2603:10b6:610:61::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Fri, 3 Feb 2023 16:49:25 +0000 Received: from DS1PEPF0000E658.namprd02.prod.outlook.com (2603:10b6:5:3b5:cafe::7d) by DS7PR03CA0050.outlook.office365.com (2603:10b6:5:3b5::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31 via Frontend Transport; Fri, 3 Feb 2023 16:49:25 +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 DS1PEPF0000E658.mail.protection.outlook.com (10.167.18.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6064.21 via Frontend Transport; Fri, 3 Feb 2023 16:49:24 +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; Fri, 3 Feb 2023 10:49:23 -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 v7 4/7] ethdev: use GTP protocol struct for flow matching Date: Fri, 3 Feb 2023 16:48:51 +0000 Message-ID: <20230203164854.602595-5-ferruh.yigit@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203164854.602595-1-ferruh.yigit@amd.com> References: <20221025214410.715864-1-thomas@monjalon.net> <20230203164854.602595-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: DS1PEPF0000E658:EE_|CH2PR12MB5001:EE_ X-MS-Office365-Filtering-Correlation-Id: 223f1f9a-bd10-4bdb-7444-08db06069b65 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vfn3VoDL/WIDJBuMoqLeyS8yGQvk6MxOP52uE608hj7IkukGlDn1iRzW8rQd4IwxvSRxpKcauV5BzQdH5eCvAUCDpCqHhdN+KnRWF7FrhifAEd9m2PT1TxoEbcIybZFMi2s5SLOmnksZZDTLndotgSSQpwB8XJ3EOTuwsh3s0VAIULRernI94bebcFBLEHvUNYNhrdfbOx/Z7X4iYp84j3xYjY2DWfWlRPIrYrjTqyFZUkEqPT9dw/ji+dlahIC2wK+BMnH/aeMbcVm68fUivTtZYrMeYTT4Kvfc2msvgmIlcYxklvFern6o35ieAxVkpDgsGx35yq7e5smgeRqu0n2VYFIBVJYDs95k9yd700qe4HzNthmlBqMxZR5rGrZqAaQNvUjL7yKtzPk5J8ddtAkamhIzACQQ7LHpH1kk1DotZAwoGMURFLVEr0VhydqzK2azBuV5sZVbXejEPPL1LRn2MhcNeOd2CRUqkwrCXOH5rle8l4XEoyiTWzL+/50JK+HPiJJawY2ZwM0r6B/SFWgFvv8PlyBWHpcv/e2HNSCjzG0c4c40ZE2QY7uL/fUuR/HWlTN+sXEbYcjEXFLcplOEXKpH3KRo3izzlhNoxzKkG7wqppI0GGdG8zC14cwS7RIZFxJE5DqsxmT4GMi+M/QyahSWburm7jvLDNdkfbbCjGldwcrTHHjNpNR+UekaZV0a1UMOolNhVfBYSZR6uU+R0Z3YenjORle5IsFXF37+k3aY9J+jy6RNTIPzXjUH3E4lYLP9TNANSXILFBchbTKLYJB5/dxFib/bbR+2B9gKnawQUuXb/sQAjSGG2u1X 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)(376002)(346002)(136003)(39860400002)(396003)(451199018)(40470700004)(46966006)(36840700001)(8676002)(41300700001)(4326008)(83380400001)(70586007)(70206006)(8936002)(36756003)(44832011)(81166007)(5660300002)(40460700003)(186003)(30864003)(921005)(26005)(16526019)(7416002)(36860700001)(110136005)(40480700001)(2906002)(356005)(43170500006)(426003)(54906003)(478600001)(6666004)(82740400003)(86362001)(336012)(316002)(47076005)(1076003)(82310400005)(7696005)(2616005)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2023 16:49:24.8963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 223f1f9a-bd10-4bdb-7444-08db06069b65 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: DS1PEPF0000E658.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB5001 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 Acked-by: Ferruh Yigit Acked-by: Andrew Rybchenko --- 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 a58245239ba1..85928349eee0 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 b904f8c3d45c..429d9cab8217 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 116722351486..c4b96b5d324b 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1068,12 +1068,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`` @@ -1239,8 +1234,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 df8b5bcb1b64..838d5854ad9b 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -74,7 +74,6 @@ Deprecation Notices - ``rte_flow_item_geneve`` - ``rte_flow_item_geneve_opt`` - ``rte_flow_item_gre`` - - ``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 604384a24253..fbcfe3665748 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 261c60a5c33a..54cd4ca7344c 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"); @@ -9318,7 +9318,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 */ @@ -10356,11 +10356,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 e2364823d622..8e8925277eb3 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -1139,23 +1139,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.34.1