]> git.ipfire.org Git - thirdparty/iproute2.git/commit
tc/police: enable use of 64 bit burst parameter
authorJay Vosburgh <jay.vosburgh@canonical.com>
Tue, 16 Sep 2025 21:57:31 +0000 (14:57 -0700)
committerDavid Ahern <dsahern@kernel.org>
Thu, 18 Sep 2025 02:18:52 +0000 (02:18 +0000)
commit3b26e8abf4044b2b6382f5e189eb0fc8c85da154
treeeb46e0a51caf7f16cd32eabb4ed35c9377c934ee
parent13b999aa74c88e90a7f6f033893c2a0974f827ae
tc/police: enable use of 64 bit burst parameter

Modify tc police to permit burst sizes up to the limit of the
kernel API, which may exceed 4 GB of burst size at higher rates.

 As presently implemented, the tc police burst option limits the
size of the burst to 4 GB in size.  This is a reasonable limit for the
rates common when this was developed.  However, the underlying
implementation of burst is expressed in terms of time at the specified
rate, and for higher rates, a burst size exceeding 4 GB is feasible
without modification to the kernel.

The kernel API specifies the burst size as the number of "psched
ticks" needed to send the burst at the specified rate.  As each psched
tick is 64 nsec, the actual kernel limit on burst size is approximately
274.88 seconds (UINT_MAX * 64 / NSEC_PER_SEC).

For example, at a rate of 10 Gbit/sec, the current 4 GB size limit
corresponds to just under 3.5 seconds.

Additionally, overflows (burst values that exceed UINT_MAX psched
ticks) are now correctly detected, and flagged as an error, rather than
passing arbitrary psched tick values to the kernel.

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
tc/m_police.c