From patchwork Thu Apr 26 19:58:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Ricardo Leitner X-Patchwork-Id: 905365 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uXXDJIdp"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40X7Mp2vQnz9s02 for ; Fri, 27 Apr 2018 06:05:10 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755750AbeDZUFC (ORCPT ); Thu, 26 Apr 2018 16:05:02 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:39111 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755252AbeDZT7Z (ORCPT ); Thu, 26 Apr 2018 15:59:25 -0400 Received: by mail-qk0-f193.google.com with SMTP id z75so15614342qkb.6; Thu, 26 Apr 2018 12:59:24 -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; bh=fbcbTY9xUIkmJmkNuYkX/SgqO0z0b+BlCAcihgvt+Bk=; b=uXXDJIdp4EQj46g/9kezPylqcfXg23l3kf/2u1j81NiQ54SWHVPJ1ChWJuX6bggvdo j6NcHSGEY1aUhtI4PVZZuThl5PB5EMj5Hh+XnoMzcL55AonSbA23a1Z9kd1RrEJzz1d9 0i3zBS+rGBrU3gsYGL7MsZF9aJQW60CeM8hvbJ7kvcTaZ2yVN8ST7O6pRsoBHq++wbWH OVxN7jjpCQflnV416HwccG3X6rG1xMYeZakEFls947Ft1ZrZmS9KR9G1Ix5PpvM4mV6O z/kXZ9RCvWIbSUwLbNs2DzFM48//sjaee3vWp4TPbPoQ60WGHogkgzoTMyHGMU4NS8+z iD5Q== 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; bh=fbcbTY9xUIkmJmkNuYkX/SgqO0z0b+BlCAcihgvt+Bk=; b=mLM6Qjligo4AyfzwiweW3/l76qaYPfRyTGTtY52bT4dywRSGeNIKKKpJKw/pdBxgjr V3FWZ83hQ3wJeFRVZYfggQlahasdUpESsVo+izcByH+lQqtBijTEl/H4DEoCwfPYsWmA 5azFkLHdUpE9HoFSNr1SB4dmpGlOcsYb0r2LM+BK9HGlySUOxR51o1WQHxlvRrRl3O3k FcJj6oDhN3grpPszuu4XI61FdTT/9xhhyv79oDD/WFAqSEw4YVqYObGIAo2Y7+Q/t9db cvw0nsM+2RGaN7OtU4uyGxo5qhR4AZI1MtBSLSL//HH/woks+bnCpYrw5YXukcMJyuld ydSQ== X-Gm-Message-State: ALQs6tBko4vSnxTUityAkwjXoVLsH8UkRhZqL4Id3q2Et9MISqlstIqP qJ4T0iAgrksTP1GadZFVM4Q= X-Google-Smtp-Source: AB8JxZot+p6hCnQWeV0C+sTcpSldW9to8F3g2ojkiC4IKVXhdgkvRnMR8zX8zR4P3LUQ5eQaIcIZ0g== X-Received: by 10.55.162.143 with SMTP id l137mr35844472qke.200.1524772764308; Thu, 26 Apr 2018 12:59:24 -0700 (PDT) Received: from localhost.localdomain ([177.10.56.95]) by smtp.gmail.com with ESMTPSA id f189sm15963134qkj.31.2018.04.26.12.59.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Apr 2018 12:59:22 -0700 (PDT) Received: by localhost.localdomain (Postfix, from userid 1000) id C0E14181106; Thu, 26 Apr 2018 16:59:18 -0300 (-03) From: Marcelo Ricardo Leitner To: netdev@vger.kernel.org Cc: linux-sctp@vger.kernel.org, Vlad Yasevich , Neil Horman , Xin Long Subject: [PATCH net-next 04/13] sctp: introduce sctp_assoc_set_pmtu Date: Thu, 26 Apr 2018 16:58:53 -0300 Message-Id: <681866125037624e9bf6df47bcd6286e0936d129.1524772453.git.marcelo.leitner@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org All changes to asoc PMTU should now go through this wrapper, making it easier to track them and to do other actions upon it. Signed-off-by: Marcelo Ricardo Leitner --- include/net/sctp/structs.h | 1 + net/sctp/associola.c | 21 +++++++++++++-------- net/sctp/socket.c | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 05594b248e5277790cca6542c3680510739ce18b..c5e244be8f1ea99118cac9ada0cfce871cb15d3f 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -2097,6 +2097,7 @@ int sctp_assoc_update(struct sctp_association *old, __u32 sctp_association_get_next_tsn(struct sctp_association *); +void sctp_assoc_set_pmtu(struct sctp_association *asoc, __u32 pmtu); void sctp_assoc_sync_pmtu(struct sctp_association *asoc); void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int); void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int); diff --git a/net/sctp/associola.c b/net/sctp/associola.c index c5ed09cfa8423b17546e3d45f6d06db03af66384..85b362324084e9ba139a39293a527ef06824e55b 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -660,13 +660,9 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, * If not and the current association PMTU is higher than the new * peer's PMTU, reset the association PMTU to the new peer's PMTU. */ - if (asoc->pathmtu) - asoc->pathmtu = min_t(int, peer->pathmtu, asoc->pathmtu); - else - asoc->pathmtu = peer->pathmtu; - - pr_debug("%s: association:%p PMTU set to %d\n", __func__, asoc, - asoc->pathmtu); + sctp_assoc_set_pmtu(asoc, asoc->pathmtu ? + min_t(int, peer->pathmtu, asoc->pathmtu) : + peer->pathmtu); peer->pmtu_pending = 0; @@ -1374,6 +1370,15 @@ sctp_assoc_choose_alter_transport(struct sctp_association *asoc, } } +void sctp_assoc_set_pmtu(struct sctp_association *asoc, __u32 pmtu) +{ + if (asoc->pathmtu != pmtu) + asoc->pathmtu = pmtu; + + pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc, + asoc->pathmtu, asoc->frag_point); +} + /* Update the association's pmtu and frag_point by going through all the * transports. This routine is called when a transport's PMTU has changed. */ @@ -1397,7 +1402,7 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc) pmtu = t->pathmtu; } - asoc->pathmtu = pmtu; + sctp_assoc_set_pmtu(asoc, pmtu); asoc->frag_point = sctp_frag_point(asoc, pmtu); pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc, diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 80835ac26d2c3ce6559f75aaaa0b315fb77d9adf..eeec81d5c485b86076f4e3a4f5dc01fc28fbb91b 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -2539,7 +2539,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, trans->pathmtu = params->spp_pathmtu; sctp_assoc_sync_pmtu(asoc); } else if (asoc) { - asoc->pathmtu = params->spp_pathmtu; + sctp_assoc_set_pmtu(asoc, params->spp_pathmtu); } else { sp->pathmtu = params->spp_pathmtu; }