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 81FD2A0C43; Thu, 23 Sep 2021 11:16:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 59A1441225; Thu, 23 Sep 2021 11:16:55 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2055.outbound.protection.outlook.com [40.107.94.55]) by mails.dpdk.org (Postfix) with ESMTP id D0822410DD for ; Thu, 23 Sep 2021 11:16:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HtaYfLRG11KFAofZLM/OF44KzL8PIPP4FwWCc1GYnF9nITrw8NDlZaLvSVKe1nLuvmgtJC5XIG3Wozs3v/8Er/eMKRkHkFm5H7DHheCWjjjeJbtcGscIcAb6CA73RZLg4YZtRY7yF6GK2WRBGAcWx/Z1GF4AZFm1Zg6ipAtIoBEgcTcwrqJDqy3Iv7/0OJWvrA4/WcQN54XP5tCag5QD46vQWXRzb0bgFcXPIhvNIjl9WIjYOk/2mdN6BBx9UEcBNR4Z0J0GTwVHyJndXTQ4/jt2e6/Jl2cG98PFd/K//NWzUABrQ4c61AWsawVN94QFWXtJ8vd1UVQIV50EAmEG9A== 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; bh=agH9VfOF99ozGi52qACRGRCGH//oEhNdUI+JVOKQjws=; b=FIOJHFFl9dU9yK+YAK/uL/6+5OBBp2rFbxTlaspirhg7EsJfVSGeuSqzealG/x8hPqhbFi5a6sNV6u/JF9BNB3ZeGPmr7Z4fo9rolA1uTM2RNi3v+HKQiggdTaeJKGZoM27XYbVt6TD8HUyVSWoHuNOoj/w+XtbpN4qew7nVN/f6yy4Z5jHz+BGG2gJJ94Cu3ZJW5FM+0y551iKLw0AHAFjd4zm+YOoPNVdjfhj3EAOUBr5HODZOVsP9m+XUSyac7JZQihBSPOHH/HdVozJc2xibYpuTuJnZk5mswq938aNQxg6aIToSMHj+A2rNKBVRTJUSOZf1s2Oi6/1bcdNU8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=agH9VfOF99ozGi52qACRGRCGH//oEhNdUI+JVOKQjws=; b=K++n+QlXS99Dab39CNg1BLh/V0+3crg7BFM3gFsiTOQYp5kLMg7tmiAC0Hx8jppy02ARQS7az5Rt9eCMWBHlaRQEk/0cKvqSOuQe/vamqgvn42b/11rjUEtEesoa8Rpm3p84NLRluD7dy6OTOBEN70aHDtNsnN3f/fWKBZ1G0aFpSyxVMlXWEGeKv6IMAPFpku7IXhZmM0kjEhhE/hm5Paa6DfZf5lq0qaxoXORx00PTwgr8/Bs4Is1drX6H3TTfGz9SoDec9CScWvmzkuKYLSDCyrYdcC7Jz2Lfp/nqu2eoJP3xrVtgRziEov1zg65ePXrCXA6RCseXBgAYrDTpzg== Received: from BN6PR1201MB0227.namprd12.prod.outlook.com (2603:10b6:405:4e::7) by BN8PR12MB2916.namprd12.prod.outlook.com (2603:10b6:408:6a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Thu, 23 Sep 2021 09:16:51 +0000 Received: from BN6PR1201MB0227.namprd12.prod.outlook.com ([fe80::e98f:7bd:1d91:3e9c]) by BN6PR1201MB0227.namprd12.prod.outlook.com ([fe80::e98f:7bd:1d91:3e9c%5]) with mapi id 15.20.4523.019; Thu, 23 Sep 2021 09:16:50 +0000 From: Gregory Etelson To: "dev@dpdk.org" , NBU-Contact-Thomas Monjalon , Andrew Rybchenko , Xiaoyun Li , Dmitry Kozlyuk CC: Asaf Penso , Matan Azrad , Slava Ovsiienko , Raslan Darawsheh , Ori Kam Thread-Topic: app/testpmd: [RFC] Create flex item object Thread-Index: AdewWmVnmwRj2TlLQju6N/QEjDwA/A== Date: Thu, 23 Sep 2021 09:16:50 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a4b36239-b6a9-4833-4146-08d97e72e097 x-ms-traffictypediagnostic: BN8PR12MB2916: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2nT1oOjGtsAeyz0VR29nDPsRofslSuLG3862C98LCwnFR71JVWUAbKKGMwT7m7hQv3YTsSsXrZXllsqG49yP6Lc7vlVgXSDNvy99IRmm+98vWfVSZX8U7Y8s4+N795t++cmK25oHLum5chTueM8HH4ul6LNprCE2qflkO6UJrCO5QODc/lsPR/y/gDbz1QzaNs94eLidyqhRpPbfzeYEP27aI4ePZV/BOAG9TXShp5iNECz11QQV4O5NdEDcMiI1lOXlqJOL7g1yX9jUypiML4TfTFl1JNEWTzGiYVhaiVBA8UERVFapCwZkkY6bLBWiDXwUQTwOwuEW1Zh0FOJtnLbVU9gtEZACb6pMH/URTuKtANlOY4Xg4hTCR55Hg8zfBV3/zem1obaR3UtkQPlNMIr4xemcC6m7RwyXLyh27bciqOKnkwmQ2zJ2R93TqYBXqCucK1E74piNfHLdfI9EgmmutNtl3vFCCj/bn99yibWwzm6lnOod+9tX8cGfcgLoZAP6mklDy1xO1HiWohEeAel/MFbDWCfDLASMzNJUzEMnERgpBbnq8pnJ+/EmNFpllIXFcS12GjbAg3ZgNVqeJniosoW29PHm9MpBOjI8sbxO6KRS1ic/QI4FGJGvf71kcl4tbYqA5k4uU+vB5kT32ij3XwUgyMTepHRbHw9bL3ZcMJuydNY61XmfgZqJshcccmHMQiTSWKpBlacNsRVcKm81dt6PA7ITuVdsKAJPn4SqflzyyvoYNt9YvT2lT0Mzf2elW03SFtTg8p/zaIzhoMu3ASoW3pAa+AYsii08r30= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN6PR1201MB0227.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6636002)(86362001)(33656002)(54906003)(110136005)(9686003)(55016002)(38070700005)(8936002)(7696005)(2906002)(966005)(66946007)(8676002)(6506007)(122000001)(83380400001)(26005)(76116006)(71200400001)(38100700002)(5660300002)(508600001)(4326008)(186003)(66476007)(107886003)(64756008)(66446008)(52536014)(66556008)(166002)(316002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?P01JjUN/HcrkZTXFULLtdR9fUG5ixURjJIEi2lLuwronuYF26YvwYjpiGrtN?= =?us-ascii?Q?aMrb1CFd/pxQVkKqk01pzhKdJ4JOwRh4noJ1vd4DcOxB2PLyMt5VgHEqh4yX?= =?us-ascii?Q?rVaEkPzM8BACJzhl2FLqlTbLhWPGl9jBmUHni4XYQ67sxmbCl03Z7EFmLj4+?= =?us-ascii?Q?6zeJU21aQxPHJcjGGe0dXSf0PA06JeTxQFuQjb6sk9pT0pmmyQYJzjqi3vhN?= =?us-ascii?Q?qy8agyMDLgTTGQlqS7oO5XebvXJ8MXSPQ7IuB4QDNZ6Rpi2jBQlfz52XBsE5?= =?us-ascii?Q?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zd636l5ZpfbeG?= =?us-ascii?Q?ccJqSqjRBj6UC+1wQTDGb4lEUQqUXB0llrulqx4Zh4n0/09COYBbLSYVJoTS?= =?us-ascii?Q?zIc3aVRwkbvCGmMJP05tXOfrnCKSIg72z1nTzWzQmX57qRgUNwVczZsz4g7H?= =?us-ascii?Q?2q5znrkyM3j+B08GkexCAUi7?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN6PR1201MB0227.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4b36239-b6a9-4833-4146-08d97e72e097 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Sep 2021 09:16:50.7117 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ZiMMUkenMsB1Xx3Yk9x14VyPwh1ic0LRLYRpVnrmGfDlvRBrM83ZtkOWFaEXQRxwmwv4IxC+GokS4Kkv0XOLqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2916 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] app/testpmd: [RFC] Create flex item object 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" app/testpmd: [RFC] Create flex item object RTE flex item infrastructure allows application to create a parser for custom network header in port hardware and offload flow rules to match the custom protocol elements. RTE flex item API was introduced in https://patchwork.dpdk.org/project/dpdk/patch/20210806085624.16497-1-viache= slavo@nvidia.com/ Application must create RTE flex item object before it can offload flow rules to match custom header elements. RTE flex item object references custom hardware parser. Custom flex parser object is built according to configuration that describes the custom header. Flex item configuration building blocks are: - New header length, fixed or variable, depending on the protocol. - Network headers that precede and follow the new header and transition conditions. - Offset and size of header samples that can be referenced in flex flow item for match. Testpmd could create a new flex item object in several ways. The following examples will use fixed size IPv4 header. 1. External configuration file. Flex item configuration is stored in external data file in JSON format. Testpmd flex item `create` and `modify` commands read the configuration file into JSON object, parse the object and assign configuration structure members according to parsing results. Assumed, that the test application will not modify file data. Different data file will be used to modify existing flex item. Example: Configuration: { "next_header": { "field_mode": "FIELD_MODE_FIXED", "field_size": 20}, "next_protocol": {"field_size": 8, "field_base": 72}, "sample_data": [ { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 0}, { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 32}= , { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 64}= , { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 96} ], "input_link": [ {"item": "eth type is 0x0800"}, {"item": "vlan inner_type is 0x0800"} ], "output_link": [ {"item": "udp", "next": 17}, {"item": "tcp", "next": 6}, {"item": "icmp", "next": 1} ] } testpmd> flow flex_item create testpmd> flow flex_item {modify|destroy} Flex item ID is selected and maintained by testpmd operator, like TOKEN in raw_decap/raw_encap commands. Pros: - One configuration file can be used by different ports to create flex items. - Single CLI command creates flex item. - JSON input file format can be parsed with existing jansson library. Cons: - Flex item configuration is in external file. 2. CLI commands with JSON data. General testpmd flex command syntax is: testpmd> flow flex_item [optional args] - port index to operate on - flex_item index to operate on (per port, the same index on diff ports means diff objects). Flex ID index is selected and maintained by testpmd operator, like TOKEN in raw_decap/raw_encap commands. init - resets the configuration that will be used to create/update the object create - creates the flex_item object on specified port with specified config modify - updates the flex_item object on specified port with specified config release - destroys the flex_item object on port field - adds field desc to conf link - adds link desc to conf Optional arguments describe flex field or link parameters in JSON format. JSON format was selected to restrict flex item tokens parsing to flex module only. Example: testpmd> flow flex_item init testpmd> flow flex_item field {"next_header": { "field_= mode": "FIELD_MODE_FIXED", "field_size": 20}} testpmd> flow flex_item field {"next_protocol": {"field= _size": 8, "field_base": 72}} testpmd> flow flex_item field {"index":0, "sample_data"= : { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 0 }} testpmd> flow flex_item field {"index":1, "sample_data"= : { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 32 }} testpmd> flow flex_item field {"index":2, "sample_data"= : { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 64 }} testpmd> flow flex_item field {"index":3, "sample_data"= : { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 96 }} testpmd> flow flex_item link {"index":0, "input_link": = {"item": "eth type is 0x0800" }} testpmd> flow flex_item link {"index":1, "input_link": = {"item": "vlan inner_type is 0x0800" }} testpmd> flow flex_item link {"index":0, "output_link":= {"item": "udp", "next": 17 }} testpmd> flow flex_item link {"index":1, "output_link":= {"item": "tcp", "next": 6 }} testpmd> flow flex_item link {"index":2, "output_link":= {"item": "icmp", "next": 1 }} testpmd> flow flex_item create Pros: - No external configuration file. - Flex data in JSON format does not add multiple tokens to global token_list array. Cons: - Multiple CLI commands to create flex item. - Commands must be repeated for each port. - Index key added to sample and link arrays. - No completion for JSON data. 3. CLI commands, no JSON This method works with built-in DPDK cmdline parser. Example: testpmd> set flex_field 0 field_mode FIELD_MODE_FIXED field_size 20 testpmd> set flex_field 1 field_size 8 field_base 72 testpmd> set flex_field 2 index 0 field_mode FIELD_MODE_FIXED field_size 32= field_base 0 testpmd> set flex_field 3 index 1 field_mode FIELD_MODE_FIXED field_size 32= field_base 32 testpmd> set flex_field 4 index 2 field_mode FIELD_MODE_FIXED field_size 32= field_base 64 testpmd> set flex_field 5 index 3 field_mode FIELD_MODE_FIXED field_size 32= field_base 96 testpmd> set flex_link 0 index 0 item "eth type is 0x0800" testpmd> set flex_link 1 index 1 item "eth type is 0x0800" testpmd> set flex_link 2 index 0 item "udp" next 17 testpmd> set flex_link 3 index 1 item "tcp" next 6 testpmd> set flex_link 3 index 1 item "icmp" next 1 testpmd> flow flex_item init testpmd> flow flex_item add field 0 testpmd> flow flex_item add field 1 testpmd> flow flex_item add sample 2 testpmd> flow flex_item add sample 3 testpmd> flow flex_item add sample 4 testpmd> flow flex_item add sample 5 testpmd> flow flex_item add link in 0 testpmd> flow flex_item add link in 1 testpmd> flow flex_item add link out 2 testpmd> flow flex_item add link out 3 testpmd> flow flex_item add link out 4 testpmd> flow flex_item create Pros: - cmdline parser only. - Full command completion. Cons: - Even more CLI commands. - `flow flex_item` commands must be repeated for each port. - Multiple tokens required to maintain this structure. - Multiple indirect index usage can lead to mistakes. Method number 1 - External configuration file, requires less resources and is preferable for implementation. Testpmd can utilize additional patch to split flex item commands into multiple lines. Signed-off-by: Gregory Etelson getelson@nvidia.com