On Mon, Oct 19, 2020 at 10:30:47AM +0000, Vladimir Oltean wrote: > 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.
We also have length issues. Most scatter/gather DMA engines require the fragments are multiple of 4 bytes. Only the last segment does not have this length restriction. And some of the DSA tag headers are 2 bytes, or 1 byte. So some master devices are going to have to convert the fragments back to a linear buffer. Andrew