Module Name:    src
Committed By:   alnsn
Date:           Thu Sep 27 18:28:56 UTC 2012

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/sys/arch/amd64/conf: files.amd64 std.amd64
        src/sys/arch/i386/conf: files.i386 std.i386
        src/sys/conf: files
        src/sys/modules/bpf: Makefile
        src/sys/net: Makefile bpf.c bpf_filter.c bpfdesc.h
Removed Files:
        src/sys/arch/amd64/amd64: bpf_jit_machdep.c bpf_jit_machdep.h
        src/sys/arch/i386/i386: bpf_jit_machdep.c bpf_jit_machdep.h
        src/sys/net: bpf_jit.c bpf_jit.h

Log Message:
Remove bpf_jit which was ported from FreeBSD recently.

It will soon be replaced with the new bpfjit kernel module.


To generate a diff of this commit:
cvs rdiff -u -r1.1781 -r1.1782 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.1 -r0 src/sys/arch/amd64/amd64/bpf_jit_machdep.c \
    src/sys/arch/amd64/amd64/bpf_jit_machdep.h
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amd64/conf/std.amd64
cvs rdiff -u -r1.364 -r1.365 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/i386/conf/std.i386
cvs rdiff -u -r1.1 -r0 src/sys/arch/i386/i386/bpf_jit_machdep.c \
    src/sys/arch/i386/i386/bpf_jit_machdep.h
cvs rdiff -u -r1.1057 -r1.1058 src/sys/conf/files
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/bpf/Makefile
cvs rdiff -u -r1.30 -r1.31 src/sys/net/Makefile
cvs rdiff -u -r1.171 -r1.172 src/sys/net/bpf.c
cvs rdiff -u -r1.53 -r1.54 src/sys/net/bpf_filter.c
cvs rdiff -u -r1.1 -r0 src/sys/net/bpf_jit.c
cvs rdiff -u -r1.2 -r0 src/sys/net/bpf_jit.h
cvs rdiff -u -r1.34 -r1.35 src/sys/net/bpfdesc.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1781 src/distrib/sets/lists/comp/mi:1.1782
--- src/distrib/sets/lists/comp/mi:1.1781	Tue Sep 18 15:14:41 2012
+++ src/distrib/sets/lists/comp/mi	Thu Sep 27 18:28:53 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1781 2012/09/18 15:14:41 skrll Exp $
+#	$NetBSD: mi,v 1.1782 2012/09/27 18:28:53 alnsn Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1805,7 +1805,7 @@
 ./usr/include/net/agr/if_agrioctl.h		comp-c-include
 ./usr/include/net/bpf.h				comp-c-include
 ./usr/include/net/bpfdesc.h			comp-c-include
-./usr/include/net/bpf_jit.h			comp-c-include
+./usr/include/net/bpf_jit.h			comp-c-include		obsolete
 ./usr/include/net/dlt.h				comp-c-include
 ./usr/include/net/ethertypes.h			comp-c-include
 ./usr/include/net/if.h				comp-c-include

Index: src/sys/arch/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.76 src/sys/arch/amd64/conf/files.amd64:1.77
--- src/sys/arch/amd64/conf/files.amd64:1.76	Wed Aug  1 23:24:29 2012
+++ src/sys/arch/amd64/conf/files.amd64	Thu Sep 27 18:28:55 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.76 2012/08/01 23:24:29 rmind Exp $
+#	$NetBSD: files.amd64,v 1.77 2012/09/27 18:28:55 alnsn Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -31,7 +31,6 @@ defflag eisa.h EISA
 file	arch/amd64/amd64/amd64func.S
 file	arch/amd64/amd64/autoconf.c
 file	arch/amd64/amd64/busfunc.S
-file	arch/amd64/amd64/bpf_jit_machdep.c	bpf_filter
 file	arch/amd64/amd64/cpu_in_cksum.S		(inet | inet6) & cpu_in_cksum
 file	arch/amd64/amd64/cpufunc.S
 file	arch/amd64/amd64/db_disasm.c		ddb

Index: src/sys/arch/amd64/conf/std.amd64
diff -u src/sys/arch/amd64/conf/std.amd64:1.8 src/sys/arch/amd64/conf/std.amd64:1.9
--- src/sys/arch/amd64/conf/std.amd64:1.8	Wed Aug  1 23:24:29 2012
+++ src/sys/arch/amd64/conf/std.amd64	Thu Sep 27 18:28:55 2012
@@ -1,11 +1,10 @@
-# $NetBSD: std.amd64,v 1.8 2012/08/01 23:24:29 rmind Exp $
+# $NetBSD: std.amd64,v 1.9 2012/09/27 18:28:55 alnsn Exp $
 #
 # standard, required NetBSD/amd64 'options'
 
 machine amd64 x86
 include		"conf/std"	# MI standard options
 
