Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Rename
details: https://anonhg.NetBSD.org/src/rev/6aeb6ea7e57b
branches: trunk
changeset: 365268:6aeb6ea7e57b
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Aug 10 06:46:08 2018 +0000
description:
Rename
ip6_undefer_csum -> in6_undefer_cksum
in6_delayed_cksum -> in6_undefer_cksum_tcpudp
The two previous names were inconsistent and misleading.
Put the two functions into in6_offload.c. Add comments to explain what
we're doing.
Same as IPv4.
diffstat:
sys/arch/powerpc/booke/dev/pq3etsec.c | 6 ++--
sys/dist/pf/net/pf_ioctl.c | 6 ++--
sys/external/bsd/ipf/netinet/ip_fil_netbsd.c | 6 ++--
sys/net/if_loop.c | 6 ++--
sys/net/npf/npf_mbuf.c | 13 +++++++--
sys/netinet6/in6.h | 3 +-
sys/netinet6/in6_offload.c | 38 +++++++++++++++++++++++++--
sys/netinet6/in6_offload.h | 5 ++-
sys/netinet6/ip6_output.c | 37 +++-----------------------
9 files changed, 66 insertions(+), 54 deletions(-)
diffs (truncated from 328 to 300 lines):
diff -r 07b1c4a6743b -r 6aeb6ea7e57b sys/arch/powerpc/booke/dev/pq3etsec.c
--- a/sys/arch/powerpc/booke/dev/pq3etsec.c Fri Aug 10 06:23:12 2018 +0000
+++ b/sys/arch/powerpc/booke/dev/pq3etsec.c Fri Aug 10 06:46:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pq3etsec.c,v 1.35 2018/07/11 05:25:45 maxv Exp $ */
+/* $NetBSD: pq3etsec.c,v 1.36 2018/08/10 06:46:08 maxv Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.35 2018/07/11 05:25:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.36 2018/08/10 06:46:08 maxv Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -2095,7 +2095,7 @@
#endif
} else if (csum_flags & M_CSUM_IP6) {
#ifdef INET6
- ip6_undefer_csum(m, ETHER_HDR_LEN,
+ in6_undefer_cksum(m, ETHER_HDR_LEN,
csum_flags & M_CSUM_IP6);
#else
panic("%s: impossible M_CSUM flags %#x",
diff -r 07b1c4a6743b -r 6aeb6ea7e57b sys/dist/pf/net/pf_ioctl.c
--- a/sys/dist/pf/net/pf_ioctl.c Fri Aug 10 06:23:12 2018 +0000
+++ b/sys/dist/pf/net/pf_ioctl.c Fri Aug 10 06:46:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pf_ioctl.c,v 1.54 2018/07/11 11:13:16 kre Exp $ */
+/* $NetBSD: pf_ioctl.c,v 1.55 2018/08/10 06:46:08 maxv Exp $ */
/* $OpenBSD: pf_ioctl.c,v 1.182 2007/06/24 11:17:13 mcbride Exp $ */
/*
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pf_ioctl.c,v 1.54 2018/07/11 11:13:16 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf_ioctl.c,v 1.55 2018/08/10 06:46:08 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -3344,7 +3344,7 @@
*/
if (dir == PFIL_OUT) {
if ((*mp)->m_pkthdr.csum_flags & (M_CSUM_TCPv6|M_CSUM_UDPv6)) {
- in6_delayed_cksum(*mp);
+ in6_undefer_cksum_tcpudp(*mp);
(*mp)->m_pkthdr.csum_flags &=
~(M_CSUM_TCPv6|M_CSUM_UDPv6);
}
diff -r 07b1c4a6743b -r 6aeb6ea7e57b sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
--- a/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c Fri Aug 10 06:23:12 2018 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c Fri Aug 10 06:46:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_fil_netbsd.c,v 1.29 2018/07/11 05:25:46 maxv Exp $ */
+/* $NetBSD: ip_fil_netbsd.c,v 1.30 2018/08/10 06:46:08 maxv Exp $ */
/*
* Copyright (C) 2012 by Darren Reed.
@@ -8,7 +8,7 @@
#if !defined(lint)
#if defined(__NetBSD__)
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.29 2018/07/11 05:25:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.30 2018/08/10 06:46:08 maxv Exp $");
#else
static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -257,7 +257,7 @@
if (dir == PFIL_OUT) {
if ((*mp)->m_pkthdr.csum_flags & (M_CSUM_TCPv6|M_CSUM_UDPv6)) {
# if (__NetBSD_Version__ > 399000600)
- in6_delayed_cksum(*mp);
+ in6_undefer_cksum_tcpudp(*mp);
# endif
(*mp)->m_pkthdr.csum_flags &= ~(M_CSUM_TCPv6|
M_CSUM_UDPv6);
diff -r 07b1c4a6743b -r 6aeb6ea7e57b sys/net/if_loop.c
--- a/sys/net/if_loop.c Fri Aug 10 06:23:12 2018 +0000
+++ b/sys/net/if_loop.c Fri Aug 10 06:46:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_loop.c,v 1.104 2018/07/11 05:25:45 maxv Exp $ */
+/* $NetBSD: if_loop.c,v 1.105 2018/08/10 06:46:09 maxv Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.104 2018/07/11 05:25:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.105 2018/08/10 06:46:09 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -332,7 +332,7 @@
KASSERT((csum_flags & ~M_CSUM_UDPv6) == 0);
if (csum_flags != 0 &&
IN6_LOOPBACK_NEED_CHECKSUM(csum_flags)) {
- ip6_undefer_csum(m, 0, csum_flags);
+ in6_undefer_cksum(m, 0, csum_flags);
}
m->m_pkthdr.csum_flags = 0;
m->m_flags |= M_LOOP;
diff -r 07b1c4a6743b -r 6aeb6ea7e57b sys/net/npf/npf_mbuf.c
--- a/sys/net/npf/npf_mbuf.c Fri Aug 10 06:23:12 2018 +0000
+++ b/sys/net/npf/npf_mbuf.c Fri Aug 10 06:46:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_mbuf.c,v 1.19 2018/07/11 05:25:45 maxv Exp $ */
+/* $NetBSD: npf_mbuf.c,v 1.20 2018/08/10 06:46:09 maxv Exp $ */
/*-
* Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_mbuf.c,v 1.19 2018/07/11 05:25:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_mbuf.c,v 1.20 2018/08/10 06:46:09 maxv Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -47,6 +47,13 @@
#include "npf_impl.h"
+#ifdef _KERNEL
+#ifdef INET6
+#include <netinet6/in6.h>
+#include <netinet6/in6_offload.h>
+#endif
+#endif
+
#if defined(_NPF_STANDALONE)
#define m_length(m) (nbuf)->nb_mops->getchainlen(m)
#define m_buflen(m) (nbuf)->nb_mops->getlen(m)
@@ -279,7 +286,7 @@
}
#ifdef INET6
if (m->m_pkthdr.csum_flags & (M_CSUM_TCPv6 | M_CSUM_UDPv6)) {
- in6_delayed_cksum(m);
+ in6_undefer_cksum_tcpudp(m);
m->m_pkthdr.csum_flags &= ~(M_CSUM_TCPv6 | M_CSUM_UDPv6);
return true;
}
diff -r 07b1c4a6743b -r 6aeb6ea7e57b sys/netinet6/in6.h
--- a/sys/netinet6/in6.h Fri Aug 10 06:23:12 2018 +0000
+++ b/sys/netinet6/in6.h Fri Aug 10 06:46:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6.h,v 1.91 2018/04/19 21:22:02 christos Exp $ */
+/* $NetBSD: in6.h,v 1.92 2018/08/10 06:46:09 maxv Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -698,7 +698,6 @@
struct sockaddr *sockaddr_in6_externalize(struct sockaddr *, socklen_t,
const struct sockaddr *);
int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t);
-void in6_delayed_cksum(struct mbuf *);
int in6_localaddr(const struct in6_addr *);
int in6_addrscope(const struct in6_addr *);
struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *);
diff -r 07b1c4a6743b -r 6aeb6ea7e57b sys/netinet6/in6_offload.c
--- a/sys/netinet6/in6_offload.c Fri Aug 10 06:23:12 2018 +0000
+++ b/sys/netinet6/in6_offload.c Fri Aug 10 06:46:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_offload.c,v 1.8 2018/06/01 08:56:00 maxv Exp $ */
+/* $NetBSD: in6_offload.c,v 1.9 2018/08/10 06:46:09 maxv Exp $ */
/*-
* Copyright (c)2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_offload.c,v 1.8 2018/06/01 08:56:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_offload.c,v 1.9 2018/08/10 06:46:09 maxv Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -193,8 +193,12 @@
return error;
}
+/*
+ * Compute now in software the IP and TCP/UDP checksums. Cancel the
+ * hardware offloading.
+ */
void
-ip6_undefer_csum(struct mbuf *m, size_t hdrlen, int csum_flags)
+in6_undefer_cksum(struct mbuf *m, size_t hdrlen, int csum_flags)
{
const size_t ip6_plen_offset =
hdrlen + offsetof(struct ip6_hdr, ip6_plen);
@@ -231,3 +235,31 @@
m->m_pkthdr.csum_flags ^= csum_flags;
}
+
+/*
+ * Compute now in software the TCP/UDP checksum. Cancel the hardware
+ * offloading.
+ */
+void
+in6_undefer_cksum_tcpudp(struct mbuf *m)
+{
+ uint16_t csum, offset;
+
+ KASSERT((m->m_pkthdr.csum_flags & (M_CSUM_UDPv6|M_CSUM_TCPv6)) != 0);
+ KASSERT((~m->m_pkthdr.csum_flags & (M_CSUM_UDPv6|M_CSUM_TCPv6)) != 0);
+ KASSERT((m->m_pkthdr.csum_flags
+ & (M_CSUM_UDPv4|M_CSUM_TCPv4|M_CSUM_TSOv4)) == 0);
+
+ offset = M_CSUM_DATA_IPv6_IPHL(m->m_pkthdr.csum_data);
+ csum = in6_cksum(m, 0, offset, m->m_pkthdr.len - offset);
+ if (csum == 0 && (m->m_pkthdr.csum_flags & M_CSUM_UDPv6) != 0) {
+ csum = 0xffff;
+ }
+
+ offset += M_CSUM_DATA_IPv6_OFFSET(m->m_pkthdr.csum_data);
+ if ((offset + sizeof(csum)) > m->m_len) {
+ m_copyback(m, offset, sizeof(csum), &csum);
+ } else {
+ *(uint16_t *)(mtod(m, char *) + offset) = csum;
+ }
+}
diff -r 07b1c4a6743b -r 6aeb6ea7e57b sys/netinet6/in6_offload.h
--- a/sys/netinet6/in6_offload.h Fri Aug 10 06:23:12 2018 +0000
+++ b/sys/netinet6/in6_offload.h Fri Aug 10 06:46:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_offload.h,v 1.7 2011/04/25 22:20:59 yamt Exp $ */
+/* $NetBSD: in6_offload.h,v 1.8 2018/08/10 06:46:09 maxv Exp $ */
/*-
* Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -36,7 +36,8 @@
int tcp6_segment(struct mbuf *, int (*)(void *, struct mbuf *), void *);
int ip6_tso_output(struct ifnet *, struct ifnet *, struct mbuf *,
const struct sockaddr_in6 *, struct rtentry *);
-void ip6_undefer_csum(struct mbuf *, size_t, int);
+void in6_undefer_cksum(struct mbuf *, size_t, int);
+void in6_undefer_cksum_tcpudp(struct mbuf *);
extern int tcp_do_loopback_cksum; /* do TCP checksum on loopback? */
extern int udp_do_loopback_cksum; /* do UDP checksum on loopback? */
diff -r 07b1c4a6743b -r 6aeb6ea7e57b sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Fri Aug 10 06:23:12 2018 +0000
+++ b/sys/netinet6/ip6_output.c Fri Aug 10 06:46:08 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_output.c,v 1.211 2018/06/01 08:56:00 maxv Exp $ */
+/* $NetBSD: ip6_output.c,v 1.212 2018/08/10 06:46:09 maxv Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.211 2018/06/01 08:56:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.212 2018/08/10 06:46:09 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -302,7 +302,7 @@
if (needipsec &&
(m->m_pkthdr.csum_flags & (M_CSUM_UDPv6|M_CSUM_TCPv6)) != 0) {
- in6_delayed_cksum(m);
+ in6_undefer_cksum_tcpudp(m);
m->m_pkthdr.csum_flags &= ~(M_CSUM_UDPv6|M_CSUM_TCPv6);
}
@@ -836,7 +836,7 @@
if ((sw_csum & (M_CSUM_UDPv6|M_CSUM_TCPv6)) != 0) {
if (IN6_NEED_CHECKSUM(ifp,
sw_csum & (M_CSUM_UDPv6|M_CSUM_TCPv6))) {
- in6_delayed_cksum(m);
+ in6_undefer_cksum_tcpudp(m);
}
m->m_pkthdr.csum_flags &= ~(M_CSUM_UDPv6|M_CSUM_TCPv6);
}
@@ -914,7 +914,7 @@
if (IN6_NEED_CHECKSUM(ifp,
m->m_pkthdr.csum_flags &
(M_CSUM_UDPv6|M_CSUM_TCPv6))) {
- in6_delayed_cksum(m);
+ in6_undefer_cksum_tcpudp(m);
}
m->m_pkthdr.csum_flags &= ~(M_CSUM_UDPv6|M_CSUM_TCPv6);
}
@@ -1072,33 +1072,6 @@
}
/*
- * Process a delayed payload checksum calculation.
- */
Home |
Main Index |
Thread Index |
Old Index