lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aErjcH3NPbdP7Usx@MacBook-Air.local>
Date: Thu, 12 Jun 2025 17:25:52 +0300
From: Joe Damato <joe@...a.to>
To: Breno Leitao <leitao@...ian.org>
Cc: Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-team@...a.com
Subject: Re: [PATCH net-next 2/2] netdevsim: collect statistics at RX side

On Wed, Jun 11, 2025 at 08:06:20AM -0700, Breno Leitao wrote:
> When the RX side of netdevsim was added, the RX statistics were missing,
> making the driver unusable for GenerateTraffic() test framework.
> 
> This patch adds proper statistics tracking on RX side, complementing the
> TX path.
> 
> Signed-off-by: Breno Leitao <Leitao@...ian.org>
> ---
>  drivers/net/netdevsim/netdev.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index 67871d31252fe..590cb5bb0d20b 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -39,12 +39,16 @@ MODULE_IMPORT_NS("NETDEV_INTERNAL");
>  
>  static int nsim_napi_rx(struct nsim_rq *rq, struct sk_buff *skb)
>  {
> +	struct net_device *dev = rq->napi.dev;
> +
>  	if (skb_queue_len(&rq->skb_queue) > NSIM_RING_SIZE) {
>  		dev_kfree_skb_any(skb);
> +		dev_dstats_rx_dropped(dev);
>  		return NET_RX_DROP;
>  	}
>  
>  	skb_queue_tail(&rq->skb_queue, skb);
> +	dev_dstats_rx_add(dev, skb->len);
>  	return NET_RX_SUCCESS;
>  }

Hm, I was wondering: is it maybe better to add the stats code to nsim_poll or
nsim_rcv instead?

It "feels" like other drivers would be bumping RX stats in their NAPI poll
function (which is nsim_poll, the naming of the functions is a bit confusing
here), so it seems like netdevsim maybe should too?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