From patchwork Mon Dec 15 01:57:34 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Ortiz X-Patchwork-Id: 13967 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 6E5DEDDF9F for ; Mon, 15 Dec 2008 13:03:44 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751765AbYLOCD2 (ORCPT ); Sun, 14 Dec 2008 21:03:28 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751824AbYLOCDY (ORCPT ); Sun, 14 Dec 2008 21:03:24 -0500 Received: from 42.mail-out.ovh.net ([213.251.189.42]:51313 "HELO 42.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751707AbYLOCDL (ORCPT ); Sun, 14 Dec 2008 21:03:11 -0500 Received: (qmail 30385 invoked by uid 503); 15 Dec 2008 01:56:11 -0000 Received: from b7.ovh.net (HELO mail246.ha.ovh.net) (213.186.33.57) by 42.mail-out.ovh.net with SMTP; 15 Dec 2008 01:56:11 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 15 Dec 2008 01:56:31 -0000 Received: from aannecy-256-1-36-87.w90-10.abo.wanadoo.fr (HELO sortiz-mobl) (samuel%sortiz.org@90.10.35.87) by ns0.ovh.net with SMTP; 15 Dec 2008 01:56:29 -0000 Message-Id: <20081215015900.428084321@sortiz.org> References: <20081215015729.587697008@sortiz.org> User-Agent: quilt/0.46-1 Date: Mon, 15 Dec 2008 02:57:34 +0100 From: Samuel Ortiz To: "David S. Miller" Cc: netdev@vger.kernel.org, irda-users@lists.sourceforge.net Subject: [RFC PATCH 5/9] irda: Introduce irda_dev_alloc_skb Content-Disposition: inline; filename=0005-irda-Introduce-irda_dev_alloc_skb.patch X-Ovh-Tracer-Id: 13352328472335394966 X-Ovh-Remote: 90.10.35.87 (aannecy-256-1-36-87.w90-10.abo.wanadoo.fr) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|H 0.5/N Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Some RX skbs are cloned and then sent back to the transmitter. In order to avoid reallocation on that code path, we get more space from the beginning on the RX path. Signed-off-by: Samuel Ortiz --- include/net/irda/irda.h | 1 + net/irda/irda_device.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h index ce510aa..213d4c0 100644 --- a/include/net/irda/irda.h +++ b/include/net/irda/irda.h @@ -133,4 +133,5 @@ extern int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, struct net_device *orig_dev); extern struct sk_buff *irda_alloc_skb(unsigned int size, gfp_t priority); +extern struct sk_buff *irda_dev_alloc_skb(unsigned int size); #endif /* NET_IRDA_H */ diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 5271015..62b991c 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c @@ -308,6 +308,18 @@ struct sk_buff *irda_alloc_skb(unsigned int size, gfp_t priority) } EXPORT_SYMBOL(irda_alloc_skb); +struct sk_buff *irda_dev_alloc_skb(unsigned int size) +{ + struct sk_buff *skb; + + skb = dev_alloc_skb(size + sizeof(struct irda_skb_cb)); + if (likely(skb)) + skb_reserve(skb, sizeof(struct irda_skb_cb)); + + return skb; +} +EXPORT_SYMBOL(irda_dev_alloc_skb); + #ifdef CONFIG_ISA_DMA_API /* * Function setup_dma (idev, buffer, count, mode)