Skip to content

Commit 473089c

Browse files
v2.3: xdp: fix draining at exit when zerocopy is enabled (backport of #7284) (#7293)
xdp: fix draining at exit when zerocopy is enabled (#7284) Starting from 219f805 we always add some umem frames to the fill ring to avoid driver bugs. Since we don't actually use the RX path, those frames are never filled and returned to the umem, therefore shouldn't wait for them when we drain on exit. (cherry picked from commit 77450a5) Co-authored-by: Alessandro Decina <[email protected]>
1 parent 0190e31 commit 473089c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

xdp/src/tx_loop.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ pub fn tx_loop<T: AsRef<[u8]>>(
7777
};
7878

7979
let umem = socket.umem();
80+
let umem_tx_capacity = umem.available();
8081
let Tx {
8182
// this is where we'll queue frames
8283
ring,
@@ -271,11 +272,11 @@ pub fn tx_loop<T: AsRef<[u8]>>(
271272
assert_eq!(batched_packets, 0);
272273

273274
// drain the ring
274-
while umem.available() < umem.capacity() || ring.available() < ring.capacity() {
275+
while umem.available() < umem_tx_capacity || ring.available() < ring.capacity() {
275276
log::debug!(
276277
"draining xdp ring umem {}/{} ring {}/{}",
277278
umem.available(),
278-
umem.capacity(),
279+
umem_tx_capacity,
279280
ring.available(),
280281
ring.capacity()
281282
);

0 commit comments

Comments
 (0)