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 02B81A0C46; Fri, 6 Aug 2021 11:44:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE3D44069E; Fri, 6 Aug 2021 11:44:49 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 7FF334014D for ; Fri, 6 Aug 2021 11:44:47 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1769Zv70018981; Fri, 6 Aug 2021 02:44:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=ObHNxuZyKkY3NbJoVp5X1BijwTd3bgnFY/LlDJUK3Ks=; b=UvpGr/qH6OmLE3IOok8XldObila6bWWPTRNrLtqBhbJC66gD6FyYSBw7UubhLs6UoyLB aSfpERTYJ95LfwcmCmoZ91ajsWvAILv3wjbRvVO26Womo2sxdzFfZCaSTs5KFgy/fRQm W7gJkn/s1DEvQvUcgiUDT3Mnkx/Q6tibifwUQeV7IdKrGKMJID5E97vEqSFsWd7C4fBd khlz1bKooCFhXkPiMuPr69XcXL7TIMRkCPNN8LphWnhACyVcACxNvw+p8cl+jHI/Dpz6 5pQPhzzqpHTBQBw4OSEBxBbV6xxc3XMd0VTFTW1WeAa3hhd0W27bcgSXPr1y0Ey3zKJj 4A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3a91q9r5sw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 06 Aug 2021 02:44:45 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 6 Aug 2021 02:44:42 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Fri, 6 Aug 2021 02:44:42 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 6E43F3F705F; Fri, 6 Aug 2021 02:44:39 -0700 (PDT) From: To: Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , "Andrew Rybchenko" CC: , , , , , , Jerin Jacob Date: Fri, 6 Aug 2021 15:13:20 +0530 Message-ID: <20210806094320.796914-1-jerinj@marvell.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210805101046.4091894-1-jerinj@marvell.com> References: <20210805101046.4091894-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: R8D3nYXzv8nKWWsUPqziQzFVIhdnqt8h X-Proofpoint-ORIG-GUID: R8D3nYXzv8nKWWsUPqziQzFVIhdnqt8h X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-06_02:2021-08-05, 2021-08-06 signatures=0 Subject: [dpdk-dev] [PATCH v3] doc: mtr: add API walk through 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" From: Jerin Jacob Added a diagram to document meter library components and added text for steps performed by the application to configure the traffic meter and policing library. Signed-off-by: Jerin Jacob --- v2: Fix long lines in svg file to avoid patch apply issue v3: Fix all Thomas's comments at http://patches.dpdk.org/project/dpdk/patch/20210804113410.3604616-1-jerinj@marvell.com/ v4: Fix all Cristian's comments at http://patches.dpdk.org/project/dpdk/patch/20210805101046.4091894-1-jerinj@marvell.com/ .../prog_guide/img/rte_mtr_meter_chaining.svg | 1600 +++++++++++++++++ .../traffic_metering_and_policing.rst | 41 + lib/ethdev/rte_mtr.h | 4 +- 3 files changed, 1643 insertions(+), 2 deletions(-) create mode 100644 doc/guides/prog_guide/img/rte_mtr_meter_chaining.svg diff --git a/doc/guides/prog_guide/img/rte_mtr_meter_chaining.svg b/doc/guides/prog_guide/img/rte_mtr_meter_chaining.svg new file mode 100644 index 0000000000..7214c5dc2b --- /dev/null +++ b/doc/guides/prog_guide/img/rte_mtr_meter_chaining.svg @@ -0,0 +1,1600 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + RTE_FLOW_ITEM + + RTE_FLOW_ACTION_TYPE_METER + + + + + RED + + YELLOW + + GREEN + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + RED + + YELLOW + + GREEN + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + + CIR + + CBS + + EBS + + PIR + + PBS + + EIR + + + + CIR + + CBS + + EBS + + PIR + + PBS + + EIR + + + RED + + YELLOW + + GREEN + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + + + CIR + + CBS + + EBS + + PIR + + PBS + + EIR + + + RED + + YELLOW + + GREEN + + RTE_FLOW_ACTION_METER + + RTE_FLOW_ACTION + + RTE_FLOW_ACTION + + + + + + + + + + + + + + diff --git a/doc/guides/prog_guide/traffic_metering_and_policing.rst b/doc/guides/prog_guide/traffic_metering_and_policing.rst index c0537e653c..125597a92c 100644 --- a/doc/guides/prog_guide/traffic_metering_and_policing.rst +++ b/doc/guides/prog_guide/traffic_metering_and_policing.rst @@ -20,6 +20,7 @@ The main features are: and RFC 4115 Two Rate Three Color Marker (trTCM) * Policer actions (per meter output color): recolor, drop * Statistics (per policer output color) +* Chaining multiple meter objects Configuration steps ------------------- @@ -64,3 +65,43 @@ The processing done for each input packet hitting an MTR object is: * Statistics: The set of counters maintained for each MTR object is configurable and subject to the implementation support. This set includes the number of packets and bytes dropped or passed for each output color. + +API Walk-through +---------------- + +.. _figure_rte_mtr_chaining: + +.. figure:: img/rte_mtr_meter_chaining.* + + Meter components + +This section will introduce the reader to the critical APIs to use +the traffic meter and policing library. + +In general, the application performs the following steps to configure the +traffic meter and policing library. + +#. Application gets the meter driver capabilities using ``rte_mtr_capabilities_get()``. +#. The application creates the required meter profiles by using the + ``rte_mtr_meter_profile_add()`` API function. +#. The application creates the required meter policies by using the + ``rte_mtr_meter_policy_add()`` API function. +#. One of the previously created meter profile + (``struct rte_mtr_params::meter_profile_id``) and meter policy + (``struct rte_mtr_params::meter_policy_id``) are provided as arguments + at this step. +#. The application enables the meter object execution as part of the flow action + processing by calling the ``rte_flow_create()`` API function with one of the + flow action set to ``RTE_FLOW_ACTION_TYPE_METER`` and the associated + meter object ID set to this meter object. +#. The API allows chaining the meter objects to create complex metering topology + by the following methods. + + * Stacking multiple ``rte_flow_action`` as + ``RTE_FLOW_ACTION_TYPE_METER`` with ``struct rte_flow_action_meter::mtr_id`` + as meter ID. The last added RTE_FLOW_ACTION_TYPE_METER object represent as + leaf node (closest to ethdev receive queue) + + * As show in :numref:`figure_rte_mtr_chaining` specify + ``struct rte_mtr_meter_policy_params::actions`` action as + ``RTE_FLOW_ACTION_TYPE_METER`` per color. diff --git a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h index dc246dd7af..40df0888c8 100644 --- a/lib/ethdev/rte_mtr.h +++ b/lib/ethdev/rte_mtr.h @@ -219,7 +219,7 @@ struct rte_mtr_meter_policy_params { * @see enum rte_mtr_stats_type */ struct rte_mtr_params { - /** Meter profile ID. */ + /** Meter profile ID. @see rte_mtr_meter_profile_add() */ uint32_t meter_profile_id; /** Meter input color in case of MTR object chaining. When non-zero: if @@ -259,7 +259,7 @@ struct rte_mtr_params { */ uint64_t stats_mask; - /** Meter policy ID. */ + /** Meter policy ID. @see rte_mtr_meter_policy_add() */ uint32_t meter_policy_id; }; -- 2.32.0