Patchwork [RFC,5/9] irda: Introduce irda_dev_alloc_skb

login
register
mail settings
Submitter Samuel Ortiz
Date Dec. 15, 2008, 1:57 a.m.
Message ID <20081215015900.428084321@sortiz.org>
Download mbox | patch
Permalink /patch/13967/
State RFC
Delegated to: David Miller
Headers show

Comments

Samuel Ortiz - Dec. 15, 2008, 1:57 a.m.
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 <samuel@sortiz.org>
---
 include/net/irda/irda.h |    1 +
 net/irda/irda_device.c  |   12 ++++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

Patch

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)