Re: [net-next v13 04/11] net: mtip: The L2 switch driver for imx287

From: Paolo Abeni
Date: Tue Jun 24 2025 - 09:27:58 EST


On 6/22/25 11:37 AM, Lukasz Majewski wrote:
> +static void mtip_aging_timer(struct timer_list *t)
> +{
> + struct switch_enet_private *fep = timer_container_of(fep, t,
> + timer_aging);
> +
> + fep->curr_time = mtip_timeincrement(fep->curr_time);
> +
> + mod_timer(&fep->timer_aging,
> + jiffies + msecs_to_jiffies(LEARNING_AGING_INTERVAL));
> +}

It's unclear to me why you decided to maintain this function and timer
while you could/should have used a macro around jiffies instead.

[...]
> +static int mtip_sw_learning(void *arg)
> +{
> + struct switch_enet_private *fep = arg;
> +
> + while (!kthread_should_stop()) {
> + set_current_state(TASK_INTERRUPTIBLE);
> + /* check learning record valid */
> + mtip_atable_dynamicms_learn_migration(fep, fep->curr_time,
> + NULL, NULL);
> + schedule_timeout(HZ / 100);
> + }
> +
> + return 0;
> +}

Why are you using a full blown kernel thread here? Here a timer could
possibly make more sense. Why are checking the table every 10ms, while
the learning intervall is 100ms? I guess you could/should align the
frequency here with such interval.

Side note: I think you should move the buffer management to a later
patch: this one is still IMHO too big.

/P