[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230111143427.1127174-6-jgh@redhat.com>
Date: Wed, 11 Jan 2023 14:34:25 +0000
From: jgh@...hat.com
To: netdev@...r.kernel.org
Cc: Jeremy Harris <jgh@...hat.com>
Subject: [RFC PATCH 5/7] drivers: net: bnx2x: 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/bnx2x/bnx2x_cmn.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 145e338487b6..62fff8f3499b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -881,6 +881,7 @@ void bnx2x_csum_validate(struct sk_buff *skb, union eth_rx_cqe *cqe,
static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
{
u16 bd_cons, bd_prod, bd_prod_fw, comp_ring_cons;
+ int congestion_level = budget * 7 / 8;
struct eth_fast_path_rx_cqe *cqe_fp;
u16 sw_comp_cons, sw_comp_prod;
struct bnx2x *bp = fp->bp;
@@ -1089,6 +1090,11 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
le16_to_cpu(cqe_fp->vlan_tag));
+ /* We are congested if the napi budget is approached
+ */
+ if (unlikely(rx_pkt > congestion_level))
+ skb->congestion_experienced = true;
+
napi_gro_receive(&fp->napi, skb);
next_rx:
rx_buf->data = NULL;
--
2.39.0
Powered by blists - more mailing lists