Re: [PATCH net RFC] net: Clear IFF_TX_SKB_SHARING for all Ethernet devices using skb_padto

From: Jakub Kicinski
Date: Fri Oct 23 2020 - 13:31:23 EST


On Thu, 22 Oct 2020 19:25:40 -0700 Xie He wrote:
> On Thu, Oct 22, 2020 at 6:56 PM Xie He <xie.he.0141@xxxxxxxxx> wrote:
> > My patch isn't complete. Because there are so many drivers with this
> > problem, I feel it's hard to solve them all at once. So I only grepped
> > "skb_padto" under "drivers/net/ethernet". There are other drivers
> > under "ethernet" using "skb_pad", "skb_put_padto" or "eth_skb_pad".
> > There are also (fake) Ethernet drivers under "drivers/net/wireless". I
> > feel it'd take a long time and also be error-prone to solve them all,
> > so I feel it'd be the best if there are other solutions.
>
> BTW, I also see some Ethernet drivers calling skb_push to prepend
> strange headers to the skbs. For example,
>
> drivers/net/ethernet/mellanox/mlxsw/switchx2.c prepends a header of
> MLXSW_TXHDR_LEN (16).
>
> We can't send shared skbs to these drivers either because they modify the skbs.
>
> It seems to me that many drivers have always assumed that they can
> modify the skb whenever needed. They've never considered there might
> be shared skbs. I guess adding IFF_TX_SKB_SHARING to ether_setup was a
> bad idea. It not only made the code less clean, but also didn't agree
> with the actual situations of the drivers.

Indeed. If we remove IFF_TX_SKB_SHARING from ether_setup we may need to
add the flag to the drivers that used to work, otherwise people using
pktgen will see a regression.