Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/ip6_output.c
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
* @(#)ip_output.c 8.3 (Berkeley) 1/21/94 | * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_inet.h" | #include "opt_inet.h" | ||||
#include "opt_inet6.h" | #include "opt_inet6.h" | ||||
#include "opt_ratelimit.h" | |||||
#include "opt_ipsec.h" | #include "opt_ipsec.h" | ||||
#include "opt_sctp.h" | #include "opt_ratelimit.h" | ||||
#include "opt_route.h" | #include "opt_route.h" | ||||
#include "opt_rss.h" | #include "opt_rss.h" | ||||
#include "opt_sctp.h" | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/errno.h> | #include <sys/errno.h> | ||||
#include <sys/priv.h> | #include <sys/priv.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
▲ Show 20 Lines • Show All 875 Lines • ▼ Show 20 Lines | passout: | ||||
/* | /* | ||||
* If we added extension headers, we will not do TSO and calculate the | * If we added extension headers, we will not do TSO and calculate the | ||||
* checksums ourselves for now. | * checksums ourselves for now. | ||||
* XXX-BZ Need a framework to know when the NIC can handle it, even | * XXX-BZ Need a framework to know when the NIC can handle it, even | ||||
* with ext. hdrs. | * with ext. hdrs. | ||||
*/ | */ | ||||
if (sw_csum & CSUM_DELAY_DATA_IPV6) { | if (sw_csum & CSUM_DELAY_DATA_IPV6) { | ||||
sw_csum &= ~CSUM_DELAY_DATA_IPV6; | sw_csum &= ~CSUM_DELAY_DATA_IPV6; | ||||
m = mb_unmapped_to_ext(m); | |||||
if (m == NULL) { | |||||
error = ENOBUFS; | |||||
IP6STAT_INC(ip6s_odropped); | |||||
goto bad; | |||||
} | |||||
in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr)); | in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr)); | ||||
} else if ((ifp->if_capenable & IFCAP_NOMAP) == 0) { | |||||
m = mb_unmapped_to_ext(m); | |||||
if (m == NULL) { | |||||
error = ENOBUFS; | |||||
IP6STAT_INC(ip6s_odropped); | |||||
goto bad; | |||||
} | } | ||||
} | |||||
#ifdef SCTP | #ifdef SCTP | ||||
if (sw_csum & CSUM_SCTP_IPV6) { | if (sw_csum & CSUM_SCTP_IPV6) { | ||||
sw_csum &= ~CSUM_SCTP_IPV6; | sw_csum &= ~CSUM_SCTP_IPV6; | ||||
m = mb_unmapped_to_ext(m); | |||||
if (m == NULL) { | |||||
error = ENOBUFS; | |||||
IP6STAT_INC(ip6s_odropped); | |||||
goto bad; | |||||
} | |||||
sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); | sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); | ||||
} | } | ||||
#endif | #endif | ||||
m->m_pkthdr.csum_flags &= ifp->if_hwassist; | m->m_pkthdr.csum_flags &= ifp->if_hwassist; | ||||
tlen = m->m_pkthdr.len; | tlen = m->m_pkthdr.len; | ||||
if ((opt && (opt->ip6po_flags & IP6PO_DONTFRAG)) || tso) | if ((opt && (opt->ip6po_flags & IP6PO_DONTFRAG)) || tso) | ||||
dontfrag = 1; | dontfrag = 1; | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | if (mtu < IPV6_MMTU) { | ||||
} | } | ||||
/* | /* | ||||
* If the interface will not calculate checksums on | * If the interface will not calculate checksums on | ||||
* fragmented packets, then do it here. | * fragmented packets, then do it here. | ||||
* XXX-BZ handle the hw offloading case. Need flags. | * XXX-BZ handle the hw offloading case. Need flags. | ||||
*/ | */ | ||||
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { | if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { | ||||
m = mb_unmapped_to_ext(m); | |||||
if (m == NULL) { | |||||
in6_ifstat_inc(ifp, ifs6_out_fragfail); | |||||
error = ENOBUFS; | |||||
goto bad; | |||||
} | |||||
in6_delayed_cksum(m, plen, hlen); | in6_delayed_cksum(m, plen, hlen); | ||||
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; | m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; | ||||
} | } | ||||
#ifdef SCTP | #ifdef SCTP | ||||
if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { | if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { | ||||
m = mb_unmapped_to_ext(m); | |||||
if (m == NULL) { | |||||
in6_ifstat_inc(ifp, ifs6_out_fragfail); | |||||
error = ENOBUFS; | |||||
goto bad; | |||||
} | |||||
sctp_delayed_cksum(m, hlen); | sctp_delayed_cksum(m, hlen); | ||||
m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; | m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; | ||||
} | } | ||||
#endif | #endif | ||||
/* | /* | ||||
* Change the next header field of the last header in the | * Change the next header field of the last header in the | ||||
* unfragmentable part. | * unfragmentable part. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 2,103 Lines • Show Last 20 Lines |