From patchwork Sat Aug 7 08:21:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob Kollanukkaran X-Patchwork-Id: 96708 X-Patchwork-Delegate: david.marchand@redhat.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 6559BA0547; Sat, 7 Aug 2021 10:22:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9C7740691; Sat, 7 Aug 2021 10:22:40 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A26214067E for ; Sat, 7 Aug 2021 10:22:38 +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 1778LOY9011734; Sat, 7 Aug 2021 01:22:36 -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=oguVw4vgdC4k5tkZNNi55Hus7C2gMll9vxZSh1wMe/0=; b=cnlhPbMaIpFqU1bKCuHJ2Nrc5xpNu4GBbMQy1cI00z7gufrVfBlLNB3XKOREjq7KRnPL WE5ulaOTfFS7c2uOCfDcz+Q+BHxXDncrGfn40jNacwhQvwSRqiqi2FHzBMwaBKKFRkuO jlZ/SvlLj8iD+wccw/j7nussVV4DAVfX3aGLPRWj9nXpHdzh6om3mzowj6smibBYm4UU kLxvQJcYIXfweo6GjYK5gOsMrjxVZzLjKIVtCmiLf9GopAV5t0kSoGvObFF7KwFdmmSd bUoXVPIUaUU35Kqqoez123wJHGXiw4ZEBd0o4L+OnKfCCJpsbrPdUjtfwe/djFz7qSZY yA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3a91q8udj0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 07 Aug 2021 01:22:35 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sat, 7 Aug 2021 01:22:33 -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; Sat, 7 Aug 2021 01:22:33 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 111193F706D; Sat, 7 Aug 2021 01:22:29 -0700 (PDT) From: To: Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , "Andrew Rybchenko" CC: , , , , , , Jerin Jacob Date: Sat, 7 Aug 2021 13:51:08 +0530 Message-ID: <20210807082109.1666761-1-jerinj@marvell.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806094518.807965-1-jerinj@marvell.com> References: <20210806094518.807965-1-jerinj@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: nuNUQvZcpQTLpyUECM87f4_zikoPbjXN X-Proofpoint-ORIG-GUID: nuNUQvZcpQTLpyUECM87f4_zikoPbjXN X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-07_02:2021-08-06, 2021-08-07 signatures=0 Subject: [dpdk-dev] [PATCH v6] 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 Acked-by: Cristian Dumitrescu --- 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 commentss at http://patches.dpdk.org/project/dpdk/patch/20210805101046.4091894-1-jerinj@marvell.com/ v5: Fix version number in the patch v6: Fix all Cristian's comments t http://patches.dpdk.org/project/dpdk/patch/20210806094518.807965-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 -- 2.32.0 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..b29459c7cb 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. +#. The application creates a meter object using the ``rte_mtr_create()`` 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. + + * Adding multiple flow actions of the type ``RTE_FLOW_ACTION_TYPE_METER`` to + the same flow. + Each of the meter action typically refers to a different meter object. + + * Adding one (or multiple) actions of the type ``RTE_FLOW_ACTION_TYPE_METER`` + to the list of meter actions (``struct rte_mtr_meter_policy_params::actions``) + specified per color as show in :numref:`figure_rte_mtr_chaining`. 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; };