[ovs-dev] [PATCH ovs-dev v3 3/4] dpif-netdev: Use the u64 instead of u32 for buckets.

Tonghao Zhang xiangxia.m.yue at gmail.com
Tue Jan 12 11:40:38 UTC 2021


On Mon, Jan 11, 2021 at 7:43 PM Ilya Maximets <i.maximets at ovn.org> wrote:
>
> On 5/23/20 12:33 PM, xiangxia.m.yue at gmail.com wrote:
> > From: Tonghao Zhang <xiangxia.m.yue at gmail.com>
> >
> > When setting the meter rate to 4.3+Gbps, there is an overflow, the
> > meters don't work as expected.
> >
> > Cc: Ilya Maximets <i.maximets at ovn.org>
> > Cc: William Tu <u9012063 at gmail.com>
> > Cc: Jarno Rajahalme <jarno at ovn.org>
> > Cc: Ben Pfaff <blp at ovn.org>
> > Cc: Andy Zhou <azhou at ovn.org>
> > Cc: Pravin Shelar <pshelar at ovn.org>
> > Acked-by: William Tu <u9012063 at gmail.com>
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue at gmail.com>
> > ---
> >  include/openvswitch/ofp-meter.h | 2 +-
> >  lib/dpif-netdev.c               | 4 ++--
> >  lib/ofp-meter.c                 | 4 ++--
> >  3 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/include/openvswitch/ofp-meter.h b/include/openvswitch/ofp-meter.h
> > index 6776eae87e26..f55f89ac1a71 100644
> > --- a/include/openvswitch/ofp-meter.h
> > +++ b/include/openvswitch/ofp-meter.h
> > @@ -37,7 +37,7 @@ struct ofputil_meter_band {
> >      uint16_t type;
> >      uint8_t prec_level;         /* Non-zero if type == OFPMBT_DSCP_REMARK. */
> >      uint32_t rate;
> > -    uint32_t burst_size;
> > +    uint64_t burst_size;
>
> This structure is part of a public API.  We can't change it that simple.
>
> IIUC, the issue is on a datapath level, so it should be solvable without
> modifying anything outside the datapath code.
Good idea. Now the meter uses the burst_size of ofputil_meter_band to
store the buckets of meters,
it will overflow when we set the rate to 4294968. In my next version
patch, I remove the "up" and introduce the
"uint64_t burst_size", that may make the code clear, and fix that bug.
More details, please see my patch, thanks.
> Could you prepare this kind of fix and send it separately from the series?
Yes, I sent with another path, which related to that patch, but patch
1 was not included.
http://patchwork.ozlabs.org/project/openvswitch/patch/20210112113308.48307-1-xiangxia.m.yue@gmail.com/
http://patchwork.ozlabs.org/project/openvswitch/patch/20210112113308.48307-2-xiangxia.m.yue@gmail.com/
> Best regards, Ilya Maximets.



-- 
Best regards, Tonghao


More information about the dev mailing list