From patchwork Mon Feb 9 03:34:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 22640 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 40777DDDA1 for ; Mon, 9 Feb 2009 14:34:47 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754304AbZBIDei (ORCPT ); Sun, 8 Feb 2009 22:34:38 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754303AbZBIDeh (ORCPT ); Sun, 8 Feb 2009 22:34:37 -0500 Received: from 74-93-104-97-Washington.hfc.comcastbusiness.net ([74.93.104.97]:49983 "EHLO sunset.davemloft.net" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753581AbZBIDeg (ORCPT ); Sun, 8 Feb 2009 22:34:36 -0500 Received: from localhost (localhost [127.0.0.1]) by sunset.davemloft.net (Postfix) with ESMTP id 98135C8D94C; Sun, 8 Feb 2009 19:34:30 -0800 (PST) Date: Sun, 08 Feb 2009 19:34:30 -0800 (PST) Message-Id: <20090208.193430.237334266.davem@davemloft.net> To: blaschka@linux.vnet.ibm.com Cc: netdev@vger.kernel.org Subject: Re: TX pre-headers... From: David Miller In-Reply-To: <20090207.001041.146584084.davem@davemloft.net> References: <20090206.014107.231141422.davem@davemloft.net> <498C26C5.7010003@linux.vnet.ibm.com> <20090207.001041.146584084.davem@davemloft.net> X-Mailer: Mew version 6.1 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Miller Date: Sat, 07 Feb 2009 00:10:41 -0800 (PST) > From: Frank Blaschka > Date: Fri, 06 Feb 2009 13:02:13 +0100 > > > Absolutely yes, this would help the s/390 qeth drivers too > > Well, I did some research and it seems all of the cases we could > actually solve with such a scheme need at a maximum 32 bytes. > > We already ensure 16 bytes, via NET_SKB_PAD. > > So instead of all of this complex "who has the largest TX header size > and what is it" code, we can simply increase NET_SKB_PAD to 32. > > You still need that headroom check there, simply because tunneling and > other device stacking situations can cause the headroom to be depleted > before your device sees the packet. > > Any objections? :-) Nobody objected, at least for now, so I commited this change, as follows: net: Increase default NET_SKB_PAD to 32. Several devices need to insert some "pre headers" in front of the main packet data when they transmit a packet. Currently we allocate only 16 bytes of pad room and this ends up not being enough for some types of hardware (NIU, usb-net, s390 qeth, etc.) So increase this to 32. Note that drivers still need to check in their transmit routine whether enough headroom exists, and if not use skb_realloc_headroom(). Tunneling, IPSEC, and other encapsulation methods can cause the padding area to be used up. Signed-off-by: David S. Miller --- include/linux/skbuff.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 08670d0..5eba400 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1287,7 +1287,7 @@ static inline int skb_network_offset(const struct sk_buff *skb) * The networking layer reserves some headroom in skb data (via * dev_alloc_skb). This is used to avoid having to reallocate skb data when * the header has to grow. In the default case, if the header has to grow - * 16 bytes or less we avoid the reallocation. + * 32 bytes or less we avoid the reallocation. * * Unfortunately this headroom changes the DMA alignment of the resulting * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive @@ -1295,11 +1295,11 @@ static inline int skb_network_offset(const struct sk_buff *skb) * perhaps setting it to a cacheline in size (since that will maintain * cacheline alignment of the DMA). It must be a power of 2. * - * Various parts of the networking layer expect at least 16 bytes of + * Various parts of the networking layer expect at least 32 bytes of * headroom, you should not reduce this. */ #ifndef NET_SKB_PAD -#define NET_SKB_PAD 16 +#define NET_SKB_PAD 32 #endif extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);