Thread (5 messages) flat view 5 messages, 2 authors, 2021-08-26

Re: [PATCH net-next v2 2/3] bnxt: count packets discarded because of netpoll

From: Michael Chan <michael.chan@broadcom.com>
Date: 2021-08-26 06:58:25

On Wed, Aug 25, 2021 at 6:47 PM Jakub Kicinski [off-list ref] wrote:
quoted hunk ↗ jump to hunk
bnxt may discard packets if Rx completions are consumed
in an attempt to let netpoll make progress. It should be
exteremely rare in practice but nonetheless such events
should be counted.

Since completion ring memory is allocated dynamically use
a similar scheme to what is done for HW stats to save them.

Report the stats in rx_dropped and per-netdev ethtool
counter. Chances that users care which ring dropped are
very low.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c     | 31 ++++++++++++++-----
 drivers/net/ethernet/broadcom/bnxt/bnxt.h     |  2 ++
 .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c |  6 ++++
 3 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index d39449e7b236..d12a9052388f 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -2003,6 +2003,7 @@ static int bnxt_force_rx_discard(struct bnxt *bp,
        struct rx_cmp *rxcmp;
        u16 cp_cons;
        u8 cmp_type;
+       int ret;

        cp_cons = RING_CMP(tmp_raw_cons);
        rxcmp = (struct rx_cmp *)
@@ -2031,7 +2032,10 @@ static int bnxt_force_rx_discard(struct bnxt *bp,
                tpa_end1->rx_tpa_end_cmp_errors_v2 |=
                        cpu_to_le32(RX_TPA_END_CMP_ERRORS);
        }
-       return bnxt_rx_pkt(bp, cpr, raw_cons, event);
+       ret = bnxt_rx_pkt(bp, cpr, raw_cons, event);
+       if (ret != -EBUSY)
+               cpr->sw_stats.rx.rx_netpoll_discards += 1;
To be more accurate, we should also skip counting if ret is 0.  0
means it is a TPA_START completion for the start of an aggregated
packet.  We haven't dropped this aggregated packet yet until we
process the TPA_END completion.
+       return ret;
 }

 u32 bnxt_fw_health_readl(struct bnxt *bp, int reg_idx)

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help