From patchwork Tue Sep 20 03:39:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 672076 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 3sdT6Z4PkMz9sC7 for ; Tue, 20 Sep 2016 13:40:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=EXaI/iHv; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754061AbcITDjj (ORCPT ); Mon, 19 Sep 2016 23:39:39 -0400 Received: from mail-qk0-f175.google.com ([209.85.220.175]:36103 "EHLO mail-qk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753200AbcITDjg (ORCPT ); Mon, 19 Sep 2016 23:39:36 -0400 Received: by mail-qk0-f175.google.com with SMTP id z190so4286568qkc.3 for ; Mon, 19 Sep 2016 20:39:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xq957xwoFcTbZg6ihZXdRl60UInETp1haSx/KsA0zHI=; b=EXaI/iHvD3N0tVbizG3SkI62RjjkV2cXF9SatOu6riNbZ337nsW0DfUYfzcW2BCZeW L6T9EVbRO5M64BdkaiCpFs3uZqIp2EQp4VJyXFhDnCMJAUOPbrG4nxKbDlcgHCVRaVKV FNCnNGuICr+cEc+76/LYu5d+ilbZgPsQAlxbLv2g9TJsFXjAfxCcAr3tv+VMz6c7w4+4 1FMNU4In+YqFfeQux1CCKOCOG3wtnN9pdYlK5ZSE8OjxaVJwBG1p/WkbTx2dtCbgA9YE bDb7EP7Dj0oGPchtUaNRP37ixifEtrIlibbmyF7Mr0cZFRVmgvpkVRsF/banjiZXdNhZ uLWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xq957xwoFcTbZg6ihZXdRl60UInETp1haSx/KsA0zHI=; b=CBaiI7vvQEltz0WGgpZgzmBCaAbGhH3JDW4kfyUw1lUYz454PZ5oT/2vADOGxHP4ED XkR1JKyDPdfoY9Q0hxK82SDfwRxtsSGEg2lyexq8u3YAvWwS9sFIWBVvZX+GNnkRFM8j A/r7dIMrXCrULX1dy2FCK9xjzegrj05JuyHfOyrnSiBTisDeonUku3Xr/ebsLKXOgz/e 8ohSXhvumk9M7NlFdte/HXuHz7cLzfpTe1KfTHBcAOzeytbi4klYKsjVoxkmdk8gAFP5 MePdg4FqHmsinxATh9HO+zUjZatcOHTZaramAEgn2GfbAUKJFJMvAOFi9amZG0WDMTQe eHUw== X-Gm-Message-State: AE9vXwOUBvs+5orDwpmab6UDNO6PxlXwGgmeefjeU0R3ptJzlsgs+d7qi/5MYsPIcVdPrdtj X-Received: by 10.55.8.138 with SMTP id 132mr35173269qki.198.1474342775125; Mon, 19 Sep 2016 20:39:35 -0700 (PDT) Received: from joy.nyc.corp.google.com ([100.101.230.104]) by smtp.gmail.com with ESMTPSA id m4sm14901942qkf.29.2016.09.19.20.39.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Sep 2016 20:39:34 -0700 (PDT) From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Eric Dumazet , Soheil Hassas Yeganeh , Neal Cardwell , Yuchung Cheng Subject: [PATCH v4 net-next 05/16] tcp: switch back to proper tcp_skb_cb size check in tcp_init() Date: Mon, 19 Sep 2016 23:39:12 -0400 Message-Id: <1474342763-16715-6-git-send-email-ncardwell@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1474342763-16715-1-git-send-email-ncardwell@google.com> References: <1474342763-16715-1-git-send-email-ncardwell@google.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet Revert to the tcp_skb_cb size check that tcp_init() had before commit b4772ef879a8 ("net: use common macro for assering skb->cb[] available size in protocol families"). As related commit 744d5a3e9fe2 ("net: move skb->dropcount to skb->cb[]") explains, the sock_skb_cb_check_size() mechanism was added to ensure that there is space for dropcount, "for protocol families using it". But TCP is not a protocol using dropcount, so tcp_init() doesn't need to provision space for dropcount in the skb->cb[], and thus we can revert to the older form of the tcp_skb_cb size check. Doing so allows TCP to use 4 more bytes of the skb->cb[] space. Fixes: b4772ef879a8 ("net: use common macro for assering skb->cb[] available size in protocol families") Signed-off-by: Eric Dumazet Signed-off-by: Soheil Hassas Yeganeh Signed-off-by: Neal Cardwell Signed-off-by: Yuchung Cheng --- net/ipv4/tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 5b0b49c..9d1ae18 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3244,11 +3244,12 @@ static void __init tcp_init_mem(void) void __init tcp_init(void) { - unsigned long limit; int max_rshare, max_wshare, cnt; + unsigned long limit; unsigned int i; - sock_skb_cb_check_size(sizeof(struct tcp_skb_cb)); + BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > + FIELD_SIZEOF(struct sk_buff, cb)); percpu_counter_init(&tcp_sockets_allocated, 0, GFP_KERNEL); percpu_counter_init(&tcp_orphan_count, 0, GFP_KERNEL);