From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 DBA7F1376 for ; Sat, 16 Sep 2023 00:40:24 +0000 (UTC) X-Greylist: delayed 682 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 15 Sep 2023 17:37:25 PDT Received: from smtp.chopps.org (smtp.chopps.org [54.88.81.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CDFD02D46 for ; Fri, 15 Sep 2023 17:37:25 -0700 (PDT) Received: from stubbs.local.chopps.org (unknown [213.61.58.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by smtp.chopps.org (Postfix) with ESMTPSA id EE7B67D082; Sat, 16 Sep 2023 00:24:48 +0000 (UTC) User-agent: mu4e 1.8.14; emacs 28.2 From: Christian Hopps To: devel@linux-ipsec.org Cc: Steffen Klassert , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, Christian Hopps , Christian Hopps Subject: [PATCH ipsec-next] xfrm: add comments in the xfrm mtu calc function Date: Fri, 15 Sep 2023 20:15:17 -0400 Message-ID: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Document the [p]mtu values used by, and calculated for xfrms. Signed-off-by: Christian Hopps --- net/xfrm/xfrm_policy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 5c61ec04b839..2480717654b6 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -3858,15 +3858,19 @@ static void xfrm_init_pmtu(struct xfrm_dst **bundle, int nr) u32 pmtu, route_mtu_cached; struct dst_entry *dst; + /* Get the xfrm's dst [p]mtu (i.e., the xfrm's intf/route). */ dst = &xdst->u.dst; pmtu = dst_mtu(xfrm_dst_child(dst)); xdst->child_mtu_cached = pmtu; + /* Subtract the xfrm mode overhead. */ pmtu = xfrm_state_mtu(dst->xfrm, pmtu); + /* Get the inner traffic route's MTU. */ route_mtu_cached = dst_mtu(xdst->route); xdst->route_mtu_cached = route_mtu_cached; + /* Update the xfrm's dst MTU to the minimum of these. */ if (pmtu > route_mtu_cached) pmtu = route_mtu_cached; -- 2.41.0