From patchwork Fri Feb 3 17:19:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander H Duyck X-Patchwork-Id: 723833 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vFNsK6BnVz9s77 for ; Sat, 4 Feb 2017 04:19:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Efg1/dqR"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 74986262C0; Fri, 3 Feb 2017 17:19:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id otfAsrf7L5YF; Fri, 3 Feb 2017 17:19:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 4D81430306; Fri, 3 Feb 2017 17:19:45 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id F288C1C0306 for ; Fri, 3 Feb 2017 17:19:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id EB8C030306 for ; Fri, 3 Feb 2017 17:19:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 124Gbk7op1Zz for ; Fri, 3 Feb 2017 17:19:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f172.google.com (mail-pf0-f172.google.com [209.85.192.172]) by silver.osuosl.org (Postfix) with ESMTPS id 976A9262C0 for ; Fri, 3 Feb 2017 17:19:41 +0000 (UTC) Received: by mail-pf0-f172.google.com with SMTP id y143so7269413pfb.0 for ; Fri, 03 Feb 2017 09:19:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=CrB20UmFjKTojaIgqRqi2n85SehcdruCFP3+blLTyLg=; b=Efg1/dqRlmlEe7OpDsbWcK5fujH2R6b2ZO76SLqatiruz7y1UY6VF2sSmvjfQFGRQ6 +KXwA+u5fdCxDLLb1tNwOa+HWJWIx3g6jV3FMOmocK6rCz/lmPTFw2DZSic+isJH5xWL 6MQPDgZCUWAIzIVsfJ0Zrsub9IYMECkmwmfUw/m/lVUZPOEMOwqrMu/zI1XmtGpSEFk3 4uRDYBl22/FzD4j+ZnFOiHkaTH7mbboGGs/nRMsPTXFVSsYE4zNWVXSmdpPpXjbdhmrP lYpeTrFhym+MSkN6PXOrcgP0e1SH7+BA+LOxmmRA1hl1tcdjp7DnHBRLKkHpQhIMnk3s Kqww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=CrB20UmFjKTojaIgqRqi2n85SehcdruCFP3+blLTyLg=; b=kdpCEyQD07KiVRpMQ2e9KYU63pojBcollBXpXtsXzv4dWFsVvDvLDvkQ6bfLSXD11G sbZFQ9P4IeMfLRrQYRF3X33X7dYPCGwdxB8jpAOSBJ2k7Bhf89SJk0JdjtN0r6rF0CHX mKe3dcjbhYl7FZoNukwltdHXadHtXRiAtnDIsMN5wkqtDV2ro7IzZ9DSjEXxr40R1Sm7 RPbN9kTXhCaE9ivZSQXdqhMsiV8m1Uc9pzXY+ShSon0v9fsHlYq8k2u3uXIyad0ef1t4 tqUywkFS8phXMdoBmL+1RJga3aHOs3KyXARutXnDaMVgl2OXc4mz81TMrixcjAdt7BdF GRxA== X-Gm-Message-State: AIkVDXL1Hmw81X4dzbmxNS/2qh5nqmaKQeCYggZI+JHVzks6Gc0zHd32F68ib+EmL643mA== X-Received: by 10.84.196.131 with SMTP id l3mr22735023pld.150.1486142381126; Fri, 03 Feb 2017 09:19:41 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id r78sm68642491pfl.63.2017.02.03.09.19.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 09:19:40 -0800 (PST) From: Alexander Duyck To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com Date: Fri, 03 Feb 2017 09:19:40 -0800 Message-ID: <20170203171601.13255.10335.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Intel-wired-lan] [next PATCH] ixgbe: Limit use of 2K buffers on architectures with 256B or larger cache lines X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" From: Alexander Duyck On architectures that have a cache line size larger than 64 Bytes we start running into issues where the amount of headroom for the frame starts shrinking. The size of skb_shared_info on a system with a 64B L1 cache line size is 320. This increases to 384 with a 128B cache line, and 512 with a 256B cache line. In addition the NET_SKB_PAD value increases as well consistent with the cache line size. As a result when we get to a 256B cache line as seen on the s390 we end up 768 bytes used by padding and shared info leaving us with only 1280 bytes to use for data storage. On architectures such as this we should default to using 3K Rx buffers out of a 8K page instead of trying to do 1.5K buffers out of a 4K page. To take all of this into account I have added one small check so that we compare the max_frame to the amount of actual data we can store. This was already occurring for igb, but I had overlooked it for ixgbe as it doesn't have strict limits for 82599 once we enable jumbo frames. By adding this check we will automatically enable 3K Rx buffers as soon as the maximum frame size we can handle drops below the standard Ethernet MTU. I also went through and fixed one small typo that I found where I had left an IGB in a variable name due to a copy/paste error. Signed-off-by: Alexander Duyck Tested-by: Andrew Bowers --- Testing Hints: If at all possible it would be best to try testing this patch on some other architectures such as PPC64. In lieu of that just build testing via the kernel build robot will probably have to do. The only architecture I can identify that might actually have an issue that this fixes is s390 which last I knew there was none of in the labs at Intel for testing. Basic Rx testing will suffice otherwise. Also I am okay with this patch just being merged into the earlier patch "ixgbe: Add support for padding packet" if you want to go that route. I just figured it wasn't worth the trouble to resend the entire set for a minor issue. drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 3537d07b4807..77bf71db85af 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -99,7 +99,7 @@ #define IXGBE_MAX_FRAME_BUILD_SKB \ (SKB_WITH_OVERHEAD(IXGBE_RXBUFFER_2K) - IXGBE_SKB_PAD) #else -#define IGB_MAX_FRAME_BUILD_SKB IXGBE_RXBUFFER_2K +#define IXGBE_MAX_FRAME_BUILD_SKB IXGBE_RXBUFFER_2K #endif /* diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 787cee9c59d3..bfcdc2fdeae4 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -4009,7 +4009,8 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state); - if (max_frame > (ETH_FRAME_LEN + ETH_FCS_LEN)) + if ((max_frame > (ETH_FRAME_LEN + ETH_FCS_LEN)) || + (max_frame > IXGBE_MAX_FRAME_BUILD_SKB)) set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state); #endif }