Messages in this thread | | | Date | Thu, 3 Feb 2022 12:10:27 -0800 | From | Jakub Kicinski <> | Subject | Re: [RFC PATCH v7 00/16] Add support for qca8k mdio rw in Ethernet packet |
| |
On Thu, 3 Feb 2022 20:21:28 +0200 Vladimir Oltean wrote: > To my knowledge, when you call dev_queue_xmit(), the skb is no longer > yours, end of story, it doesn't matter whether you increase the refcount > on it or not. The DSA master may choose to do whatever it wishes with > that buffer after its TX completion interrupt fires: it may not call > napi_consume_skb() but directly recycle that buffer in its pool of RX > buffers, as part of some weird buffer recycling scheme. So you'll think > that the buffer is yours, but it isn't, because the driver hasn't > returned it to the allocator, and your writes for the next packet may be > concurrent with some RX DMA transactions. I don't have a mainline > example to give you, but I've seen the pattern, and I don't think it's > illegal (although of course, I stand to be corrected if necessary).
Are we talking about holding onto the Tx skb here or also recycling the Rx one? Sorry for another out of context comment in advance..
AFAIK in theory shared skbs are supposed to be untouched or unshared explicitly by the driver on Tx. pktgen takes advantage of it. We have IFF_TX_SKB_SHARING.
In practice everyone gets opted into SKB_SHARING because ether_setup() sets the flag. A lot of drivers are not aware of the requirement and will assume full ownership (and for example use skb->cb[]) :/
I don't think there is any Tx completion -> Rx pool recycling scheme inside the drivers (if that's what you described).
| |