From patchwork Mon Sep 25 12:33:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 131890 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 435DF42635; Mon, 25 Sep 2023 14:33:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BEAFE402DF; Mon, 25 Sep 2023 14:33:52 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 108F3402DE; Mon, 25 Sep 2023 14:33:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695645230; x=1727181230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CBYntXn6cxXsooEWZ5wpFfVBJLLvG+FEPQAzIYxG/Ds=; b=Dyh0byCm2jw0c66HEQmLRyif60Wie1lnSQGx4e8Kut8jfG6YxzYGD5/e 6HoOSxxY4GeOWGYykd4rJT8cKAdenO4GPCdbjgB3RZRxQm1F1s1y3MMNN I6z9Om2v3iaQ3poQxBKw2zXy1P1wa1I9SF0Y/bGIL7PMvATHVS0xqo8Sy 7OOO/S0CAV2E6bT5UmTzt5tZxeFOMujV/kOJ5AJNdzUZwR/ClVFeiqzhM u8o5lj/vOOagiF5rTYw1uXz31UFZQaE24N8EF8i4AJ4pyIhrHJjaoxJ7C MX/IW1EGouVL/f4MlHVhCaEPUjJMPeInuEyXhj6yDtAe8CRc82ETM7TWf g==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="383998655" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="383998655" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 05:33:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="813949222" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="813949222" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.222.53]) by fmsmga008.fm.intel.com with ESMTP; 25 Sep 2023 05:33:45 -0700 From: Cristian Dumitrescu To: dev@dpdk.org, orika@nvidia.com, thomas@monjalon.net, david.marchand@redhat.com, jerinj@marvell.com, jerinjacobk@gmail.com, mb@smartsharesystems.com, ferruh.yigit@amd.com, helin.zhang@intel.com, bruce.richardson@intel.com, john.mcnamara@intel.com Cc: techboard@dpdk.org, qi.z.zhang@intel.com Subject: [PATCH V2] ethdev: add flow API support for P4-programmable devices Date: Mon, 25 Sep 2023 12:33:44 +0000 Message-Id: <20230925123344.3237627-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915185932.3070938-1-cristian.dumitrescu@intel.com> References: <20230915185932.3070938-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 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 This patch introduces the new "program" action type to enable flow API support for P4-programmable devices. In the case of P4-programmable devices, the device is initially blank. The flow items and actions are defined by the user (outside of any vendor control) through the P4 program, which is typically compiled into firmware that is loaded on the device at init time. These flow items and actions are then used during the run-time phase to add flows on the device. Signed-off-by: Cristian Dumitrescu Signed-off-by: Qi Zhang Acked-by: Ori Kam Acked-by: Ferruh Yigit --- Change log: V2: -Adjusted field names and improved some comments based on Ori's feedback: https://mails.dpdk.org/archives/dev/2023-September/277358.html V1: -Incorporated the feedback from the DPDK Summit 2023, sincere thanks to the many colleagues who contributed! -Based on Ori's suggestion, decided to reuse the existing "flex" flow item instead of defining a new flow item, so only the new "program" action type is required. RFC: -RFC link: https://mails.dpdk.org/archives/dev/2023-August/273703.html lib/ethdev/rte_flow.h | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 2ebb76dbc0..fe2bb9c948 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2981,6 +2981,15 @@ enum rte_flow_action_type { * @see struct rte_flow_action_indirect_list */ RTE_FLOW_ACTION_TYPE_INDIRECT_LIST, + + /** + * Program action. These actions are defined by the program currently + * loaded on the device. For example, these actions are applicable to + * devices that can be programmed through the P4 language. + * + * @see struct rte_flow_action_prog. + */ + RTE_FLOW_ACTION_TYPE_PROG, }; /** @@ -4055,6 +4064,48 @@ struct rte_flow_indirect_update_flow_meter_mark { enum rte_color init_color; }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice. + * + * Program action argument configuration parameters. + * + * For each action argument, its *size* must be non-zero and its *value* must + * point to a valid array of *size* bytes specified in network byte order. + * + * @see struct rte_flow_action_prog + */ +struct rte_flow_action_prog_argument { + /** Argument name. */ + const char *name; + /** Argument size in bytes. */ + uint32_t size; + /** Argument value. */ + const uint8_t *value; +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice. + * + * RTE_FLOW_ACTION_TYPE_PROG + * + * Program action configuration parameters. + * + * Each action can have zero or more arguments. When *args_num* is non-zero, the + * *args* parameter must point to a valid array of *args_num* elements. + * + * @see RTE_FLOW_ACTION_TYPE_PROG + */ +struct rte_flow_action_prog { + /** Action name. */ + const char *name; + /** Number of action arguments. */ + uint32_t args_num; + /** Action arguments array. */ + const struct rte_flow_action_prog_argument *args; +}; + /* Mbuf dynamic field offset for metadata. */ extern int32_t rte_flow_dynf_metadata_offs;