[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250110115548.GB7706@kernel.org>
Date: Fri, 10 Jan 2025 11:55:48 +0000
From: Simon Horman <horms@...nel.org>
To: Ahmed Zaki <ahmed.zaki@...el.com>
Cc: netdev@...r.kernel.org, intel-wired-lan@...ts.osuosl.org,
andrew+netdev@...n.ch, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, davem@...emloft.net, michael.chan@...adcom.com,
tariqt@...dia.com, anthony.l.nguyen@...el.com,
przemyslaw.kitszel@...el.com, jdamato@...tly.com, shayd@...dia.com,
akpm@...ux-foundation.org, shayagr@...zon.com,
kalesh-anakkur.purayil@...adcom.com
Subject: Re: [PATCH net-next v4 2/6] net: napi: add internal ARFS rmap
management
On Thu, Jan 09, 2025 at 04:31:03PM -0700, Ahmed Zaki wrote:
> For drivers using the netif_enable_cpu_rmap(), move the IRQ rmap notifier
> inside the napi_struct.
>
> Signed-off-by: Ahmed Zaki <ahmed.zaki@...el.com>
...
> diff --git a/net/core/dev.c b/net/core/dev.c
...
> +static int napi_irq_cpu_rmap_add(struct napi_struct *napi, int irq)
> +{
> + struct cpu_rmap *rmap = napi->dev->rx_cpu_rmap;
> + int rc;
> +
> + if (!napi || !rmap)
> + return -EINVAL;
Hi Ahmed,
Here it is assumed that napi may be NULL. But it is dereferenced
unconditionally on the first like of this function.
Flagged by Smatch.
> + napi->notify.notify = netif_irq_cpu_rmap_notify;
> + napi->notify.release = netif_napi_affinity_release;
> + cpu_rmap_get(rmap);
> + rc = cpu_rmap_add(rmap, napi);
> + if (rc < 0)
> + goto err_add;
> +
> + napi->napi_rmap_idx = rc;
> + rc = irq_set_affinity_notifier(irq, &napi->notify);
> + if (rc)
> + goto err_set;
> +
> + return 0;
> +
> +err_set:
> + rmap->obj[napi->napi_rmap_idx] = NULL;
> +err_add:
> + cpu_rmap_put(rmap);
> + return rc;
> +}
> #endif
>
> void netif_napi_set_irq(struct napi_struct *napi, int irq)
...
--
pw-bot: changes-requested
Powered by blists - more mailing lists