From: Cristian Dumitrescu Date: Fri, 13 Oct 2017 12:22:14 +0000 (+0100) Subject: ethdev: add flow action for metering and policing X-Git-Tag: spdx-start~1288 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1634de27280a6abb328007d10efd0a85fccdc814;p=dpdk.git ethdev: add flow action for metering and policing Metering and policing action typically sits on top of flow classification, which is why MTR objects are enabled through a newly introduced flow action. The configuration of MTR objects is done in their own namespace (rte_mtr) within the librte_ether library. The MTR object is hooked into ethdev RX processing path using the "meter" flow action. Signed-off-by: Cristian Dumitrescu Acked-by: Adrien Mazarguil Acked-by: Jerin Jacob --- diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 13e3dbe0d8..bcb438ed48 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1371,6 +1371,29 @@ rule or if packets are not addressed to a VF in the first place. | ``vf`` | VF ID to redirect packets to | +--------------+--------------------------------+ +Action: ``METER`` +^^^^^^^^^^^^^^^^^ + +Applies a stage of metering and policing. + +The metering and policing (MTR) object has to be first created using the +rte_mtr_create() API function. The ID of the MTR object is specified as +action parameter. More than one flow can use the same MTR object through +the meter action. The MTR object can be further updated or queried using +the rte_mtr* API. + +- Non-terminating by default. + +.. _table_rte_flow_action_meter: + +.. table:: METER + + +--------------+---------------+ + | Field | Value | + +==============+===============+ + | ``mtr_id`` | MTR object ID | + +--------------+---------------+ + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index a0ffb7126f..062e3ac56c 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -967,6 +967,14 @@ enum rte_flow_action_type { * See struct rte_flow_action_vf. */ RTE_FLOW_ACTION_TYPE_VF, + + /** + * Traffic metering and policing (MTR). + * + * See struct rte_flow_action_meter. + * See file rte_mtr.h for MTR object configuration. + */ + RTE_FLOW_ACTION_TYPE_METER, }; /** @@ -1059,6 +1067,20 @@ struct rte_flow_action_vf { uint32_t id; /**< VF ID to redirect packets to. */ }; +/** + * RTE_FLOW_ACTION_TYPE_METER + * + * Traffic metering and policing (MTR). + * + * Packets matched by items of this type can be either dropped or passed to the + * next item with their color set by the MTR object. + * + * Non-terminating by default. + */ +struct rte_flow_action_meter { + uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */ +}; + /** * Definition of a single action. *