From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 93CF228EE for ; Tue, 30 May 2017 18:46:16 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 May 2017 09:46:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,418,1491289200"; d="scan'208";a="974720555" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by orsmga003.jf.intel.com with ESMTP; 30 May 2017 09:44:30 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: thomas@monjalon.net, adrien.mazarguil@6wind.com, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, declan.doherty@intel.com, keith.wiles@intel.com Date: Tue, 30 May 2017 17:44:10 +0100 Message-Id: <1496162653-137817-1-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [RFC 0/3] rte_mtr: generic ethdev API for metering and policing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 May 2017 16:46:17 -0000 This patch set introduces an ethdev-based generic API for Traffic Metering and Policing (MTR), which is yet another standard RX offload for Ethernet devices. Similar to rte_flow and rte_tm APIs, the configuration of MTR objects is done in their own namespace (rte_mtr) within the librte_ether library. Metering and policing action typically sits on top of flow classification, which is why MTR objects are enabled through a newly introduced rte_flow action, which is the only impact to rte_flow API. Q1: Why introduce ethdev-based traffic metering ad policing API? A1: Traffic metering and policing is a standard RX offload for Ethernet devices present in NICs, SoCs and NPUs across the industry. Q2: What's the connection between the new rte_mtr API and the existing librte_meter library? A2: The existing librte_meter library provides a SW implementation for a subset of the features exposed by this API. The rte_mtr API is agnostic to whether the implementation is HW, SW or mixed HW-SW. Q3: What's the connection between the new rte_mtr API and the existing rte_flow API? A3: The MTR object is hooked into ethdev RX processing path using a newly introduced rte_flow action, which is the only impact to the rte_flow API. The configuration of MTR objects is done in separate namespace (rte_mtr) outside of rte_flow API. Q4: Can the new rte_flow meter action drop packets? Is this a terminating action or not? A4: Although packets can be dropped by the newly introduced rte_flow meter action, this action is non-terminating, i.e. the action list typically contains at least one more action, which is a terminating action. Depending on the policer actions configured for the MTR object, some packets might be dropped while some packets passed to the next flow action with their color set in the packet mbuf. For example, a typical policer configuration is to drop the red packets while passing the green packets, therefore a subsequent rte_flow action needs to be configured to determine the final destination of green packets. Q5: Which are the main operations exposed for the MTR object? A5: Traffic metering, policing and statistics update. Traffic metering determines the color for the current packet (green, yellow, red) based on the previous history for this flow as maintained by the MTR object. The policer can do nothing, recolor or drop the packet. Stats are maintained for MTR object, as configured. Q6: Where is the output color stored for the current packet. A6: struct rte_mbuf::sched::color. Q7: Which are the supported metering algorithms? A7: srTCM (RFC 2697), trTCM (RFC 2698). Q8: Which are the supported policer actions? A8: Recolor the packet (keep or change the color determined by metering) or drop the packet. Cristian Dumitrescu (3): ethdev: add traffic metering and policing ops get API ethdev: add new rte_mtr API for traffic metering and policing rte_flow: add new action for traffic metering and policing MAINTAINERS | 4 + lib/librte_ether/Makefile | 7 +- lib/librte_ether/rte_ethdev.c | 12 + lib/librte_ether/rte_ethdev.h | 20 ++ lib/librte_ether/rte_ether_version.map | 14 + lib/librte_ether/rte_flow.h | 22 ++ lib/librte_ether/rte_mtr.c | 184 +++++++++++++ lib/librte_ether/rte_mtr.h | 465 +++++++++++++++++++++++++++++++++ lib/librte_ether/rte_mtr_driver.h | 188 +++++++++++++ 9 files changed, 914 insertions(+), 2 deletions(-) create mode 100644 lib/librte_ether/rte_mtr.c create mode 100644 lib/librte_ether/rte_mtr.h create mode 100644 lib/librte_ether/rte_mtr_driver.h -- 2.7.4