net: mscc: ocelot: report FIFO drop counters through stats->rx_dropped
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 8 Sep 2022 16:48:06 +0000 (19:48 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Sep 2022 09:59:12 +0000 (10:59 +0100)
commitcc160fc29a264726b2bfbc2f551081430db3df03
treef9d9e8521a0dae820076cb1b4e36588b710efcbf
parent25027c8409b4541611d0060077607d8ca70740df
net: mscc: ocelot: report FIFO drop counters through stats->rx_dropped

if_link.h says:

 * @rx_dropped: Number of packets received but not processed,
 *   e.g. due to lack of resources or unsupported protocol.
 *   For hardware interfaces this counter may include packets discarded
 *   due to L2 address filtering but should not include packets dropped
 *   by the device due to buffer exhaustion which are counted separately in
 *   @rx_missed_errors (since procfs folds those two counters together).

Currently we report "stats->rx_dropped = dev->stats.rx_dropped", the
latter being incremented by various entities in the stack. This is not
wrong, but we'd like to move ocelot_get_stats64() in the common ocelot
switch lib which is independent of struct net_device.

To do that, report the hardware RX drop counters instead. These drops
are due to policer action, or due to no destinations. When we have no
memory in the queue system, report this through rx_missed_errors, as
instructed.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mscc/ocelot_net.c