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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <alexandr.lobakin@xxxxxxxxx>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@xxxxxxxxx>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@xxxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux