Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Feb 2022 00:00:25 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: f921b952dc19 - stable/13 - sctp: retire sctp_mtu_size_reset()
Message-ID:  <202202230000.21N00Pjg061146@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=f921b952dc192b1cef0f9c5ef6625dd7acb7f42c

commit f921b952dc192b1cef0f9c5ef6625dd7acb7f42c
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-12-30 14:30:11 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-02-22 23:58:56 +0000

    sctp: retire sctp_mtu_size_reset()
    
    Thanks to Timo Voelker for making me aware that sctp_mtu_size_reset()
    is very similar to sctp_pathmtu_adjustment().
    
    (cherry picked from commit 1adb91e52164af634c816327f8cdb3751dc76ce4)
---
 sys/netinet/sctp_output.c | 16 +++++++---------
 sys/netinet/sctputil.c    | 31 -------------------------------
 sys/netinet/sctputil.h    |  3 ---
 3 files changed, 7 insertions(+), 43 deletions(-)

diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index 27c384ca5b5a..35a0406a5a9d 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -4244,10 +4244,10 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
 							mtu -= sizeof(struct udphdr);
 						}
 						if (mtu < net->mtu) {
+							net->mtu = mtu;
 							if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) {
-								sctp_mtu_size_reset(inp, &stcb->asoc, mtu);
+								sctp_pathmtu_adjustment(stcb, mtu, true);
 							}
-							net->mtu = mtu;
 						}
 					}
 				} else if (ro->ro_nh == NULL) {
@@ -4586,18 +4586,16 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
 							mtu -= sizeof(struct udphdr);
 						}
 						if (mtu < net->mtu) {
+							net->mtu = mtu;
 							if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) {
-								sctp_mtu_size_reset(inp, &stcb->asoc, mtu);
+								sctp_pathmtu_adjustment(stcb, mtu, false);
 							}
-							net->mtu = mtu;
 						}
 					}
-				} else if (ifp) {
-					if (ND_IFINFO(ifp)->linkmtu &&
+				} else if (ifp != NULL) {
+					if ((ND_IFINFO(ifp)->linkmtu > 0) &&
 					    (stcb->asoc.smallest_mtu > ND_IFINFO(ifp)->linkmtu)) {
-						sctp_mtu_size_reset(inp,
-						    &stcb->asoc,
-						    ND_IFINFO(ifp)->linkmtu);
+						sctp_pathmtu_adjustment(stcb, ND_IFINFO(ifp)->linkmtu, false);
 					}
 				}
 			}
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index df3768ca2a35..04a7e12f10eb 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -2905,37 +2905,6 @@ sctp_calculate_len(struct mbuf *m)
 	return (tlen);
 }
 
-void
-sctp_mtu_size_reset(struct sctp_inpcb *inp,
-    struct sctp_association *asoc, uint32_t mtu)
-{
-	/*
-	 * Reset the P-MTU size on this association, this involves changing
-	 * the asoc MTU, going through ANY chunk+overhead larger than mtu to
-	 * allow the DF flag to be cleared.
-	 */
-	struct sctp_tmit_chunk *chk;
-	unsigned int eff_mtu, ovh;
-
-	asoc->smallest_mtu = mtu;
-	if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
-		ovh = SCTP_MIN_OVERHEAD;
-	} else {
-		ovh = SCTP_MIN_V4_OVERHEAD;
-	}
-	eff_mtu = mtu - ovh;
-	TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) {
-		if (chk->send_size > eff_mtu) {
-			chk->flags |= CHUNK_FLAGS_FRAGMENT_OK;
-		}
-	}
-	TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
-		if (chk->send_size > eff_mtu) {
-			chk->flags |= CHUNK_FLAGS_FRAGMENT_OK;
-		}
-	}
-}
-
 /*
  * Given an association and starting time of the current RTT period, update
  * RTO in number of msecs. net should point to the current network.
diff --git a/sys/netinet/sctputil.h b/sys/netinet/sctputil.h
index 3319eb4f455b..8253fde829e1 100644
--- a/sys/netinet/sctputil.h
+++ b/sys/netinet/sctputil.h
@@ -108,9 +108,6 @@ sctp_timer_stop(int, struct sctp_inpcb *, struct sctp_tcb *,
 int
     sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t vrf_id);
 
-void
-     sctp_mtu_size_reset(struct sctp_inpcb *, struct sctp_association *, uint32_t);
-
 void
 sctp_wakeup_the_read_socket(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
     int so_locked



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202230000.21N00Pjg061146>