From nobody Tue Apr 23 14:28:23 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:1d48:0:0:0:0:0 with SMTP id 69csp2186120jaj; Fri, 17 Sep 2021 08:39:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ03ztVKkVuDA6SCdOxgoRwepDv0d2uAYGgDJwR+bCo0LqCUi24Tvuu8KFPmqleCyeKsaj X-Received: by 2002:a17:90a:1a50:: with SMTP id 16mr21609490pjl.164.1631893151599; Fri, 17 Sep 2021 08:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631893151; cv=none; d=google.com; s=arc-20160816; b=oYd27dKPQIGgX1X5CCFfHctNolsUS+b470gVU6GKbwEFpG1QlwlBP1MUdDXUhu/eMD US21BaoIsa6636XAyCxqMnrj5+NYTo2XmZiIcRVwQq9sJpRYO/UGsp8i4BuYDsjI1UgG LWEkj7DgTtJaD5se5WPq1SHHVvz5Xwza+zCxAurzqPn6S0ENlxZpB4G39QcU+1EY/R8z p20/ThHzqd8+gKiuxXa6miOod1qD1GSawWP+KJvkBt3BxJ6eLBfrszlNhgvT/Iwh8PmJ Du6pk6w8Jl0DC7pOCLAR4QS3yaBpVhmAc1fEI2ZsWfQrTDJYuyJEs0YigNI9eCUqDF77 ZLlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Zhpqnvr5P0Rs3k/q+nqsF3Dii07E6KFJrmbpNgKLJMM=; b=oW2/N0MbSVJ5Ape1TbEAwa2dlB8tfuetNZsssFr2bWrAKDYFqMgvd0I7qUOXK3CX+w 09WO3wmUaWOIYnGGNhtdrhgVuW9HTiY1q+Svu19JJyiaL2ZrlwSMtU5jMFQ5hh6mVFkQ 0YUYMK0m174/OVBAPVsoXM66/cFMtTqTmIIxDM5sUgSuDfhqFMjEuURNfmNhiyLAXmDd jbu8p1rgJuZIPy9YTeZUnG/2+vTidNnWl8rx0pYTNpOw8N4469Ekkk3eUjSApsNcolp4 Mz3G1DhaWsif5sA0MK8dOErTJHK0Buevq5mInM3p2qPo7pSihaFBWMfkL1r6KJShBLxw Iwyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RL8DdFzo; spf=pass (google.com: domain of mptcp+bounces-1948-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-1948-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id p6si8303667pls.425.2021.09.17.08.39.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Sep 2021 08:39:11 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-1948-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RL8DdFzo; spf=pass (google.com: domain of mptcp+bounces-1948-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-1948-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sjc.edge.kernel.org (Postfix) with ESMTPS id 2E6033E10A8 for ; Fri, 17 Sep 2021 15:39:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53F702FB2; Fri, 17 Sep 2021 15:39:10 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29A3C2FAE for ; Fri, 17 Sep 2021 15:39:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631893148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zhpqnvr5P0Rs3k/q+nqsF3Dii07E6KFJrmbpNgKLJMM=; b=RL8DdFzoIc6J5BLPMnm65hi4IIku3LIlPKPiWRIFRT/JA4ucaP3G5JDZiU+xU+abNu1rib kn4+x3KY70b+A/l2RiqF/WsKzKUfwOPb2XfDAVIaOCSSg7OJg6LwjnxLi0azIgSnlzZ1gO d8UYIMq5B/1z1R/ew2x44rJ0yAX87b0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-RLcskn4CMtySgKIJaomz7w-1; Fri, 17 Sep 2021 11:39:06 -0400 X-MC-Unique: RLcskn4CMtySgKIJaomz7w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94560101F007; Fri, 17 Sep 2021 15:39:05 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D87DC18A8F; Fri, 17 Sep 2021 15:39:03 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Mat Martineau , Ayush Sawal , Eric Dumazet , mptcp@lists.linux.dev Subject: [RFC PATCH 1/5] chtls: rename skb_entail() to chtls_skb_entail() Date: Fri, 17 Sep 2021 17:38:36 +0200 Message-Id: <04d1b3ce3e139be5114c1fd89eb64a7e0b0df810.1631888517.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Content-Type: text/plain; charset="utf-8" The next patch will expose the core TCP helper with the same name. It looks like we can't trivially re-use it in chtls, so remame the driver specific's one to avoid name conflicts. Reported-by: kernel test robot Acked-by: Mat Martineau Signed-off-by: Paolo Abeni --- .../net/ethernet/chelsio/inline_crypto/chtls/chtls.h | 2 +- .../ethernet/chelsio/inline_crypto/chtls/chtls_cm.c | 2 +- .../ethernet/chelsio/inline_crypto/chtls/chtls_io.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h b/dri= vers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h index 9e2378013642..4b57e58845b0 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls.h @@ -580,7 +580,7 @@ void chtls_set_tcb_field_rpl_skb(struct sock *sk, u16 w= ord, int through_l2t); int chtls_setkey(struct chtls_sock *csk, u32 keylen, u32 mode, int cipher_= type); void chtls_set_quiesce_ctrl(struct sock *sk, int val); -void skb_entail(struct sock *sk, struct sk_buff *skb, int flags); +void chtls_skb_entail(struct sock *sk, struct sk_buff *skb, int flags); unsigned int keyid_to_addr(int start_addr, int keyid); void free_tls_keyid(struct sock *sk); #endif diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c b/= drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c index bcad69c48074..dfa2bfc9638e 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c @@ -317,7 +317,7 @@ static void chtls_close_conn(struct sock *sk) OPCODE_TID(req) =3D htonl(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, tid)); =20 tcp_uncork(sk); - skb_entail(sk, skb, ULPCB_FLAG_NO_HDR | ULPCB_FLAG_NO_APPEND); + chtls_skb_entail(sk, skb, ULPCB_FLAG_NO_HDR | ULPCB_FLAG_NO_APPEND); if (sk->sk_state !=3D TCP_SYN_SENT) chtls_push_frames(csk, 1); } diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c b/= drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c index c320cc8ca68d..05cf45098462 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c @@ -119,8 +119,8 @@ static int send_flowc_wr(struct sock *sk, struct fw_flo= wc_wr *flowc, if (!skb) return -ENOMEM; =20 - skb_entail(sk, skb, - ULPCB_FLAG_NO_HDR | ULPCB_FLAG_NO_APPEND); + chtls_skb_entail(sk, skb, + ULPCB_FLAG_NO_HDR | ULPCB_FLAG_NO_APPEND); return 0; } =20 @@ -816,7 +816,7 @@ static int select_size(struct sock *sk, int io_len, int= flags, int len) return io_len; } =20 -void skb_entail(struct sock *sk, struct sk_buff *skb, int flags) +void chtls_skb_entail(struct sock *sk, struct sk_buff *skb, int flags) { struct chtls_sock *csk =3D rcu_dereference_sk_user_data(sk); struct tcp_sock *tp =3D tcp_sk(sk); @@ -840,7 +840,7 @@ static struct sk_buff *get_tx_skb(struct sock *sk, int = size) skb =3D alloc_skb(size + TX_HEADER_LEN, sk->sk_allocation); if (likely(skb)) { skb_reserve(skb, TX_HEADER_LEN); - skb_entail(sk, skb, ULPCB_FLAG_NEED_HDR); + chtls_skb_entail(sk, skb, ULPCB_FLAG_NEED_HDR); skb_reset_transport_header(skb); } return skb; @@ -857,7 +857,7 @@ static struct sk_buff *get_record_skb(struct sock *sk, = int size, bool zcopy) if (likely(skb)) { skb_reserve(skb, (TX_TLSHDR_LEN + KEY_ON_MEM_SZ + max_ivs_size(sk, size))); - skb_entail(sk, skb, ULPCB_FLAG_NEED_HDR); + chtls_skb_entail(sk, skb, ULPCB_FLAG_NEED_HDR); skb_reset_transport_header(skb); ULP_SKB_CB(skb)->ulp.tls.ofld =3D 1; ULP_SKB_CB(skb)->ulp.tls.type =3D csk->tlshws.type; --=20 2.26.3 From nobody Tue Apr 23 14:28:23 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:1d48:0:0:0:0:0 with SMTP id 69csp2186144jaj; Fri, 17 Sep 2021 08:39:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznSVwhmbuH0sFIcjmYeLA12Jri9pe7/I/if/QZzqF68j6wQnykX2o1oIfeqlu+LkzdF2QX X-Received: by 2002:aa7:9467:0:b0:43e:10a2:5409 with SMTP id t7-20020aa79467000000b0043e10a25409mr11240913pfq.12.1631893153783; Fri, 17 Sep 2021 08:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631893153; cv=none; d=google.com; s=arc-20160816; b=pauFZlK/sjkWr9h40b2mr9yTjBcHnNTBOXDwI4EXDFow1rs24xReKSUIPwLD8H9GJK xfmY/sYZdgg5C1gJzstEz0XKXGpzFr9kpid/Y+A31evxeLalJOOlLEcmKudTpGQliLy5 6ePHDv14qfCutIvS1I8qV/Tn5Zc6xMGSOPwcelzkh4q8H0ZUdXvgwiX+JQESsG5nPx2E vKtwtEW3fsL9vTQ6BNVzR0LuLQNxjY1Vvt91Wgeb7NqeApguANi4rmP2g/qEHspvTEZD YNeNoM4XXODANlwwXY0HVnifKAK1cnb4+ZwGUsvav73s1OPKCnMNkTbY06rcbTIkXn2Z WdaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=U0a5YPbzRj7T4EnLfI6lSnZlEAhSaB116OUK3rRIgso=; b=J2qwcVQ1dvjtTYwha+LkoOnXfEjPANrNILMnBDBSDDDUVyPIyvI0Yrs4whoFstSGUs RwpZsPJ60JOCziWJiFY7EQGUd6i6gZ6+CFvMAhI4rmFqSwICV53HZMVL6gh4T2Rj5Brs saRTUTjRTbAvHQtMuQPu1/h3MXiAW4cYQr96z5IbhdO94oezRQf2vZDOMPrjEve/vuqG 54w4facmmzzYVEle4l+JFgo4v+gYLKZiaNvBcgCC43+TfVSwMzCfbfhKUKCRzlFh/bMH cFUyUtRPCyROkIozmrPfKLp03qzr9J0yJmLG9Ne0EOp72BJp1vOO6eFaHW4lWVcD22ZZ l6AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="jPAaG/P2"; spf=pass (google.com: domain of mptcp+bounces-1949-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-1949-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id h5si3112506pfr.335.2021.09.17.08.39.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Sep 2021 08:39:13 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-1949-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="jPAaG/P2"; spf=pass (google.com: domain of mptcp+bounces-1949-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-1949-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sjc.edge.kernel.org (Postfix) with ESMTPS id EEC3D3E1103 for ; Fri, 17 Sep 2021 15:39:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 880192FB6; Fri, 17 Sep 2021 15:39:12 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 225AF2FAE for ; Fri, 17 Sep 2021 15:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631893150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U0a5YPbzRj7T4EnLfI6lSnZlEAhSaB116OUK3rRIgso=; b=jPAaG/P2m9WDtgEW37gFHz40c7HlukBg24kWbCdfsliXos88y04iz2yA7OzUo2h04E+76m kPTzPH7lv+Qob9ruAAN9IOHgflUgSkWBXcOTCl7I1Q0sGJDVajH5CCfxPEZFtrwxXTh8u8 GLT0yXvWL35FA/E4Dca3WfiftSsmzKE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-Du287dFVPguyIu4BSOdiEg-1; Fri, 17 Sep 2021 11:39:08 -0400 X-MC-Unique: Du287dFVPguyIu4BSOdiEg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C5D350751; Fri, 17 Sep 2021 15:39:07 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id E706A69CAD; Fri, 17 Sep 2021 15:39:05 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Mat Martineau , Ayush Sawal , Eric Dumazet , mptcp@lists.linux.dev Subject: [RFC PATCH 2/5] tcp: expose the tcp_mark_push() and skb_entail() helpers Date: Fri, 17 Sep 2021 17:38:37 +0200 Message-Id: <07fd053d2c2239e70b20b105ff6f33d299dabea7.1631888517.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Content-Type: text/plain; charset="utf-8" They will be used by the next patch. Acked-by: Mat Martineau Signed-off-by: Paolo Abeni --- include/net/tcp.h | 2 ++ net/ipv4/tcp.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 3166dc15d7d6..dc52ea8adfc7 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -581,6 +581,8 @@ __u32 cookie_v6_init_sequence(const struct sk_buff *skb= , __u16 *mss); #endif /* tcp_output.c */ =20 +void skb_entail(struct sock *sk, struct sk_buff *skb); +void tcp_mark_push(struct tcp_sock *tp, struct sk_buff *skb); void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, int nonagle); int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs); diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index e8b48df73c85..7a3e632b0048 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -647,7 +647,7 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long a= rg) } EXPORT_SYMBOL(tcp_ioctl); =20 -static inline void tcp_mark_push(struct tcp_sock *tp, struct sk_buff *skb) +void tcp_mark_push(struct tcp_sock *tp, struct sk_buff *skb) { TCP_SKB_CB(skb)->tcp_flags |=3D TCPHDR_PSH; tp->pushed_seq =3D tp->write_seq; @@ -658,7 +658,7 @@ static inline bool forced_push(const struct tcp_sock *t= p) return after(tp->write_seq, tp->pushed_seq + (tp->max_window >> 1)); } =20 -static void skb_entail(struct sock *sk, struct sk_buff *skb) +void skb_entail(struct sock *sk, struct sk_buff *skb) { struct tcp_sock *tp =3D tcp_sk(sk); struct tcp_skb_cb *tcb =3D TCP_SKB_CB(skb); --=20 2.26.3 From nobody Tue Apr 23 14:28:23 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:1d48:0:0:0:0:0 with SMTP id 69csp2186198jaj; Fri, 17 Sep 2021 08:39:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwU9pOygVnXtHMcR7ESAAkjoOgB8nz0hhT0ec7tV//3b75ZNm/2+wxbKMTEqtw0Pnq7romr X-Received: by 2002:a0c:b2c5:: with SMTP id d5mr11573507qvf.65.1631893157003; Fri, 17 Sep 2021 08:39:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631893156; cv=none; d=google.com; s=arc-20160816; b=jI56AHZsEAMttBWniYwHR0hw1M+/pnHqUeKu/8v8Q7RW1P8PRSCp+mm/i474xWsk73 Ev1AYXxgkM45+CcOry/FLCQIwMgO7gFZ5Nftno4X1uRb1MVZAQ+SlFD6kZ+xGIOoCQ5+ 2Jb4oSeekY82wmeuRLE0J68E5tztRDwrAL0/d/fKVbynYkpdVTGEOvn8f6y5o6oUHAQ/ /L444mgAzf3ADDrEfmEWBlzd73ojXT6iWIEJJ+AhJfxh8rgOC+67BpjExayboa7ls7yl MW17gQ3cZJ5KBVrZWRdGo/902L6M3bo0LYuF20IPJQuXnW3femM/FdYZQeAREQnMBr/A MSSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BBe+YUebzRWUqHknG9R3JD0QUOLI6kwE9YOHiB2f5eM=; b=Lf1FrKrmDV5Nz//2bWXtD0nATJJumbMrz8PiIfzeON85AFnld9vYMpMmVYYF5PUvfX BafZPxEQmlWdYpui3z8XQ/lsUYJLGwfPYy6PkPZKmw97GhLIZw4YnQ67ToucYW2leuh1 aF1MORApUM/ndaaBC9GwsN/Nq+41Nda0BCdKOC3lnQwdgpRgO9lmKYcGWLOf4GpvBwvH vijQ5PFXGN04wGcEWwunLP6RObBjg70Cw2uUBzzOvmbe0uHw39jNm/iP95NzJP47kCYe CHfrhWzu3NPrML+FDOqh78pp1Dl26MwejKbnXyJ+Wi+3ItAR/Mk1bys+ZoEmAn3udGer rY5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S+hZDPP5; spf=pass (google.com: domain of mptcp+bounces-1950-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-1950-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id j14si1347050qkp.181.2021.09.17.08.39.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Sep 2021 08:39:16 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-1950-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S+hZDPP5; spf=pass (google.com: domain of mptcp+bounces-1950-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-1950-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ewr.edge.kernel.org (Postfix) with ESMTPS id 5884A1C0F8B for ; Fri, 17 Sep 2021 15:39:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 200762FB2; Fri, 17 Sep 2021 15:39:15 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B5712FAE for ; Fri, 17 Sep 2021 15:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631893152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BBe+YUebzRWUqHknG9R3JD0QUOLI6kwE9YOHiB2f5eM=; b=S+hZDPP5QKr1FSgmcpL5Gs26HyaWBRgQyBu9n8teM0cOBHyEsUVg3qnFw1EIgJ0eSoHaVw sePyc1JY2oySeN6pZ8lZQsa4Wc9G1d6AJ0nKG5SC4Iso6RwszzReTEa/Yf24pwwT1+ePtd bEFZMuPm01m9OK9HOsSbRsjAHN1IHbQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-573-xSwYvZEbMeidIBqhx-acuQ-1; Fri, 17 Sep 2021 11:39:11 -0400 X-MC-Unique: xSwYvZEbMeidIBqhx-acuQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F01B3FA1; Fri, 17 Sep 2021 15:39:09 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id E173A2C175; Fri, 17 Sep 2021 15:39:07 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Mat Martineau , Ayush Sawal , Eric Dumazet , mptcp@lists.linux.dev Subject: [RFC PATCH 3/5] mptcp: stop relying on tcp_tx_skb_cache Date: Fri, 17 Sep 2021 17:38:38 +0200 Message-Id: <2a69b0b2231e0c7126c8448381c980d3307b28be.1631888517.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Content-Type: text/plain; charset="utf-8" We want to revert the skb TX cache, but MPTCP is currently using it unconditionally. Rework the MPTCP tx code, so that tcp_tx_skb_cache is not needed anymore: do the whole coalescing check, skb allocation skb initialization/update inside mptcp_sendmsg_frag(), quite alike the current TCP code. Reviewed-by: Mat Martineau Signed-off-by: Paolo Abeni --- net/mptcp/protocol.c | 137 ++++++++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 60 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 2602f1386160..95503dadab55 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1224,6 +1224,7 @@ static struct sk_buff *__mptcp_do_alloc_tx_skb(struct= sock *sk, gfp_t gfp) if (likely(__mptcp_add_ext(skb, gfp))) { skb_reserve(skb, MAX_TCP_HEADER); skb->reserved_tailroom =3D skb->end - skb->tail; + INIT_LIST_HEAD(&skb->tcp_tsorted_anchor); return skb; } __kfree_skb(skb); @@ -1233,31 +1234,23 @@ static struct sk_buff *__mptcp_do_alloc_tx_skb(stru= ct sock *sk, gfp_t gfp) return NULL; } =20 -static bool __mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, gfp_t = gfp) +static struct sk_buff *__mptcp_alloc_tx_skb(struct sock *sk, struct sock *= ssk, gfp_t gfp) { struct sk_buff *skb; =20 - if (ssk->sk_tx_skb_cache) { - skb =3D ssk->sk_tx_skb_cache; - if (unlikely(!skb_ext_find(skb, SKB_EXT_MPTCP) && - !__mptcp_add_ext(skb, gfp))) - return false; - return true; - } - skb =3D __mptcp_do_alloc_tx_skb(sk, gfp); if (!skb) - return false; + return NULL; =20 if (likely(sk_wmem_schedule(ssk, skb->truesize))) { - ssk->sk_tx_skb_cache =3D skb; - return true; + skb_entail(ssk, skb); + return skb; } kfree_skb(skb); - return false; + return NULL; } =20 -static bool mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, bool dat= a_lock_held) +static struct sk_buff *mptcp_alloc_tx_skb(struct sock *sk, struct sock *ss= k, bool data_lock_held) { gfp_t gfp =3D data_lock_held ? GFP_ATOMIC : sk->sk_allocation; =20 @@ -1287,23 +1280,29 @@ static int mptcp_sendmsg_frag(struct sock *sk, stru= ct sock *ssk, struct mptcp_sendmsg_info *info) { u64 data_seq =3D dfrag->data_seq + info->sent; + int offset =3D dfrag->offset + info->sent; struct mptcp_sock *msk =3D mptcp_sk(sk); bool zero_window_probe =3D false; struct mptcp_ext *mpext =3D NULL; - struct sk_buff *skb, *tail; - bool must_collapse =3D false; - int size_bias =3D 0; - int avail_size; - size_t ret =3D 0; + bool can_coalesce =3D false; + bool reuse_skb =3D true; + struct sk_buff *skb; + size_t copy; + int i; =20 pr_debug("msk=3D%p ssk=3D%p sending dfrag at seq=3D%llu len=3D%u already = sent=3D%u", msk, ssk, dfrag->data_seq, dfrag->data_len, info->sent); =20 + if (WARN_ON_ONCE(info->sent > info->limit || + info->limit > dfrag->data_len)) + return 0; + /* compute send limit */ info->mss_now =3D tcp_send_mss(ssk, &info->size_goal, info->flags); - avail_size =3D info->size_goal; + copy =3D info->size_goal; + skb =3D tcp_write_queue_tail(ssk); - if (skb) { + if (skb && copy > skb->len) { /* Limit the write to the size available in the * current skb, if any, so that we create at most a new skb. * Explicitly tells TCP internals to avoid collapsing on later @@ -1316,62 +1315,80 @@ static int mptcp_sendmsg_frag(struct sock *sk, stru= ct sock *ssk, goto alloc_skb; } =20 - must_collapse =3D (info->size_goal - skb->len > 0) && - (skb_shinfo(skb)->nr_frags < sysctl_max_skb_frags); - if (must_collapse) { - size_bias =3D skb->len; - avail_size =3D info->size_goal - skb->len; + i =3D skb_shinfo(skb)->nr_frags; + can_coalesce =3D skb_can_coalesce(skb, i, dfrag->page, offset); + if (!can_coalesce && i >=3D sysctl_max_skb_frags) { + tcp_mark_push(tcp_sk(ssk), skb); + goto alloc_skb; } - } =20 + copy -=3D skb->len; + } else { alloc_skb: - if (!must_collapse && !ssk->sk_tx_skb_cache && - !mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held)) - return 0; + skb =3D mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held); + if (!skb) + return -ENOMEM; + + i =3D skb_shinfo(skb)->nr_frags; + reuse_skb =3D false; + mpext =3D skb_ext_find(skb, SKB_EXT_MPTCP); + } =20 /* Zero window and all data acked? Probe. */ - avail_size =3D mptcp_check_allowed_size(msk, data_seq, avail_size); - if (avail_size =3D=3D 0) { + copy =3D mptcp_check_allowed_size(msk, data_seq, copy); + if (copy =3D=3D 0) { u64 snd_una =3D READ_ONCE(msk->snd_una); =20 - if (skb || snd_una !=3D msk->snd_nxt) + if (snd_una !=3D msk->snd_nxt) { + tcp_remove_empty_skb(ssk, tcp_write_queue_tail(ssk)); return 0; + } + zero_window_probe =3D true; data_seq =3D snd_una - 1; - avail_size =3D 1; - } + copy =3D 1; =20 - if (WARN_ON_ONCE(info->sent > info->limit || - info->limit > dfrag->data_len)) - return 0; + /* all mptcp-level data is acked, no skbs should be present into the + * ssk write queue + */ + WARN_ON_ONCE(reuse_skb); + } =20 - ret =3D info->limit - info->sent; - tail =3D tcp_build_frag(ssk, avail_size + size_bias, info->flags, - dfrag->page, dfrag->offset + info->sent, &ret); - if (!tail) { - tcp_remove_empty_skb(sk, tcp_write_queue_tail(ssk)); + copy =3D min_t(size_t, copy, info->limit - info->sent); + if (!sk_wmem_schedule(ssk, copy)) { + tcp_remove_empty_skb(ssk, tcp_write_queue_tail(ssk)); return -ENOMEM; } =20 - /* if the tail skb is still the cached one, collapsing really happened. - */ - if (skb =3D=3D tail) { - TCP_SKB_CB(tail)->tcp_flags &=3D ~TCPHDR_PSH; - mpext->data_len +=3D ret; + if (can_coalesce) { + skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); + } else { + get_page(dfrag->page); + skb_fill_page_desc(skb, i, dfrag->page, offset, copy); + } + + skb->len +=3D copy; + skb->data_len +=3D copy; + skb->truesize +=3D copy; + sk_wmem_queued_add(ssk, copy); + sk_mem_charge(ssk, copy); + skb->ip_summed =3D CHECKSUM_PARTIAL; + WRITE_ONCE(tcp_sk(ssk)->write_seq, tcp_sk(ssk)->write_seq + copy); + TCP_SKB_CB(skb)->end_seq +=3D copy; + tcp_skb_pcount_set(skb, 0); + + /* on skb reuse we just need to update the DSS len */ + if (reuse_skb) { + TCP_SKB_CB(skb)->tcp_flags &=3D ~TCPHDR_PSH; + mpext->data_len +=3D copy; WARN_ON_ONCE(zero_window_probe); goto out; } =20 - mpext =3D skb_ext_find(tail, SKB_EXT_MPTCP); - if (WARN_ON_ONCE(!mpext)) { - /* should never reach here, stream corrupted */ - return -EINVAL; - } - memset(mpext, 0, sizeof(*mpext)); mpext->data_seq =3D data_seq; mpext->subflow_seq =3D mptcp_subflow_ctx(ssk)->rel_write_seq; - mpext->data_len =3D ret; + mpext->data_len =3D copy; mpext->use_map =3D 1; mpext->dsn64 =3D 1; =20 @@ -1380,18 +1397,18 @@ static int mptcp_sendmsg_frag(struct sock *sk, stru= ct sock *ssk, mpext->dsn64); =20 if (zero_window_probe) { - mptcp_subflow_ctx(ssk)->rel_write_seq +=3D ret; + mptcp_subflow_ctx(ssk)->rel_write_seq +=3D copy; mpext->frozen =3D 1; if (READ_ONCE(msk->csum_enabled)) - mptcp_update_data_checksum(tail, ret); + mptcp_update_data_checksum(skb, copy); tcp_push_pending_frames(ssk); return 0; } out: if (READ_ONCE(msk->csum_enabled)) - mptcp_update_data_checksum(tail, ret); - mptcp_subflow_ctx(ssk)->rel_write_seq +=3D ret; - return ret; + mptcp_update_data_checksum(skb, copy); + mptcp_subflow_ctx(ssk)->rel_write_seq +=3D copy; + return copy; } =20 #define MPTCP_SEND_BURST_SIZE ((1 << 16) - \ --=20 2.26.3 From nobody Tue Apr 23 14:28:23 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:1d48:0:0:0:0:0 with SMTP id 69csp2186249jaj; Fri, 17 Sep 2021 08:39:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzNj88CXd86fTQB59xfa7ZCj69uJ/s1aZvU/1tc7Rs41i+85Mkjzy9TS1y6+AdCZfDGO30 X-Received: by 2002:a37:2e87:: with SMTP id u129mr9159105qkh.208.1631893160328; Fri, 17 Sep 2021 08:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631893160; cv=none; d=google.com; s=arc-20160816; b=OPMdr5hOqPAIVyFkq/BO5MVNiHEbycrw7PwOvqnjOETaDjLSR1dSlTeIaVxTOplXHo 7EpfrBFoADcDLOoPB1ox+jxhGgFaWk4y9hOZOa1dwu4hIjGT1ihXKAgZOH4pmZrucMsd IO93UObCYdEVwj4llUVhIijPURbzQo7Pc8biu6x1NnSGfh047u02LOdPmiNYVqkWiYDy pG4kRboC6wRUKPetoKY/9lrT1ppbo6PlFXlwJfMqM4yC5LKL1n+JllCFpubBm6SEkq0n 5th9G9+SOZfRnYmQWhASW8L7f6zRdXcsSvzYa1kuIJN2gZ/oJPeKrh6PG5SR+2QS/qUJ /lSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MET/cio3IrOSRaBgyuoIC3TW47jET2T5el6yYg5y+y0=; b=iU/Zvms1vLOHjddcjE6NH1I+fp0p0TKBlQ+LJtc0DVMXQ3u1bZl2G+LTFkHlic1zdt R9+AtEvWyEKLr0JnZuHrYOWr4YteC7KrHPRnnXTeqHj7XRm2tK3mqaNNEobRuWSNhOJ7 aCYvbylMtUZDUpXERj6tXVlj1kMxWQB/da7+Cr/4l7iCeegqXKmqt2srjKgx4Wr7x/PA 20vDHMMuWjsSvyJ+wpLlYjItnH+gkRtjyO0rurYOsf4Sro7T2Y3vl4zLMxxpmKrI0nsa etNyemRT0TeyUiG4CqlSwhBUEOvnflVmSx0mBROZ/r47aQxLTBERZrx72YhITxqjJ0uf Z57g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SJwdQWIm; spf=pass (google.com: domain of mptcp+bounces-1951-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-1951-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id t8si3640723qvb.236.2021.09.17.08.39.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Sep 2021 08:39:20 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-1951-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SJwdQWIm; spf=pass (google.com: domain of mptcp+bounces-1951-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-1951-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ewr.edge.kernel.org (Postfix) with ESMTPS id 098A51C0F8D for ; Fri, 17 Sep 2021 15:39:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89E9F2FB2; Fri, 17 Sep 2021 15:39:18 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 072D12FAE for ; Fri, 17 Sep 2021 15:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631893156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MET/cio3IrOSRaBgyuoIC3TW47jET2T5el6yYg5y+y0=; b=SJwdQWIme3Jeko/kK/qpCIYl4RxX6yEyHks+SL5hPetRLydtJvjItp2p3sXoTNRc4Tlr0G I7tYhi55QoWJ0i61KZ4VYwe6bc9jReM98mAXdX9eV9PQPoZYG5FSSkNP9AqjnGqpxI7+h2 +AY3UqdT3duSekUMIB5tXAEWZLyUVJM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-9cd6dl6xMcGTkXhxR-sJWg-1; Fri, 17 Sep 2021 11:39:12 -0400 X-MC-Unique: 9cd6dl6xMcGTkXhxR-sJWg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 85BBA101F010; Fri, 17 Sep 2021 15:39:11 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id E118E18B5E; Fri, 17 Sep 2021 15:39:09 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Mat Martineau , Ayush Sawal , Eric Dumazet , mptcp@lists.linux.dev Subject: [RFC PATCH 4/5] Partially revert "tcp: factor out tcp_build_frag()" Date: Fri, 17 Sep 2021 17:38:39 +0200 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Content-Type: text/plain; charset="utf-8" This is a partial revert for commit b796d04bd014 ("tcp: factor out tcp_build_frag()"). MPTCP was the only user of the tcp_build_frag helper, and after the previous patch MPTCP does not use the mentioned helper anymore. Let's avoid exposing TCP internals. The revert is partial, as tcp_remove_empty_skb(), exposed by the same commit is still required. Acked-by: Mat Martineau Signed-off-by: Paolo Abeni --- include/net/tcp.h | 2 - net/ipv4/tcp.c | 117 ++++++++++++++++++++-------------------------- 2 files changed, 51 insertions(+), 68 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index dc52ea8adfc7..91f4397c4c08 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -330,8 +330,6 @@ int tcp_sendpage(struct sock *sk, struct page *page, in= t offset, size_t size, int flags); int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, size_t size, int flags); -struct sk_buff *tcp_build_frag(struct sock *sk, int size_goal, int flags, - struct page *page, int offset, size_t *size); ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, size_t size, int flags); int tcp_send_mss(struct sock *sk, int *size_goal, int flags); diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 7a3e632b0048..caf0c50d86bc 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -963,68 +963,6 @@ void tcp_remove_empty_skb(struct sock *sk, struct sk_b= uff *skb) } } =20 -struct sk_buff *tcp_build_frag(struct sock *sk, int size_goal, int flags, - struct page *page, int offset, size_t *size) -{ - struct sk_buff *skb =3D tcp_write_queue_tail(sk); - struct tcp_sock *tp =3D tcp_sk(sk); - bool can_coalesce; - int copy, i; - - if (!skb || (copy =3D size_goal - skb->len) <=3D 0 || - !tcp_skb_can_collapse_to(skb)) { -new_segment: - if (!sk_stream_memory_free(sk)) - return NULL; - - skb =3D sk_stream_alloc_skb(sk, 0, sk->sk_allocation, - tcp_rtx_and_write_queues_empty(sk)); - if (!skb) - return NULL; - -#ifdef CONFIG_TLS_DEVICE - skb->decrypted =3D !!(flags & MSG_SENDPAGE_DECRYPTED); -#endif - skb_entail(sk, skb); - copy =3D size_goal; - } - - if (copy > *size) - copy =3D *size; - - i =3D skb_shinfo(skb)->nr_frags; - can_coalesce =3D skb_can_coalesce(skb, i, page, offset); - if (!can_coalesce && i >=3D sysctl_max_skb_frags) { - tcp_mark_push(tp, skb); - goto new_segment; - } - if (!sk_wmem_schedule(sk, copy)) - return NULL; - - if (can_coalesce) { - skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); - } else { - get_page(page); - skb_fill_page_desc(skb, i, page, offset, copy); - } - - if (!(flags & MSG_NO_SHARED_FRAGS)) - skb_shinfo(skb)->flags |=3D SKBFL_SHARED_FRAG; - - skb->len +=3D copy; - skb->data_len +=3D copy; - skb->truesize +=3D copy; - sk_wmem_queued_add(sk, copy); - sk_mem_charge(sk, copy); - skb->ip_summed =3D CHECKSUM_PARTIAL; - WRITE_ONCE(tp->write_seq, tp->write_seq + copy); - TCP_SKB_CB(skb)->end_seq +=3D copy; - tcp_skb_pcount_set(skb, 0); - - *size =3D copy; - return skb; -} - ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, size_t size, int flags) { @@ -1060,13 +998,60 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct pag= e *page, int offset, goto out_err; =20 while (size > 0) { - struct sk_buff *skb; - size_t copy =3D size; + struct sk_buff *skb =3D tcp_write_queue_tail(sk); + int copy, i; + bool can_coalesce; =20 - skb =3D tcp_build_frag(sk, size_goal, flags, page, offset, ©); - if (!skb) + if (!skb || (copy =3D size_goal - skb->len) <=3D 0 || + !tcp_skb_can_collapse_to(skb)) { +new_segment: + if (!sk_stream_memory_free(sk)) + goto wait_for_space; + + skb =3D sk_stream_alloc_skb(sk, 0, sk->sk_allocation, + tcp_rtx_and_write_queues_empty(sk)); + if (!skb) + goto wait_for_space; + +#ifdef CONFIG_TLS_DEVICE + skb->decrypted =3D !!(flags & MSG_SENDPAGE_DECRYPTED); +#endif + skb_entail(sk, skb); + copy =3D size_goal; + } + + if (copy > size) + copy =3D size; + + i =3D skb_shinfo(skb)->nr_frags; + can_coalesce =3D skb_can_coalesce(skb, i, page, offset); + if (!can_coalesce && i >=3D sysctl_max_skb_frags) { + tcp_mark_push(tp, skb); + goto new_segment; + } + if (!sk_wmem_schedule(sk, copy)) goto wait_for_space; =20 + if (can_coalesce) { + skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); + } else { + get_page(page); + skb_fill_page_desc(skb, i, page, offset, copy); + } + + if (!(flags & MSG_NO_SHARED_FRAGS)) + skb_shinfo(skb)->flags |=3D SKBFL_SHARED_FRAG; + + skb->len +=3D copy; + skb->data_len +=3D copy; + skb->truesize +=3D copy; + sk_wmem_queued_add(sk, copy); + sk_mem_charge(sk, copy); + skb->ip_summed =3D CHECKSUM_PARTIAL; + WRITE_ONCE(tp->write_seq, tp->write_seq + copy); + TCP_SKB_CB(skb)->end_seq +=3D copy; + tcp_skb_pcount_set(skb, 0); + if (!copied) TCP_SKB_CB(skb)->tcp_flags &=3D ~TCPHDR_PSH; =20 --=20 2.26.3 From nobody Tue Apr 23 14:28:23 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:1d48:0:0:0:0:0 with SMTP id 69csp2186311jaj; Fri, 17 Sep 2021 08:39:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAPsaRvuNGNxg+i9CqmOJH3Zddo0X9TjUgN6CC0AF90hO2fB7euCJW251IukSPmjlczUek X-Received: by 2002:aa7:8106:0:b0:416:143c:44e3 with SMTP id b6-20020aa78106000000b00416143c44e3mr11020977pfi.41.1631893162903; Fri, 17 Sep 2021 08:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631893162; cv=none; d=google.com; s=arc-20160816; b=IQPtT6yqYRZhuREaM3szsrvQwh0xa7OFPTYiIVl7dsieSpORqEsiJsYqThw+4foqRN t/J6PUJaDuVZdeHX1EI/vDR/GeeCyFv3QJyPEc7NPhXNi8sOrcN4EY0G5aH2ZI3af1L3 2iGGBA15rpCwqtp2XjzVBTu2qtupjRuIyKqmPHpFbuUfcZxjrXnSkISoapjjl90dbrAa 3eI9dRVgYHD2fiqd2yzMYk1Vg7/pUgnTNnPW/bba1TSSBPNSDdG2bTJUice/hOJ0fC/u trwitQ6ue604DKUKRfFTHZi9kg7OWE6btEfzpKpBWZkUP9wAMMCXhRpP/QX4ENz7u9fL TUxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DPMZQjGr/REOSZoBnm/6ceWEy5fNbm264K7q21o8L/E=; b=h2Vh5BU1yWoE3ZZrhZkb5nSrINYFoa2DDytM3M4C4XZBWkQJxvFP+cR3+gUZzd2j/p 3mtLpkkJt0YaBo6Q7+3qkjzn//GIeZXIOrfdxWuDYX9A2xN1nSsbmaG34YX79l6DGoX6 0/3liLsT5EA6+Gwdbm0DU42hH4g3OtCl70zZ6jglnHkJH0CoOEq96+x9mu9cyBQHCb7E a3xB4Jw38CDUxlUkrYlPL7OjEEa2W4qWakiQwIJKaAxXokF25QIJWsouL0/NYKypilYI 820szxYLmhDYhUsvjv1ID4YNSBSOEd7Wvu8/i4CbVxHcxo/JnalZlCh/1jHXQnIuIVbK 3aFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ibBFdgB9; spf=pass (google.com: domain of mptcp+bounces-1952-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-1952-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id u129si2587525pfc.146.2021.09.17.08.39.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Sep 2021 08:39:22 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-1952-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ibBFdgB9; spf=pass (google.com: domain of mptcp+bounces-1952-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-1952-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sjc.edge.kernel.org (Postfix) with ESMTPS id 1630E3E118D for ; Fri, 17 Sep 2021 15:39:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E04F2FB2; Fri, 17 Sep 2021 15:39:21 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92EB52FAE for ; Fri, 17 Sep 2021 15:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631893158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DPMZQjGr/REOSZoBnm/6ceWEy5fNbm264K7q21o8L/E=; b=ibBFdgB9csqoTLStAzgTHnzIFlLSHeQjakvzbGY1ws9rBmngRXgsfEnCF2wBieQT0KKKVD X5TSMIS+w8CI/j90+BTimPteiNBI9X37SYugTEYcLaOsq6nR2GBIHyC4QUS6ZXnn55PAm1 ui64GerA6+v40/jgNEfgTQujbMeGwM8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-441--UN7reAHOfO3eV0QT_LFoQ-1; Fri, 17 Sep 2021 11:39:15 -0400 X-MC-Unique: -UN7reAHOfO3eV0QT_LFoQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 890701084683; Fri, 17 Sep 2021 15:39:13 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D924118A8F; Fri, 17 Sep 2021 15:39:11 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Mat Martineau , Ayush Sawal , Eric Dumazet , mptcp@lists.linux.dev Subject: [RFC PATCH 5/5] tcp: remove sk_{tr}x_skb_cache Date: Fri, 17 Sep 2021 17:38:40 +0200 Message-Id: <936af3441ff8972df542fb571ea0ecfe031611fb.1631888517.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Content-Type: text/plain; charset="utf-8" From: Eric Dumazet This reverts the following patches : - commit 2e05fcae83c4 ("tcp: fix compile error if !CONFIG_SYSCTL") - commit 4f661542a402 ("tcp: fix zerocopy and notsent_lowat issues") - commit 472c2e07eef0 ("tcp: add one skb cache for tx") - commit 8b27dae5a2e8 ("tcp: add one skb cache for rx") Having a cache of one skb (in each direction) per TCP socket is fragile, since it can cause a significant increase of memory needs, and not good enough for high speed flows anyway where more than one skb is needed. We want instead to add a generic infrastructure, with more flexible per-cpu caches, for alien NUMA nodes. Acked-by: Paolo Abeni Acked-by: Mat Martineau Signed-off-by: Eric Dumazet --- Documentation/networking/ip-sysctl.rst | 8 -------- include/net/sock.h | 19 ------------------- net/ipv4/af_inet.c | 4 ---- net/ipv4/sysctl_net_ipv4.c | 12 ------------ net/ipv4/tcp.c | 26 -------------------------- net/ipv4/tcp_ipv4.c | 6 ------ net/ipv6/tcp_ipv6.c | 6 ------ 7 files changed, 81 deletions(-) diff --git a/Documentation/networking/ip-sysctl.rst b/Documentation/network= ing/ip-sysctl.rst index d91ab28718d4..16b8bf72feaf 100644 --- a/Documentation/networking/ip-sysctl.rst +++ b/Documentation/networking/ip-sysctl.rst @@ -989,14 +989,6 @@ tcp_challenge_ack_limit - INTEGER in RFC 5961 (Improving TCP's Robustness to Blind In-Window Attacks) Default: 1000 =20 -tcp_rx_skb_cache - BOOLEAN - Controls a per TCP socket cache of one skb, that might help - performance of some workloads. This might be dangerous - on systems with a lot of TCP sockets, since it increases - memory usage. - - Default: 0 (disabled) - UDP variables =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 diff --git a/include/net/sock.h b/include/net/sock.h index 66a9a90f9558..708b9de3cdbb 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -262,7 +262,6 @@ struct bpf_local_storage; * @sk_dst_cache: destination cache * @sk_dst_pending_confirm: need to confirm neighbour * @sk_policy: flow policy - * @sk_rx_skb_cache: cache copy of recently accessed RX skb * @sk_receive_queue: incoming packets * @sk_wmem_alloc: transmit queue bytes committed * @sk_tsq_flags: TCP Small Queues flags @@ -328,7 +327,6 @@ struct bpf_local_storage; * @sk_peek_off: current peek_offset value * @sk_send_head: front of stuff to transmit * @tcp_rtx_queue: TCP re-transmit queue [union with @sk_send_head] - * @sk_tx_skb_cache: cache copy of recently accessed TX skb * @sk_security: used by security modules * @sk_mark: generic packet mark * @sk_cgrp_data: cgroup data for this cgroup @@ -393,7 +391,6 @@ struct sock { atomic_t sk_drops; int sk_rcvlowat; struct sk_buff_head sk_error_queue; - struct sk_buff *sk_rx_skb_cache; struct sk_buff_head sk_receive_queue; /* * The backlog queue is special, it is always used with @@ -442,7 +439,6 @@ struct sock { struct sk_buff *sk_send_head; struct rb_root tcp_rtx_queue; }; - struct sk_buff *sk_tx_skb_cache; struct sk_buff_head sk_write_queue; __s32 sk_peek_off; int sk_write_pending; @@ -1555,18 +1551,10 @@ static inline void sk_mem_uncharge(struct sock *sk,= int size) __sk_mem_reclaim(sk, 1 << 20); } =20 -DECLARE_STATIC_KEY_FALSE(tcp_tx_skb_cache_key); static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) { sk_wmem_queued_add(sk, -skb->truesize); sk_mem_uncharge(sk, skb->truesize); - if (static_branch_unlikely(&tcp_tx_skb_cache_key) && - !sk->sk_tx_skb_cache && !skb_cloned(skb)) { - skb_ext_reset(skb); - skb_zcopy_clear(skb, true); - sk->sk_tx_skb_cache =3D skb; - return; - } __kfree_skb(skb); } =20 @@ -2575,7 +2563,6 @@ static inline void skb_setup_tx_timestamp(struct sk_b= uff *skb, __u16 tsflags) &skb_shinfo(skb)->tskey); } =20 -DECLARE_STATIC_KEY_FALSE(tcp_rx_skb_cache_key); /** * sk_eat_skb - Release a skb if it is no longer needed * @sk: socket to eat this skb from @@ -2587,12 +2574,6 @@ DECLARE_STATIC_KEY_FALSE(tcp_rx_skb_cache_key); static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb) { __skb_unlink(skb, &sk->sk_receive_queue); - if (static_branch_unlikely(&tcp_rx_skb_cache_key) && - !sk->sk_rx_skb_cache) { - sk->sk_rx_skb_cache =3D skb; - skb_orphan(skb); - return; - } __kfree_skb(skb); } =20 diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 1d816a5fd3eb..40558033f857 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -133,10 +133,6 @@ void inet_sock_destruct(struct sock *sk) struct inet_sock *inet =3D inet_sk(sk); =20 __skb_queue_purge(&sk->sk_receive_queue); - if (sk->sk_rx_skb_cache) { - __kfree_skb(sk->sk_rx_skb_cache); - sk->sk_rx_skb_cache =3D NULL; - } __skb_queue_purge(&sk->sk_error_queue); =20 sk_mem_reclaim(sk); diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 6f1e64d49232..6eb43dc91218 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -594,18 +594,6 @@ static struct ctl_table ipv4_table[] =3D { .extra1 =3D &sysctl_fib_sync_mem_min, .extra2 =3D &sysctl_fib_sync_mem_max, }, - { - .procname =3D "tcp_rx_skb_cache", - .data =3D &tcp_rx_skb_cache_key.key, - .mode =3D 0644, - .proc_handler =3D proc_do_static_key, - }, - { - .procname =3D "tcp_tx_skb_cache", - .data =3D &tcp_tx_skb_cache_key.key, - .mode =3D 0644, - .proc_handler =3D proc_do_static_key, - }, { } }; =20 diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index caf0c50d86bc..cbb0f807be46 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -325,11 +325,6 @@ struct tcp_splice_state { unsigned long tcp_memory_pressure __read_mostly; EXPORT_SYMBOL_GPL(tcp_memory_pressure); =20 -DEFINE_STATIC_KEY_FALSE(tcp_rx_skb_cache_key); -EXPORT_SYMBOL(tcp_rx_skb_cache_key); - -DEFINE_STATIC_KEY_FALSE(tcp_tx_skb_cache_key); - void tcp_enter_memory_pressure(struct sock *sk) { unsigned long val; @@ -866,18 +861,6 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, i= nt size, gfp_t gfp, { struct sk_buff *skb; =20 - if (likely(!size)) { - skb =3D sk->sk_tx_skb_cache; - if (skb) { - skb->truesize =3D SKB_TRUESIZE(skb_end_offset(skb)); - sk->sk_tx_skb_cache =3D NULL; - pskb_trim(skb, 0); - INIT_LIST_HEAD(&skb->tcp_tsorted_anchor); - skb_shinfo(skb)->tx_flags =3D 0; - memset(TCP_SKB_CB(skb), 0, sizeof(struct tcp_skb_cb)); - return skb; - } - } /* The TCP header must be at least 32-bit aligned. */ size =3D ALIGN(size, 4); =20 @@ -2905,11 +2888,6 @@ void tcp_write_queue_purge(struct sock *sk) sk_wmem_free_skb(sk, skb); } tcp_rtx_queue_purge(sk); - skb =3D sk->sk_tx_skb_cache; - if (skb) { - __kfree_skb(skb); - sk->sk_tx_skb_cache =3D NULL; - } INIT_LIST_HEAD(&tcp_sk(sk)->tsorted_sent_queue); sk_mem_reclaim(sk); tcp_clear_all_retrans_hints(tcp_sk(sk)); @@ -2946,10 +2924,6 @@ int tcp_disconnect(struct sock *sk, int flags) =20 tcp_clear_xmit_timers(sk); __skb_queue_purge(&sk->sk_receive_queue); - if (sk->sk_rx_skb_cache) { - __kfree_skb(sk->sk_rx_skb_cache); - sk->sk_rx_skb_cache =3D NULL; - } WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); tp->urg_data =3D 0; tcp_write_queue_purge(sk); diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 2e62e0d6373a..29a57bd159f0 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1941,7 +1941,6 @@ static void tcp_v4_fill_cb(struct sk_buff *skb, const= struct iphdr *iph, int tcp_v4_rcv(struct sk_buff *skb) { struct net *net =3D dev_net(skb->dev); - struct sk_buff *skb_to_free; int sdif =3D inet_sdif(skb); int dif =3D inet_iif(skb); const struct iphdr *iph; @@ -2082,17 +2081,12 @@ int tcp_v4_rcv(struct sk_buff *skb) tcp_segs_in(tcp_sk(sk), skb); ret =3D 0; if (!sock_owned_by_user(sk)) { - skb_to_free =3D sk->sk_rx_skb_cache; - sk->sk_rx_skb_cache =3D NULL; ret =3D tcp_v4_do_rcv(sk, skb); } else { if (tcp_add_backlog(sk, skb)) goto discard_and_relse; - skb_to_free =3D NULL; } bh_unlock_sock(sk); - if (skb_to_free) - __kfree_skb(skb_to_free); =20 put_and_return: if (refcounted) diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 0ce52d46e4f8..8cf5ff2e9504 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1618,7 +1618,6 @@ static void tcp_v6_fill_cb(struct sk_buff *skb, const= struct ipv6hdr *hdr, =20 INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) { - struct sk_buff *skb_to_free; int sdif =3D inet6_sdif(skb); int dif =3D inet6_iif(skb); const struct tcphdr *th; @@ -1754,17 +1753,12 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_bu= ff *skb) tcp_segs_in(tcp_sk(sk), skb); ret =3D 0; if (!sock_owned_by_user(sk)) { - skb_to_free =3D sk->sk_rx_skb_cache; - sk->sk_rx_skb_cache =3D NULL; ret =3D tcp_v6_do_rcv(sk, skb); } else { if (tcp_add_backlog(sk, skb)) goto discard_and_relse; - skb_to_free =3D NULL; } bh_unlock_sock(sk); - if (skb_to_free) - __kfree_skb(skb_to_free); put_and_return: if (refcounted) sock_put(sk); --=20 2.26.3