-options 	BPF_JIT
 options 	CPU_IN_CKSUM
 options 	EXEC_ELF64	# exec ELF binaries
 options 	EXEC_SCRIPT	# exec #! scripts

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.364 src/sys/arch/i386/conf/files.i386:1.365
--- src/sys/arch/i386/conf/files.i386:1.364	Wed Aug  1 23:24:29 2012
+++ src/sys/arch/i386/conf/files.i386	Thu Sep 27 18:28:55 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.364 2012/08/01 23:24:29 rmind Exp $
+#	$NetBSD: files.i386,v 1.365 2012/09/27 18:28:55 alnsn Exp $
 #
 # new style config file for i386 architecture
 #
@@ -61,7 +61,6 @@ file 	arch/i386/i386/multiboot.c	multibo
 
 file	arch/i386/i386/autoconf.c
 file	arch/i386/i386/aout_machdep.c	exec_aout
-file	arch/i386/i386/bpf_jit_machdep.c	bpf_filter
 file	arch/i386/i386/busfunc.S
 file	arch/i386/i386/cpufunc.S
 file	arch/i386/i386/cpu_in_cksum.S	(inet | inet6) & cpu_in_cksum

Index: src/sys/arch/i386/conf/std.i386
diff -u src/sys/arch/i386/conf/std.i386:1.32 src/sys/arch/i386/conf/std.i386:1.33
--- src/sys/arch/i386/conf/std.i386:1.32	Wed Aug  1 23:24:29 2012
+++ src/sys/arch/i386/conf/std.i386	Thu Sep 27 18:28:55 2012
@@ -1,11 +1,10 @@
-# $NetBSD: std.i386,v 1.32 2012/08/01 23:24:29 rmind Exp $
+# $NetBSD: std.i386,v 1.33 2012/09/27 18:28:55 alnsn Exp $
 #
 # standard, required NetBSD/i386 'options'
 
 machine i386 x86
 include		"conf/std"	# MI standard options
 
-options 	BPF_JIT
 options 	CPU_IN_CKSUM
 options 	EXEC_AOUT	# exec a.out binaries
 options 	EXEC_ELF32	# exec ELF binaries

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1057 src/sys/conf/files:1.1058
--- src/sys/conf/files:1.1057	Sat Sep  1 11:21:22 2012
+++ src/sys/conf/files	Thu Sep 27 18:28:56 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1057 2012/09/01 11:21:22 matt Exp $
+#	$NetBSD: files,v 1.1058 2012/09/27 18:28:56 alnsn Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -184,7 +184,6 @@ include "dev/sysmon/files.sysmon"
 #
 define	bpf_filter
 defparam opt_bpf.h	BPF_BUFSIZE
-defflag opt_bpf.h	BPF_JIT
 
 include "net80211/files.net80211"
 include "netatalk/files.netatalk"
@@ -1648,7 +1647,6 @@ file	miscfs/syncfs/sync_vnops.c
 
 file	net/bpf.c			bpfilter
 file	net/bpf_filter.c		bpf_filter
-file	net/bpf_jit.c			bpf_filter & bpf_jit
 file	net/bpf_stub.c
 file	net/bsd-comp.c			ppp & ppp_bsdcomp
 file	net/if.c

Index: src/sys/modules/bpf/Makefile
diff -u src/sys/modules/bpf/Makefile:1.3 src/sys/modules/bpf/Makefile:1.4
--- src/sys/modules/bpf/Makefile:1.3	Thu Aug  2 00:22:32 2012
+++ src/sys/modules/bpf/Makefile	Thu Sep 27 18:28:56 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2012/08/02 00:22:32 matt Exp $
+#	$NetBSD: Makefile,v 1.4 2012/09/27 18:28:56 alnsn Exp $
 #
 
 .include "../Makefile.inc"
@@ -10,16 +10,4 @@ KMOD=	bpf
 # inseparable from bpfilter?)
 SRCS=	bpf.c bpf_filter.c
 
