On Mon, Oct 19, 2020 at 08:33:27AM +0000, David Laight wrote: > Is it possible to send the extra bytes from a separate buffer fragment? > The entire area could be allocated (coherent) when the rings are > allocated. > That would save having to modify the skb at all. > > Even if some bytes of the frame header need 'adjusting' transmitting > from a copy may be faster - especially on systems with an iommu. > > Many (many) moons ago we found the cutoff point for copying frames > on a system with an iommu to be around 1k bytes.
Please help me understand better how to implement what you're suggesting. DSA switches have 3 places where they might insert a tag: 1. Between the source MAC address and the EtherType (this is the most common) 2. Before the destination MAC address 3. Before the FCS I imagine that the most common scenario (1) is also the most difficult to implement using fragments, since I would need to split the Ethernet header from the rest of the skb data area, which might defeat the purpose. Also, simply integrating these 3 code paths into something generic will bring challenges of its own. Lastly, I fully expect the buffers to have proper headroom and tailroom now (if they don't, then it's worth investigating what's the code path that doesn't observe our dev->needed_headroom and dev->needed_tailroom). The reallocation code is there just for clones (and as far as I understand, fragments won't save us from the need of reallocating the data areas of clones), and for short frames with DSA switches in case (3).