mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 23:51:02 +02:00
net: macb: copy shared skbs before appending the FCS
macb_pad_and_fcs() appends the FCS in place when the skb has tailroom.
A shared skb, as pktgen sends in clone_skb mode, grows by one FCS per
transmit. BQL then completes more bytes than were queued and
dql_completed() hits its BUG_ON.
On a Raspberry Pi CM5 (RP1 GEM) pktgen with clone_skb 1000 burst 32 at
60 bytes kills the box within seconds.
Copy shared skbs before appending the FCS. Clearing IFF_TX_SKB_SHARING
would also fix it but makes pktgen refuse clone_skb on macb.
Fixes: 653e92a917 ("net: macb: add support for padding and fcs computation")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20261006-nb-macb-shared-skb-net-v1-2-a80641479041@tipi-net.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
6b48ed85ae
commit
9151d6c427
|
|
@ -2435,6 +2435,7 @@ static int macb_pad_and_fcs(struct sk_buff **skb, bool add_fcs)
|
|||
skb_is_nonlinear(*skb);
|
||||
int padlen = ETH_ZLEN - (*skb)->len;
|
||||
int tailroom = skb_tailroom(*skb);
|
||||
bool shared = skb_shared(*skb);
|
||||
struct sk_buff *nskb;
|
||||
u32 fcs;
|
||||
|
||||
|
|
@ -2443,7 +2444,8 @@ static int macb_pad_and_fcs(struct sk_buff **skb, bool add_fcs)
|
|||
|
||||
if (padlen <= 0) {
|
||||
/* FCS could be appended to tailroom. */
|
||||
if (!skb_is_nonlinear(*skb) && tailroom >= ETH_FCS_LEN)
|
||||
if (!shared && !skb_is_nonlinear(*skb) &&
|
||||
tailroom >= ETH_FCS_LEN)
|
||||
goto add_fcs;
|
||||
/* Reallocate with room for the FCS. */
|
||||
padlen = ETH_FCS_LEN;
|
||||
|
|
@ -2452,7 +2454,7 @@ static int macb_pad_and_fcs(struct sk_buff **skb, bool add_fcs)
|
|||
padlen += ETH_FCS_LEN;
|
||||
}
|
||||
|
||||
if (cloned || tailroom < padlen) {
|
||||
if (shared || cloned || tailroom < padlen) {
|
||||
nskb = skb_copy_expand(*skb, 0, padlen, GFP_ATOMIC);
|
||||
if (!nskb)
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user