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

From
Xie He <hidden>
Date
2020-10-22 20:00:26
Also in
lkml
Reply to
Jakub Kicinski, 2020-10-22
On Thu, Oct 22, 2020 at 8:22 AM Jakub Kicinski [off-list ref] wrote:
Are most of these drivers using skb_padto()? Is that the reason they
can't be sharing the SKB?
Yes, I think if a driver calls skb_pad / skb_padto / skb_put_padto /
eth_skb_pad, the driver can't accept shared skbs because it may modify
the skbs.
I think the IFF_TX_SKB_SHARING flag is only used by pktgen, so perhaps
we can make sure pktgen doesn't generate skbs < dev->min_mtu, and then
the drivers won't pad?
Yes, I see a lot of drivers just want to pad the skb to ETH_ZLEN, or
just call eth_skb_pad. In this case, requiring the shared skb to be at
least dev->min_mtu long can solve the problem for these drivers.

But I also see some drivers that want to pad the skb to a strange
length, and don't set their special min_mtu to match this length. For
example:

drivers/net/ethernet/packetengines/yellowfin.c wants to pad the skb to
a dynamically calculated value.

drivers/net/ethernet/ti/cpsw.c, cpsw_new.c and tlan.c want to pad the
skb to macro defined values.

drivers/net/ethernet/intel/iavf/iavf_txrx.c wants to pad the skb to
IAVF_MIN_TX_LEN (17).

drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c wants to pad the skb to 17.

Another solution I can think of is to add a "skb_shared" check to
"__skb_pad", so that if __skb_pad encounters a shared skb, it just
returns an error. The driver would think this is a memory allocation
failure. This way we can ensure shared skbs are not modified.
Thread (8 messages) 8 messages, 2 authors, last reply 2020-10-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help