1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

Block in start_xmit when ring is full

This commit is contained in:
Alex Forencich 2022-01-27 23:34:38 -08:00
parent f98d831014
commit 155aa5caae

View File

@ -536,6 +536,8 @@ class TxRing:
self.tail_ptr = 0
self.clean_tail_ptr = 0
self.clean_event = Event()
self.packets = 0
self.bytes = 0
@ -1087,6 +1089,8 @@ class Interface:
ring.clean_tail_ptr = ring_clean_tail_ptr
ring.clean_event.set()
async def process_rx_cq(self, cq_ring):
self.log.info("Process RX CQ %d (interface %d)", cq_ring.ring_index, self.index)
@ -1163,7 +1167,14 @@ class Interface:
ring = self.tx_queues[ring_index]
tail_ptr = ring.tail_ptr
while True:
# check for space in ring
if ring.head_ptr - ring.clean_tail_ptr < ring.full_size:
break
# wait for space
ring.clean_event.clear()
await ring.clean_event.wait()
index = ring.head_ptr & ring.size_mask