From patchwork Sun Jul 18 09:44:00 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: 96011 X-Patchwork-Delegate: thomas@monjalon.net 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 54418A0C47; Sun, 18 Jul 2021 11:45:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E81244069D; Sun, 18 Jul 2021 11:45:08 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D9F1440683 for ; Sun, 18 Jul 2021 11:45:06 +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 16I9g5PY023615; Sun, 18 Jul 2021 02:45:03 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Rr+56WfpIvte3rdSaBZ8+zQ06euwJJCvA7Yd+UeCTyk=; b=Co73WCY/e7Z+lQVkKa0onWI8u1GfKHvOUiMw9PtUshHRHuIaPRWP9pfMjAm/zDNINZed HlWiBozUY6tHP4gKDH0NU1ZsFSy1YwW/RmTIZUk3pjOqvKuIb4MKvRg9yY5+26P5WWxC 8/UlV7DsxWPZUPPJ8nlWD/JU/sHSPcOqFCnvcACBjnZadzOO8Q8C4VpY8xZyMCumVPi3 RsP17vURvfKcPOvmllCfuQFWCKjx6o/Gcq8RQmd0EcTd4/H2NxIeLGLfaP9enX5uu553 rmI5C9NR1sPlnt11weOlZ0/kZPctWRJGYgSu/LuQb9XLsS/gppghQM2V/OJxd25PA/6Y eg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 39uvjsan0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 18 Jul 2021 02:45:03 -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; Sun, 18 Jul 2021 02:45:01 -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; Sun, 18 Jul 2021 02:45:01 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id AC8483F7072; Sun, 18 Jul 2021 02:44:57 -0700 (PDT) From: To: Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , "Andrew Rybchenko" CC: , , , , , , Jerin Jacob Date: Sun, 18 Jul 2021 15:14:00 +0530 Message-ID: <20210718094400.2772435-1-jerinj@marvell.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 4TGWa4dWvZ3_REuNg1b7xfRVFHoxI4LI X-Proofpoint-GUID: 4TGWa4dWvZ3_REuNg1b7xfRVFHoxI4LI X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-18_04:2021-07-16, 2021-07-18 signatures=0 Subject: [dpdk-dev] [PATCH] 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 must performed by the application to configure the traffic meter and policing library. Signed-off-by: Jerin Jacob --- doc/guides/prog_guide/img/meter.svg | 1027 +++++++++++++++++ .../traffic_metering_and_policing.rst | 42 +- lib/ethdev/rte_mtr.h | 4 +- 3 files changed, 1065 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..0629e4f591 --- /dev/null +++ b/doc/guides/prog_guide/img/meter.svg @@ -0,0 +1,1027 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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; };