Add infrastructure to allow ports to override build of in6_cksum.c by
enabling the INET6_MD_CKSUM option, which is defopted into opt_inet.h. Supply an i386 assembly version of in6_cksum in in_cksum.s; on P6-family cpu's, this is is roughly 20% faster than the C code in sys/netinet6 for ethernet-mtu-sized mbufs in L1 cache. Turn on INET6_MD_CKSUM in i386/conf/std.i386 While we're here, also nuke some now-obsolete XXX comments from in_cksum.s.
This commit is contained in:
parent
839708d0cf
commit
bdecf91bef
@ -1,4 +1,4 @@
|
||||
# $NetBSD: std.i386,v 1.19 2000/06/22 20:27:53 fvdl Exp $
|
||||
# $NetBSD: std.i386,v 1.20 2001/05/26 17:46:12 sommerfeld Exp $
|
||||
#
|
||||
# standard, required NetBSD/i386 'options'
|
||||
|
||||
@ -7,3 +7,5 @@ machine i386
|
||||
options EXEC_AOUT # exec a.out binaries
|
||||
options EXEC_ELF32 # exec ELF binaries
|
||||
options EXEC_SCRIPT # exec #! scripts
|
||||
|
||||
options INET6_MD_CKSUM # machine-dependant code for in6_cksum
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: genassym.cf,v 1.26 2001/04/14 13:56:02 augustss Exp $
|
||||
# $NetBSD: genassym.cf,v 1.27 2001/05/26 17:46:12 sommerfeld Exp $
|
||||
|
||||
#
|
||||
# Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -89,6 +89,7 @@ include <sys/mbuf.h>
|
||||
include <netinet/in.h>
|
||||
include <netinet/in_systm.h>
|
||||
include <netinet/ip.h>
|
||||
include <netinet/ip6.h>
|
||||
include <netinet/ip_var.h>
|
||||
|
||||
include <uvm/uvm.h>
|
||||
@ -158,6 +159,9 @@ define M_NEXT offsetof(struct mbuf, m_next)
|
||||
define IP_SRC offsetof(struct ip, ip_src)
|
||||
define IP_DST offsetof(struct ip, ip_dst)
|
||||
|
||||
define IP6_SRC offsetof(struct ip6_hdr, ip6_src)
|
||||
define IP6_DST offsetof(struct ip6_hdr, ip6_dst)
|
||||
|
||||
define V_TRAP offsetof(struct uvmexp, traps)
|
||||
define V_INTR offsetof(struct uvmexp, intrs)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: in_cksum.s,v 1.15 2001/05/23 15:56:51 sommerfeld Exp $ */
|
||||
/* $NetBSD: in_cksum.s,v 1.16 2001/05/26 17:46:12 sommerfeld Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
||||
@ -69,6 +69,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "assym.h"
|
||||
|
||||
@ -124,7 +126,71 @@
|
||||
addw %dx, %ax ; \
|
||||
adcw $0, %ax
|
||||
|
||||
/* XXX There should really be a section 9 for this. --PM, May 21, 2001 */
|
||||
|
||||
/*
|
||||
* XXX KAME handles link-local scopes in a way which causes us great pain.
|
||||
* we need to special-case link-local addresses and not include the scope id
|
||||
* as part of the transport-layer pseudoheader.
|
||||
* Both ff02::/16 and fe80::/10 get this treatment.
|
||||
*
|
||||
* so, big-endian, this would be:
|
||||
* (s6_addr32[0] & 0xffc00000) == 0xfe800000
|
||||
* (s6_addr32[0] & 0xff0f) == 0xff020000
|
||||
* since we're little-endian,
|
||||
* (s6_addr32[0] & 0x0000c0ff) == 0x000080fe
|
||||
* (s6_addr32[0] & 0x00000fff) == 0x000002ff
|
||||
*/
|
||||
|
||||
#define ADD6SCOPE(n) \
|
||||
movw n(%ebx), %cx ; \
|
||||
addl %ecx,%eax ; \
|
||||
andl $0xc0ff,%ecx ; \
|
||||
cmpl $0x80fe,%ecx ; \
|
||||
je 1f ; \
|
||||
movw n(%ebx), %cx ; \
|
||||
andl $0xfff,%ecx ; \
|
||||
cmpl $0x2ff,%ecx ; \
|
||||
je 1f ; \
|
||||
movw n+2(%ebx),%cx ; \
|
||||
addl %ecx,%eax ; \
|
||||
1:
|
||||
|
||||
#if defined(INET6) && defined(INET6_MD_CKSUM)
|
||||
/*
|
||||
* XXX does not deal with jumbograms.
|
||||
*/
|
||||
/* LINTSTUB: Func: int in6_cksum(struct mbuf *m, u_int8_t nxt, int off, int len) */
|
||||
ENTRY(in6_cksum)
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
|
||||
movl 16(%esp), %ebp
|
||||
movzbl 20(%esp), %eax /* sum = nxt */
|
||||
movl 24(%esp), %edx /* %edx = off */
|
||||
movl 28(%esp), %esi /* %esi = len */
|
||||
testl %eax, %eax
|
||||
jz mbuf_loop_0 /* skip if nxt == 0 */
|
||||
movl M_DATA(%ebp), %ebx
|
||||
addl %esi, %eax /* sum += len */
|
||||
shll $8, %eax /* sum = htons(sum) */
|
||||
xorl %ecx,%ecx
|
||||
ADD6SCOPE(IP6_SRC)
|
||||
ADD6SCOPE(IP6_DST)
|
||||
ADD(IP6_SRC+4) /* sum += ip6->ip6_src */
|
||||
ADC(IP6_SRC+8) /* sum += ip6->ip6_src */
|
||||
ADC(IP6_SRC+12) /* sum += ip6->ip6_src */
|
||||
ADC(IP6_DST+4) /* sum += ip6->ip_dst */
|
||||
ADC(IP6_DST+8) /* sum += ip6->ip_dst */
|
||||
ADC(IP6_DST+12) /* sum += ip6->ip_dst */
|
||||
|
||||
MOP
|
||||
#ifdef INET
|
||||
jmp mbuf_loop_0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef INET
|
||||
/* LINTSTUB: Func: int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len) */
|
||||
ENTRY(in4_cksum)
|
||||
pushl %ebp
|
||||
@ -144,7 +210,7 @@ ENTRY(in4_cksum)
|
||||
ADD(IP_SRC) /* sum += ip->ip_src */
|
||||
ADC(IP_DST) /* sum += ip->ip_dst */
|
||||
MOP
|
||||
|
||||
#endif
|
||||
mbuf_loop_0:
|
||||
testl %ebp, %ebp
|
||||
jz out_of_mbufs
|
||||
@ -170,9 +236,7 @@ mbuf_loop_0:
|
||||
jmp in4_entry
|
||||
|
||||
|
||||
/* XXX There should really be a section 9 for this. --PM, May 21, 2001 */
|
||||
/* XXX The prototype below deserves better parameter names. */
|
||||
/* LINTSTUB: Func: int in_cksum(struct mbuf *m, int i) */
|
||||
/* LINTSTUB: Func: int in_cksum(struct mbuf *m, int len) */
|
||||
ENTRY(in_cksum)
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files,v 1.441 2001/05/18 19:59:03 matt Exp $
|
||||
# $NetBSD: files,v 1.442 2001/05/26 17:46:11 sommerfeld Exp $
|
||||
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
|
||||
@ -55,7 +55,7 @@ defopt opt_compat_netbsd.h COMPAT_09 COMPAT_10 COMPAT_11 COMPAT_12
|
||||
COMPAT_13 COMPAT_14 COMPAT_15 COMPAT_NOMID
|
||||
|
||||
# networking protocols
|
||||
defopt opt_inet.h INET INET6
|
||||
defopt opt_inet.h INET INET6 INET6_MD_CKSUM
|
||||
defopt opt_ipsec.h IPSEC IPSEC_ESP
|
||||
defopt opt_inet_conf.h SUBNETSARELOCAL HOSTZEROBROADCAST
|
||||
defopt opt_atalk.h NETATALK
|
||||
@ -1039,7 +1039,7 @@ file netinet6/esp_rijndael.c ipsec & ipsec_esp
|
||||
file netinet6/frag6.c inet6
|
||||
file netinet6/icmp6.c inet6
|
||||
file netinet6/in6.c inet6
|
||||
file netinet6/in6_cksum.c inet6
|
||||
file netinet6/in6_cksum.c inet6 & !inet6_md_cksum
|
||||
file netinet6/in6_gif.c gif & inet6
|
||||
file netinet6/in6_ifattach.c inet6
|
||||
file netinet6/in6_pcb.c inet6
|
||||
|
Loading…
Reference in New Issue
Block a user