netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Gal Pressman <gal@nvidia.com>
Cc: Yafang Shao <laoar.shao@gmail.com>,
	Tariq Toukan <ttoukan.linux@gmail.com>,
	saeedm@nvidia.com, tariqt@nvidia.com, leon@kernel.org,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH] net/mlx5e: Report rx_discards_phy via rx_missed_errors
Date: Wed, 6 Nov 2024 17:17:17 -0800	[thread overview]
Message-ID: <20241106171717.1bf7331f@kernel.org> (raw)
In-Reply-To: <9b3af2dd-8b56-4817-b223-c6a85ba80562@nvidia.com>

On Wed, 6 Nov 2024 21:23:47 +0200 Gal Pressman wrote:
> > It appears that rx_fifo_errors is a more appropriate counter for this purpose.
> > I will submit a v2. Thanks for your suggestion.  
> 
> Probably not a good idea:
>  *   This statistics was used interchangeably with @rx_over_errors.
>  *   Not recommended for use in drivers for high speed interfaces.

FWIW we can change the definition. Let me copy paste below the commit
which added the docs because it has the background.

tl;dr is that I was trying to push drivers towards a single stat to
keep things simple. If we have a clear definition of how rx_fifo_errors
would differ - we can reuse it and update the doc. For example if
rx_discards_phy usually means that the adapter itself is overwhelmed
(too many rules etc) that would be a pretty clear, since rx_missed is
supposed to primarily indicate that the host rings are full or perhaps
the PCIe interface of the NIC is struggling. But not the packet
processing.



commit 0db0c34cfbc9838c1a14cb04dd880602abd699a7
Author: Jakub Kicinski <kuba@kernel.org>
Date:   Thu Sep 3 16:14:31 2020 -0700

    net: tighten the definition of interface statistics
    
    This patch is born out of an investigation into which IEEE statistics
    correspond to which struct rtnl_link_stats64 members. Turns out that
    there seems to be reasonable consensus on the matter, among many drivers.
    To save others the time (and it took more time than I'm comfortable
    admitting) I'm adding comments referring to IEEE attributes to
    struct rtnl_link_stats64.
    
    Up until now we had two forms of documentation for stats - in
    Documentation/ABI/testing/sysfs-class-net-statistics and the comments
    on struct rtnl_link_stats64 itself. While the former is very cautious
    in defining the expected behavior, the latter feel quite dated and
    may not be easy to understand for modern day driver author
    (e.g. rx_over_errors). At the same time modern systems are far more
    complex and once obvious definitions lost their clarity. For example
    - does rx_packet count at the MAC layer (aFramesReceivedOK)?
    packets processed correctly by hardware? received by the driver?
    or maybe received by the stack?
    
    I tried to clarify the expectations, further clarifications from
    others are very welcome.
    
    The part hardest to untangle is rx_over_errors vs rx_fifo_errors
    vs rx_missed_errors. After much deliberation I concluded that for
    modern HW only two of the counters will make sense. The distinction
    between internal FIFO overflow and packets dropped due to back-pressure
    from the host is likely too implementation (driver and device) specific
    to expose in the standard stats.
    
    Now - which two of those counters we select to use is anyone's pick:
    
    sysfs documentation suggests rx_over_errors counts packets which
    did not fit into buffers due to MTU being too small, which I reused.
    There don't seem to be many modern drivers using it (well, CAN drivers
    seem to love this statistic).
    
    Of the remaining two I picked rx_missed_errors to report device drops.
    bnxt reports it and it's folded into "drop"s in procfs (while
    rx_fifo_errors is an error, and modern devices usually receive the frame
    OK, they just can't admit it into the pipeline).
    
    Of the drivers I looked at only AMD Lance-like and NS8390-like use all
    three of these counters. rx_missed_errors counts missed frames,
    rx_over_errors counts overflow events, and rx_fifo_errors counts frames
    which were truncated because they didn't fit into buffers. This suggests
    that rx_fifo_errors may be the correct stat for truncated packets, but
    I'd think a FIFO stat counting truncated packets would be very confusing
    to a modern reader.

  reply	other threads:[~2024-11-07  1:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06  6:40 [PATCH] net/mlx5e: Report rx_discards_phy via rx_missed_errors Yafang Shao
2024-11-06  9:56 ` Tariq Toukan
2024-11-06 11:49   ` Yafang Shao
2024-11-06 19:23     ` Gal Pressman
2024-11-07  1:17       ` Jakub Kicinski [this message]
2024-11-08  8:39         ` Yafang Shao
2024-11-08  8:37       ` Yafang Shao

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=20241106171717.1bf7331f@kernel.org \
    --to=kuba@kernel.org \
    --cc=gal@nvidia.com \
    --cc=laoar.shao@gmail.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=ttoukan.linux@gmail.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;
as well as URLs for NNTP newsgroup(s).