Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet redo ip_output.c rev.1.206 and 1.207 differently...
details: https://anonhg.NetBSD.org/src/rev/c96e262df14b
branches: trunk
changeset: 770737:c96e262df14b
user: yamt <yamt%NetBSD.org@localhost>
date: Mon Oct 31 13:16:01 2011 +0000
description:
redo ip_output.c rev.1.206 and 1.207 differently. PR/43664.
ok'ed by martin@
diffstat:
sys/netinet/ip_output.c | 39 ++++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 17 deletions(-)
diffs (71 lines):
diff -r 230d04c93eef -r c96e262df14b sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c Mon Oct 31 13:01:42 2011 +0000
+++ b/sys/netinet/ip_output.c Mon Oct 31 13:16:01 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_output.c,v 1.209 2011/07/17 20:54:53 joerg Exp $ */
+/* $NetBSD: ip_output.c,v 1.210 2011/10/31 13:16:01 yamt Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.209 2011/07/17 20:54:53 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.210 2011/10/31 13:16:01 yamt Exp $");
#include "opt_pfil_hooks.h"
#include "opt_inet.h"
@@ -1008,12 +1008,19 @@
m->m_pkthdr.len = mhlen + len;
m->m_pkthdr.rcvif = (struct ifnet *)0;
mhip->ip_sum = 0;
+ KASSERT((m->m_pkthdr.csum_flags & M_CSUM_IPv4) == 0);
if (sw_csum & M_CSUM_IPv4) {
mhip->ip_sum = in_cksum(m, mhlen);
- KASSERT((m->m_pkthdr.csum_flags & M_CSUM_IPv4) == 0);
} else {
- m->m_pkthdr.csum_flags |= M_CSUM_IPv4;
+ /*
+ * checksum is hw-offloaded or not necessary.
+ */
+ m->m_pkthdr.csum_flags |=
+ m0->m_pkthdr.csum_flags & M_CSUM_IPv4;
m->m_pkthdr.csum_data |= mhlen << 16;
+ KASSERT(!(ifp != NULL &&
+ IN_NEED_CHECKSUM(ifp, M_CSUM_IPv4))
+ || (m->m_pkthdr.csum_flags & M_CSUM_IPv4) != 0);
}
IP_STATINC(IP_STAT_OFRAGMENTS);
fragments++;
@@ -1028,19 +1035,17 @@
ip->ip_len = htons((u_int16_t)m->m_pkthdr.len);
ip->ip_off |= htons(IP_MF);
ip->ip_sum = 0;
- /*
- * We may not use checksums on loopback interfaces
- */
- if (__predict_false(ifp == NULL) ||
- IN_NEED_CHECKSUM(ifp, M_CSUM_IPv4)) {
- if (sw_csum & M_CSUM_IPv4) {
- ip->ip_sum = in_cksum(m, hlen);
- m->m_pkthdr.csum_flags &= ~M_CSUM_IPv4;
- } else {
- KASSERT(m->m_pkthdr.csum_flags & M_CSUM_IPv4);
- KASSERT(M_CSUM_DATA_IPv4_IPHL(m->m_pkthdr.csum_data) >=
- sizeof(struct ip));
- }
+ if (sw_csum & M_CSUM_IPv4) {
+ ip->ip_sum = in_cksum(m, hlen);
+ m->m_pkthdr.csum_flags &= ~M_CSUM_IPv4;
+ } else {
+ /*
+ * checksum is hw-offloaded or not necessary.
+ */
+ KASSERT(!(ifp != NULL && IN_NEED_CHECKSUM(ifp, M_CSUM_IPv4))
+ || (m->m_pkthdr.csum_flags & M_CSUM_IPv4) != 0);
+ KASSERT(M_CSUM_DATA_IPv4_IPHL(m->m_pkthdr.csum_data) >=
+ sizeof(struct ip));
}
sendorfree:
/*
Home |
Main Index |
Thread Index |
Old Index