Skip to contentSkip to conversation

net: add __pskb_copy_fclone and pskb_copy_for_clone

PATCH Applied Antonio Quartulli 2 participants 2 messages Jun 13, 2014 – Jun 14, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: add __pskb_copy_fclone and pskb_copy_for_clone

From: Octavian Purdila <[email protected]>

There are several instances where a pskb_copy or __pskb_copy is immediately followed by an skb_clone.

Add a couple of new functions to allow the copy skb to be allocated from the fclone cache and thus speed up subsequent skb_clone calls.

Cc Alexander Smirnov <[email protected]>
Cc Dmitry Eremin-Solenikov <[email protected]>
Cc Marek Lindner <[email protected]>
Cc Simon Wunderlich <[email protected]>
Cc Antonio Quartulli <[email protected]>
Cc Marcel Holtmann <[email protected]>
Cc Gustavo Padovan <[email protected]>
Cc Johan Hedberg <[email protected]>
Cc Arvid Brodin <[email protected]>
Cc Patrick McHardy <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>
Cc Jozsef Kadlecsik <[email protected]>
Cc Lauro Ramos Venancio <[email protected]>
Cc Aloisio Almeida Jr <[email protected]>
Cc Samuel Ortiz <[email protected]>
Cc Jon Maloy <[email protected]>
Cc Allan Stephens <[email protected]>
Cc Andrew Hendry <[email protected]>
Cc Eric Dumazet <[email protected]>
---
 compat.h                | 6 ++++++
 distributed-arp-table.c | 2 +-
 network-coding.c        | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
compat.h +6 -0
index 28f4cfe..ed5b815 100644
@@ -440,4 +440,10 @@ static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
 
 #endif /* < KERNEL_VERSION(3, 14, 0) */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
+
+#define pskb_copy_for_clone pskb_copy
+
+#endif /* < KERNEL_VERSION(3, 16, 0) */
+
 #endif /* _NET_BATMAN_ADV_COMPAT_H_ */
distributed-arp-table.c +1 -1
index b7406e0..b598111 100644
@@ -595,7 +595,7 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
 		if (!neigh_node)
 			goto free_orig;
 
-		tmp_skb = pskb_copy(skb, GFP_ATOMIC);
+		tmp_skb = pskb_copy_for_clone(skb, GFP_ATOMIC);
 		if (!batadv_send_skb_prepare_unicast_4addr(bat_priv, tmp_skb,
 							   cand[i].orig_node,
 							   packet_subtype)) {
network-coding.c +1 -1
index 40a2fc4..8d04d17 100644
@@ -1344,7 +1344,7 @@ static void batadv_nc_skb_store_before_coding(struct batadv_priv *bat_priv,
 	struct ethhdr *ethhdr;
 
 	/* Copy skb header to change the mac header */
-	skb = pskb_copy(skb, GFP_ATOMIC);
+	skb = pskb_copy_for_clone(skb, GFP_ATOMIC);
 	if (!skb)
 		return;
 
Signature · 1 line
1.8.5.5
#1 lore raw
Quoted 30 lines · On Friday 13 June 2014 11:27:14 Antonio Quartulli wrote:

From: Octavian Purdila <[email protected]>

There are several instances where a pskb_copy or __pskb_copy is immediately followed by an skb_clone.

Add a couple of new functions to allow the copy skb to be allocated from the fclone cache and thus speed up subsequent skb_clone calls.

Cc Alexander Smirnov <[email protected]>
Cc Dmitry Eremin-Solenikov <[email protected]>
Cc Marek Lindner <[email protected]>
Cc Simon Wunderlich <[email protected]>
Cc Antonio Quartulli <[email protected]>
Cc Marcel Holtmann <[email protected]>
Cc Gustavo Padovan <[email protected]>
Cc Johan Hedberg <[email protected]>
Cc Arvid Brodin <[email protected]>
Cc Patrick McHardy <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>
Cc Jozsef Kadlecsik <[email protected]>
Cc Lauro Ramos Venancio <[email protected]>
Cc Aloisio Almeida Jr <[email protected]>
Cc Samuel Ortiz <[email protected]>
Cc Jon Maloy <[email protected]>
Cc Allan Stephens <[email protected]>
Cc Andrew Hendry <[email protected]>
Cc Eric Dumazet <[email protected]>
Quoted 5 lines
---
 compat.h                | 6 ++++++
 distributed-arp-table.c | 2 +-
 network-coding.c        | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

Applied in revision 8c12d63.

Thanks,
Marek