From patchwork Wed Jan 25 13:56:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 137768 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.180.67]) by ozlabs.org (Postfix) with ESMTP id E43BAB6EEC for ; Thu, 26 Jan 2012 00:56:37 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755395Ab2AYN4g (ORCPT ); Wed, 25 Jan 2012 08:56:36 -0500 Received: from mail-bk0-f46.google.com ([209.85.214.46]:45560 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755065Ab2AYN4e (ORCPT ); Wed, 25 Jan 2012 08:56:34 -0500 Received: by bkas6 with SMTP id s6so4405246bka.19 for ; Wed, 25 Jan 2012 05:56:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:subject:from:to:cc:date:content-type:x-mailer :content-transfer-encoding:mime-version; bh=J7G9n/92AGihE+3YKs8PwbXakSEQ+Tdk0R9+dJD6L5M=; b=sAgwNbp1knrtq+8y4bNy3xg90OKcj6seNkE2X2alQhM8yA2bw0DhzU5yNK+nmzRNAM jdH6HvW8oyWU+XjweRbHLeZmOV5FjOXRFxoOgRhfItymhaVUqf9OIHwiD85/DtFaXtqI Xs5O1Zp2D2sQCoH9vz4Da+57QKq0KYi8PaxaU= Received: by 10.205.124.17 with SMTP id gm17mr5597780bkc.69.1327499793670; Wed, 25 Jan 2012 05:56:33 -0800 (PST) Received: from [10.150.51.214] (gw0.net.jmsp.net. [212.23.165.14]) by mx.google.com with ESMTPS id ez5sm1107668bkc.15.2012.01.25.05.56.31 (version=SSLv3 cipher=OTHER); Wed, 25 Jan 2012 05:56:32 -0800 (PST) Message-ID: <1327499790.2425.45.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC> Subject: [PATCH net-next] be2net: allocate more headroom in incoming skbs From: Eric Dumazet To: David Miller Cc: netdev , Ian Campbell , Vasundhara Volam , Sathya Perla , Ajit Khaparde Date: Wed, 25 Jan 2012 14:56:30 +0100 X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Allocation of 64 bytes in skb headroom is not enough if we have to pull ethernet + ipv6 + tcp headers, and/or extra tunneling header. Its currently not noticed because netdev_alloc_skb_ip_align(64) give us more room, thanks to power-of-two kmalloc() roundups. Make sure we ask for 128 bytes so that side effects of upcoming patches from Ian Campbell dont decrease benet rx performance, because of extra skb head reallocations. Signed-off-by: Eric Dumazet Cc: Ian Campbell Cc: Vasundhara Volam Cc: Sathya Perla Cc: Ajit Khaparde --- drivers/net/ethernet/emulex/benet/be.h | 3 +++ drivers/net/ethernet/emulex/benet/be_main.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index cbdec25..5ee7cc0 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h @@ -74,6 +74,9 @@ static inline char *nic_name(struct pci_dev *pdev) /* Number of bytes of an RX frame that are copied to skb->data */ #define BE_HDR_LEN ((u16) 64) +/* allocate extra space to allow tunneling decapsulation without head reallocation */ +#define BE_RX_SKB_ALLOC_SIZE (BE_HDR_LEN + 64) + #define BE_MAX_JUMBO_FRAME_SIZE 9018 #define BE_MIN_MTU 256 diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index e703d64..0fbf365 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -1189,7 +1189,7 @@ static void be_rx_compl_process(struct be_adapter *adapter, struct net_device *netdev = adapter->netdev; struct sk_buff *skb; - skb = netdev_alloc_skb_ip_align(netdev, BE_HDR_LEN); + skb = netdev_alloc_skb_ip_align(netdev, BE_RX_SKB_ALLOC_SIZE); if (unlikely(!skb)) { rx_stats(rxo)->rx_drops_no_skbs++; be_rx_compl_discard(adapter, rxo, rxcp);