From patchwork Fri Sep 15 18:59:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 131508 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 C622E425A8; Fri, 15 Sep 2023 20:59:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E4CF402AF; Fri, 15 Sep 2023 20:59:40 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 97E58402AD; Fri, 15 Sep 2023 20:59:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694804379; x=1726340379; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=3P33z93Pu2qZskx56E6TxgMt86qlcfCk5pCVoUfhTPk=; b=cLb04GkthF/wK9QMBkwuClQyDmT+T8jqLOfoS7X0y/ijoTmncmGaPbGd mVLao+hDKaK7YYcfqPuercPk+mSJ/5siyr2I0PFRLsk9XITEJwy5WMp9S D/6dq6JNjfg660lz8RxjHaDb7G9fGJ3ywOERci2mi0K17t+2KuS6FXpWH EiydYqVQARxB344wFVBJoPDQ52f5DlLWrLu4Go7HL5CZ1uDD6UBktM1Bp PoubFpzGs6quat7KuFljf/vsvQZEkXPS9LRBQEQt6yQ15No+H2pbRurrY yCt6dUJwL9NPeGPnuomCS0OvvEPK4Fh+2qz2HkmvJ3sNLwx81tAN/tXM0 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="445793081" X-IronPort-AV: E=Sophos;i="6.02,149,1688454000"; d="scan'208";a="445793081" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 11:59:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="1075879125" X-IronPort-AV: E=Sophos;i="6.02,149,1688454000"; d="scan'208";a="1075879125" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.222.53]) by fmsmga005.fm.intel.com with ESMTP; 15 Sep 2023 11:59:33 -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] ethdev: add flow API support for P4-programmable devices Date: Fri, 15 Sep 2023 18:59:32 +0000 Message-Id: <20230915185932.3070938-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 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 --- Change log: 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..9eef5027d0 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,47 @@ 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. + * + * The action argument field length must be non-zero. The action argument field + * value must be non-NULL, with the value bytes specified in network byte order. + * + * @see struct rte_flow_action_prog + */ +struct rte_flow_action_prog_argument { + /** Argument name. */ + const char *arg_name; + /** Argument field length. */ + uint32_t arg_length; + /** Argument field value. */ + const uint8_t *arg_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. + * + * @see RTE_FLOW_ACTION_TYPE_PROG + */ +struct rte_flow_action_prog { + /** Action name. */ + const char *action_name; + /** Number of action arguments. */ + uint32_t action_args_num; + /** Action arguments array. */ + const struct rte_flow_action_prog_argument *action_args; +}; + /* Mbuf dynamic field offset for metadata. */ extern int32_t rte_flow_dynf_metadata_offs;