Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 2021 18:52:45 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 756bb50b6a86 - main - sctp: Remove now-unneeded mb_unmapped_to_ext() calls
Message-ID:  <202111161852.1AGIqjV7017940@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

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

commit 756bb50b6a867f3309ce76d76f1842a667dd303a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-11-16 18:38:09 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-11-16 18:38:09 +0000

    sctp: Remove now-unneeded mb_unmapped_to_ext() calls
    
    sctp_delayed_checksum() now handles unmapped mbufs, thanks to m_apply().
    
    No functional change intended.
    
    Reviewed by:    tuexen
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D32942
---
 sys/netinet/ip_divert.c     |  6 ------
 sys/netinet/ip_output.c     | 12 ------------
 sys/netipsec/ipsec_output.c | 12 ------------
 sys/netpfil/pf/pf.c         |  3 ---
 4 files changed, 33 deletions(-)

diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 3e1200b1ff1c..fb4eba220703 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -220,9 +220,6 @@ divert_packet(struct mbuf *m, bool incoming)
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m->m_pkthdr.csum_flags & CSUM_SCTP) {
-		m = mb_unmapped_to_ext(m);
-		if (m == NULL)
-			return;
 		sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
 		m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
 	}
@@ -238,9 +235,6 @@ divert_packet(struct mbuf *m, bool incoming)
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) {
-		m = mb_unmapped_to_ext(m);
-		if (m == NULL)
-			return;
 		sctp_delayed_cksum(m, sizeof(struct ip6_hdr));
 		m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6;
 	}
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index d850cf5b5167..cfa6b1919a06 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -753,12 +753,6 @@ sendit:
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) {
-		m = mb_unmapped_to_ext(m);
-		if (m == NULL) {
-			IPSTAT_INC(ips_odropped);
-			error = ENOBUFS;
-			goto bad;
-		}
 		sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
 		m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
 	}
@@ -911,12 +905,6 @@ ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m0->m_pkthdr.csum_flags & CSUM_SCTP) {
-		m0 = mb_unmapped_to_ext(m0);
-		if (m0 == NULL) {
-			error = ENOBUFS;
-			IPSTAT_INC(ips_odropped);
-			goto done;
-		}
 		sctp_delayed_cksum(m0, hlen);
 		m0->m_pkthdr.csum_flags &= ~CSUM_SCTP;
 	}
diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c
index 0a722140f93e..0b171e9c4970 100644
--- a/sys/netipsec/ipsec_output.c
+++ b/sys/netipsec/ipsec_output.c
@@ -411,12 +411,6 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp, int forwarding)
 		if (m->m_pkthdr.csum_flags & CSUM_SCTP) {
 			struct ip *ip;
 
-			m = mb_unmapped_to_ext(m);
-			if (m == NULL) {
-				IPSECSTAT_INC(ips_out_nomem);
-				key_freesp(&sp);
-				return (ENOBUFS);
-			}
 			ip = mtod(m, struct ip *);
 			sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
 			m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
@@ -791,12 +785,6 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding)
 		}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 		if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) {
-			m = mb_unmapped_to_ext(m);
-			if (m == NULL) {
-				IPSEC6STAT_INC(ips_out_nomem);
-				key_freesp(&sp);
-				return (ENOBUFS);
-			}
 			sctp_delayed_cksum(m, sizeof(struct ip6_hdr));
 			m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6;
 		}
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 9595650dbc36..8891ac75330a 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -6000,9 +6000,6 @@ pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp,
 	}
 #if defined(SCTP) || defined(SCTP_SUPPORT)
 	if (m0->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) {
-		m0 = mb_unmapped_to_ext(m0);
-		if (m0 == NULL)
-			goto done;
 		sctp_delayed_cksum(m0, (uint32_t)(ip->ip_hl << 2));
 		m0->m_pkthdr.csum_flags &= ~CSUM_SCTP;
 	}



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