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 C93AA42C9D; Tue, 13 Jun 2023 05:48:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 97EB540C35; Tue, 13 Jun 2023 05:48:38 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 6B1F040A8A; Tue, 13 Jun 2023 05:48:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686628116; x=1718164116; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=7M1cfQgW2gA2CesHv4BEXJ8hq46VJya64Jawu0DgRhE=; b=BAcgUsaogiBDHUg+8NmE8r2nuTcUZ+ZXBZAN6iPnhWJdBTNqBSNmBdCV rSpwPcdbzS2AjiAJoB3NJVVyPW0zZwPDx2NwoFbnTUOeb6Y3578sHGXNQ e1v583hoKhBQ6/ZeAoBGnxnXwj51B21ujNMTT0BZzQPgE2M/hQ2y/+vZw FeDqEe8C0HYT1vJW+K6jmv6ehPecFiG+nRdXdcfDVFOTG4+Yog6BTCyZK 4KYiAqJ7Mm7XtYtfCTOpE/JgiIjRGI5eehInH9pyyrd8cUA8T5Sp6MrVL 7+U11EyJVvtIKoMn33+05oggLtX7bX8d/WPHu1E0oAWPh13yfzpi4V3hv g==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="386613726" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="386613726" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 20:48:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="835723574" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="835723574" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga004.jf.intel.com with ESMTP; 12 Jun 2023 20:48:27 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 12 Jun 2023 20:48:27 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 12 Jun 2023 20:48:27 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Mon, 12 Jun 2023 20:48:27 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.173) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Mon, 12 Jun 2023 20:48:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tw/wAsVX3htiXHUhwtLn/jPeKuPndmKhdEnArxEJlpttLPTlrmaJ1PHmBkV9cXcPiqnChFL8oazWMAYV7EAbLcXYmxbJGEBa1GIIvFMOBnwWmdYVVPJDFBAx390ZSBZutca326fHX/1qa4YFwmcU9boVFtyhw8cHHGlgbYO298qe9i0a3uCiB/ykOyK9PxPdQsME2vBMRZZ+VI70ciTblqKhvPFC7lkX2ykcvKRP86g3D8Rjzyrw0nanmNGEP0t7T6r/tGKCKqW7F0E2TmPe1K9WAWrgVbCbspr8Kr3RwGwSEnVMwAP05Bwt6Iv+gT7wzqkHmvvxc7kJ80OgprASAw== 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=QHx5fG6hQ9aWQdwaAqYxY2qXTV5mIE622QVtwIfgwCc=; b=GILq8gv4uMs+xDCx1+qD5lC+l3J/iCiwI2u8ZOPhu2ZdBFs6sSvVkJxvn6NwT7Gu5knWtftyD8edj5mYcOQBZkeWOQoypI13EMqpXPUxrEfULrJjrLMWICq2cnxjJLxxNAC49OXOfD9ndQyKL2fWwRlTs/8SYjB6dy7+/SdFDWJNcwhdKr/C0ufs5yvx9Bk6YEnjJkvekEudZveGW4LzeX2a2pptQMziXYErACTawcBvTJz+VBtD6F29I37KaSDwzx5rvYygN1Zs1tr/Asv7tyhmTlyeU5bphydMehUX8cZejh9eB5Fra9mRwfuXPVLAifre2tHnKxuooqKZxxo1Yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM4PR11MB5994.namprd11.prod.outlook.com (2603:10b6:8:5d::20) by DS0PR11MB8163.namprd11.prod.outlook.com (2603:10b6:8:165::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 13 Jun 2023 03:48:23 +0000 Received: from DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::e570:d9a7:df1b:1589]) by DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::e570:d9a7:df1b:1589%6]) with mapi id 15.20.6455.030; Tue, 13 Jun 2023 03:48:23 +0000 From: "Zhang, Qi Z" To: Ivan Malov CC: "thomas@monjalon.net" , "orika@nvidia.com" , "david.marchand@redhat.com" , "Richardson, Bruce" , "jerinj@marvell.com" , "ferruh.yigit@amd.com" , "Mcnamara, John" , "Zhang, Helin" , "techboard@dpdk.org" , "dev@dpdk.org" Subject: RE: [RFC] lib/ethdev: introduce table driven APIs Thread-Topic: [RFC] lib/ethdev: introduce table driven APIs Thread-Index: AQHZnNl/YukvwyUJXUylZdiSr9fMFq+HTIIAgAC0zHA= Date: Tue, 13 Jun 2023 03:48:23 +0000 Message-ID: References: <20230612111539.462084-1-qi.z.zhang@intel.com> <3b4c548-bf1f-ad57-6587-ad2b427d08e@arknetworks.am> In-Reply-To: <3b4c548-bf1f-ad57-6587-ad2b427d08e@arknetworks.am> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR11MB5994:EE_|DS0PR11MB8163:EE_ x-ms-office365-filtering-correlation-id: 916a9c9e-6cdf-435d-bc0d-08db6bc10965 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NF2t6TqRZVBCUqpvCP30rtOgNmlo0Gt1AfF+fBi4cPBYdi2LZq/1ub1J5briXWcwKg+e/vG0O7dsojto2yUw7/u83fljFtyUtxVFAoJwDn2Oce0N6VAnPngPjxNat70vpsRrAx/ePWpaqRCboa9DlBjr1NUht99WpBO30vGRyIP1AOPPgsPxJmY57uDXmXnI7U2jLLTUCheERtg2Gw6KJ3SfyzUj9D/0gUgfi86U3SjtYyrR7y4R6A8g7lMiI19hpRszCWU4WGPnZFXHIwYX7uyphVTbDzCF4WlfTAbgDeUN2oKZjRHnnLX7rkMv4PBcuNMAZLja+bqipSlADCCwYG1f1/lKy1fnuDj+dYun+P8ddSRBy/tYSKgEPfiNGTxt9KTqFPAIbJcnJuko+NTwrZ357vu4mlwPa65l7X5lYMiCgoHIgpsk8awpm6cmq6RqiE98zl/1ZMOKqOnjWQOHMQ65lK5FURHbbdVNdnM0NOemv0CBSMODKBrTc2PMY51goZ9spUYEI6t3XMbJuQlSD4Gv+XMk95uX7Egi+YGji0uVJgWdYgb8M3fHMnDcUsHG6NkDup+3sdFedKXs9Vg2KXbdzTRmk9K3y+y3scLG9dFJZk0cckX69H6wtURzBoQuLhjUAUeOWtgSXP0O1JDWUg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5994.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(376002)(39860400002)(136003)(396003)(451199021)(26005)(55016003)(9686003)(52536014)(41300700001)(6506007)(5660300002)(186003)(53546011)(7696005)(38070700005)(33656002)(64756008)(66476007)(66446008)(83380400001)(76116006)(66946007)(8936002)(71200400001)(4326008)(478600001)(8676002)(66556008)(966005)(54906003)(316002)(86362001)(122000001)(2906002)(30864003)(6916009)(38100700002)(82960400001)(579004)(559001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?1i0BDvYN2yw6RuPi1djbKdd2SWPRIxsdUte4gCBhXQSxAi8MTzXxGzTo/TfH?= =?us-ascii?Q?jkHeWrZ7xofgrp4IixzZBBbBXKEyMjDqKzcqfNzGJt4pd6DHI/lhJzc46Iyu?= =?us-ascii?Q?p3eAyeuynVfDr/Xi3IPBkrjuKZcCUqI6MTUbXJoY7EAW+NEM8SDCINx++hTa?= =?us-ascii?Q?qIohPRKm9NKGF/l57ZbW8+xNE/XaC9D5OepcORDGLvxWFsZHO66C4GPCZaYy?= =?us-ascii?Q?QEvD2s/LIHdlYlgWyRBJdogcEhIEBz9OcfFjZ5QqwdHLJ96HaQLgB/cxpRz1?= =?us-ascii?Q?O84Vg1wXwDwXnqCnWd58xg7KOY8VC4GGHXcrW9cra+9T+ZlaL50jXjdfuCNK?= =?us-ascii?Q?9jvoJIeYX2xDMR9q8waWwGdFo2uGbPccjvjRA1joFfxB/0aTfdWtRkob7JMg?= =?us-ascii?Q?0M+oxPq/GTT40XQKh8YNriahSUm49SlvSkBvw8eqRrrc5YjDq+0wM3fDWI/f?= =?us-ascii?Q?cd+UKzAmwltqzLXaFMT5dFjZWJN0pYTCUESTWC3PS5QPU7buRQY83Vc6FwAB?= =?us-ascii?Q?VxcpxQKP4uNLtp+f+2yg0J1+4uFGjPuGtwyM/ZN/FTMkR+drZqNiXNwQkwoz?= =?us-ascii?Q?p52gR3Be9371bFVnLbKpiC3bjJLoWeGj/27U59clQTKtQVJVTfOhcR+C/4qL?= =?us-ascii?Q?eq4bvQHSL4EHz/UQ7DWgA00iq0ShWpMMvF1fzR+/2BW5f/lMg8jZbM1q1vvF?= =?us-ascii?Q?JhrVmbBO2yEzdFbyaXY4tnLhtG33zWaAZDKZ07UzqRsNU/Azp9VNE8fNksKy?= =?us-ascii?Q?nB9Rs9sTT74QFhgCPXvcwEPf8QgDlypJj41S5CFrcKpWA7XQ7GXRXgFNKSOi?= =?us-ascii?Q?+9nz8RKP2RlgIIt1gUuoLO1fiIjmPsnUmfc3jhGeY3ZXEgD0Yv5FN8LfjHfa?= =?us-ascii?Q?Hq16QqC+VB1mHA0vj/ajYPTWNduKwBXnuIklzR17Bb03pdQHFqs1Uet21ZH7?= =?us-ascii?Q?J4YjSaY/wmVj2l8vO423drwONwVNQbrilK3mGLHUq2slIVOBZY3x4IGC9hQf?= =?us-ascii?Q?F4gqCFQw3oO5+VclAv3ZhaPY7w4y8glndpd1lchLLfW3a0STUm5X+aDnkTU9?= =?us-ascii?Q?ilUYwlTKJFrOqrXU1AE2AdR74mXRqTxtDMUpMdxtTWreS7EnE6f9xeGChWqv?= =?us-ascii?Q?fgddVrY/bfJHQD9ntFknWqYH/dR/VxjKE1S0/cDPo1cTJDwB+R1nfRuergZX?= =?us-ascii?Q?hI8rF1pjIAgrzaXfD84n6tRU4w90qnxJujZs8fIhLkPTWI74atWcwFpjzChk?= =?us-ascii?Q?s1KcHty+deubdjteRQVAd9cipwhFIdlELsneiG3hKjXRQdoFFUzota0ZGkVD?= =?us-ascii?Q?Fb6b8g6xT6loJvz5osT/qQj/ha9FHo7wRkycmFWExxwSnHzcdT5K6OGg8Bq5?= =?us-ascii?Q?wjnAv4icsim/QD+VvVVyCbmHZaEQG4eUrAJUGLJ6z2B2BmqF4wjkWzZLvieS?= =?us-ascii?Q?BmqsEzTlHidZASOVMSVgF+s1tNYSVhWitGMYszK5buCHuZumin3MK0XgILAH?= =?us-ascii?Q?RMOCkFGXdOEXknWmmPa0bwMRIZcwgz9SN/BYi81LTfD24WYPLS+Pk89PkZED?= =?us-ascii?Q?2HzVQRKsPZQdQ+2ZbnbGOyuEhyOVivz13KxCogRo?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5994.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 916a9c9e-6cdf-435d-bc0d-08db6bc10965 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2023 03:48:23.3401 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: y56Wr77x0yQXZ4VrXjFlZ6puQsugDDBK2uxJbYA75PBEA7DtjUIdq74do4+Rn+u+vQ9Z0BAV5rYUy+zyjcS+CA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB8163 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Ivan Malov > Sent: Monday, June 12, 2023 11:33 PM > To: Zhang, Qi Z > Cc: thomas@monjalon.net; orika@nvidia.com; david.marchand@redhat.com; > Richardson, Bruce ; jerinj@marvell.com; > ferruh.yigit@amd.com; Mcnamara, John ; > Zhang, Helin ; techboard@dpdk.org; dev@dpdk.org > Subject: Re: [RFC] lib/ethdev: introduce table driven APIs >=20 > Hi, >=20 > Thanks for sending the RFC. Sounds interesting. >=20 > My impression is that this API is rather low-level, so the question is ho= w > does the application find a vendor-neutral approach to discover and use > specific table to do some job? >=20 > For example, the application needs to do some tunnel match and > decapsulation. It invokes rte_flow_table_list_get and > rte_flow_table_info_get. Say, there're four different tables. How does th= e > application know which of the tables fits the purpose of tunnel match / > decap? > Especially in the case when different tables have overlapping match field= s / > actions. >=20 > Does the application have to expect some common names for the same- > purpose tables across different vendors/PMDs? >=20 > I'm asking because I'm trying to figure out how major flow-based > applications are expected to use the new API in a generic, vendor-neutral > manner. >=20 > Also, now you mention the pipeline approach, it appears that the > application may want to do some match/actions in one table, then send the > matched packet to another one, using a jump action of sorts. But sometime= s > such jumps are confined to specific paths. For example, there are tables = A, B, > C and D, and the NIC only allows transitions A -> C -> D or A -> D. >=20 > So my question is how does the proposed API expose such constraints on > packet transitions between various tables? >=20 > Thank you. Thank you for your review! The table-driven APIs are specifically designed for hardware with a program= mable pipeline. In certain cases, hardware vendors only provide the device, SDK, or toolcha= in to users.. As a result, users, such as network service vendors, utilize = P4 or other languages to design and build their own pipelines, which are th= en loaded onto the hardware. Typically, the compiler generates all the necessary table keys and action h= ints to assist users in building a control plane application. So, essentially, we can assume that users have a comprehensive understandin= g of the pipeline details and possess the necessary knowledge to construct = applications capable of manipulating the tables The missing component is a driver that acts as a bridge between the control= plane application and the hardware. The table-driven API fills this gap sp= ecifically for the case when DPDK is selected as the driver. Actually, the driver has no knowledge of the specific network usage or deta= ils, . It simply translates the table keys and actions into the appropriate= hardware configurations, which are also provided as hints by the compiler. Regarding your concern about the "vendor-neutral approach," utilizing a sta= ndardized programming language like P4 enables users to develop application= s that are independent of the underlying hardware, that means if two hardwa= re both support p4, and be deployed with same pipeline configure, the appli= cation consuming the table-driven API should work seamlessly on both platfo= rms without requiring any modifications. Furthermore, one of purpose of the learning API is to assist user applicati= ons in negotiating with the hardware. Its purpose is to ensure that the exp= ected pipeline is loaded onto the hardware. Thanks Qi >=20 > On Mon, 12 Jun 2023, Qi Zhang wrote: >=20 > > The patch addresses the problem statement [1] by introducing a set of > > "Table-Driven" APIs in rte_flow. > > > > This approach is inspired by p4land/tdi [2] and is particularly > > beneficial for P4 programmable network controller drivers. > > It provides the following advantages: > > > > * Easy integration of DPDK as a P4 runtime [3] backend. > > * Reduced effort for PMDs to enable flow offloading when the packet > > processing unit is abstracted as a pipeline of match/action tables in > > low-level drivers. > > > > The new APIs can be categoried into 5 types > > > > 1. Learning APIs > > > > Retrieve information about attributes supported by each table > > and action specification in the current pipeline. > > > > rte_flow_table_list_get > > rte_flow_table_info_get > > rte_flow_table_info_get_by_name > > rte_flow_table_key_field_info_get > > rte_flow_table_key_field_info_get_by_name > > rte_flow_action_spec_list_group > > rte_flow_action_spec_info_get > > rte_flow_action_spec_info_get_by_name > > rte_flow_action_spec_field_info_get_by_name > > > > 2. Key / Action Object Management API: > > > > Create, destroy, and clone key and action objects. > > > > rte_flow_table_key_create > > rte_flow_table_key_destroy > > rte_flow_table_key_clone > > rte_flow_table_key_field_set > > rte_flow_table_key_field_set_by_name > > rte_flow_table_key_field_set_with_mask > > rte_flow_table_key_field_set_with_mask_by_name > > rte_flow_table_key_field_set_with_range > > rte_flow_table_key_field_set_with_range_by_name > > rte_flow_table_key_field_set_with_prefix_ > > rte_flow_table_key_field_set_with_prefix_by_name > > > > rte_flow_table_action_create > > rte_flow_table_action_destroy > > rte_flow_table_action_clone > > rte_flow_table_action_field_get > > rte_flow_table_action_field_set > > rte_flow_table_action_field_set_by_name > > > > 3. Table Entry Update Synchronized APIs: > > > > Enable synchronized table updates, ensuring the updates are > > run-to-completion. > > > > rte_flow_table_entry_add > > rte_flow_table_entry_query > > rte_flow_table_entry_del > > rte_flow_table_entry_count_query > > rte_flow_table_default_action_set > > rte_flow_table_default_action_cancel > > > > 4. Table Entry Update Asynchronized APIs > > > > Provide asynchronous table update mode using a > > prepare/commit/pull pattern. > > > > rte_flow_table_entry_add_prepare > > rte_flow_table_entry_del_prepare > > rte_flow_table_update_status_commit > > rte_flow_table_update_status_pull > > > > 5. DPDK to PNA Interpretation APIs > > > > Facilitate APIs that map the DPDK context to the P4 Portable > > NIC Architecture (PNA) context, enabling interoperability between > > DPDK and PNA applications > > > > rte_flow_pna_port_get > > rte_flow_pna_rx_queue_get > > rte_flow_pna_tx_queue_get > > > > Follow the example in Problem Statement [1], to create a rule for > > table decap_vxlan_tcp_table with action decap_vxlan_fwd, we can use > > the following code. > > > > Code Snippet: > > > > /* Get the table info */ > > struct rte_flow_table_info tbl_info; > > rte_flow_table_info_get_by_name(port_id, "decap_vxlan_tcp_table", > > &tbl_info); > > > > /* Create the key */ > > struct rte_flow_table_key *key; > > rte_flow_table_key_create(port_id, tbl_info->id, &key); > > > > /* Set the key fields */ > > rte_flow_table_key_field_set_by_name(port_id, key, "wire_port", > > &wire_port, 2); rte_flow_table_key_field_set_by_name(port_id, key, > > "tun_ip_src", &tun_ip_src, 4); > > rte_flow_table_key_field_set_by_name(port_id, key, "tun_ip_dst", > > &tun_ip_dst, 4); rte_flow_table_key_field_set_by_name(port_id, key, > > "vni", &vni, 3); rte_flow_table_key_field_set_by_name(port_id, key, > > "ipv4_src", &ipv4_src, 4); > > rte_flow_table_key_field_set_by_name(port_id, key, "ipv4_dst", > > &ipv4_dst, 4); rte_flow_table_key_field_set_by_name(port_id, key, > > "src_port", &src_port, 2); > > rte_flow_table_key_field_set_by_name(port_id, key, "dst_port", > > &dst_port, 2); > > > > /* Get the action spec info */ > > struct rte_flow_action_spec_info as_info; > > rte_flow_action_spec_info_get_by_name(port_id, "decap_vxlan_fwd", > > &as_info); > > > > /* Create the action */ > > struct rte_flow_table_action *action; > > rte_flow_table_action_create(port_id, as_info->id, &action); > > > > /* Set the action fields */ > > rte_flow_table_action_field_set_by_name(port_id, action, "mod_id", > > &mod_id, 3); rte_flow_table_action_field_set_by_name(port_id, action, > > "port_id", &target_port_id, 2); > > > > /* Add the entry */ > > rte_flow_table_entry_add(port_id, tbl_info->id, key, action); > > > > /* destroy key and action */ > > rte_flow_table_action_destroy(port_id, action); > > rte_flow_table_key_destroy(port_id, key); > > > > ... > > > > Below code demonstrates how to use the prepare/commit/pull for high > > performance table entry updates. > > > > Code Snipped: > > > > struct rte_flow_table_key *keys[BATCH_SIZE]; struct > > rte_flow_table_action *actions[BATCH_SIZE]; struct > > rte_flow_table_update_status stats[BATCH_SIZE]; > > > > /* Create Keys and Actions */ > > for (i =3D 0; i < BATCH_SIZE; i++) { > > rte_flow_table_key_create(port_id, table_id, &keys[i]); > > /* set key field */ > > rte_flow_table_key_field_set(...) > > > > rte_flow_table_action_create(port_id, table_id, spec_id, &actions[i]= ); > > /* set action field */ > > rte_flow_table_action_field_set(...) > > } > > > > /* program loop */ > > While (condition =3D true) { > > > > /* Prepare entry adding */ > > for (i =3D 0; i < BATCH_SIZE; i++) { > > struct rte_flow_table_key *key =3D keys[i]; > > struct rte_flow_table_action *action =3D actions[i]; > > > > rte_flow_table_entry_add_prepare(port_id, TABLE_ID, key, action)= ; > > } > > > > /* Commit to hardware */ > > rte_flow_table_update_commit(port_id); > > > > /* pull status */ > > int count =3D 0; > > while (count < BATCH_SIZE) { > > count +=3D rte_flow_table_update_status_pull(port_id, stats, > BATCH_SIZE, NULL); > > } > > > > /* reused Key and Action object */ > > for (i =3D 0; i< BATCH_SIZE; i++) { > > struct rte_flow_table_key *key =3D stats[i].key; > > struct rte_flow_table_action *action =3D stats[i].action; > > > > rte_flow_table_key_field_set(...); > > rte_flow_table_action_field_set(...) > > } > > } > > > > ... > > > > NOTE: For simplicity, error check and the rte_flow_error parameter for > > each API has been omitted: > > > > [1]. http://mails.dpdk.org/archives/dev/2023-May/267719.html > > [2]. https://github.com/p4lang/tdi/ > > [3]. https://p4.org/p4-spec/p4runtime/main/P4Runtime-Spec.html > > > > Signed-off-by: Qi Zhang > > --- > > lib/ethdev/rte_flow_table.h | 1261 > +++++++++++++++++++++++++++++++++++ > > 1 file changed, 1261 insertions(+) > > create mode 100644 lib/ethdev/rte_flow_table.h > > > > diff --git a/lib/ethdev/rte_flow_table.h b/lib/ethdev/rte_flow_table.h > > new file mode 100644 index 0000000000..31edf57a0f > > --- /dev/null > > +++ b/lib/ethdev/rte_flow_table.h > > @@ -0,0 +1,1261 @@ > > +/* SPDX-License-Identifier: BSD-3-Clause > > + * Copyright 2023 Intel Corporation. > > + */ > > + > > +#ifndef RTE_FLOW_TABLE_H_ > > +#define RTE_FLOW_TABLE_H_ > > + > > +#include > > +#include > > + > > +/** > > + * Max number of key field in a table. > > + */ > > +#define RTE_FLOW_TABLE_KEY_FIELD_NUM_MAX 256 > > +/** > > + * Max number of action spec in a table. > > + */ > > +#define RTE_FLOW_TABLE_ACTION_SPEC_NUM_MAX 64 > > +/** > > + * Max number of field in an action spec. > > + */ > > +#define RTE_FLOW_ACTION_SPEC_FIELD_NUM_MAX 16 > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Table key match type. > > + * > > + * To specify the key match type of a table. > > + */ > > +enum rte_flow_table_key_match_type { > > + RTE_FLOW_TABLE_KEY_MATCH_TYPE_EXACT, /**< Exact match. */ > > + RTE_FLOW_TABLE_KEY_MATCH_TYPE_WILDCARD, /**< Wildcard > match. */ > > + RTE_FLOW_TABLE_KEY_MATCH_TYPE_RANGE, /**< Range match. */ > > + RTE_FLOW_TABLE_KEY_MATCH_TYPE_LPM, /**< longest prefix > match. */ }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Byte order. > > + * > > + * To specify the byte order of table key / action field value in byte= s. > > + */ > > +enum rte_flow_byte_order { > > + RTE_FLOW_BYTE_ORDER_HOST, /**< follow host byte order. */ > > + RTE_FLOW_BYTE_ORDER_NETWORK, /**< follow network byte order. > */ }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Flow rule table info. > > + * > > + * A structure stores the properties of a flow rule table. > > + * Typically, a flow rule table represents to a P4 table which > > +describe a > > + * match/action unit in packet process pipeline. > > + */ > > +struct rte_flow_table_info { > > + uint32_t id; /**< Identifier of a table within the ethdev. */ > > + const char *name; /**< Name of the table. */ > > + const char *annotation; /**< Human readable message about this > table. */ > > + uint16_t key_field_num; /**< Number of key field. */ > > + uint32_t key_fields[RTE_FLOW_TABLE_KEY_FIELD_NUM_MAX]; /**< > Key field id array. */ > > + uint16_t action_spec_num; /**< Number of action spec. */ > > + uint32_t action_specs[RTE_FLOW_TABLE_ACTION_SPEC_NUM_MAX]; > /**< > > +Action spec id array */ }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Table key field info. > > + * > > + * A structure stores the properties of a table key field. > > + */ > > +struct rte_flow_table_key_field_info { > > + uint32_t table_id; /**< Identifier of a table within the ethdev. */ > > + uint32_t field_id; /**< Identifier of the key field within the table.= */ > > + const char *name; /**< Name of the key field. */ > > + const char *annotation; /**< Human readable message about this > key field. */ > > + enum rte_flow_table_key_match_type match_type; /**< Key match > type. */ > > + uint16_t bit_width; /**< Bit width of the field value. */ > > + uint16_t byte_width; /**< Number of bytes to store the field value. > */ > > + /** > > + * Byte order of the byte array that store the key value. > > + */ > > + enum rte_flow_byte_order byte_order; }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Action spec info. > > + * > > + * A structure stores the properties of a action specification. > > + * Typically, a action specification represents a P4 Action. > > + */ > > +struct rte_flow_action_spec_info { > > + uint32_t id; /**< Identifier of a action spec within the ethdev. */ > > + const char *name; /**< Name of the action spec. */ > > + const char *annotation; /**< Human readable message about this > action spec */ > > + uint16_t field_num; /**< Number of fields */ > > + uint32_t fields[RTE_FLOW_ACTION_SPEC_FIELD_NUM_MAX]; /**< > Field id > > +array */ }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Action spec field info. > > + * > > + * A structure stores the properties of a action spec field. > > + */ > > +struct rte_flow_action_spec_field_info { > > + uint32_t spec_id; /**< Identifier of a action spec within the ethdev. > */ > > + uint32_t field_id; /**< Identifier of the field within the action spe= c. > */ > > + const char *name; /**< Name of the field. */ > > + const char *annotation; /**< Human readable message about this > action spec. */ > > + uint16_t bit_width; /**< Bit width of the field value */ > > + uint16_t byte_width; /**< Number of bytes to store the field value. > */ > > + /** > > + * Byte order of the byte array that stores the key value. > > + */ > > + enum rte_flow_byte_order byte_order; }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Table Key object. > > + * > > + * A structure represent a table key object, should be created / > > +destroyed by > > + * rte_flow_table_key_create and rte_flow_table_key_destroy. > > + */ > > +struct rte_flow_table_key { > > + uint32_t table_id; /**< Indicate which table the key instance belongs > to. */ > > + int ref_cnt; /**< Reference count, in async ops it prevents the objec= t > be destoried .*/ > > + uint8_t data[]; /**< PMD specific data. */ }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Action object. > > + * > > + * A structure represent a table action object, should be created / > > +destroyed by > > + * rte_flow_table_action_create and rte_flow_table_action_destroy. > > + */ > > +struct rte_flow_table_action { > > + uint32_t table_id; /**< Indicate which table the action instance > belongs to. */ > > + uint32_t spec_id; /**< Indicate which action spec the action follow. > */ > > + int ref_cnt; /**< Reference count, in async ops it prevents the objec= t > be destoried .*/ > > + uint8_t data[]; /**< PMD specific data. */ }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * ID list. > > + * > > + * An id list with variant size, should be created by > > + * rte_flow_table_list_popup or rte_flow_action_spec_list_popup. > > + * > > + * Application need to free the list by rte_free. > > + */ > > +struct rte_flow_id_list { > > + uint32_t num; /**< Number of the id list */ > > + uint32_t ids[]; /**< ID array */ > > +}; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Popup table id list. > > + * > > + * A variant size list that store all table identifiers will be create= d. > > + * Application need to free the list by rte_free. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[out] list > > + * A variant size id list, store all table identifiers of current e= thernet > > + * device. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_list_popup(uint16_t port_id, > > + struct rte_flow_id_list **list, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Get table info by identifier. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[out] info > > + * Pointer to store the table info. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_info_get(uint16_t port_id, > > + uint32_t table_id, > > + struct rte_flow_table_info *info, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > +* @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Get table info by name. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] name > > + * Table name. > > + * @param[out] info > > + * Pointer to store the table info. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_info_get_by_name(uint16_t port_id, > > + const char *name, > > + struct rte_flow_table_info *info, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Get table key info by identifier. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[in] field_id > > + * Key field identifier. > > + * @param[info] info > > + * Pointer to store the table key field info. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_field_info_get(uint16_t port_id, > > + uint32_t table_id, > > + uint32_t field_id, > > + struct rte_flow_table_key_field_info *info, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Popup action spec id list. > > + * > > + * A variant size list that store all action spec identifiers will be = created. > > + * Application need to free the list by rte_free. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_action_spec_list_popup(uint16_t port_id, > > + struct rte_flow_id_list **list, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Get action spec info by identifier. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] spec_id > > + * Action spec identifier. > > + * @info[out] info > > + * Pointer to store the action spec info. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_action_spec_info_get(uint16_t port_id, > > + uint32_t spec_id, > > + struct rte_flow_action_spec_info *info, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Get action spec info by name. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] name > > + * Action spec name. > > + * @info[out] info > > + * Pointer to store the action spec info. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_action_spec_info_get_by_name(uint16_t port_id, > > + const char *name, > > + struct rte_flow_action_spec_info *info, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Get action spec field info by identifier. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] spec_id > > + * Action spec identifier. > > + * @param[in] field_id > > + * Field identifier. > > + * @param[out] info > > + * Pointer to store the action spec field info. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_action_spec_field_info_get(uint16_t port_id, > > + uint32_t spec_id, > > + uint32_t field_id, > > + struct rte_flow_action_spec_field_info > *info, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Create a table key object. > > + * > > + * Application need to call rte_flow_table_key_destroy to free the key > object. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[out] key > > + * Table key object created by PMD. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_create(uint16_t port_id, > > + uint32_t table_id, > > + struct rte_flow_table_key **key, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Destroy a table key object. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to destroy. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_destroy(uint16_t port_id, > > + struct rte_flow_table_key *key, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Create an table action object. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[in] spec_id > > + * Action spec identifier. > > + * @param[out] action > > + * Action key created by PMD. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_action_create(uint16_t port_id, > > + uint32_t table_id, > > + uint32_t spec_id, > > + struct rte_flow_table_action **action, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Destroy an table action object. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] action > > + * Action object to destroy. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_action_destroy(uint16_t port_id, > > + struct rte_flow_table_action *action, > > + struct rte_flow_error *error); > > + > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set table key field value by identifier. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to update. > > + * @param[in] field_id > > + * key field identifier. > > + * @param[in] value > > + * Byte array to store the value > > + * @param[in] size > > + * Size of the byte array. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_field_set(uint16_t port_id, > > + struct rte_flow_table_key *key, > > + uint32_t field_id, > > + const uint8_t *value, > > + uint16_t size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set table key field value by name. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to update. > > + * @param[in] name > > + * key field name. > > + * @param[in] value > > + * Byte array to store the value to match. > > + * @param[in] size > > + * Size of the byte array. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_field_set_by_name(uint16_t port_id, > > + struct rte_flow_table_key *key, > > + const char *name, > > + const uint8_t *value, > > + uint16_t size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set wildcard match key field by identifier. > > + * > > + * For wildcard match, only a bit set in mask should be matched. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to update. > > + * @param[in] field_id > > + * Key field identifier. > > + * @param[in] value > > + * Byte array stores the value to match. > > + * @param[in] mask > > + * Byte array stores the bit mask. > > + * @param[in] size > > + * Size of value and mask byte array. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_field_set_with_mask(uint16_t port_id, > > + struct rte_flow_table_key *key, > > + uint32_t field_id, > > + const uint8_t *value, > > + const uint8_t *mask, > > + uint16_t size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set wildcard match key field by name. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to update. > > + * @param[in] name > > + * Key field name. > > + * @param[in] value > > + * Byte array stores the value to match. > > + * @param[in] mask > > + * Byte array stores the bit mask. > > + * @param[in] size > > + * Size of value and mask byte array. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_field_set_with_mask_by_name(uint16_t port_id, > > + struct rte_flow_table_key *key, > > + const char *name, > > + const uint8_t *value, > > + const uint8_t *mask, > > + uint16_t size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set range match key field by identifier. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to update. > > + * @param[in] field_id > > + * Key field identifier. > > + * @param[in] min > > + * Byte array stores the min value of the range to match > > + * @param[in] max > > + * Byte array stores the max value of the range to match > > + * @param[in] size > > + * Size of the min and max byte array > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_field_set_with_range(uint16_t port_id, > > + struct rte_flow_table_key *key, > > + uint32_t field_id, > > + const uint8_t *min, > > + const uint8_t *max, > > + uint16_t size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set range match key field by name. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to update. > > + * @param[in] name > > + * Key field name. > > + * @param[in] min > > + * Byte array stores the min value of the range to match > > + * @param[in] max > > + * Byte array stores the max value of the range to match > > + * @param[in] size > > + * Size of the min and max byte array > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_field_set_with_range_by_name(uint16_t port_id, > > + struct rte_flow_table_key > *key, > > + const char *name, > > + const uint8_t *min, > > + const uint8_t *max, > > + uint16_t size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set lpm match key field by identifier. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to update. > > + * @param[in] field_id > > + * Key field identifier. > > + * @param[in] value > > + * Byte array stores the value to match. > > + * @param[in] size > > + * Size of value byte array. > > + * @param[in] prefix > > + * Bits of the prefix to match, must <=3D (8 * size) > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_field_set_with_prefix(uint16_t port_id, > > + struct rte_flow_table_key *key, > > + uint32_t field_id, > > + const uint8_t *value, > > + uint16_t size, > > + uint16_t prefix, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set lpm match key field by name. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to update. > > + * @param[in] name > > + * Key field name. > > + * @param[in] value > > + * Byte array stores the value to match. > > + * @param[in] size > > + * Size of value byte array. > > + * @param[in] prefix > > + * Bits of the prefix to match, must <=3D (8 * size) > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_field_set_with_prefix_by_name(uint16_t port_id, > > + struct rte_flow_table_key > *key, > > + const char* name, > > + const uint8_t *value, > > + uint16_t size, > > + uint16_t prefix, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set action field value. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] action > > + * Action object to update. > > + * @param[in] field_id > > + * Field identifier. > > + * @param[in] value > > + * Byte array stores the value of the field. > > + * @param[in] size > > + * Size of the byte array. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_action_field_set(uint16_t port_id, > > + struct rte_flow_table_action *action, > > + uint32_t field_id, > > + const uint8_t *value, > > + uint16_t size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * get action field value, application may use > > +rte_flow_table_entry_query > > + * to query by key and use this API to figure out each action field. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] action > > + * Action object to query. > > + * @param[in] field_id > > + * Field identifier. > > + * @param[out] value > > + * Byte array stores the value of the field. > > + * @param[in | out] size > > + * Input as size of the byte array, return the size of the value. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_action_field_get(uint16_t port_id, > > + const struct rte_flow_table_action *action, > > + uint32_t field_id, > > + uint8_t *value, > > + uint16_t *size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] action > > + * Action object to update. > > + * @param[in] name > > + * Field name. > > + * @param[in] value > > + * Byte array stores the value of the field. > > + * @param[in] size > > + * Size of the byte array. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_action_field_set_by_name(uint16_t port_id, > > + struct rte_flow_action *action, > > + const char *name, > > + const uint8_t *value, > > + uint16_t size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Set table default action. > > + * > > + * The default action will take effect when a packet hit no rules. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier > > + * @param[in] action > > + * Default action object. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_default_action_set(uint16_t port_id, > > + uint32_t table_id, > > + const struct rte_flow_table_action *action, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Cancel table default action > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_default_action_cancel(uint32_t port_id, > > + uint32_t table_id, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Add matching rule as a table entry, the rule take effect > > +immediately > > + * after the API call. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[in] key > > + * Table key object. > > + * @param[in] action > > + * Action object. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_entry_add(uint16_t port_id, > > + uint32_t table_id, > > + const struct rte_flow_table_key *key, > > + const struct rte_flow_table_action *action, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Query action of a table entry. > > + * > > + * If success, a new rte_flow_table_action object will be created. > > + * Use rte_flow_table_action_destroy to free the resource. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[in] key > > + * Table key object. > > + * @param[out] action > > + * Action object returned. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_entry_query(uint16_t port_id, > > + uint32_t table_id, > > + const struct rte_flow_table_key *key, > > + struct rte_flow_table_action **action, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Delete a table entry, this take effect immeidatly after the API cal= l. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[in] key > > + * Table key object to match. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_entry_del(uint16_t port_id, > > + uint32_t table_id, > > + const struct rte_flow_table_key *key, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Query rule hit counters. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[in] key > > + * Table key object to match. > > + * @param[out] count > > + * Pointer stores the hit counters. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_entry_count_query(uint16_t port_id, > > + uint32_t table_id, > > + const struct rte_flow_table_key *key, > > + struct rte_flow_query_count *count, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Clone a table key object. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] key > > + * Table key object to clone. > > + * @param[out] new_key > > + * New table key object be created by PMD. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_key_clone(uint16_t port_id, > > + const struct rte_flow_table_key *key, > > + struct rte_flow_table_key **new_key, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Clone a action object. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] action > > + * Action object to clone. > > + * @param[out] new_action > > + * New action object be created by PMD. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_action_clone(uint16_t port_id, > > + const struct rte_flow_action *action, > > + struct rte_flow_action **new_action, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Prepare table entry adding. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[in] key > > + * Table key object. > > + * @param[in] action > > + * Action object. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_entry_add_prepare(uint16_t port_id, > > + uint32_t table_id, > > + struct rte_flow_table_key *key, > > + struct rte_flow_table_action *action, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Prepare table entry deletion. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] table_id > > + * Table identifier. > > + * @param[in] key > > + * Table key object to match. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_entry_del_prepare(uint16_t port_id, > > + uint32_t table_id, > > + struct rte_flow_table_key *key, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Commit all prepared adding and deletion requests. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_table_update_commit(uint16_t port_id, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Table entry operation type. > > + */ > > + > > +enum rte_flow_table_update_op { > > + RTE_FLOW_TABLE_ENTRY_OP_ADD, /* Add an entry */ > > + RTE_FLOW_TABLE_ENTRY_OP_DEL, /* Delete an entry */ > > + RTE_FLOW_TABLE_ENTRY_OP_QRY, /* Query an entry */ }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Table entry update status. > > + */ > > +struct rte_flow_table_update_status { > > + struct rte_flow_table_key *key; /**< Table key object of the entry */ > > + struct rte_flow_table_action *action; /**< Action object of the entry > */ > > + enum rte_flow_table_update_op op; /**< Operation type */ > > + enum rte_flow_error_type err; /**< Error type */ }; > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Pull table entry update status. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[out] stats > > + * An array stores the status of all finished entry adding / delete > > + * requests. > > + * @param[in] size > > + * Size of the input array. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * >=3D0 on success, indiates the number of status be pulled. > > + * A negative errno value otherwise and rte_errno is set. > > + */ > > +__rte_experimental int > > +rte_flow_table_update_status_pull(uint16_t port_id, > > + struct rte_flow_table_update_status *stats, > > + int size, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Get PNA port identifier. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] ethdev_port_id > > + * Ethdev port identifier maps to the required PNA port. > > + * @param[out] pna_port_id > > + * Pointer stores the PNA port identifier. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_pna_port_get(uint16_t port_id, > > + uint16_t ethdev_port_id, > > + uint32_t *hw_port_id, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Get a PNA queue identifer from a ethdev Rx queue. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] ethdev_port_id > > + * Ethdev port identifier the Rx queue belongs to. > > + * @param[in] ethdev_queue_id > > + * Ethdev Rx queue index that maps to the required PNA queue > identifier. > > + * @param[out] pna_queue_id > > + * Pointer stores the PNA queue identifier. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_pna_rx_queue_get(uint16_t port_id, > > + uint16_t ethdev_port_id, > > + uint16_t ethdev_queue_id, > > + uint32_t *hw_queue_id, > > + struct rte_flow_error *error); > > + > > +/** > > + * @warning > > + * @b EXPERIMENTAL: this API may change without prior notice. > > + * > > + * Get a PNA queue identifer from a ethdev Tx queue. > > + * > > + * @param[in] port_id > > + * Port identifier of the Ethernet device. > > + * @param[in] ethdev_port_id > > + * Ethdev port identifier the Tx queue belongs to. > > + * @param[in] ethdev_queue_id > > + * Ethdev Tx queue index that maps to the required PNA queue > identifier. > > + * @param[out] pna_queue_id > > + * Pointer stores the PNA queue identifier. > > + * @param[out] error > > + * Perform verbose error reporting if not NULL. PMDs initialize thi= s > > + * structure in case of error only. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is = set. > > + */ > > +__rte_experimental int > > +rte_flow_pna_tx_queue_get(uint16_t port_id, > > + uint16_t ethdev_port_id, > > + uint16_t ethdev_queue_id, > > + uint32_t *hw_queue_id, > > + struct rte_flow_error *error); > > +#endif > > -- > > 2.31.1 > > > >