mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
netdev-dpdk: use 64-bit arithmetic when converting rates.
Force 64-bit arithmetic to be used when converting uint32_t rate
and burst parameters from kilobits per second to bytes per second,
avoiding incorrect behavior for rates exceeding UINT_MAX bits
per second.
Reported-by: "王志克" <wangzhike@jd.com>
Fixes: 9509913aa7
("netdev-dpdk.c: Add ingress-policing functionality.")
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Acked-By: Mark Michelson <mmichels@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Darrell Ball <dlu998@gmail.com>
This commit is contained in:
committed by
Darrell Ball
parent
d8c5a93bd1
commit
602c86681c
@@ -2231,8 +2231,8 @@ netdev_dpdk_policer_construct(uint32_t rate, uint32_t burst)
|
||||
rte_spinlock_init(&policer->policer_lock);
|
||||
|
||||
/* rte_meter requires bytes so convert kbits rate and burst to bytes. */
|
||||
rate_bytes = rate * 1000/8;
|
||||
burst_bytes = burst * 1000/8;
|
||||
rate_bytes = rate * 1000ULL / 8;
|
||||
burst_bytes = burst * 1000ULL / 8;
|
||||
|
||||
policer->app_srtcm_params.cir = rate_bytes;
|
||||
policer->app_srtcm_params.cbs = burst_bytes;
|
||||
|
Reference in New Issue
Block a user