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 2C5F3A04A8; Wed, 26 Jan 2022 09:44:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7127042726; Wed, 26 Jan 2022 09:44:31 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2083.outbound.protection.outlook.com [40.107.243.83]) by mails.dpdk.org (Postfix) with ESMTP id 9FBFC4271B for ; Wed, 26 Jan 2022 09:44:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TlxniKxuG3rVw4Pfgcit25ul+L3gN0L+D+TgHLKU2KvZfuMjTJX4cxqeqfCI+LVgJ75qX8+T2WiGKG9UMK9hJckJezmlSVmZ/ubufWiFNgsGD8yPXCSpnPWjgtvAmUflqZ8f+6TU5b7SaJbJ5bWpVO9t5oFJqHWhdkuitlrh9SP7kHotmO7KdmTctwbFC/SxwJEFctiz9EZSxr8Iwax/glcT+MRQmGKugOEJ/HOfmSAv+/A/OtpmUeqp/5fIXHGCgrFfXSvP1S4+XBBMIWkCMW6icCc+WMLzruB0IsRb/YSa3EuMRivFJoNPGBNyYh5oHC67P902V9u+0Mg/SGX5hA== 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=R8Doe6IJHOqpBXaEHlw0W5aTH5v12VJ0nrgaRZ0OTNc=; b=GlIVDPU6B+X9QGRsDhtsytO5ev7o7ELgDcrWDhKRpW2hqaeJ0Do7xaS2i4922xnUGRg4sWBUOAi3ZBb5TprFMML+0Xne2XJ73Rk3LwJ+1xPq7aJoeSHtzs/DMCAC5Et8Mp5aMXSo2RkUt8APAzh6yhXlMXsmh6pvaXjYl09sD/vMYW3L9FAHZkT4lkjHHNbjiVhLuYWHPdoxThq7ylB3PCfSr8akEqZOADVDhBtOgPP+tbaOC+dFTuGY7KkTaYPfM9mV+eMt0hWR+AMkJLy9iWWaZXeNHmjmSc7Hgek9xxVBgsaG5DTaQLkYwnz4oF//tg9O94OKeNvOou16QbZWVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=intel.com 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=R8Doe6IJHOqpBXaEHlw0W5aTH5v12VJ0nrgaRZ0OTNc=; b=PbicJZYEQEs0d6mWokWfmmx4Ypitl7oNvRrvXPmIWw/okq8HEa7+R+TNt/nEPBXQa/PVFkTlbuh7qQnXG661NWy8Xs0Lx2MKhju4pJdpox3nEtGfkuGhs1YOcV5oxa6vXmSJLQPocPDvbrxkCOX4M7tvN1SBOgq3DqxF9yP5alMks1PpS996Cs9imcN3YJhb5qCinzbZ2VKvXtRRjXCFLTSKevlSGZRpRO6dbttXmDIKHVyWA2cEGpaSu5yuMVHYhR9j6aUf7Q0SiM0J393i18AONn0cFbPtlLgpaOjfLMrNH4LeRs3IFLGDxsWxKbv7OzzT7A4cnbZNUJw/xdylbA== Received: from MW4P223CA0007.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::12) by MW5PR12MB5597.namprd12.prod.outlook.com (2603:10b6:303:192::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.14; Wed, 26 Jan 2022 08:44:28 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::2d) by MW4P223CA0007.outlook.office365.com (2603:10b6:303:80::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Wed, 26 Jan 2022 08:44:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4930.15 via Frontend Transport; Wed, 26 Jan 2022 08:44:28 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 26 Jan 2022 08:44:26 +0000 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Wed, 26 Jan 2022 00:44:24 -0800 From: Sean Zhang To: , Ori Kam , Xiaoyun Li , Aman Singh , Yuying Zhang CC: Subject: [v1 3/4] app/testpmd: add gre_option item command Date: Wed, 26 Jan 2022 10:44:03 +0200 Message-ID: <20220126084404.40178-4-xiazhang@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220126084404.40178-1-xiazhang@nvidia.com> References: <20211230030817.15264-2-xiazhang@nvidia.com> <20220126084404.40178-1-xiazhang@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: drhqmail203.nvidia.com (10.126.190.182) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f5225c27-6c39-4fb0-77d3-08d9e0a81049 X-MS-TrafficTypeDiagnostic: MW5PR12MB5597: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: sMMM6gYbS6Nkd9FOQ5+T5ARWbhVGICk5KzWoUpAhaD1mk16Yrmov8HRjQ/Vfcxt2NkWvhkdpyv4EfAlrpC1/RAW9nrdNzuUmVzLpUzw27VzzC8VnmWyE8aYnHqvtd/PGHgs6M7M35SLkoriILHv5YZTNdTPcfKeskkQAr66E6U8WguUzPatS0TDZiPe8WVKHPD3k8EFv+hTrjp31bA+A2Ag5rNk79W9JiurxwjMrVs2QW0q3oYaHv5F5r9jfejMKgFvNM3PA6swYTKXguauOmijKhCtfmyGTiLmIAcrjRxwF7Z7/HUOrx+crBQj0CwrfBnme9e5ZXMH7WNR4ZcgiiV5Q+RRepy0GAIDgCnsLRoRG4Ebg49Q3U+wg0TZXTU+aplWVyBEDuZahVRhBrsg5eaNrMfFXiQBy5/P6Ye1Kpe9USuPyDiiMu9Qt07FMeF2lTZKbKm/cvogWdyitNWiTagQX4hygQn/131gqQlgjoQOg6pyPAzgaMpbPSBYXTh2HWSjMI5D6LBGlk2RhosjolrZAJV3y31IiDU/9H8+AzVYHBj4Dn4uaqV4L1nsAND5eCpIvkjnpelyLuICN1LWr7xLpit3ENBNPITCqjQm/nL1StokB8Qak7egNgclGHfsSNl5u6LAR7NtM2EKKbgmKeww+R2w9bO0Vdr6p5WCmYJlWwtQbVmApfHMT0NCbj111kXpjSkm84cVeORqIrl5lNn9Hn94kSyvz097MSQgucLiACSIXt+tKGI8Zd/g+infLDX3tyH12FraopeXSxLKTaOSLReONGplI2UKCt9Xwepg= X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(40470700004)(46966006)(6286002)(82310400004)(86362001)(70206006)(5660300002)(8676002)(55016003)(47076005)(6666004)(40460700003)(36756003)(16526019)(36860700001)(2616005)(1076003)(426003)(2906002)(336012)(7696005)(4326008)(508600001)(316002)(81166007)(356005)(110136005)(186003)(8936002)(70586007)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2022 08:44:28.0763 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f5225c27-6c39-4fb0-77d3-08d9e0a81049 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.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5597 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 | 59 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 +++ 2 files changed, 65 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 5c2bba4..b7aacac 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,38 @@ 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_flow_item_gre_opt)), + .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_flow_item_gre_opt, + 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_flow_item_gre_opt, + 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_flow_item_gre_opt, + sequence)), + }, [ITEM_GTP_PSC] = { .name = "gtp_psc", .help = "match GTP extension header with type 0x85", @@ -9235,6 +9280,20 @@ 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_flow_item_gre_opt + *opt = item->spec; + if (opt->checksum.checksum) + size += 4; + if (opt->key.key) + size += 4; + if (opt->sequence.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 94792d8..751503e 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