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 D52DFA0C40; Thu, 5 Aug 2021 12:12:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE7F241263; Thu, 5 Aug 2021 12:12:21 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id B811241262 for ; Thu, 5 Aug 2021 12:12:19 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 175ACHIx010421; Thu, 5 Aug 2021 03:12:17 -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=nHAAYNl2+9oaiJAbdecOi6HGDx1YFf9HGPRRKST/G90=; b=UvDEJUF6Y3p+h5wtvZ8MG7C9i0JdCifBWnnNRHh8gCNQUj12v4QzIyX9XJmmfSeCBlnU 5NHJv0iAMcMReEFOOkllPy0ecYWTjpyURcDmMoIo482q99rPL+a7jAWQlkv4YY3NdvvQ +4zGR3p3oTS0RxP77JdLTICKlnH8y3QIW8hiymsujqiyGumd+gmG3OF7a+N+SC88g7MO UJZXSwCUjj806S5dmk2dCbZGqe9W82tO+VdQmanO0T1Gc442FaAIUsIzo60wByW92wQy ycvcpvFyZJO3o6GZ7yhHViESl62AEgiDWfuP8YZSX2rLoRqP3WAzvQalaj6uoDkUfJcq FQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3a8bkb8cuc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Aug 2021 03:12:16 -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; Thu, 5 Aug 2021 03:12:14 -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; Thu, 5 Aug 2021 03:12:14 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id D19E83F705F; Thu, 5 Aug 2021 03:12:11 -0700 (PDT) From: To: Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , "Andrew Rybchenko" CC: , , , , , , Jerin Jacob Date: Thu, 5 Aug 2021 15:40:46 +0530 Message-ID: <20210805101046.4091894-1-jerinj@marvell.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210804113410.3604616-1-jerinj@marvell.com> References: <20210804113410.3604616-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: Wmn_WKDCWDcgPpM2lknXruBOJRNUQb_a X-Proofpoint-ORIG-GUID: Wmn_WKDCWDcgPpM2lknXruBOJRNUQb_a X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-05_03:2021-08-05, 2021-08-05 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 comment at http://patches.dpdk.org/project/dpdk/patch/20210804113410.3604616-1-jerinj@marvell.com/ doc/guides/prog_guide/img/meter.svg | 1600 +++++++++++++++++ .../traffic_metering_and_policing.rst | 29 + lib/ethdev/rte_mtr.h | 4 +- 3 files changed, 1631 insertions(+), 2 deletions(-) create mode 100644 doc/guides/prog_guide/img/meter.svg diff --git a/doc/guides/prog_guide/img/meter.svg b/doc/guides/prog_guide/img/meter.svg new file mode 100644 index 0000000000..7214c5dc2b --- /dev/null +++ b/doc/guides/prog_guide/img/meter.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..0fe013522f 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 the meter objects Configuration steps ------------------- @@ -64,3 +65,31 @@ 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:: img/meter.* + + Meter components + +This section will introduce the reader to the critical APIs to use +the traffic meter and policing library. + +In general, the following steps are performed by the application to configure +the traffic meter and policing library. + +#. Application gets the meter driver capabilities using ``rte_mtr_capabilities_get()``. +#. Application identifies the profile(s) needed for metering and creates it with + ``rte_mtr_meter_profile_add()``. +#. Application identifies the policies needed and creates it with ``rte_mtr_meter_policy_add()``. +#. A meter object consists of a profile and a policy. Use above created objects to create + meter object using ``rte_mtr_create()``. Application uses + ``struct rte_mtr_params::meter_profile_id`` and ``struct rte_mtr_params::meter_policy_id`` + to specify the profile (created in step 2) and policy (created in step 3). +#. Once the meter object is created, the application shall use ``rte_flow_create()`` API to + instantiate the meter object using ``RTE_FLOW_ACTION_TYPE_METER`` action. +#. The API allows chaining the meter objects to create complex metering topology + by specifying ``struct rte_mtr_meter_policy_params::actions`` action as + ``RTE_FLOW_ACTION_TYPE_METER`` to the parent meter object encoded as + ``struct rte_flow_action_meter::mtr_id``. 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