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 B7DFAA00C2; Thu, 30 Dec 2021 04:08:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B686141141; Thu, 30 Dec 2021 04:08:45 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2084.outbound.protection.outlook.com [40.107.220.84]) by mails.dpdk.org (Postfix) with ESMTP id C99404113D for ; Thu, 30 Dec 2021 04:08:43 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mDx2PgXUVsHTszNztCe3DhvZQXvLFL5wI6KcTeqJHbkKlpryVXl87W5+L4Kp05eucbnYJkJCj41L3aWkw5otgWpxRyMmYOLgziZ6RgXUskHfn5B2DcZRb7Ay01KlCI7bnx28TyLUd5R30DmtVCdMjgPUPM0acGdrge1yCDH2n9lUDYh0Kq+0mbUu4ID8JcXqaYvLWmKy8JtjmQZrU0Vb8em+cup3OJ+aV2FtIgzx0w50Ar5Okll3lq0Ph1kvHvPxAG+qDMnjl6SdzDwiUJ3VRFMjr2tJ/xN34w4T5FeYEDUzpZB1vz+nSVkEPDptpLnUdNJkb6qfbmnrSW4r0JSNFQ== 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=0duyja4NRPj330I1v7SaLdo1XV9q6IPtVjiFRZqjjwc=; b=QOJE6zcrspMg6z+tkUcRuExLVwpuqIbYGo6rrhsS2dlq2RU4fPA08h2blQKGRkOGZPvNcgLJ2fS5uzvpyz4ERyXW4w1qPcL9FSxBoVGNIBgjRpKSPcNA/kfb+v4mSYGbe58byygKvqWxOhOXOklwcyDUU6OwxW5cZZD0NnyhfvXjfXPEcUfMZCmfMqmZ/zIVkMj6gXUPaLNkXicSczsZiggGdsA6TFNXtr3pj8Wt7INk50MqGr9jIYgTEu4ZcuLDO1c4spvjKs0BUSTI7sjgaUK2Ag9WeHox3jd9OujjXRmQYOWId5jAXxcGgKLDeyS2z+oE8e/Sil6hbPYQSdG9xA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0duyja4NRPj330I1v7SaLdo1XV9q6IPtVjiFRZqjjwc=; b=U79trQgTwGIlyFijMTAuOd0+ZJMia+OZ3pwhOx5qeoDEfazRN/ayb2h66FBpawa0c3RYL8vyxa6ZmH1jhzjTGv50p82fgqDKXyPf2knmZ8bnfIcUulBpFN0Ba3d2s2SEqrOTOwL38ohzDOcpJ6qOSYC1pk0JDsyY1JpYb71+Ke5as+PTTcf2Xm4xEzhNiy0urTZACdfAetJkS50Q3yUACYtWpaTP2lbjoQroFDFCcHCVzLP87sHyG3iGYg/0v12xrHEVbfBkoqtEMLigqABpxZZtWxjICyDWDxqz/E6f/AMrvJYmsRWJdSvJCfkb5wbGMw9Cc3ytVP3LmuOt3mquRg== Received: from MW4PR03CA0228.namprd03.prod.outlook.com (2603:10b6:303:b9::23) by CY4PR12MB1671.namprd12.prod.outlook.com (2603:10b6:910:c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.21; Thu, 30 Dec 2021 03:08:40 +0000 Received: from CO1NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9:cafe::45) by MW4PR03CA0228.outlook.office365.com (2603:10b6:303:b9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.14 via Frontend Transport; Thu, 30 Dec 2021 03:08:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by CO1NAM11FT052.mail.protection.outlook.com (10.13.174.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4844.14 via Frontend Transport; Thu, 30 Dec 2021 03:08:40 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 30 Dec 2021 03:08:39 +0000 Received: from nvidia.com (172.20.187.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.986.9; Wed, 29 Dec 2021 19:08:37 -0800 From: Sean Zhang To: , , Xiaoyun Li , Aman Singh CC: , Subject: [RFC 2/3] app/testpmd: add gre_option item command Date: Thu, 30 Dec 2021 05:08:16 +0200 Message-ID: <20211230030817.15264-3-xiazhang@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211230030817.15264-1-xiazhang@nvidia.com> References: <20211230030817.15264-1-xiazhang@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 262e1065-b6ac-43f2-2db1-08d9cb41ae45 X-MS-TrafficTypeDiagnostic: CY4PR12MB1671:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aOZnfQNg0C+VaCnIDIJI27P0uyenmgupMAETcsSzwMHJx+V8GkbHQf9pe/ikfBp4JkTcRz51DrWbmXV7HJ/8nOKSbd+9NRYkyOj7mAKOoLs7O96cZAwLrnY9gCaQcV09XxA9+K7PVWBjEGet3ErWK5SJozNnMRcExtBj3I/5q03hNFqtLrqbXOx83NqQyYfVm8ECjLm8Nd/fhsr05EcmxWv12GrAPC5N5pkJ37gdpLLxrk5kGqYJsaFh3uJ2iFgSq3qRIVkWVtbtHf9QuFZtTjG/OTPYV/CuNGQi0fntP/LMjxYb81bckKy6xl9gvXsdls8jeOD//gWVhxLcJ6VMLRLEiTvVhdIlSBMpONsJeT8OnurrSp8MUIulxl9cocJkKOKZUnR7HgAaWcfxUBqYnRoDMJRWa8U+/INu+ERg/oP35+ZA3yzsz88BFzjB8YVAOJxTfUE+yFCviOPNjRADN4BI6GUd8k28ACNldOUQgRomeU89mnotwM1yftxcQVvS4JLGAUVTNcWoGX+IZH8PllA3piM+zj65GrSH2vGI/io3Sk5/ow4MgGuz+QS6d7koHqdzFyQYDuZ1F6GpnVGN4/kPihvOWchFdp2Dnm8FWUh/pigKMpn9Opu0KIcpxUOLrEVlNScQAxRb9BpA1p4ZDS361H7CqR9Tu0s+fbxaOhGTza8kjLOJvydCgptSQC3u/KYXh5EcaD9DrUQLNQGJ/DvEqUF7fefhLGOIZkUr4595K6f7LVNV0cnN3JCF58EHbBORBTUSTNQwPMIV13Udbiev5/E0Txg9Eh6oJ2e7SWQ= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(40470700002)(46966006)(47076005)(6286002)(36860700001)(4326008)(54906003)(81166007)(86362001)(356005)(2906002)(110136005)(7696005)(40460700001)(70206006)(2616005)(8676002)(8936002)(316002)(508600001)(36756003)(70586007)(336012)(16526019)(55016003)(1076003)(26005)(426003)(82310400004)(5660300002)(6666004)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2021 03:08:40.5467 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 262e1065-b6ac-43f2-2db1-08d9cb41ae45 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1671 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 Add gre_option command for matching optional fields(checksum/key/sequence) in GRE header. The item must follow gre item, and the item does not change the flags in gre item, the application should set the flags in gre item correspondingly. Application can still use gre_key item 'gre_key value is xx' for key matching, the effect is the same with using 'gre_option key is xx'. The examples for gre_option are as follows: To match on checksum field with value 0x11: testpmd> ... pattern / eth / gre c_bit is 1 / gre_option checksum is 0x11 / end .. To match on checksum field with value 0x11 and any value of key: testpmd> ... pattern / eth / gre c_bit is 1 k_bit is 1 / gre_option checksum is 0x11 / end .. To match on checksum field with value 0x11 and no key field in packet: testpmd> ... pattern / eth / gre c_bit is 1 k_bit is 0 / gre_option checksum is 0x11 / end .. The invalid patterns for gre_option are as follows: testpmd> ... pattern / eth / gre / gre_option checksum is 0x11 / end .. (c_bit in gre item not present) testpmd> ... pattern / eth / gre c_bit is 0 / gre_option checksum is 0x11 / end .. (c_bit is unset for gre item, but checksum is specified by gre_option item) Signed-off-by: Sean Zhang --- app/test-pmd/cmdline_flow.c | 57 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 +++ 2 files changed, 63 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index bbe3dc0..4e714c2 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -271,6 +271,10 @@ enum index { ITEM_META_DATA, ITEM_GRE_KEY, ITEM_GRE_KEY_VALUE, + ITEM_GRE_OPTION, + ITEM_GRE_OPTION_CHECKSUM, + ITEM_GRE_OPTION_KEY, + ITEM_GRE_OPTION_SEQUENCE, ITEM_GTP_PSC, ITEM_GTP_PSC_QFI, ITEM_GTP_PSC_PDU_T, @@ -1042,6 +1046,7 @@ struct parse_action_priv { ITEM_ICMP6_ND_OPT_TLA_ETH, ITEM_META, ITEM_GRE_KEY, + ITEM_GRE_OPTION, ITEM_GTP_PSC, ITEM_PPPOES, ITEM_PPPOED, @@ -1232,6 +1237,14 @@ struct parse_action_priv { ZERO, }; +static const enum index item_gre_option[] = { + ITEM_GRE_OPTION_CHECKSUM, + ITEM_GRE_OPTION_KEY, + ITEM_GRE_OPTION_SEQUENCE, + ITEM_NEXT, + ZERO, +}; + static const enum index item_gtp[] = { ITEM_GTP_FLAGS, ITEM_GTP_MSG_TYPE, @@ -3479,6 +3492,37 @@ static int comp_set_modify_field_id(struct context *, const struct token *, item_param), .args = ARGS(ARG_ENTRY_HTON(rte_be32_t)), }, + [ITEM_GRE_OPTION] = { + .name = "gre_option", + .help = "match GRE optional fields", + .priv = PRIV_ITEM(GRE_OPTION, sizeof(struct rte_gre_hdr_option)), + .next = NEXT(item_gre_option), + .call = parse_vc, + }, + [ITEM_GRE_OPTION_CHECKSUM] = { + .name = "checksum", + .help = "match GRE checksum", + .next = NEXT(item_gre_option, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_gre_hdr_option, + checksum)), + }, + [ITEM_GRE_OPTION_KEY] = { + .name = "key", + .help = "match GRE key", + .next = NEXT(item_gre_option, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_gre_hdr_option, + key)), + }, + [ITEM_GRE_OPTION_SEQUENCE] = { + .name = "sequence", + .help = "match GRE sequence", + .next = NEXT(item_gre_option, NEXT_ENTRY(COMMON_UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_gre_hdr_option, + sequence)), + }, [ITEM_GTP_PSC] = { .name = "gtp_psc", .help = "match GTP extension header with type 0x85", @@ -9235,6 +9279,19 @@ static int comp_set_modify_field_id(struct context *, const struct token *, ((const struct rte_flow_item_flex *) item->spec)->length : 0; break; + case RTE_FLOW_ITEM_TYPE_GRE_OPTION: + size = 0; + if (item->spec) { + const struct rte_gre_hdr_option *opt = item->spec; + if (opt->checksum) + size += 4; + if (opt->key) + size += 4; + if (opt->sequence) + size += 4; + } + proto = 0x2F; + break; default: fprintf(stderr, "Error - Not supported item\n"); goto error; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 44228cd..b49e93c 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3714,6 +3714,12 @@ This section lists supported pattern items and their attributes, if any. - ``value {unsigned}``: key value. +- ``gre_option``: match GRE optional fields(checksum/key/sequence). + + - ``checksum {unsigned}``: checksum value. + - ``key {unsigned}``: key value. + - ``sequence {unsigned}``: sequence number value. + - ``fuzzy``: fuzzy pattern match, expect faster than default. - ``thresh {unsigned}``: accuracy threshold. -- 1.8.3.1