[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aExKCMX4SLM772xi@gmail.com>
Date: Fri, 13 Jun 2025 08:55:52 -0700
From: Breno Leitao <leitao@...ian.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
David Wei <dw@...idwei.uk>, Shuah Khan <shuah@...nel.org>,
Simon Horman <horms@...nel.org>, joe@...a.to,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH net-next v2 4/4] netdevsim: account dropped packet length
in stats on queue free
On Fri, Jun 13, 2025 at 07:55:07AM -0700, Jakub Kicinski wrote:
> On Fri, 13 Jun 2025 07:47:11 -0700 Breno Leitao wrote:
> > > static void nsim_queue_free(struct nsim_rq *rq)
> > > {
> > > + struct net_device *dev = rq->napi.dev;
> > > +
> > > hrtimer_cancel(&rq->napi_timer);
> > > + dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen);
> >
> > This is wrong and it will cause the kernel to crash in some cases, given
> > we can get here with dev == NULL, in the following path:
>
> It's probably because NAPI wasn't registered yet in some paths.
> You can pass dev in from the callers, it always exists, and all
> callers have it.
Right, that is a better approach.
I will update and send another version soon,
--breno
Powered by blists - more mailing lists