From patchwork Fri Jun 13 09:27:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 4071 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=178.209.62.157; helo=s3.neomailbox.net; envelope-from=antonio@meshcoding.com; receiver=b.a.t.m.a.n@lists.open-mesh.org Received: from s3.neomailbox.net (s3.neomailbox.net [178.209.62.157]) by open-mesh.org (Postfix) with ESMTPS id DB1A3600A30 for ; Fri, 13 Jun 2014 11:28:48 +0200 (CEST) From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 13 Jun 2014 11:27:14 +0200 Message-Id: <1402651634-30966-1-git-send-email-antonio@meshcoding.com> Cc: antonio@meshcoding.com Subject: [B.A.T.M.A.N.] [PATCH] net: add __pskb_copy_fclone and pskb_copy_for_clone X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jun 2014 09:28:49 -0000 From: Octavian Purdila 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 Cc: Dmitry Eremin-Solenikov Cc: Marek Lindner Cc: Simon Wunderlich Cc: Antonio Quartulli Cc: Marcel Holtmann Cc: Gustavo Padovan Cc: Johan Hedberg Cc: Arvid Brodin Cc: Patrick McHardy Cc: Pablo Neira Ayuso Cc: Jozsef Kadlecsik Cc: Lauro Ramos Venancio Cc: Aloisio Almeida Jr Cc: Samuel Ortiz Cc: Jon Maloy Cc: Allan Stephens Cc: Andrew Hendry Cc: Eric Dumazet Reviewed-by: Christoph Paasch Signed-off-by: Octavian Purdila Signed-off-by: David S. Miller --- compat.h | 6 ++++++ distributed-arp-table.c | 2 +- network-coding.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compat.h b/compat.h index 28f4cfe..ed5b815 100644 --- a/compat.h +++ b/compat.h @@ -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_ */ diff --git a/distributed-arp-table.c b/distributed-arp-table.c index b7406e0..b598111 100644 --- a/distributed-arp-table.c +++ b/distributed-arp-table.c @@ -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)) { diff --git a/network-coding.c b/network-coding.c index 40a2fc4..8d04d17 100644 --- a/network-coding.c +++ b/network-coding.c @@ -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;