Thread (74 messages) 74 messages, 14 authors, 2021-12-01

[PATCH v2 net-next 23/26] igc: bail out early on XSK xmit if no descs are available

From: Alexander Lobakin <hidden>
Date: 2021-11-23 16:42:51
Also in: linux-doc, linux-rdma, lkml, netdev
Subsystem: intel ethernet drivers, networking drivers, the rest · Maintainers: Tony Nguyen, Przemek Kitszel, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

There's no need to fetch an XSK pool desc in case our ring is full,
we can rather quit under unlikely branch.
Can't skip taking a lock here unfortunately since igc_desc_unused()
assumes we call it being locked.
This was designed to track xsk_tx::full counter, but won't hurt
either way.

Signed-off-by: Alexander Lobakin <redacted>
Reviewed-by: Jesse Brandeburg <redacted>
Reviewed-by: Michal Swiatkowski <redacted>
---
 drivers/net/ethernet/intel/igc/igc_main.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 8e448288ee26..7d0c540d6b76 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -2604,6 +2604,8 @@ static void igc_xdp_xmit_zc(struct igc_ring *ring)
 	__netif_tx_lock(nq, cpu);

 	budget = igc_desc_unused(ring);
+	if (unlikely(!budget))
+		goto out_unlock;

 	while (xsk_tx_peek_desc(pool, &xdp_desc) && budget--) {
 		u32 cmd_type, olinfo_status;
@@ -2644,6 +2646,7 @@ static void igc_xdp_xmit_zc(struct igc_ring *ring)
 		xsk_tx_release(pool);
 	}

+out_unlock:
 	__netif_tx_unlock(nq);
 }

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