On Wed, 4 Nov 2020 15:08:57 +0100 Magnus Karlsson wrote: > From: Magnus Karlsson <magnus.karlsson@xxxxxxxxx> > > Introduce lazy Tx completions when a queue is used for AF_XDP > zero-copy. In the current design, each time we get into the NAPI poll > loop we try to complete as many Tx packets as possible from the > NIC. This is performed by reading the head pointer register in the NIC > that tells us how many packets have been completed. Reading this > register is expensive as it is across PCIe, so let us try to limit the > number of times it is read by only completing Tx packets to user-space > when the number of available descriptors in the Tx HW ring is below > some threshold. This will decrease the number of reads issued to the > NIC and improves performance with 1.5% - 2% for the l2fwd xdpsock > microbenchmark. > > The threshold is set to the minimum possible size that the HW ring can > have. This so that we do not run into a scenario where the threshold > is higher than the configured number of descriptors in the HW ring. > > Signed-off-by: Magnus Karlsson <magnus.karlsson@xxxxxxxxx> I feel like this needs a big fat warning somewhere. It's perfectly fine to never complete TCP packets, but AF_XDP could be used to implement protocols in user space. What if someone wants to implement something like TSQ?