[PATCH net-next 11/15] net: lan969x: add function for calculating the DSM calendar

Daniel Machon daniel.machon at microchip.com
Mon Oct 21 12:13:48 PDT 2024


Hi Maxime,

> Hi Daniel,
> 
> On Mon, 21 Oct 2024 15:58:48 +0200
> Daniel Machon <daniel.machon at microchip.com> wrote:
> 
> > Lan969x has support for RedBox / HSR / PRP (not implemented yet). In
> > order to accommodate for this in the future, we need to give lan969x it's
> > own function for calculating the DSM calendar.
> >
> > The function calculates the calendar for each taxi bus. The calendar is
> > used for bandwidth allocation towards the ports attached to the taxi
> > bus. A calendar configuration consists of up-to 64 slots, which may be
> > allocated to ports or left unused. Each slot accounts for 1 clock cycle.
> >
> > Also expose sparx5_cal_speed_to_value(), sparx5_get_port_cal_speed,
> > sparx5_cal_bw and SPX5_DSM_CAL_EMPTY for use by lan969x.
> >
> > Reviewed-by: Steen Hegelund <Steen.Hegelund at microchip.com>
> > Signed-off-by: Daniel Machon <daniel.machon at microchip.com>
> 
> [...]
> 
> > +     /* Place the remaining devices */
> > +     for (u32 i = 0; i < DSM_CAL_DEV_MAX; i++) {
> > +             speed = &dev_speeds[i];
> > +             for (u32 dev = 0; dev < speed->n_devs; dev++) {
> > +                     u32 idx = 0;
> > +
> > +                     for (n_slots = 0; n_slots < speed->n_slots; n_slots++) {
> > +                             lan969x_dsm_cal_idx_find_next_free(data->schedule,
> > +                                                                cal_len,
> > +                                                                &idx);
> 
> You're not checking the return of lan969x_dsm_cal_idx_find_next_free(),
> can this be a problem ?
> 
> Thanks,
> 
> Maxime

Yes, it should be checked as we have a finite number of calendar slots.

Will fix in v2. Thanks!

/Daniel




More information about the linux-arm-kernel mailing list