From patchwork Tue Sep 29 13:49:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 289383 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFC6EC4727C for ; Tue, 29 Sep 2020 13:51:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 767F42145D for ; Tue, 29 Sep 2020 13:51:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XorZi2p5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730716AbgI2NvH (ORCPT ); Tue, 29 Sep 2020 09:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729351AbgI2NvG (ORCPT ); Tue, 29 Sep 2020 09:51:06 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22DFAC061755; Tue, 29 Sep 2020 06:51:05 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id o25so3954911pgm.0; Tue, 29 Sep 2020 06:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=g1NOLKpd2hSWg3tMRG0Q+HZFXyCwBYbuga7haroPsDs=; b=XorZi2p5oIwFQmiJxYwTHsuPrZY4roo1m23TLllF0H+IQwrgPU2uh8A0+BoyNFCCf8 gfwAKsgW2ALMP8/ie5f/9IeyWqotvnMPH95S7YPZRciuHi5aKQ2iuh8KLkfWsQFHdPsv YTq+sVCYUwqwajEPJbKR3WGtTg7MbnfzFsxZffpWFJ3nWHxYZC9jjlYZNBrIu6h3IC4t MiLKjdVQcLSm90RjOesxss28YBOE7q0JseB4tGb9keObWXbiMHDCQN8j2uXrM263kz8n CCtbE957keP9O/isoGv/SSIOnGprlVoC1GVKcm7DIwwR63rxD314hUTIHWrEWBadthhZ dttw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=g1NOLKpd2hSWg3tMRG0Q+HZFXyCwBYbuga7haroPsDs=; b=r9lSkaITtbkSIOpN+r6ziYBM8hFXtO+Kxtk0djbVT/M3HuYFwOrcRvCoqSAXW8gIRa sWaldT7KQ7ABEhb697Ro+eopCmjGXU8KkTRcEnOP2Vp5cYxKJAYqzP1fXjJHDOfeNDyq kH03ElP08UVomvDPKrA9GZHhMNgZuZLnY0NnM7dosTDGKk2JRH8bT4IMxt+uWkwCAjij Z1QjcM3so1o4q0Q57SMzUxIIuMQeGOpRSDJpoiI/T4nbAixX9kBMeTp4Gv5A3YVKjtzM HoIlLI0Ox7C/amT6W1SUe6UdEWbk8mz5/5KNVmCGBWr4ohHjzuGBsO4Dvno2V8qXKGEp 3wOA== X-Gm-Message-State: AOAM530yXlFqs9aejoYA/rMRNlndE99fyDSQsNVeZTgM+1dmrmn79GbT sU5VnejSh9FOaBuvCeTD+NBhnfVt9Ow= X-Google-Smtp-Source: ABdhPJxRK1bUg9FsFhuQdYcDUmMsf0epxcYJZnhAWuTh7MZ+zKLmPzB69SrRIrXt9UmloWqVss9bAQ== X-Received: by 2002:a63:5916:: with SMTP id n22mr3227723pgb.375.1601387464002; Tue, 29 Sep 2020 06:51:04 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id q10sm4946233pja.48.2020.09.29.06.51.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Sep 2020 06:51:03 -0700 (PDT) From: Xin Long To: network dev , linux-sctp@vger.kernel.org Cc: Marcelo Ricardo Leitner , Neil Horman , Michael Tuexen , Tom Herbert , davem@davemloft.net Subject: [PATCH net-next 12/15] sctp: call sk_setup_caps in sctp_packet_transmit instead Date: Tue, 29 Sep 2020 21:49:04 +0800 Message-Id: <3716fc0699dc1d5557574b5227524e80b7fd76b8.1601387231.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <7ff312f910ada8893fa4db57d341c628d1122640.1601387231.git.lucien.xin@gmail.com> References: <51c1fdad515076f3014476711aec1c0a81c18d36.1601387231.git.lucien.xin@gmail.com> <65f713004ab546e0b6ec793572c72c1d0399f0fe.1601387231.git.lucien.xin@gmail.com> <49a1cbb99341f50304b514aeaace078d0b065248.1601387231.git.lucien.xin@gmail.com> <97963ca7171b92486f46477b55928182abe44806.1601387231.git.lucien.xin@gmail.com> <3f1b88ab88b5cc5321ffe094bcfeff68a3a5ef2c.1601387231.git.lucien.xin@gmail.com> <7ff312f910ada8893fa4db57d341c628d1122640.1601387231.git.lucien.xin@gmail.com> In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org sk_setup_caps() was originally called in Commit 90017accff61 ("sctp: Add GSO support"), as: "We have to refresh this in case we are xmiting to more than one transport at a time" This actually happens in the loop of sctp_outq_flush_transports(), and it shouldn't be gso related, so move it out of gso part and before sctp_packet_pack(). Signed-off-by: Xin Long --- net/sctp/output.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/net/sctp/output.c b/net/sctp/output.c index 1441eaf..fb16500 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c @@ -508,12 +508,6 @@ static int sctp_packet_pack(struct sctp_packet *packet, sizeof(struct inet6_skb_parm))); skb_shinfo(head)->gso_segs = pkt_count; skb_shinfo(head)->gso_size = GSO_BY_FRAGS; - rcu_read_lock(); - if (skb_dst(head) != tp->dst) { - dst_hold(tp->dst); - sk_setup_caps(sk, tp->dst); - } - rcu_read_unlock(); goto chksum; } @@ -593,6 +587,13 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) } skb_dst_set(head, dst); + rcu_read_lock(); + if (__sk_dst_get(sk) != tp->dst) { + dst_hold(tp->dst); + sk_setup_caps(sk, tp->dst); + } + rcu_read_unlock(); + /* pack up chunks */ pkt_count = sctp_packet_pack(packet, head, gso, gfp); if (!pkt_count) {