On Sat, Aug 05, 2023 at 12:14:37AM +0800, [email protected] wrote:
> From: Lin Huang <[email protected]>
> 
> OvS has supported packet-per-second policer which can be set at ingress
> and egress side in kernel datapath. But the userspace datapath doesn't
> support for ingress and egress packet-per-second policing now.
> 
> So, this patch add support for userspace egress pps policing by using
> native ovs token bucket library. Token bucket is accumulated by 'rate'
> tokens per millisecond and store maximum tokens at 'burst' bucket size.
> One token in the bucket means one packet (1 kpkts * millisecond) which
> will drop or pass by policer.
> 
> This patch add a new egress Qos type called 'kpkts-policer'.
> the policer police the kilo-packet per second at which the token bucket
> be updated by 'kpkts_rate'. and the policer's burst size is defined by
> 'kpkts_burst'.
> 
> Examples:
> $ovs-vsctl set port vhost-user0 qos=@newqos --
>            --id=@newqos create qos type=kpkts-policer \
>            other-config:kpkts_rate=123 other-config:kpkts_burst=123
> 
> Add some unit tests for egress packet-per-second policing.
> 
> Signed-off-by: Lin Huang <[email protected]>
> ---
>  Documentation/topics/dpdk/qos.rst |  21 +++
>  NEWS                              |   1 +
>  lib/netdev-dpdk.c                 | 160 +++++++++++++++++++
>  tests/system-dpdk.at              | 255 ++++++++++++++++++++++++++++++
>  vswitchd/vswitch.xml              |  32 ++++
>  5 files changed, 469 insertions(+)
> 
> diff --git a/Documentation/topics/dpdk/qos.rst 
> b/Documentation/topics/dpdk/qos.rst
> index a98ec672f..6a4408127 100644
> --- a/Documentation/topics/dpdk/qos.rst
> +++ b/Documentation/topics/dpdk/qos.rst
> @@ -36,6 +36,9 @@ QoS (Egress Policing)
>  Single Queue Policer
>  ~~~~~~~~~~~~~~~~~~~~
>  
> +Bytes Per Second Policer
> ++++++++++++++++++++

Unfortunately this introduces a build failure:

  Warning, treated as error:
  .../qos.rst:40:Title underline too short.


> +
>  Assuming you have a :doc:`vhost-user port <vhost-user>` transmitting traffic
>  consisting of packets of size 64 bytes, the following command would limit the
>  egress transmission rate of the port to ~1,000,000 packets per second::
> @@ -52,6 +55,24 @@ To clear the QoS configuration from the port and ovsdb, 
> run::
>  
>      $ ovs-vsctl destroy QoS vhost-user0 -- clear Port vhost-user0 qos
>  
> +Packets Per Second Policer
> ++++++++++++++++++++

Probably here too.

> +
> +Assuming you have a :doc:`vhost-user port <vhost-user>` transmitting traffic,
> +the following command would limit the egress transmission rate of the port to
> +~1,000,000 packets per second::
> +
> +       ovs-vsctl set port vhost-user0 qos=@newqos -- \
> +          --id=@newqos create qos type=kpkts-policer \
> +          other-config:kpkts_rate=1000 other-config:kpkts_burst=1000
> +
> +To examine the QoS configuration of the port, run::
> +
> +    $ ovs-appctl -t ovs-vswitchd qos/show vhost-user0
> +
> +To clear the QoS configuration from the port and ovsdb, run::
> +
> +    $ ovs-vsctl destroy QoS vhost-user0 -- clear Port vhost-user0 qos
>  
>  Multi Queue Policer
>  ~~~~~~~~~~~~~~~~~~~

...
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to