Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759826AbYC0MjP (ORCPT ); Thu, 27 Mar 2008 08:39:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760080AbYC0MiR (ORCPT ); Thu, 27 Mar 2008 08:38:17 -0400 Received: from courier.cs.helsinki.fi ([128.214.9.1]:36880 "EHLO mail.cs.helsinki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757077AbYC0MiJ (ORCPT ); Thu, 27 Mar 2008 08:38:09 -0400 From: "=?ISO-8859-1?Q?Ilpo_J=E4rvinen?=" To: Andrew Morton , David Miller , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnaldo Carvalho de Melo , "=?utf-8?q?Ilpo=20J=E4rvinen?=" Subject: [PATCH 1/7] [NET]: uninline skb_put, de-bloats a lot Date: Thu, 27 Mar 2008 14:38:00 +0200 Message-Id: <1206621486-5408-2-git-send-email-ilpo.jarvinen@helsinki.fi> X-Mailer: git-send-email 1.5.4.2.156.ge3c5 In-Reply-To: <1206621486-5408-1-git-send-email-ilpo.jarvinen@helsinki.fi> References: <1206621486-5408-1-git-send-email-ilpo.jarvinen@helsinki.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2945 Lines: 97 Allyesconfig (v2.6.24-mm1): ~500 files changed ... 869 funcs, 198 +, 111003 -, diff: -110805 --- skb_put skb_put | +104 Without number of debug related CONFIGs (v2.6.25-rc2-mm1): -60744 855 funcs, 861 +, 61605 -, diff: -60744 --- skb_put skb_put | +57 Signed-off-by: Ilpo J?rvinen --- include/linux/skbuff.h | 21 +-------------------- net/core/skbuff.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 7beb239..f085955 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -892,6 +892,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) /* * Add data to an sk_buff */ +extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len); static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) { unsigned char *tmp = skb_tail_pointer(skb); @@ -901,26 +902,6 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) return tmp; } -/** - * skb_put - add data to a buffer - * @skb: buffer to use - * @len: amount of data to add - * - * This function extends the used data area of the buffer. If this would - * exceed the total buffer size the kernel will panic. A pointer to the - * first byte of the extra data is returned. - */ -static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) -{ - unsigned char *tmp = skb_tail_pointer(skb); - SKB_LINEAR_ASSERT(skb); - skb->tail += len; - skb->len += len; - if (unlikely(skb->tail > skb->end)) - skb_over_panic(skb, len, current_text_addr()); - return tmp; -} - static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) { skb->data -= len; diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 0d0fd28..3402eca 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -857,6 +857,27 @@ free_skb: return err; } +/** + * skb_put - add data to a buffer + * @skb: buffer to use + * @len: amount of data to add + * + * This function extends the used data area of the buffer. If this would + * exceed the total buffer size the kernel will panic. A pointer to the + * first byte of the extra data is returned. + */ +unsigned char *skb_put(struct sk_buff *skb, unsigned int len) +{ + unsigned char *tmp = skb_tail_pointer(skb); + SKB_LINEAR_ASSERT(skb); + skb->tail += len; + skb->len += len; + if (unlikely(skb->tail > skb->end)) + skb_over_panic(skb, len, __builtin_return_address(0)); + return tmp; +} +EXPORT_SYMBOL(skb_put); + /* Trims skb to length len. It can change skb pointers. */ -- 1.5.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/