From patchwork Thu Apr 4 18:18:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 2394491 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0D4143FD8C for ; Thu, 4 Apr 2013 18:18:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764372Ab3DDSSR (ORCPT ); Thu, 4 Apr 2013 14:18:17 -0400 Received: from na3sys010aog104.obsmtp.com ([74.125.245.76]:37818 "HELO na3sys010aog104.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1764323Ab3DDSSQ (ORCPT ); Thu, 4 Apr 2013 14:18:16 -0400 Received: from mail-pa0-f69.google.com ([209.85.220.69]) (using TLSv1) by na3sys010aob104.postini.com ([74.125.244.12]) with SMTP ID DSNKUV3D5uT6vnc97b/sA1U2xHu2+cYwmunl@postini.com; Thu, 04 Apr 2013 11:18:14 PDT Received: by mail-pa0-f69.google.com with SMTP id kq13so2753514pab.0 for ; Thu, 04 Apr 2013 11:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google; h=x-received:x-received:sender:from:to:cc:subject:date:message-id :x-mailer; bh=PUIpOt9FW8b5Ist2n+Rgo1m5X8wn68+V3lo/pFFa2OA=; b=AYeUfy54ub/h2gTciksFD5D3E4f0cpnCfkUQo0wk+qsy6DQB2Ye6uTpXTz3Yyhtl96 8VMqLZYA+v8TpQH+qoywnqTX2uAjLRQvv76N4QiuvIck12+dPGCF6J19aTKufc0yMOf9 kSSsASgchC64koDFD3LZMfeOJ/1akQq3i0RG8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-received:sender:from:to:cc:subject:date:message-id :x-mailer:x-gm-message-state; bh=PUIpOt9FW8b5Ist2n+Rgo1m5X8wn68+V3lo/pFFa2OA=; b=Af4PSHtTaKDLakbKh1JJrGMjp/kn6KskyxRjJPs7iMpcoBpUG2kVxLar129esy0LZN EGYycPEQk7z28qVuscptKdwhyD03cvx6OYWUS9s4Pc/WYP4YNlIXVk0m+ogf4YM5Ul82 Aa0MG/zsSPmqvauuML4er13lYjgTAAQdrXvo/LRwwmiiNb/QNVM04voeAlAuMRJnz8xS xEWj4kX7eVLf+raRaQ4DbTrTfi6Q5kYEoQrGdoUA/9XArWv47REIqrsIrvrSP1kxr3pY hd2Ejk3vwwcdZpE5P0360FcTg9zyMM1rGqN7uAwFY3fbG1wdPfeavwbLcoFMe7guhsYP EDzQ== X-Received: by 10.66.245.105 with SMTP id xn9mr11218972pac.35.1365099494087; Thu, 04 Apr 2013 11:18:14 -0700 (PDT) X-Received: by 10.66.245.105 with SMTP id xn9mr11218956pac.35.1365099493971; Thu, 04 Apr 2013 11:18:13 -0700 (PDT) Received: from roland-t410s.purestorage.com ([216.200.155.2]) by mx.google.com with ESMTPS id bs1sm11098584pbc.8.2013.04.04.11.18.11 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Apr 2013 11:18:12 -0700 (PDT) From: Roland Dreier To: linux-rdma@vger.kernel.org, Markus Stockhausen Cc: Roland Dreier , Eric Dumazet Subject: [PATCH/RFC] IPoIB: Leave space in skb linear buffer for IP headers Date: Thu, 4 Apr 2013 11:18:02 -0700 Message-Id: <1365099482-30287-1-git-send-email-roland@kernel.org> X-Mailer: git-send-email 1.8.1.2 X-Gm-Message-State: ALoCoQkih9uLn3ntHpCUjE3+1tA8JrSPOonMffMR73zUIbEZgdEBrPvkNdWwTy8cUg+DAyxZUxrrkWqUm5E3jhth1CSAWcaGWcefe86EILEKkTRyfYy9QglDheVjSrStfuIoPCbcMYFCU4gv7cqI+Q7udrS9blBEJ6x+siLGD2kdeFJ33KhsWcU= Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Roland Dreier Markus Stockhausen noticed that IPoIB was spending significant time doing memcpy() in __pskb_pull_tail(). He found that this is because his adapter reports a maximum MTU of 4K, which causes IPoIB datagram mode to receive all the actual data in a separate page in the fragment list. We're already allocating extra tailroom for the skb linear part, so we might as well use it. Cc: Eric Dumazet Reported-by: Markus Stockhausen Signed-off-by: Roland Dreier --- drivers/infiniband/ulp/ipoib/ipoib.h | 3 ++- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 12 +++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index eb71aaa..ab2cc4c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h @@ -64,7 +64,8 @@ enum ipoib_flush_level { enum { IPOIB_ENCAP_LEN = 4, - IPOIB_UD_HEAD_SIZE = IB_GRH_BYTES + IPOIB_ENCAP_LEN, + /* add 128 bytes of tailroom for IP/TCP headers */ + IPOIB_UD_HEAD_SIZE = IB_GRH_BYTES + IPOIB_ENCAP_LEN + 128, IPOIB_UD_RX_SG = 2, /* max buffer needed for 4K mtu */ IPOIB_CM_MTU = 0x10000 - 0x10, /* padding to align header to 16 */ diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 2cfa76f..9eaa58e 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -156,18 +156,12 @@ static struct sk_buff *ipoib_alloc_rx_skb(struct net_device *dev, int id) struct ipoib_dev_priv *priv = netdev_priv(dev); struct sk_buff *skb; int buf_size; - int tailroom; u64 *mapping; - if (ipoib_ud_need_sg(priv->max_ib_mtu)) { - buf_size = IPOIB_UD_HEAD_SIZE; - tailroom = 128; /* reserve some tailroom for IP/TCP headers */ - } else { - buf_size = IPOIB_UD_BUF_SIZE(priv->max_ib_mtu); - tailroom = 0; - } + buf_size = ipoib_ud_need_sg(priv->max_ib_mtu) ? + IPOIB_UD_HEAD_SIZE : IPOIB_UD_BUF_SIZE(priv->max_ib_mtu); - skb = dev_alloc_skb(buf_size + tailroom + 4); + skb = dev_alloc_skb(buf_size + 4); if (unlikely(!skb)) return NULL;