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 18833A034F; Wed, 4 Aug 2021 13:35:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A33A4014F; Wed, 4 Aug 2021 13:35:42 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id B6F4C4003E for ; Wed, 4 Aug 2021 13:35:40 +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 174BQjJg015094; Wed, 4 Aug 2021 04:35:38 -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=14yhG8ebZi0GLnxHv2QW+IV3LB72gCu/wSEq6kjGrJw=; b=Fit8SZef4ujimyc0EvB3bn1hCNtV81uXFiEmFou6cieySsRPhhfWmgEGuLS9+UaY9D2r furN9WQ/vlkqgEOsn7Sja1yIw/cIBmHycNNSnaCtjdQxxkYp4Rlapp/NliNYg3nopyX7 viLlTszJBv5FdRpJ9QMQOJ9w1wr3X+6UOmUCiUXogK+X2TCT5wGS51vSiCftEaq/0g6Y hqS7/6jxwVawNrEvb2vvtpgIN2IEUhq8MZqaKm9qbraIlXOT9Py4NFBStsoCMUURaQp9 84Krgc7uzCRu/qSwbv9IrcbUqJ0+QMAs2Z/mTe3Vc5U7zFWL7H0d6zw8FRggToQjdmkQ hg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3a7aub2u08-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 04 Aug 2021 04:35:37 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 4 Aug 2021 04:35:35 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 4 Aug 2021 04:35:35 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 864D43F705A; Wed, 4 Aug 2021 04:35:31 -0700 (PDT) From: To: Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , "Andrew Rybchenko" CC: , , , , , , Jerin Jacob Date: Wed, 4 Aug 2021 17:04:10 +0530 Message-ID: <20210804113410.3604616-1-jerinj@marvell.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210718094400.2772435-1-jerinj@marvell.com> References: <20210718094400.2772435-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: ouuAFbXU8o3Hs1UhaKpBypAqirZ0zm6q X-Proofpoint-GUID: ouuAFbXU8o3Hs1UhaKpBypAqirZ0zm6q X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-04_03:2021-08-04, 2021-08-04 signatures=0 Subject: [dpdk-dev] [PATCH v2] 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 --- - Fix long lines in svg file to avoid patch apply issue doc/guides/prog_guide/img/meter.svg | 1600 +++++++++++++++++ .../traffic_metering_and_policing.rst | 42 +- lib/ethdev/rte_mtr.h | 4 +- 3 files changed, 1638 insertions(+), 8 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..69dbf91a2a 100644 --- a/doc/guides/prog_guide/traffic_metering_and_policing.rst +++ b/doc/guides/prog_guide/traffic_metering_and_policing.rst @@ -14,12 +14,13 @@ SW or mixed HW-SW implementation. The main features are: -* Part of DPDK rte_ethdev API -* Capability query API -* Metering algorithms: RFC 2697 Single Rate Three Color Marker (srTCM), RFC 2698 - and RFC 4115 Two Rate Three Color Marker (trTCM) -* Policer actions (per meter output color): recolor, drop -* Statistics (per policer output color) +#. Part of DPDK rte_ethdev API +#. Capability query API +#. Metering algorithms: RFC 2697 Single Rate Three Color Marker (srTCM), RFC 2698 + 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,32 @@ 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_meter_components: + +.. 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 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()``. +#. An 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`` as + ``RTE_FLOW_ACTION_TYPE_METER`` the parent meter object. 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