Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109513243
D33097.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D33097.diff
View Options
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -212,9 +212,6 @@
/* Delayed checksums are currently not compatible with divert. */
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
- m = mb_unmapped_to_ext(m);
- if (m == NULL)
- return;
in_delayed_cksum(m);
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
@@ -226,9 +223,6 @@
#endif
#ifdef INET6
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
- m = mb_unmapped_to_ext(m);
- if (m == NULL)
- return;
in6_delayed_cksum(m, m->m_pkthdr.len -
sizeof(struct ip6_hdr), sizeof(struct ip6_hdr));
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -733,23 +733,20 @@
}
}
- m->m_pkthdr.csum_flags |= CSUM_IP;
- if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA & ~ifp->if_hwassist) {
+ /* Ensure the packet data is mapped if the interface requires it. */
+ if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) {
m = mb_unmapped_to_ext(m);
if (m == NULL) {
IPSTAT_INC(ips_odropped);
error = ENOBUFS;
goto bad;
}
+ }
+
+ m->m_pkthdr.csum_flags |= CSUM_IP;
+ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA & ~ifp->if_hwassist) {
in_delayed_cksum(m);
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
- } else if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) {
- m = mb_unmapped_to_ext(m);
- if (m == NULL) {
- IPSTAT_INC(ips_odropped);
- error = ENOBUFS;
- goto bad;
- }
}
#if defined(SCTP) || defined(SCTP_SUPPORT)
if (m->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) {
@@ -894,12 +891,6 @@
* fragmented packets, then do it here.
*/
if (m0->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
- m0 = mb_unmapped_to_ext(m0);
- if (m0 == NULL) {
- error = ENOBUFS;
- IPSTAT_INC(ips_odropped);
- goto done;
- }
in_delayed_cksum(m0);
m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -212,42 +212,26 @@
*(u_short *)mtodo(m, offset) = csum;
}
-static int
+static void
ip6_output_delayed_csum(struct mbuf *m, struct ifnet *ifp, int csum_flags,
- int plen, int optlen, bool frag)
+ int plen, int optlen)
{
KASSERT((plen >= optlen), ("%s:%d: plen %d < optlen %d, m %p, ifp %p "
- "csum_flags %#x frag %d\n",
- __func__, __LINE__, plen, optlen, m, ifp, csum_flags, frag));
+ "csum_flags %#x",
+ __func__, __LINE__, plen, optlen, m, ifp, csum_flags));
- if ((csum_flags & CSUM_DELAY_DATA_IPV6) ||
-#if defined(SCTP) || defined(SCTP_SUPPORT)
- (csum_flags & CSUM_SCTP_IPV6) ||
-#endif
- (!frag && (ifp->if_capenable & IFCAP_MEXTPG) == 0)) {
- m = mb_unmapped_to_ext(m);
- if (m == NULL) {
- if (frag)
- in6_ifstat_inc(ifp, ifs6_out_fragfail);
- else
- IP6STAT_INC(ip6s_odropped);
- return (ENOBUFS);
- }
- if (csum_flags & CSUM_DELAY_DATA_IPV6) {
- in6_delayed_cksum(m, plen - optlen,
- sizeof(struct ip6_hdr) + optlen);
- m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
- }
+ if (csum_flags & CSUM_DELAY_DATA_IPV6) {
+ in6_delayed_cksum(m, plen - optlen,
+ sizeof(struct ip6_hdr) + optlen);
+ m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
+ }
#if defined(SCTP) || defined(SCTP_SUPPORT)
- if (csum_flags & CSUM_SCTP_IPV6) {
- sctp_delayed_cksum(m, sizeof(struct ip6_hdr) + optlen);
- m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6;
- }
-#endif
+ if (csum_flags & CSUM_SCTP_IPV6) {
+ sctp_delayed_cksum(m, sizeof(struct ip6_hdr) + optlen);
+ m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6;
}
-
- return (0);
+#endif
}
int
@@ -1104,6 +1088,16 @@
passout:
if (vlan_pcp > -1)
EVL_APPLY_PRI(m, vlan_pcp);
+
+ /* Ensure the packet data is mapped if the interface requires it. */
+ if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) {
+ m = mb_unmapped_to_ext(m);
+ if (m == NULL) {
+ IP6STAT_INC(ip6s_odropped);
+ return (ENOBUFS);
+ }
+ }
+
/*
* Send the packet to the outgoing interface.
* If necessary, do IPv6 fragmentation before sending.
@@ -1136,9 +1130,7 @@
* XXX-BZ Need a framework to know when the NIC can handle it, even
* with ext. hdrs.
*/
- error = ip6_output_delayed_csum(m, ifp, sw_csum, plen, optlen, false);
- if (error != 0)
- goto bad;
+ ip6_output_delayed_csum(m, ifp, sw_csum, plen, optlen);
/* XXX-BZ m->m_pkthdr.csum_flags &= ~ifp->if_hwassist; */
tlen = m->m_pkthdr.len;
@@ -1217,10 +1209,8 @@
* fragmented packets, then do it here.
* XXX-BZ handle the hw offloading case. Need flags.
*/
- error = ip6_output_delayed_csum(m, ifp, m->m_pkthdr.csum_flags,
- plen, optlen, true);
- if (error != 0)
- goto bad;
+ ip6_output_delayed_csum(m, ifp, m->m_pkthdr.csum_flags, plen,
+ optlen);
/*
* Change the next header field of the last header in the
diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c
--- a/sys/netipsec/ipsec_output.c
+++ b/sys/netipsec/ipsec_output.c
@@ -398,12 +398,6 @@
* this is done in the normal processing path.
*/
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
- m = mb_unmapped_to_ext(m);
- if (m == NULL) {
- IPSECSTAT_INC(ips_out_nomem);
- key_freesp(&sp);
- return (ENOBUFS);
- }
in_delayed_cksum(m);
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
@@ -773,12 +767,6 @@
* this is done in the normal processing path.
*/
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
- m = mb_unmapped_to_ext(m);
- if (m == NULL) {
- IPSEC6STAT_INC(ips_out_nomem);
- key_freesp(&sp);
- return (ENOBUFS);
- }
in6_delayed_cksum(m, m->m_pkthdr.len -
sizeof(struct ip6_hdr), sizeof(struct ip6_hdr));
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
diff --git a/sys/netpfil/ipfw/nat64/nat64_translate.c b/sys/netpfil/ipfw/nat64/nat64_translate.c
--- a/sys/netpfil/ipfw/nat64/nat64_translate.c
+++ b/sys/netpfil/ipfw/nat64/nat64_translate.c
@@ -1292,11 +1292,6 @@
/* Handle delayed checksums if needed. */
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
- m = mb_unmapped_to_ext(m);
- if (m == NULL) {
- NAT64STAT_INC(&cfg->stats, nomem);
- return (NAT64RETURN);
- }
in_delayed_cksum(m);
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
@@ -1674,11 +1669,6 @@
/* Handle delayed checksums if needed. */
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
- m = mb_unmapped_to_ext(m);
- if (m == NULL) {
- NAT64STAT_INC(&cfg->stats, nomem);
- return (NAT64RETURN);
- }
in6_delayed_cksum(m, plen, hlen);
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
}
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -5989,9 +5989,6 @@
/* Copied from FreeBSD 10.0-CURRENT ip_output. */
m0->m_pkthdr.csum_flags |= CSUM_IP;
if (m0->m_pkthdr.csum_flags & CSUM_DELAY_DATA & ~ifp->if_hwassist) {
- m0 = mb_unmapped_to_ext(m0);
- if (m0 == NULL)
- goto done;
in_delayed_cksum(m0);
m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
@@ -6178,9 +6175,6 @@
if (m0->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6 &
~ifp->if_hwassist) {
uint32_t plen = m0->m_pkthdr.len - sizeof(*ip6);
- m0 = mb_unmapped_to_ext(m0);
- if (m0 == NULL)
- goto done;
in6_delayed_cksum(m0, plen, sizeof(struct ip6_hdr));
m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 7, 1:46 AM (20 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16504339
Default Alt Text
D33097.diff (7 KB)
Attached To
Mode
D33097: netinet: Remove unneeded mb_unmapped_to_ext() calls
Attached
Detach File
Event Timeline
Log In to Comment