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 3CAB1A00BE; Fri, 11 Feb 2022 02:46:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 640AD411CB; Fri, 11 Feb 2022 02:46:01 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2069.outbound.protection.outlook.com [40.107.94.69]) by mails.dpdk.org (Postfix) with ESMTP id C6C42411DB for ; Fri, 11 Feb 2022 02:45:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LYCA4yi+n78/uvVzwW2nH/Mwe5fV4tg2eKFVZTlyqnehmTELEh00nl8wMT42opns2XYI7X16oavaIVBPAVJgJMwNU4Q29ic02L/0cP5YVNm1l6FIRICGmII4p/sHhtpHn1QuQqA0WPK0x7DU6mGSQtqAoZHXHJqN+62+D/AL2nfI0SV8l7Ild+FdTikxzb5pxZLiw+Q1qMR+kHHes9f38hDhU4E88sCx9s980UNxqetc5ye5cs8/hYIWfCkgFknvMQi6xOoUtrJP2/SAD7v7uXgM5TjNK3B5ydw5P3P/sHr3Jlu77t/XgVIrcIdE/Tv7ey6y7osNOmFLdrj//vHGjg== 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=ukDlPe/mPvfWHekH7l5/F7EU/MH1lPcg7RM1jE3ZXNs=; b=Bm1qRIq5rYdfxKkoQJuGIUADZsgVdDqV0HRM+84qO37fsCY+Sa2A4payPr5CCLgMH0YVpd5m7XSXr1AyX/yZZFmylNEHWbKVhAUR9RNvRFxYnolh1r4uUBLzZbycbFeiii6ltzAoxUkfBrcIhDoxxQiVr46JN0XQpMxzJzD8qLdhoRvAQLndT6aUA5TpyDdw95+0OnZOb8kGK9Ora2BecN6gIXZIVMbgCpK8FawSppFl76iNnZ72wYFM5zUreW6nNcjb7WtbNKHMawU2+Afcnpr+fnHR8LUha87MFqvn19EbwWcuJHUacM7oX5FNi+CFtLNsJ2HcFlFH7vMTMu7Wag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) 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=ukDlPe/mPvfWHekH7l5/F7EU/MH1lPcg7RM1jE3ZXNs=; b=csUc+MJ/ihwbCNzKbJy1DUGh5oLlh6aEwON/ThhWOTM1AXtd90KC5aiTUuOnFqS6MPo61L3gSfzsKlA8DlMCUcsw16reS5+ZKEttAwQvHv+JAo+Bh60RL8rikeHqGhVVgxSVZ2yWHA+bj/TkshDpyRts5vYcdSVioPlN290tjmZJSUPXYwiNkHdxp7nP5kCjsJTNNqg/Ee/2at5vGVlkhAC4vkBgZK0I2OW+yfs3VOJC1GCfgfse25jmcQwGwFGnR9CqTq/f3G9Y2xMEC2eIaricH29wx3D6xLArW26NdqX2ezf4ggqlC0dgJJnTFTCUshk8D00vwvGoWRMPo1gDYg== Received: from MWHPR17CA0060.namprd17.prod.outlook.com (2603:10b6:300:93::22) by BY5PR12MB4099.namprd12.prod.outlook.com (2603:10b6:a03:20f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Fri, 11 Feb 2022 01:45:56 +0000 Received: from CO1NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:300:93:cafe::50) by MWHPR17CA0060.outlook.office365.com (2603:10b6:300:93::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Fri, 11 Feb 2022 01:45:56 +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 CO1NAM11FT044.mail.protection.outlook.com (10.13.175.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4975.11 via Frontend Transport; Fri, 11 Feb 2022 01:45:56 +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; Fri, 11 Feb 2022 01:45:55 +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; Thu, 10 Feb 2022 17:45:53 -0800 From: Sean Zhang To: , , Ori Kam , Xiaoyun Li , Aman Singh , Yuying Zhang CC: Subject: [v2 3/4] app/testpmd: add gre_option item command Date: Fri, 11 Feb 2022 03:45:29 +0200 Message-ID: <20220211014530.77711-4-xiazhang@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220211014530.77711-1-xiazhang@nvidia.com> References: <20220126084404.40178-1-xiazhang@nvidia.com> <20220211014530.77711-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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b8f01e22-0253-4def-8d1f-08d9ed003f15 X-MS-TrafficTypeDiagnostic: BY5PR12MB4099: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: YMs2tSaZ7dD/SXAUD/YM0eaD4/Kk6cbx448gKUE2lIr5FfDfJojPs5juvxt8OP+znaj8QII8QyNdeYcMsATXB6gvYuOqc+VMMNfIePogB6cis3OvTfyPzZCO8dCFh/auHFaaWFof5umFPSHputKGBx8h6xL7RprGFJ1U14bbYR3q9osGopwHDkN0uaz79jdCWmryACiE3xVXZ+r9jPYm1jOyrScTqEC+K7RZb4jdyXEkzKd4gM06Roi46oVxkJu9RigL4/9l7duGCmTEDMDoGtyj1khPQNOicGijZSQJv0/EuBgxxXcszBqnDEUpx2BgGir9hr0SROj0yFcI+3ap3acL4yyd4BloXWc8nxAvI+jgZ8PtWB76ZWSjLWybMoCzMSW2tpERpl/fzGtWWHYahWHx26PWcghNUtWnf/moJnjTHJtG8B+ANJrdE62TQWaIu06e+oplNQcScMKhbzSO9eggZGQdc3wiXS5lsb+nbyIQV6Q+aTOmk9ZCfcH5V8oKdb9DWgVVDg7UiI2vLs/3DZMrIrXfFhktzcCGrRlLnqAEbfUR3/bMyXBpJRoHqmVT0JStVbjuztA3JfM0TGchEQf+YfrzsPTiipDMghH50bNEuhdWWQEZS62PND4t7fHaAZyVtFpMlOh3Us0tzfhzRXbDY6RIiFq5bepJK9QyltLTBxprHJ0JhIBMkjSoO2Vo6hGMzCHULBXk8bhNaPnjdA== 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(55016003)(86362001)(4326008)(6286002)(316002)(426003)(16526019)(82310400004)(8936002)(40460700003)(2906002)(36756003)(70206006)(8676002)(36860700001)(81166007)(356005)(6666004)(26005)(1076003)(336012)(110136005)(47076005)(2616005)(70586007)(7696005)(5660300002)(508600001)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2022 01:45:56.2702 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8f01e22-0253-4def-8d1f-08d9ed003f15 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: CO1NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4099 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 | 72 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 6 +++ 2 files changed, 78 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 7b56b1b..b977480 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -272,6 +272,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, @@ -1043,6 +1047,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, @@ -1234,6 +1239,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, @@ -3494,6 +3507,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_rsvd.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.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.sequence)), + }, [ITEM_GTP_PSC] = { .name = "gtp_psc", .help = "match GTP extension header with type 0x85", @@ -9252,6 +9297,33 @@ 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_rsvd.checksum) { + *total_size += + sizeof(opt->checksum_rsvd); + rte_memcpy(data_tail - (*total_size), + &opt->checksum_rsvd, + sizeof(opt->checksum_rsvd)); + } + if (opt->key.key) { + *total_size += sizeof(opt->key.key); + rte_memcpy(data_tail - (*total_size), + &opt->key.key, + sizeof(opt->key.key)); + } + if (opt->sequence.sequence) { + *total_size += sizeof(opt->sequence.sequence); + rte_memcpy(data_tail - (*total_size), + &opt->sequence.sequence, + sizeof(opt->sequence.sequence)); + } + } + 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 0551121..09cd1f4 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3715,6 +3715,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