-.PATH:	${S}/arch/${MACHINE}/${MACHINE}
-.PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-.PATH:	${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}
-
-.if (exists(${S}/arch/${MACHINE}/${MACHINE}/bpf_jit_machdep.c)) || \
-    (exists(${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}/bpf_jit_machdep.c)) || \
-    (exists(${S}/arch/${MACHINE_CPU}/${MACHINE_CPU}/bpf_jit_machdep.c))
-SRCS+=		bpf_jit.c
-SRCS+=		bpf_jit_machdep.c
-CPPFLAGS+=	-DBPF_JIT
-.endif
-
 .include <bsd.kmodule.mk>

Index: src/sys/net/Makefile
diff -u src/sys/net/Makefile:1.30 src/sys/net/Makefile:1.31
--- src/sys/net/Makefile:1.30	Thu Aug  2 01:16:36 2012
+++ src/sys/net/Makefile	Thu Sep 27 18:28:56 2012
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.30 2012/08/02 01:16:36 matt Exp $
+#	$NetBSD: Makefile,v 1.31 2012/09/27 18:28:56 alnsn Exp $
 
 INCSDIR= /usr/include/net
 
-INCS=	bpf.h bpfdesc.h bpf_jit.h dlt.h ethertypes.h if.h if_arc.h if_arp.h \
+INCS=	bpf.h bpfdesc.h dlt.h ethertypes.h if.h if_arc.h if_arp.h \
 	if_atm.h if_bridgevar.h if_dl.h if_ether.h if_etherip.h if_fddi.h if_gif.h \
 	if_gre.h if_hippi.h if_ieee1394.h if_llc.h if_media.h if_mpls.h \
 	if_pflog.h if_ppp.h if_pppoe.h if_sppp.h if_srt.h if_stf.h \

Index: src/sys/net/bpf.c
diff -u src/sys/net/bpf.c:1.171 src/sys/net/bpf.c:1.172
--- src/sys/net/bpf.c:1.171	Wed Aug 15 20:59:51 2012
+++ src/sys/net/bpf.c	Thu Sep 27 18:28:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.171 2012/08/15 20:59:51 alnsn Exp $	*/
+/*	$NetBSD: bpf.c,v 1.172 2012/09/27 18:28:56 alnsn Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.171 2012/08/15 20:59:51 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.172 2012/09/27 18:28:56 alnsn Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -79,7 +79,6 @@ __KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.17
 #include <net/slip.h>
 
 #include <net/bpf.h>
-#include <net/bpf_jit.h>
 #include <net/bpfdesc.h>
 
 #include <net/if_arc.h>
@@ -120,14 +119,6 @@ struct bpf_stat	bpf_gstats;
  */
 static kmutex_t bpf_mtx;
 
-/* BPF JIT compilation. */
-static bool bpf_jit_enable __read_mostly = false;
-
-#ifndef BPF_JIT
-#define	bpf_jit(x, y)			NULL
-#define	bpf_destroy_jit_filter(x)	(void)x
-#endif
-
 /*
  *  bpf_iflist is the list of interfaces; each corresponds to an ifnet
  *  bpf_dtab holds the descriptors, indexed by minor device #
@@ -1063,7 +1054,6 @@ int
 bpf_setf(struct bpf_d *d, struct bpf_program *fp)
 {
 	struct bpf_insn *fcode, *old;
-	bpf_jit_filter *jfunc, *ofunc;
 	size_t flen, size;
 	int s;
 
@@ -1085,28 +1075,20 @@ bpf_setf(struct bpf_d *d, struct bpf_pro
 			free(fcode, M_DEVBUF);
 			return EINVAL;
 		}
-
-		/* Perform JIT compilation. */
-		jfunc = bpf_jit(fcode, flen);
 	} else {
 		fcode = NULL;
-		jfunc = NULL;
 	}
 
 	s = splnet();
 	old = d->bd_filter;
-	ofunc = d->bd_bfilter;
 	d->bd_filter = fcode;
-	d->bd_bfilter = jfunc;
 	reset_d(d);
 	splx(s);
 
 	if (old) {
 		free(old, M_DEVBUF);
 	}
-	if (ofunc) {
-		bpf_destroy_jit_filter(ofunc);
-	}
+
 	return 0;
 }
 
