From: Shahar Shitrit <shshitrit@nvidia.com>
To: netdev-bot+sashiko@kernel.org, tariqt@nvidia.com
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,
horms@kernel.org
Subject: Re: [PATCH net-next V3 3/5] net/mlx5: nodnic: Add TX/RX statistics
Date: Sun, 29 Nov 2026 16:46:03 +0200 [thread overview]
Message-ID: <bfa48961-6e39-4e99-a2dd-881e8f971e6d@nvidia.com> (raw)
In-Reply-To: <179580622240.3135.9305281980559404975@kernel.org>
On 27/11/2026 21:03, netdev-bot+sashiko@kernel.org wrote:
> 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);
>
> [ ... ]
>
TX error CQEs should be counted for tx_packets and bytes, like mlx5
count them. The doc says "Number of packets successfully transmitted.
For hardware interfaces counts packets which host was able to
successfully hand over to the device, whichdoes not necessarily mean
that packets had been successfully transmitted out of the device…".
next prev parent reply other threads:[~2026-11-29 14:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 18:24 [PATCH net-next V3 0/5] net/mlx5: Introduce mlx5_nodnic, a driver for DRAM-less NVIDIA Mellanox NIC functions Tariq Toukan
2026-11-26 18:24 ` [PATCH net-next V3 1/5] net/mlx5: nodnic: Introduce the mlx5_nodnic driver Tariq Toukan
2026-11-27 8:58 ` Paolo Abeni
2026-11-27 19:03 ` netdev-bot+sashiko
2026-11-29 14:40 ` Shahar Shitrit
2026-11-26 18:24 ` [PATCH net-next V3 2/5] net/mlx5: nodnic: Implement data path Tariq Toukan
2026-11-27 19:03 ` netdev-bot+sashiko
2026-11-29 14:44 ` Shahar Shitrit
2026-11-26 18:24 ` [PATCH net-next V3 3/5] net/mlx5: nodnic: Add TX/RX statistics Tariq Toukan
2026-11-27 19:03 ` netdev-bot+sashiko
2026-11-29 14:46 ` Shahar Shitrit [this message]
2026-11-26 18:24 ` [PATCH net-next V3 4/5] net/mlx5: nodnic: Add ethtool driver info Tariq Toukan
2026-11-27 19:03 ` netdev-bot+sashiko
2026-11-26 18:24 ` [PATCH net-next V3 5/5] net/mlx5: nodnic: Add health monitoring Tariq Toukan
2026-11-27 19:03 ` netdev-bot+sashiko
2026-11-29 14:47 ` Shahar Shitrit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bfa48961-6e39-4e99-a2dd-881e8f971e6d@nvidia.com \
--to=shshitrit@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=cjubran@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gal@nvidia.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox