Module Name:    src
Committed By:   ozaki-r
Date:           Tue Dec  6 07:49:25 UTC 2016

Modified Files:
        src/sys/arch/sun3/dev: if_ie.c

Log Message:
Remove obsolete ancient optimization for bpf

The optimization code was obsoleted over 15 years ago.
We can remove it safely.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/sun3/dev/if_ie.c

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

Modified files:

Index: src/sys/arch/sun3/dev/if_ie.c
diff -u src/sys/arch/sun3/dev/if_ie.c:1.59 src/sys/arch/sun3/dev/if_ie.c:1.60
--- src/sys/arch/sun3/dev/if_ie.c:1.59	Thu Jul  7 06:55:39 2016
+++ src/sys/arch/sun3/dev/if_ie.c	Tue Dec  6 07:49:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie.c,v 1.59 2016/07/07 06:55:39 msaitoh Exp $ */
+/*	$NetBSD: if_ie.c,v 1.60 2016/12/06 07:49:25 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@@ -98,7 +98,7 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.59 2016/07/07 06:55:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.60 2016/12/06 07:49:25 ozaki-r Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -203,10 +203,9 @@ static inline uint16_t vtop16sw(struct i
 
 static inline void ie_ack(struct ie_softc *, u_int);
 static inline u_short ether_cmp(u_char *, uint8_t *);
-static inline int check_eh(struct ie_softc *, struct ether_header *, int *);
 static inline int ie_buflen(struct ie_softc *, int);
 static inline int ie_packet_len(struct ie_softc *);
-static inline struct mbuf * ieget(struct ie_softc *, int *);
+static inline struct mbuf * ieget(struct ie_softc *);
 
 
 /*
@@ -666,32 +665,6 @@ ether_cmp(uint8_t *one, uint8_t *two)
 #define	ether_equal !ether_cmp
 
 /*
- * Check for a valid address.  to_bpf is filled in with one of the following:
- *   0 -> BPF doesn't get this packet
- *   1 -> BPF does get this packet
- *   2 -> BPF does get this packet, but we don't
- * Return value is true if the packet is for us, and false otherwise.
- *
- * This routine is a mess, but it's also critical that it be as fast
- * as possible.  It could be made cleaner if we can assume that the
- * only client which will fiddle with IFF_PROMISC is BPF.  This is
- * probably a good assumption, but we do not make it here.  (Yet.)
- */
-static inline int 
-check_eh(struct ie_softc *sc, struct ether_header *eh, int *to_bpf)
-{
-	struct ifnet *ifp;
-
-	ifp = &sc->sc_if;
-	*to_bpf = (ifp->if_bpf != 0);
-
-	/*
-	 * This is all handled at a higher level now.
-	 */
-	return 1;
-}
-
-/*
  * We want to isolate the bits that have meaning...  This assumes that
  * IE_RBUF_SIZE is an even power of two.  If somehow the act_len exceeds
  * the size of the buffer, then we are screwed anyway.
@@ -791,7 +764,7 @@ iexmit(struct ie_softc *sc)
  * operation considerably.  (Provided that it works, of course.)
  */
 static inline struct mbuf *
-ieget(struct ie_softc *sc, int *to_bpf)
+ieget(struct ie_softc *sc)
 {
 	struct mbuf *top, **mp, *m;
 	int len, totlen, resid;
@@ -811,19 +784,6 @@ ieget(struct ie_softc *sc, int *to_bpf)
 	(sc->sc_memcpy)((void *)&eh, (void *)sc->cbuffs[head],
 	    sizeof(struct ether_header));
 
-	/*
-	 * As quickly as possible, check if this packet is for us.
-	 * If not, don't waste a single cycle copying the rest of the
-	 * packet in.
-	 * This is only a consideration when FILTER is defined; i.e., when
-	 * we are either running BPF or doing multicasting.
-	 */
-	if (check_eh(sc, &eh, to_bpf) == 0) {
-		/* just this case, it's not an error */
-		sc->sc_if.if_ierrors--;
-		return 0;
-	}
-
 	resid = totlen;
 
 	MGETHDR(m, M_DONTWAIT, MT_DATA);
@@ -931,7 +891,6 @@ ie_readframe(struct ie_softc *sc, int nu
 {
 	int status;
 	struct mbuf *m = 0;
-	int bpf_gets_it = 0;
 
 	status = sc->rframes[num]->ie_fd_status;
 
@@ -943,7 +902,7 @@ ie_readframe(struct ie_softc *sc, int nu
 	sc->rfhead = (sc->rfhead + 1) % sc->nframes;
 
 	if (status & IE_FD_OK) {
-		m = ieget(sc, &bpf_gets_it);
+		m = ieget(sc);
 		ie_drop_packet_buffer(sc);
 	}
 	if (m == 0) {
@@ -961,37 +920,8 @@ ie_readframe(struct ie_softc *sc, int nu
 	}
 #endif
 
-	/*
-	 * Check for a BPF filter; if so, hand it up.
-	 * Note that we have to stick an extra mbuf up front, because
-	 * bpf_mtap expects to have the ether header at the front.
-	 * It doesn't matter that this results in an ill-formatted mbuf chain,
-	 * since BPF just looks at the data.  (It doesn't try to free the mbuf,
-	 * tho' it will make a copy for tcpdump.)
-	 */
-	if (bpf_gets_it) {
-		/* Pass it up. */
-		bpf_mtap(&sc->sc_if, m);
-
-		/*
-		 * A signal passed up from the filtering code indicating that
-		 * the packet is intended for BPF but not for the protocol
-		 * machinery.  We can save a few cycles by not handing it off
-		 * to them.
-		 */
-		if (bpf_gets_it == 2) {
-			m_freem(m);
-			return;
-		}
-	}
-
-	/*
-	 * In here there used to be code to check destination addresses upon
-	 * receipt of a packet.  We have deleted that code, and replaced it
-	 * with code to check the address much earlier in the cycle, before
-	 * copying the data in; this saves us valuable cycles when operating
-	 * as a multicast router or when using BPF.
-	 */
+	/* Pass it up. */
+	bpf_mtap(&sc->sc_if, m);
 
 	/*
 	 * Finally pass this packet up to higher layers.

Reply via email to