[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230111143427.1127174-8-jgh@redhat.com>
Date: Wed, 11 Jan 2023 14:34:27 +0000
From: jgh@...hat.com
To: netdev@...r.kernel.org
Cc: Jeremy Harris <jgh@...hat.com>
Subject: [RFC PATCH 7/7] drivers: net: bnx2: NIC driver Rx ring ECN
From: Jeremy Harris <jgh@...hat.com>
Sample NIC driver support.
This is a less-preferred model, which will throttle based on the NAPI
budget rather than the receive ring fill level.
Signed-off-by: Jeremy Harris <jgh@...hat.com>
---
drivers/net/ethernet/broadcom/bnx2.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index f55ac9c7b6fd..c7d867114234 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -3143,6 +3143,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
{
u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod;
struct bnx2_rx_ring_info *rxr = &bnapi->rx_ring;
+ int congestion_level = budget * 7 / 8;
int rx_pkt = 0, pg_ring_used = 0;
struct l2_fhdr *rx_hdr;
@@ -3273,6 +3274,12 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
PKT_HASH_TYPE_L3);
skb_record_rx_queue(skb, bnapi - &bp->bnx2_napi[0]);
+
+ /* We are congested if the budget is approached
+ */
+ if (unlikely(rx_pkt > congestion_level))
+ skb->congestion_experienced = true;
+
napi_gro_receive(&bnapi->napi, skb);
rx_pkt++;
--
2.39.0
Powered by blists - more mailing lists