🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23716

Re: [PATCH net-next V3 3/5] net/mlx5: nodnic: Add TX/RX statistics

#23716
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 19:03
86 lines
11199 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] mlx5_nodnic_handle_err_cqe() in
  drivers/net/ethernet/mellanox/mlx5/nodnic/en.c counts failed send…

--

net/mlx5: nodnic: Add TX/RX statistics

This commit adds TX and RX packet and byte counters to the nodnic
driver, plus a TX drop counter. The counters are updated from the xmit,
send completion, error completion and receive paths. They are exposed
through ndo_get_stats64.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/nodnic/en.c b/drivers/net/ethernet/mellanox/mlx5/nodnic/en.c
> index 6400e100bcb10..38dd7498568e2 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/nodnic/en.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/nodnic/en.c
> @@ -85,10 +85,15 @@ static void mlx5_nodnic_handle_err_cqe(struct mlx5_nodnic_cq *cq,
>  
>  	if (opcode == OPCODE_CQ_SEND_ERR) {
>  		struct mlx5_nodnic_sq *sq = &priv->sq;
> -		u16 sq_pi = mlx5_nodnic_sq_get_pi(sq, wqe_counter);
> +		struct mlx5_nodnic_tx_wqe_info *wi;
> +		u16 sq_pi;
>  
> -		mlx5_nodnic_complete_send_wqe(sq, &sq->wqe_info[sq_pi],
> -					      napi_budget);
> +		sq_pi = mlx5_nodnic_sq_get_pi(sq, wqe_counter);
> +		wi = &sq->wqe_info[sq_pi];
> +
> +		mlx5_nodnic_sq_stats_inc(&priv->sq_stats, wi);

[Severity: Medium]
Should an error completion count as a successful transmit here?

The normal path in mlx5_nodnic_handle_send_cqe() uses the same helper,
mlx5_nodnic_sq_stats_inc(). It increments sq_stats.packets and adds
wi->num_bytes to sq_stats.bytes. mlx5_nodnic_get_stats64() then reports
those values as tx_packets and tx_bytes.

An OPCODE_CQ_SEND_ERR CQE means the device did not complete the WQE,
for example LOCAL_LENGTH_ERR, LOCAL_PROT_ERR or WR_FLUSH_ERR. After the
SQ enters the error state, every outstanding WQE completes with
WR_FLUSH_ERR, and each of those would be counted as transmitted.

The rtnl_link_stats64 kernel-doc in include/uapi/linux/if_link.h defines
tx_packets as packets the device "acknowledged it copied them out of
host memory". Flushed or rejected WQEs don't meet that definition.

These failures are also not reported anywhere else.
mlx5_nodnic_update_sq_stats() never sets tx_errors, and tx_dropped only
counts WQE build failures in mlx5_nodnic_xmit():

    do {
        start = u64_stats_fetch_begin(&sq->xmit_syncp);
        s->tx_dropped = u64_stats_read(&sq->dropped);
    } while (u64_stats_fetch_retry(&sq->xmit_syncp, start));

As a result, after an SQ error, ip -s link would show every flushed
packet and byte as transmitted, with zero errors.

The slot still has to be released through
mlx5_nodnic_complete_send_wqe(). Could this branch increment a separate
error counter instead, and report it as tx_errors (or tx_dropped)?

> +
> +		mlx5_nodnic_complete_send_wqe(sq, wi, napi_budget);
>  	} else {
>  		struct mlx5_nodnic_rq *rq = &priv->rq;
>  		u16 ci = wqe_counter & (rq->ring.num_entries - 1);

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126182448.707782-1-tariqt%40nvidia.com
Technical Details
Message-ID: <179580622240.3135.9305281980559404975@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372920-linux-kernel-netdev=dewy.ru
References: <20261126182448.707782-4-tariqt@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372920-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next V3 3/5] net/mlx5: nodnic: Add TX/RX statistics
Date: Fri, 27 Nov 2026 19:03:42 +0000
Organization: Usenet Network
Message-ID: <179580622240.3135.9305281980559404975@kernel.org>
References: <20261126182448.707782-4-tariqt@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="796443"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3pHRhE9mmlVQMHy2+EmhuWeL7/g= sha256:lHxUmDIS8m67IxYrFeYd2gmdpcuB5CWugWjrcC/fh/Q=
	sha1:mhOlnFVBun3FpnjWvpBj0xDRu9M= sha256:3d90zXtEFzejXcX5VXFO7YgoiYxgP5h1gASeNkxmzWk=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 29DBA125F63; Fri, 27 Nov 2026 22:04:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id duiEwWZqTMxm;
	Fri, 27 Nov 2026 22:04:14 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372920-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id A7504125F5E; Fri, 27 Nov 2026 22:04:05 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 35FD92F8EA; Fri, 27 Nov 2026 19:03:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795806230;
	b=YLUypWMxukJbhTPvQLKtsK35jywb4HgHaaUzls48PPlWYcc9qDQYodS7GZm5PBOVj87E
	 7jUlGi0xtuc/9czut5Emckt/JcRnmj9E1YFIf829r41YXtgvUekuG9A1wRw4iekmioryG
	 a2IbV84WiJdCMgKX/onwD+tFggdMtY2tk1BWGcR7CWk5sAaVJvd8awmmsXCfKs464jy5Z
	 f1ROnMi1+np8iq2xnjArRXcm1UKr5uPYImM2WKRXTPI72KgK1z+GvvNLvLYhy5R5CCcVi
	 ytixTdaAoQ7cngTHF7lyzyzqw47+5QyJVnUCutNksdgCHphxGlBFL1Vu+unmbjP4zXg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795806230;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=J1hz33671+fJ5SeQS+zZhxuApW2iPJMyNeB7Cy214d8=;
	b=kS51AwCwtNNuvYSjMeFTqJs8iBiFkBAvi6RNZDDRufxWHjeZpKpmlbPxan4Jr5XsDPCR
	 Re3ycNXacBw/wumDFX+FVXRQVu/yMFcxhCidFD2ZW/UwfxKZJIH4bK8a+18U5eQZ3joFq
	 qGTaog78NmfOE8TYX7CKSTTbMqQ/oP/Aj7XLyHeZ0RITFym6qfmZZqR2uek7uZRIMnnzB
	 GdrwtFt1rlTyOQeKbQ0kUUf4YMlqTN4uk2x8oG6pYnA0h66eDSqouwAxs2lYsfyMa47Xl
	 l42zkMsyVS8EL2Qy3DCAeb09GzaOvQmoYPnBw8UDI8QvGDQd9g80HCXdsp5di7SqUPw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GnT7TbB0;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 07BBE606A330;
	Fri, 27 Nov 2026 19:03:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GnT7TbB0
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795806224;
	b=UEnrjfbmAV3CZlBSp5q4C6p+8eW+qg8gp+DRL9DpdhmbjEeQSIJ8x0KQ2qcT/LQ9801z
	 TIrj5SlN3IHFppJdgmtI5JZZtb36B/Ral6gV0A7tTHrMY9ngJKUWbV/4t4JIyEGO5YLDB
	 eN6u1r+oJombmjKv0V2Bekpbtig9oXYrLNRHKHe6DA6V5dQE+p++YtXdXf0tw2XvHII5b
	 UhtTtcJAboGA3DbsM17DLdmgHZG4yxVVHi+LUTfg3Qu05zQFT9+RIzRW3nvsNvLcg8Kf5
	 GgjYSi2UQMvudx1w71hYqvozc0Oxfo/nMYFEUfFbBdOdR0kpVHXFuRLK3YQt+1QmZ5g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795806224;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=J1hz33671+fJ5SeQS+zZhxuApW2iPJMyNeB7Cy214d8=;
	b=Lzf827JgdiyFS7r4UBlUlk+EDf++qPgKr8veFeuDihDhrgodcQJl/puW/zgw5erNIHiz
	 mzlzXnia7yARUhLGsr1dpjx1t0PBcL1mGZePfPXFSFlqkeANvkv7MSCLxlXQtFTpb3KXU
	 xNOsKd0F81kfXvIE4IxvUmozLxug8gPTzO3CROSsutm+DSW2f1RK7vRvX9QxQpwvT4Xq5
	 jtANefqOIcuYnT/eqhKTkfgKKN7G4nP6+c4yXFZ33MEpXiDqwPdpqL2MfjX4wdldjQdOH
	 1Rg/7owDYZmFZ6buCLi+qG6eyoPo//k0HoT78D+qsmPZgaUV2rr0mTepczYBYFEoEPg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GnT7TbB0;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27B3B606A327;
	Fri, 27 Nov 2026 19:03:43 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D504E1F000C1;
	Fri, 27 Nov 2026 19:03:42 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795806223;
	bh=J1hz33671+fJ5SeQS+zZhxuApW2iPJMyNeB7Cy214d8=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=GnT7TbB0NKP6hPHRqFGEicJqqs40MzUBIOILa4NCIGMCgCG7/CEIJgUmngNg2Yd3M
	 +j9mxNA1ceEUW9SoWAe/2ZVXhzAUnauwM713QnKBS4lTRerQ9YlAVJU5wQM1VsrmeX
	 eXrcpx/QJADS11BJga1wi3lgmbiQPZJNrIRwekDSaeEqENoeOW80fM2P8qsZ3INxNC
	 wxPX9BC7/3HPuG8k6LRaWjftOy6StShxticsGdz6+WNmTGF9SdS3Obn6kIYsVOSQJZ
	 wsqXezReCJjjBI8g2wQvf+9rYskNBb8/7nvO/KlTNAUP+J8jbPd3L8gwuHFT7wzeBh
	 CRza4ueL2BYaQ==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com,
 cjubran@nvidia.com, gal@nvidia.com, linux-kernel@vger.kernel.org,
 shshitrit@nvidia.com, horms@kernel.org
X-In-Reply-To: <20261126182448.707782-4-tariqt@nvidia.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list