HomeFreeBSD

netmap: pkt-gen: init all slots of every tx ring

Description

netmap: pkt-gen: init all slots of every tx ring

sender_body() uses OPT_COPY to copy the frame into the destination slot
for the first 100,000 packets. Then it removes OPT_COPY to improve
performance. The function always starts with the first tx ring.

If multiple tx rings are in use, it is possible that the initial 100k
packets will only use the first ring. After OPT_COPY is removed, there
may come a time when the first ring is full and sender_body() will move
to the next ring which was never initialized. As a result it will send
all zero packets. (This was discovered when the receiving NIC reported
rx errors.)

Before any transmissions, step through every tx ring and set
NS_BUF_CHANGED on every slot. That will force send_packets() to
initialize the slot when first used. Since it only copies when
necessary, it performs better than always setting OPT_COPY. With this
change, there is no reason for the "drop copy" code.

Submitted by: Brian Poole <brian90013@gmail.com>
MFC after: 7 days

Details

Provenance
vmaffioneAuthored on Mar 6 2023, 5:22 PM
Parents
rG935b194ded5d: Mechanically convert usb ethernet drivers to DrvAPI
Branches
Unknown
Tags
Unknown