From patchwork Fri Oct 13 12:22:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 30352 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A79741B676; Fri, 13 Oct 2017 14:22:38 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0B0821B65D for ; Fri, 13 Oct 2017 14:22:31 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2017 05:22:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,371,1503385200"; d="scan'208";a="162293017" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by fmsmga005.fm.intel.com with ESMTP; 13 Oct 2017 05:22:20 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: thomas@monjalon.net, adrien.mazarguil@6wind.com, jingjing.wu@intel.com, john.mcnamara@intel.com, hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com, jasvinder.singh@intel.com Date: Fri, 13 Oct 2017 13:22:14 +0100 Message-Id: <1507897338-236951-2-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507897338-236951-1-git-send-email-cristian.dumitrescu@intel.com> References: <1507301136-131382-2-git-send-email-cristian.dumitrescu@intel.com> <1507897338-236951-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH V4 1/5] ethdev: add new flow action for metering and policing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Metering and policing action typically sits on top of flow classification, which is why MTR objects are enabled through a newly introduced flow action. The configuration of MTR objects is done in their own namespace (rte_mtr) within the librte_ether library. The MTR object is hooked into ethdev RX processing path using the "meter" flow action. Signed-off-by: Cristian Dumitrescu Acked-by: Adrien Mazarguil Acked-by: Jerin Jacob --- Changes in v4: - None Changes in v3: - Implemented input from Adrien: - Removed doc mention on multiple MTR objects for same flow. doc/guides/prog_guide/rte_flow.rst | 23 +++++++++++++++++++++++ lib/librte_ether/rte_flow.h | 22 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 3113881..5289350 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1371,6 +1371,29 @@ rule or if packets are not addressed to a VF in the first place. | ``vf`` | VF ID to redirect packets to | +--------------+--------------------------------+ +Action: ``METER`` +^^^^^^^^^^^^^^^^^ + +Applies a stage of metering and policing. + +The metering and policing (MTR) object has to be first created using the +rte_mtr_create() API function. The ID of the MTR object is specified as +action parameter. More than one flow can use the same MTR object through +the meter action. The MTR object can be further updated or queried using +the rte_mtr* API. + +- Non-terminating by default. + +.. _table_rte_flow_action_meter: + +.. table:: METER + + +--------------+---------------+ + | Field | Value | + +==============+===============+ + | ``mtr_id`` | MTR object ID | + +--------------+---------------+ + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index a0ffb71..062e3ac 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -967,6 +967,14 @@ enum rte_flow_action_type { * See struct rte_flow_action_vf. */ RTE_FLOW_ACTION_TYPE_VF, + + /** + * Traffic metering and policing (MTR). + * + * See struct rte_flow_action_meter. + * See file rte_mtr.h for MTR object configuration. + */ + RTE_FLOW_ACTION_TYPE_METER, }; /** @@ -1060,6 +1068,20 @@ struct rte_flow_action_vf { }; /** + * RTE_FLOW_ACTION_TYPE_METER + * + * Traffic metering and policing (MTR). + * + * Packets matched by items of this type can be either dropped or passed to the + * next item with their color set by the MTR object. + * + * Non-terminating by default. + */ +struct rte_flow_action_meter { + uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */ +}; + +/** * Definition of a single action. * * A list of actions is terminated by a END action.