@@ -1368,7 +1350,6 @@ bpf_deliver(struct bpf_if *bp, void *(*c
 	 * interfaces shared any data.  This is not the case.
 	 */
 	for (d = bp->bif_dlist; d != NULL; d = d->bd_next) {
-		bpf_jit_filter *bf;
 		u_int slen;
 
 		if (!d->bd_seesent && !rcv) {
@@ -1377,17 +1358,7 @@ bpf_deliver(struct bpf_if *bp, void *(*c
 		d->bd_rcount++;
 		bpf_gstats.bs_recv++;
 
-		bf = bpf_jit_enable ? d->bd_bfilter : NULL;
-		if (bf) {
-			/*
-			 * XXX THIS is totally broken when pkt
-			 * points to mbuf. FreeBSD does a runtime
-			 * check, we don't.
-			 */
-			slen = (*(bf->func))(pkt, pktlen, pktlen);
-		} else {
-			slen = bpf_filter(d->bd_filter, pkt, pktlen, buflen);
-		}
+		slen = bpf_filter(d->bd_filter, pkt, pktlen, buflen);
 		if (!slen) {
 			continue;
 		}
@@ -1716,8 +1687,6 @@ bpf_freed(struct bpf_d *d)
 	}
 	if (d->bd_filter)
 		free(d->bd_filter, M_DEVBUF);
-	if (d->bd_bfilter)
-		bpf_destroy_jit_filter(d->bd_bfilter);
 }
 
 /*

Index: src/sys/net/bpf_filter.c
diff -u src/sys/net/bpf_filter.c:1.53 src/sys/net/bpf_filter.c:1.54
--- src/sys/net/bpf_filter.c:1.53	Wed Aug 15 21:31:39 2012
+++ src/sys/net/bpf_filter.c	Thu Sep 27 18:28:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf_filter.c,v 1.53 2012/08/15 21:31:39 alnsn Exp $	*/
+/*	$NetBSD: bpf_filter.c,v 1.54 2012/09/27 18:28:56 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.53 2012/08/15 21:31:39 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.54 2012/09/27 18:28:56 alnsn Exp $");
 
 #if 0
 #if !(defined(lint) || defined(KERNEL))
@@ -86,10 +86,8 @@ m_xword(const struct mbuf *m, uint32_t k
 		return EXTRACT_LONG(cp);
 	}
 	m0 = m->m_next;
-	if (m0 == 0 || m0->m_len + len - k < 4) {
-		*err = 1;
+	if (m0 == 0 || m0->m_len + len - k < 4)
 		return 0;
-	}
 	*err = 0;
 	np = mtod(m0, u_char *);
 
@@ -118,16 +116,13 @@ m_xhalf(const struct mbuf *m, uint32_t k
 		return EXTRACT_SHORT(cp);
 	}
 	m0 = m->m_next;
-	if (m0 == 0) {
-		*err = 1;
+	if (m0 == 0)
 		return 0;
-	}
 	*err = 0;
 	return (cp[0] << 8) | mtod(m0, u_char *)[0];
 }
 #else /* _KERNEL */
 #include <stdlib.h>
-#include <string.h>
 #endif /* !_KERNEL */
 
 #include <net/bpf.h>

Index: src/sys/net/bpfdesc.h
diff -u src/sys/net/bpfdesc.h:1.34 src/sys/net/bpfdesc.h:1.35
--- src/sys/net/bpfdesc.h:1.34	Wed Aug  1 23:24:29 2012
+++ src/sys/net/bpfdesc.h	Thu Sep 27 18:28:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfdesc.h,v 1.34 2012/08/01 23:24:29 rmind Exp $	*/
+/*	$NetBSD: bpfdesc.h,v 1.35 2012/09/27 18:28:56 alnsn Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -44,7 +44,6 @@
 #include <sys/callout.h>
 #include <sys/selinfo.h>		/* for struct selinfo */
 #include <net/if.h>			/* for IFNAMSIZ */
-#include <net/bpf_jit.h>
 
 /*
  * Descriptor associated with each open bpf file.
@@ -71,7 +70,6 @@ struct bpf_d {
 	struct bpf_if *	bd_bif;		/* interface descriptor */
 	u_long		bd_rtout;	/* Read timeout in 'ticks' */
 	struct bpf_insn *bd_filter; 	/* filter code */
-	bpf_jit_filter	*bd_bfilter;	/* binary filter code */
 	u_long		bd_rcount;	/* number of packets received */
 	u_long		bd_dcount;	/* number of packets dropped */
 	u_long		bd_ccount;	/* number of packets captured */
@@ -102,6 +100,7 @@ struct bpf_d {
 #ifdef _LP64
 	int		bd_compat32;	/* 32-bit stream on LP64 system */
 #endif
+	void		*bd_dummy;	/* to be replaced shortly with bd_jitcode */
 };
 
 

Reply via email to