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 62B85A0562; Wed, 14 Apr 2021 18:10:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 47F40161BA8; Wed, 14 Apr 2021 18:10:26 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2084.outbound.protection.outlook.com [40.107.223.84]) by mails.dpdk.org (Postfix) with ESMTP id 4864D4013F for ; Wed, 14 Apr 2021 18:10:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GbcVwcb0pV+02rmBFWbtNX1tieonbMJKpxr5Noiq9H6Dc0aMpComsCK5TjaJzSoDzwjrBjrlsh5RuQXpVd08fx5BKtSh8tkIUHqnOtiHj+I/37EBpAQRAQ24uz/h7uOj5NQF6Tga63NBbLJ6fnUT2mFhm7OkyJoCgdYqL6eFFAP5JivjtdFpkBW1md0HB1pYPpi2mtrQmvNv5g0NASbaM+4SvZ9Is16uU3Wx7Q3xzTHyRQvAm1hVjkFTEM5Jsz/FzcgC0+RGtaZVUgTsjO0h7up6dKKOt1dEz0IE+udX+4ESa7RE4vYzEjq7AHYCECskbAj0YXmazIPJIHwjFzyhBA== 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-SenderADCheck; bh=FvXz5NWI86nJTupERLesvQWZbUhq8jqlMlFptAMIJ0M=; b=alC+BzvexdtUQQ33EgpgFmEW4DDFcAOQ1WYTvEq9btsq3lju7Cz7hVlsSlvjXf++ZgHrzSANYWQCa0eVIXZwTLLtNgKchK9Wjhi8NQPlPBNHzrhAKjfilBaXOCCtXlg4nroxt29BWBhrxFA5J8Xnv+0uTYADi14gIdQUWElIHNXdnpb5QxXcmO3t7Nt4hZui2hI20IchUBnceIFkiqZ09YvPyQ7NUI5VlNuvfSzokOB/0AREp2h4USlQTPuaqcjdGdO2vg/WaCBPL2nXUVoRbf8y/6scFFZdzKbuZ06ieSNUML6GurYT4oC6OeIrhNFYa+i1/0LQpZct7U6G74O9WA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none 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=FvXz5NWI86nJTupERLesvQWZbUhq8jqlMlFptAMIJ0M=; b=rFWMXNLvDgJ5/Fzzun9lciI0t4sKn0cAzFILX3n48gpUVRb5ws/TLToELb2D75iNewr2o1GWBNqEZQ75PHyx3gKFIHUMN4fdIX5WsYL9MfkdsntbIJlaMgH4uvTWc2YB+SgsthX722VvXDSCDA/SnjH2ukn/6D1KWet+4Y/cSPSox87Q6eAFvKgAqw2iM8BCi/hBsm+RIgmrUo1HDSxwbRcnuuIouWZ3n8+KAqalia6WH4IiGDaLBWoQykSY7qFz+wTNotOj7zeHVDkR02bG7yG65Z9AaLcdKSr18btLiOHx6QjyTpVY+6iRlAejTYcmmLGBAFzF9WItdPKnHv373g== Received: from CO1PR15CA0092.namprd15.prod.outlook.com (2603:10b6:101:21::12) by CH0PR12MB5060.namprd12.prod.outlook.com (2603:10b6:610:e3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.20; Wed, 14 Apr 2021 16:10:23 +0000 Received: from CO1NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:101:21:cafe::62) by CO1PR15CA0092.outlook.office365.com (2603:10b6:101:21::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.16 via Frontend Transport; Wed, 14 Apr 2021 16:10:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by CO1NAM11FT010.mail.protection.outlook.com (10.13.175.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4042.16 via Frontend Transport; Wed, 14 Apr 2021 16:10:23 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Apr 2021 16:09:56 +0000 Received: from nvidia.com (172.20.145.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Apr 2021 16:09:53 +0000 From: Gregory Etelson To: CC: , , , , , , , , , , , , Xiaoyun Li Date: Wed, 14 Apr 2021 19:09:30 +0300 Message-ID: <20210414160930.14928-3-getelson@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210414160930.14928-1-getelson@nvidia.com> References: <20210414160930.14928-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1a51266-8dbb-4059-5f48-08d8ff5fcf27 X-MS-TrafficTypeDiagnostic: CH0PR12MB5060: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-Transport-Forked: True X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lwTtbB3+v5sAKDsqct8/QrcJHxacAjaxYaLiMW97ExCfuoLgouWPDMtEOo7b+S3tbm9O6YqKKrTxa0g4e44wco1zt9t2pZVl3GCMRz7kZua4Rd6Oq2YX0ttPz71tC4hgkcZkCRPPBXYWcJQZ8wZq/5IprkOcpVSh2TY7USIcg4jcm9uYsLkKE3qTZ4qMqQDJNhDfl304S7NdbV7u6yGv9iStgoaJXzcYGzS3Ok7/N+zNHnTKWyD1fIXjfEpcK4/agHx3Frm5oz2PMuRmFVtn0J/BJIldtuc3fIBFcxb7GxO3dwE89Ax9//GQ1eyKDCH3S7wha3pCU6/a2po4CiUPBXEkFRUH7pQMYbmEIAaOe/qL6Jl2GW8XOKirSMNZu4pXglqD93b9VBZOoFfCUUSrZ1oDApsW7GOGh2oVYmHdjlBDq09vU1lF4pnBiguKZDNLWYOSGCkopENjPiAM5lQ3SOoRjlqRTs8v03RBDzXghlFYya23Za8/12NnZx2ssZFgFLM7S1lP0z9Q6wfbm9pYWx0pUM0j2JRv3KgjY/YOLKwihW2HZ/FAsnHv95vVW0hKoOu7TuyZefXbcohNToZGj7a6hWJmst5d6deI0eMAy/ueymVyGsvo75UJhqVHBJJugno9Tutk4O7wMGiCQagABlK9a/W6K39eku6EByAC5IY= X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(376002)(346002)(136003)(396003)(36840700001)(46966006)(55016002)(6286002)(6666004)(36906005)(37006003)(316002)(54906003)(82310400003)(2906002)(36756003)(86362001)(83380400001)(7636003)(82740400003)(356005)(47076005)(1076003)(36860700001)(6636002)(8936002)(478600001)(2616005)(5660300002)(186003)(16526019)(336012)(426003)(6862004)(26005)(7696005)(4326008)(70206006)(8676002)(70586007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2021 16:10:23.4215 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1a51266-8dbb-4059-5f48-08d8ff5fcf27 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5060 Subject: [dpdk-dev] [PATCH v5 2/2] app/testpmd: add support for integrity item 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 Sender: "dev" From: Ori Kam The integrity item allows the application to match on the integrity of a packet. use example: match that packet integrity checks are ok. The checks depend on packet layers. For example ICMP packet will not check L4 level. flow create 0 ingress pattern integrity value mask 0x01 value spec 0x01 match that L4 packet is ok - check L2 & L3 & L4 layers: flow create 0 ingress pattern integrity value mask 0xfe value spec 0xfe Signed-off-by: Ori Kam Signed-off-by: Gregory Etelson --- app/test-pmd/cmdline_flow.c | 39 +++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 28 +++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index fb7a3a8bd3..b5dec34325 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -289,6 +289,9 @@ enum index { ITEM_GENEVE_OPT_TYPE, ITEM_GENEVE_OPT_LENGTH, ITEM_GENEVE_OPT_DATA, + ITEM_INTEGRITY, + ITEM_INTEGRITY_LEVEL, + ITEM_INTEGRITY_VALUE, /* Validate/create actions. */ ACTIONS, @@ -956,6 +959,7 @@ static const enum index next_item[] = { ITEM_PFCP, ITEM_ECPRI, ITEM_GENEVE_OPT, + ITEM_INTEGRITY, END_SET, ZERO, }; @@ -1307,6 +1311,19 @@ static const enum index item_geneve_opt[] = { ZERO, }; +static const enum index item_integrity[] = { + ITEM_INTEGRITY_LEVEL, + ITEM_INTEGRITY_VALUE, + ZERO, +}; + +static const enum index item_integrity_lv[] = { + ITEM_INTEGRITY_LEVEL, + ITEM_INTEGRITY_VALUE, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -3373,6 +3390,28 @@ static const struct token token_list[] = { (sizeof(struct rte_flow_item_geneve_opt), ITEM_GENEVE_OPT_DATA_SIZE)), }, + [ITEM_INTEGRITY] = { + .name = "integrity", + .help = "match packet integrity", + .priv = PRIV_ITEM(INTEGRITY, + sizeof(struct rte_flow_item_integrity)), + .next = NEXT(item_integrity), + .call = parse_vc, + }, + [ITEM_INTEGRITY_LEVEL] = { + .name = "level", + .help = "integrity level", + .next = NEXT(item_integrity_lv, NEXT_ENTRY(UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY(struct rte_flow_item_integrity, level)), + }, + [ITEM_INTEGRITY_VALUE] = { + .name = "value", + .help = "integrity value", + .next = NEXT(item_integrity_lv, NEXT_ENTRY(UNSIGNED), + item_param), + .args = ARGS(ARGS_ENTRY(struct rte_flow_item_integrity, value)), + }, /* Validate/create actions. */ [ACTIONS] = { .name = "actions", diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 36f0a328a5..58d4d712ab 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3783,6 +3783,13 @@ This section lists supported pattern items and their attributes, if any. - ``s_field {unsigned}``: S field. - ``seid {unsigned}``: session endpoint identifier. +- ``integrity``: match packet integrity. + + - ``level {unsigned}``: Packet encapsulation level the item should + apply to. See rte_flow_action_rss for details. + - ``value {unsigned}``: A bitmask that specify what packet elements + must be matched for integrity. + Actions list ^^^^^^^^^^^^ @@ -4917,6 +4924,27 @@ NVGRE encapsulation header and sent to port id 0. testpmd> flow create 0 ingress transfer pattern eth / end actions sample ratio 1 index 0 / port_id id 2 / end +Sample integrity rules +~~~~~~~~~~~~~~~~~~~~~~ + +Integrity rules can be created by the following commands: + +Integrity rule that forwards valid TCP packets to group 1. +TCP packet integrity is matched with the ``l4_ok`` bit 3. + +:: + + testpmd> flow create 0 ingress + pattern eth / ipv4 / tcp / integrity value mask 8 value spec 8 / end + actions jump group 1 / end + +Integrity rule that forwards invalid packets to application. +General packet integrity is matched with the ``packet_ok`` bit 0. + +:: + + testpmd> flow create 0 ingress pattern integrity value mask 1 value spec 0 / end actions queue index 0 / end + BPF Functions -------------- -- 2.25.1