From patchwork Mon Oct 25 22:13:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12583049 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8ABC8C433FE for ; Mon, 25 Oct 2021 22:13:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6555161073 for ; Mon, 25 Oct 2021 22:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233200AbhJYWQK (ORCPT ); Mon, 25 Oct 2021 18:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232817AbhJYWQJ (ORCPT ); Mon, 25 Oct 2021 18:16:09 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E95C1C061745 for ; Mon, 25 Oct 2021 15:13:46 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id t11so8867491plq.11 for ; Mon, 25 Oct 2021 15:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fK2AuSC/dL5cpRudqXJd07eLvFf8M8PsNRGcYkfsGpE=; b=dD7VSgxia3Piawxbcs2DqrfZkeWnIxz8X10/RDol1ZgxjnySrunHrp6G6wOUGu9Mo5 2uP0vzfnghz3Q0oUdoRWyjkNcwPpKpF9FTFcHOsausT4suJ9eOKF5UKq9gscXhIOvs5J BNjBv57IBQGpFsivfGQ3DfypJuuMA9lrCBSm7eY3ZcOTkKwNXeVmOPKYHz1V9gjJVa81 weJ+AK4FpPD6t5r0cvxr+n4ZbT06JMBje64oT2GEuRHlkIbIo7/Jj/tGVP+AarHUahJa wnsqPSVkS8KsFykugx2DqxhVpNAcTd71LBK1H0USq/yHudZ0K3cPrmWbPs27W170g1KM I7Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fK2AuSC/dL5cpRudqXJd07eLvFf8M8PsNRGcYkfsGpE=; b=orTlT6sSSQhnzdl0+KLDX9fSEb3fvXBIT2lcMWHHhwmN/Tlvi4TXGbnsKjsthUOfAz V7+N35nYUAT2e5DO4KnFYvSxUqLaqNTmdc5Iz56Kg3ghg4UsmJdm33XBtK/t3qKXdicr 7Z04/G+4oQDurdF9PCaPJ6XlKeapL8W2pI+UUrbammaqznlYOkI128W/H2Zyo3co0K9O FSlVm9nn1Idw31RfkNk8oNO4HdgGTWTfVy7UgY2CdK9HdZQBkjN/z4B4nELHHAaarStw dAbrSaeid4pwt3T2YiXkzroA7vTsqP3beJCbwNVhn9dcm+ggZJ921VHxmL6KgMQRar5d ZQNg== X-Gm-Message-State: AOAM533BdYiswI/s3rLR2TksPR3ZUILy/+DFIHLSg/RPHnzdYCaHYiSm YQGWZ+Li/lHoHnMPrt5E51zuG+HSoIM= X-Google-Smtp-Source: ABdhPJxNL9YLZWXFmX+mFehSFmCnA+B9iXCKb39lECycR717m/chZV304nVgtAtXzH0OBY+h18JE7g== X-Received: by 2002:a17:90a:6542:: with SMTP id f2mr37951568pjs.159.1635200026369; Mon, 25 Oct 2021 15:13:46 -0700 (PDT) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:b7cd:daa3:a144:1652]) by smtp.gmail.com with ESMTPSA id f15sm22351108pfe.132.2021.10.25.15.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 15:13:46 -0700 (PDT) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Soheil Hassas Yeganeh , Eric Dumazet , Eric Dumazet Subject: [PATCH net-next 1/3] tcp: rename sk_stream_alloc_skb Date: Mon, 25 Oct 2021 15:13:40 -0700 Message-Id: <20211025221342.806029-2-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211025221342.806029-1-eric.dumazet@gmail.com> References: <20211025221342.806029-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet sk_stream_alloc_skb() is only used by TCP. Rename it to make this clear, and move its declaration to include/net/tcp.h Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh --- include/net/sock.h | 3 --- include/net/tcp.h | 2 ++ net/ipv4/tcp.c | 12 ++++++------ net/ipv4/tcp_output.c | 10 +++++----- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index b76be30674efc88434ed45d46b9c4600261b6271..ff4e62aa62e51a68d086e9e2b8429cba5731be00 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2422,9 +2422,6 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk) WRITE_ONCE(sk->sk_sndbuf, max_t(u32, val, SOCK_MIN_SNDBUF)); } -struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, - bool force_schedule); - /** * sk_page_frag - return an appropriate page_frag * @sk: socket diff --git a/include/net/tcp.h b/include/net/tcp.h index d62467a0094fe016ee2f5d9581631e1425e8f201..701587af685296a6b2372fee7b3e94f998c3bbe8 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -337,6 +337,8 @@ void tcp_twsk_destructor(struct sock *sk); ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags); +struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, + bool force_schedule); void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks); static inline void tcp_dec_quickack_mode(struct sock *sk, diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index c2d9830136d298a27abc12a5633bf77d1224759c..68dd580dba3d0e04412466868135c49225a4a33b 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -856,8 +856,8 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, } EXPORT_SYMBOL(tcp_splice_read); -struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, - bool force_schedule) +struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, + bool force_schedule) { struct sk_buff *skb; @@ -960,8 +960,8 @@ static struct sk_buff *tcp_build_frag(struct sock *sk, int size_goal, int flags, if (!sk_stream_memory_free(sk)) return NULL; - skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation, - tcp_rtx_and_write_queues_empty(sk)); + skb = tcp_stream_alloc_skb(sk, 0, sk->sk_allocation, + tcp_rtx_and_write_queues_empty(sk)); if (!skb) return NULL; @@ -1289,8 +1289,8 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) goto restart; } first_skb = tcp_rtx_and_write_queues_empty(sk); - skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation, - first_skb); + skb = tcp_stream_alloc_skb(sk, 0, sk->sk_allocation, + first_skb); if (!skb) goto wait_for_space; diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 3a01e5593a171d8e8978c11c9880eb9314feeda9..c0c55a8be8f79857e176714f240fddcb0580fa6b 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1564,7 +1564,7 @@ int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue, return -ENOMEM; /* Get a new skb... force flag on. */ - buff = sk_stream_alloc_skb(sk, nsize, gfp, true); + buff = tcp_stream_alloc_skb(sk, nsize, gfp, true); if (!buff) return -ENOMEM; /* We'll just try again later. */ skb_copy_decrypted(buff, skb); @@ -2121,7 +2121,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, return tcp_fragment(sk, TCP_FRAG_IN_WRITE_QUEUE, skb, len, mss_now, gfp); - buff = sk_stream_alloc_skb(sk, 0, gfp, true); + buff = tcp_stream_alloc_skb(sk, 0, gfp, true); if (unlikely(!buff)) return -ENOMEM; skb_copy_decrypted(buff, skb); @@ -2388,7 +2388,7 @@ static int tcp_mtu_probe(struct sock *sk) return -1; /* We're allowed to probe. Build it now. */ - nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false); + nskb = tcp_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false); if (!nskb) return -1; sk_wmem_queued_add(sk, nskb->truesize); @@ -3754,7 +3754,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) /* limit to order-0 allocations */ space = min_t(size_t, space, SKB_MAX_HEAD(MAX_TCP_HEADER)); - syn_data = sk_stream_alloc_skb(sk, space, sk->sk_allocation, false); + syn_data = tcp_stream_alloc_skb(sk, space, sk->sk_allocation, false); if (!syn_data) goto fallback; syn_data->ip_summed = CHECKSUM_PARTIAL; @@ -3835,7 +3835,7 @@ int tcp_connect(struct sock *sk) return 0; } - buff = sk_stream_alloc_skb(sk, 0, sk->sk_allocation, true); + buff = tcp_stream_alloc_skb(sk, 0, sk->sk_allocation, true); if (unlikely(!buff)) return -ENOBUFS; From patchwork Mon Oct 25 22:13:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12583051 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6B51C433F5 for ; Mon, 25 Oct 2021 22:13:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C95FB6101C for ; Mon, 25 Oct 2021 22:13:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233240AbhJYWQL (ORCPT ); Mon, 25 Oct 2021 18:16:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232817AbhJYWQK (ORCPT ); Mon, 25 Oct 2021 18:16:10 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 134A6C061745 for ; Mon, 25 Oct 2021 15:13:48 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id n11-20020a17090a2bcb00b001a1e7a0a6a6so583948pje.0 for ; Mon, 25 Oct 2021 15:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m7iabE0+4yufql12fKo8HPgyYuWgvD4a915iTVOnQz4=; b=AkSgFNUbH4kwza1EjnFOWnTWPF+8+U7BED6w3rpXF5IfIWqbpcILS8NWQWK0zqHfx1 iqhUMcEnaXGs2bHQiDeLMbYjALdEDCP39LEJd2mIBhq6fX1/hx7zMrAjA/PcZXJDHw7c e4iZKgZdOm4v/+c8HY4/lQI11oWpQze9o+q4ngincAqu+VdZDoTxPIoTtlx8smUPdxym W1p4zUOOX/mv0thleD1RPxoJUGOcYVXOej6u8MeCX+sPzgzZU9vfh7D1EP90O4VnADXW S4IxQrdjZhSb+F7QmO5gD+9UPdFAFR35WEMCIFCbXSZew2bIXBLV/G8huLxMYlwnxju2 Bo+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m7iabE0+4yufql12fKo8HPgyYuWgvD4a915iTVOnQz4=; b=PblwcccAZC+7wmouJ5W/B3LfYor/rxSVTPYDtBRi1mj5OcddhdXIzbkIPzq7reQWhp 0NRpV4mp2kWAFWgKdYKR4txO8YFkB9sqIcB626jIQN2JhMyds31H9+XAE7BxD1icRvTs dfkub/kwfvJlG62Hc6yZMtejFuZCnt1tVZKb28k7BEERX54Oc9DdbnRW8OZZTmP6YblG 3Z8YYq/h1Sdu8+NZXHbpI36dq0YIFGM/oU8egDq5wuBaKO9b+GAIYTqO+7FEroEbPcMz ib4zHYehqOFT2B7SUyNCXuN1wCfpi5jo4qHIYxzGfugB74FIJb1es2HfSyEd/8/2d8Yw Zq2Q== X-Gm-Message-State: AOAM53032BHx2Y7K+HiEdfOltqECRi03DBb+O8fsaVohQMJKzURB6Hzj eglBWT8HNhMHa6BnrZsNVRQ= X-Google-Smtp-Source: ABdhPJxqGCKfnkKe9UsytvqMUM/9nRR3mkBYnrn9EkhFofgeArP5pl77SSWwmW5/QIhdnalfesEZEg== X-Received: by 2002:a17:90a:6b0b:: with SMTP id v11mr24621444pjj.178.1635200027687; Mon, 25 Oct 2021 15:13:47 -0700 (PDT) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:b7cd:daa3:a144:1652]) by smtp.gmail.com with ESMTPSA id f15sm22351108pfe.132.2021.10.25.15.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 15:13:47 -0700 (PDT) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Soheil Hassas Yeganeh , Eric Dumazet , Eric Dumazet Subject: [PATCH net-next 2/3] tcp: use MAX_TCP_HEADER in tcp_stream_alloc_skb Date: Mon, 25 Oct 2021 15:13:41 -0700 Message-Id: <20211025221342.806029-3-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211025221342.806029-1-eric.dumazet@gmail.com> References: <20211025221342.806029-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Both IPv4 and IPv6 uses same reserve, no need risking cache line misses to fetch its value. Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh --- net/ipv4/tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 68dd580dba3d0e04412466868135c49225a4a33b..121400557fde898283a8eae3b09d93479c4a089e 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -867,7 +867,7 @@ struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, if (unlikely(tcp_under_memory_pressure(sk))) sk_mem_reclaim_partial(sk); - skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); + skb = alloc_skb_fclone(size + MAX_TCP_HEADER, gfp); if (likely(skb)) { bool mem_scheduled; @@ -878,7 +878,7 @@ struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, mem_scheduled = sk_wmem_schedule(sk, skb->truesize); } if (likely(mem_scheduled)) { - skb_reserve(skb, sk->sk_prot->max_header); + skb_reserve(skb, MAX_TCP_HEADER); /* * Make sure that we have exactly size bytes * available to the caller, no more, no less. From patchwork Mon Oct 25 22:13:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12583053 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCFB3C433FE for ; Mon, 25 Oct 2021 22:13:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0CF960F70 for ; Mon, 25 Oct 2021 22:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233243AbhJYWQM (ORCPT ); Mon, 25 Oct 2021 18:16:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232817AbhJYWQM (ORCPT ); Mon, 25 Oct 2021 18:16:12 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B33BC061745 for ; Mon, 25 Oct 2021 15:13:49 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id t11so8867548plq.11 for ; Mon, 25 Oct 2021 15:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yxG4+xzDXI12+XDNxP2xEzoUnFRzWOWw6t0IGnV6Cbg=; b=OLVn0GfCYMbqKpmogH9rbCKyAqAh5b/0Uqi9/JgeVLBjphcR2P5Vgktb9H4qBq8KGe husPyKfuozSKcplrZrte0QisyjWwtDB6ajjtbA+p6A++ZHepoQ+/7TBmtt3xXdNxCCTO wTHEJyh+Orr+XHUhVQgfERKqxp0J/L0vySOXikKaD9JVssfefg4W6QurIgzqUTCmlutp vS2IChvATW2pV7kgvupYc4NtgF6vO2jXP3tDJQhHApAqbG30USQ7oBEoD7iwLHAG6mxg AZheUf5S/S1xtvAwRd104KlaXED6Po6P2GxiQCdqNCSIVBb3AfCkrXsd8Faalq50RVKV bRiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yxG4+xzDXI12+XDNxP2xEzoUnFRzWOWw6t0IGnV6Cbg=; b=geAsHcDbdPoNw0Q6YmGwZSNaBxtz9RT9Q+zH4BFNvasoTdUo/gc3qqdRyzfImO76YO Q69zAw2yDu/7t3h4m0LTs7UTzXT82wHCmMnkiB6r2ZK0Bqb1u13aE1mQ1aoU39PkgrF/ m9PoVVh6lmKayax0WzyuZ1TCJtcAPPeTg9yzBe4Nf0cOtq1F2X5SVBvb4i6D2ax93aCS ajZ7A5ExNAbJ3cv6rzvz0NPYp0y4pK3Y46ctcs8g74QzGLkXj4t+4RZauYu7Ote6C6F9 L7BTRL4pmyF0l2KO8mVIfwgHmUwpj129owW/I5Pi1xOMJAjJQXBNsanRVOCw3LawR+MS n2PQ== X-Gm-Message-State: AOAM531EGEBECknrPeIYZ0sqP8gCayUek0AQwlPfuIkN8uYnR3ECCnPO nbVgeI7Xg8GfVTvCmyqIxpq1qzG0sEI= X-Google-Smtp-Source: ABdhPJxgPIp7gFQKppkYPHAytTPfX1nvAyLrwpzCsps2JtPEX5UVPFcEkBIfBARcvyO4Z5Bp+dYefg== X-Received: by 2002:a17:90b:4b06:: with SMTP id lx6mr37840012pjb.220.1635200028992; Mon, 25 Oct 2021 15:13:48 -0700 (PDT) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:b7cd:daa3:a144:1652]) by smtp.gmail.com with ESMTPSA id f15sm22351108pfe.132.2021.10.25.15.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 15:13:48 -0700 (PDT) From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski Cc: netdev , Soheil Hassas Yeganeh , Eric Dumazet , Eric Dumazet Subject: [PATCH net-next 3/3] tcp: remove unneeded code from tcp_stream_alloc_skb() Date: Mon, 25 Oct 2021 15:13:42 -0700 Message-Id: <20211025221342.806029-4-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211025221342.806029-1-eric.dumazet@gmail.com> References: <20211025221342.806029-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Eric Dumazet Aligning @size argument to 4 bytes is not needed. The header alignment has nothing to do with @size. It really depends on skb->head alignment and MAX_TCP_HEADER. Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh --- net/ipv4/tcp.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 121400557fde898283a8eae3b09d93479c4a089e..0a27b7ef1a9db8aea8d98cff4b8ab7092994febd 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -861,9 +861,6 @@ struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, { struct sk_buff *skb; - /* The TCP header must be at least 32-bit aligned. */ - size = ALIGN(size, 4); - if (unlikely(tcp_under_memory_pressure(sk))) sk_mem_reclaim_partial(sk);