Re: [PATCH net-next 03/10] net: microchip: sparx5: add support for Service Dual Leacky Buckets

From: Simon Horman
Date: Mon Feb 06 2023 - 05:19:26 EST


On Sun, Feb 05, 2023 at 08:11:02PM +0000, Daniel.Machon@xxxxxxxxxxxxx wrote:
> Hi Simon,
>
> Thanks for reviewing my patches, appreciate it!
>
> > > +static u32 sparx5_sdlb_group_get_last(struct sparx5 *sparx5, u32 group)
> > > +{
> > > + u32 itr, next;
> > > +
> > > + itr = sparx5_sdlb_group_get_first(sparx5, group);
> > > +
> > > + for (;;) {
> >
> > Unbounded loops like this give me some apprehension.
> > Will they always terminate?
>
> Yes, it will always terminate - unless the add() del() functions are
> buggy to begin with.
>
> The end of the leak chain is marked by an index pointing to itself, and
> this is the exit condition I am looking for in the unbounded loop.

Thanks for confirming, much appreciated.