Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: remove skb_orphan_try()

Orphaning skb in dev_hard_start_xmit() makes bonding behavior
unfriendly for applications sending big UDP bursts : Once packets
pass the bonding device and come to real device, they might hit a full
qdisc and be dropped. Without orphaning, the sender is automatically
throttled because sk->sk_wmemalloc reaches sk->sk_sndbuf (assuming
sk_sndbuf is not too big)

We could try to defer the orphaning adding another test in
dev_hard_start_xmit(), but all this seems of little gain,
now that BQL tends to make packets more likely to be parked
in Qdisc queues instead of NIC TX ring, in cases where performance
matters.

Reverts commits :
fc6055a5ba31 net: Introduce skb_orphan_try()
87fd308cfc6b net: skb_tx_hash() fix relative to skb_orphan_try()
and removes SKBTX_DRV_NEEDS_SK_REF flag

Reported-and-bisected-by: Jean-Michel Hautbois <jhautbois@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
62b1a8ab bc14786a

+3 -31
+2 -5
include/linux/skbuff.h
··· 225 225 /* device driver is going to provide hardware time stamp */ 226 226 SKBTX_IN_PROGRESS = 1 << 2, 227 227 228 - /* ensure the originating sk reference is available on driver level */ 229 - SKBTX_DRV_NEEDS_SK_REF = 1 << 3, 230 - 231 228 /* device driver supports TX zero-copy buffers */ 232 - SKBTX_DEV_ZEROCOPY = 1 << 4, 229 + SKBTX_DEV_ZEROCOPY = 1 << 3, 233 230 234 231 /* generate wifi status information (where possible) */ 235 - SKBTX_WIFI_STATUS = 1 << 5, 232 + SKBTX_WIFI_STATUS = 1 << 4, 236 233 }; 237 234 238 235 /*
-3
net/can/raw.c
··· 681 681 if (err < 0) 682 682 goto free_skb; 683 683 684 - /* to be able to check the received tx sock reference in raw_rcv() */ 685 - skb_shinfo(skb)->tx_flags |= SKBTX_DRV_NEEDS_SK_REF; 686 - 687 684 skb->dev = dev; 688 685 skb->sk = sk; 689 686
+1 -22
net/core/dev.c
··· 2089 2089 return 0; 2090 2090 } 2091 2091 2092 - /* 2093 - * Try to orphan skb early, right before transmission by the device. 2094 - * We cannot orphan skb if tx timestamp is requested or the sk-reference 2095 - * is needed on driver level for other reasons, e.g. see net/can/raw.c 2096 - */ 2097 - static inline void skb_orphan_try(struct sk_buff *skb) 2098 - { 2099 - struct sock *sk = skb->sk; 2100 - 2101 - if (sk && !skb_shinfo(skb)->tx_flags) { 2102 - /* skb_tx_hash() wont be able to get sk. 2103 - * We copy sk_hash into skb->rxhash 2104 - */ 2105 - if (!skb->rxhash) 2106 - skb->rxhash = sk->sk_hash; 2107 - skb_orphan(skb); 2108 - } 2109 - } 2110 - 2111 2092 static bool can_checksum_protocol(netdev_features_t features, __be16 protocol) 2112 2093 { 2113 2094 return ((features & NETIF_F_GEN_CSUM) || ··· 2173 2192 2174 2193 if (!list_empty(&ptype_all)) 2175 2194 dev_queue_xmit_nit(skb, dev); 2176 - 2177 - skb_orphan_try(skb); 2178 2195 2179 2196 features = netif_skb_features(skb); 2180 2197 ··· 2283 2304 if (skb->sk && skb->sk->sk_hash) 2284 2305 hash = skb->sk->sk_hash; 2285 2306 else 2286 - hash = (__force u16) skb->protocol ^ skb->rxhash; 2307 + hash = (__force u16) skb->protocol; 2287 2308 hash = jhash_1word(hash, hashrnd); 2288 2309 2289 2310 return (u16) (((u64) hash * qcount) >> 32) + qoffset;
-1
net/iucv/af_iucv.c
··· 372 372 skb_trim(skb, skb->dev->mtu); 373 373 } 374 374 skb->protocol = ETH_P_AF_IUCV; 375 - skb_shinfo(skb)->tx_flags |= SKBTX_DRV_NEEDS_SK_REF; 376 375 nskb = skb_clone(skb, GFP_ATOMIC); 377 376 if (!nskb) 378 377 return -ENOMEM;