Deleted Added
full compact
if_xe.c (48118) if_xe.c (48645)
1/*-
2 * Copyright (c) 1998, 1999 Scott Mitchell
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: if_xe.c,v 1.20 1999/06/13 19:17:40 scott Exp $
1/*-
2 * Copyright (c) 1998, 1999 Scott Mitchell
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: if_xe.c,v 1.20 1999/06/13 19:17:40 scott Exp $
27 * $FreeBSD: head/sys/dev/xe/if_xe.c 48118 1999-06-22 19:21:00Z obrien $
27 * $FreeBSD: head/sys/dev/xe/if_xe.c 48645 1999-07-06 19:23:32Z des $
28 */
29
30/*
31 * Portions of this software were derived from Werner Koch's xirc2ps driver
32 * for Linux under the terms of the following license (from v1.30 of the
33 * xirc2ps driver):
34 *
35 * Copyright (c) 1997 by Werner Koch (dd9jn)

--- 65 unchanged lines hidden (view full) ---

101
102#ifndef XE_DEBUG
103#define XE_DEBUG 1 /* Increase for more voluminous output! */
104#endif
105
106#include "xe.h"
107#include "card.h"
108#include "apm.h"
28 */
29
30/*
31 * Portions of this software were derived from Werner Koch's xirc2ps driver
32 * for Linux under the terms of the following license (from v1.30 of the
33 * xirc2ps driver):
34 *
35 * Copyright (c) 1997 by Werner Koch (dd9jn)

--- 65 unchanged lines hidden (view full) ---

101
102#ifndef XE_DEBUG
103#define XE_DEBUG 1 /* Increase for more voluminous output! */
104#endif
105
106#include "xe.h"
107#include "card.h"
108#include "apm.h"
109#include "bpfilter.h"
109#include "bpf.h"
110
111#if NXE > 0
112
113#if NCARD > 0
114
115#include <sys/param.h>
116#include <sys/cdefs.h>
117#include <sys/conf.h>

--- 8 unchanged lines hidden (view full) ---

126#include <sys/uio.h>
127
128#include <net/ethernet.h>
129#include <net/if.h>
130#include <net/if_arp.h>
131#include <net/if_dl.h>
132#include <net/if_media.h>
133#include <net/if_mib.h>
110
111#if NXE > 0
112
113#if NCARD > 0
114
115#include <sys/param.h>
116#include <sys/cdefs.h>
117#include <sys/conf.h>

--- 8 unchanged lines hidden (view full) ---

126#include <sys/uio.h>
127
128#include <net/ethernet.h>
129#include <net/if.h>
130#include <net/if_arp.h>
131#include <net/if_dl.h>
132#include <net/if_media.h>
133#include <net/if_mib.h>
134#if NBPFILTER > 0
134#if NBPF > 0
135#include <net/bpf.h>
135#include <net/bpf.h>
136#endif /* NBPFILTER > 0 */
136#endif /* NBPF > 0 */
137
138#include <i386/isa/isa.h>
139#include <i386/isa/isa_device.h>
140#include <dev/pccard/if_xereg.h>
141#include <machine/clock.h>
142#if NAPM > 0
143#include <machine/apm_bios.h>
144#endif /* NAPM > 0 */

--- 658 unchanged lines hidden (view full) ---

803 printf(":%02x", scp->arpcom.ac_enaddr[i]);
804 }
805 printf("\n");
806
807 /* Attach the interface */
808 if_attach(scp->ifp);
809 ether_ifattach(scp->ifp);
810
137
138#include <i386/isa/isa.h>
139#include <i386/isa/isa_device.h>
140#include <dev/pccard/if_xereg.h>
141#include <machine/clock.h>
142#if NAPM > 0
143#include <machine/apm_bios.h>
144#endif /* NAPM > 0 */

--- 658 unchanged lines hidden (view full) ---

803 printf(":%02x", scp->arpcom.ac_enaddr[i]);
804 }
805 printf("\n");
806
807 /* Attach the interface */
808 if_attach(scp->ifp);
809 ether_ifattach(scp->ifp);
810
811#if NBPFILTER > 0
811#if NBPF > 0
812 /* If BPF is in the kernel, call the attach for it */
813#if XE_DEBUG > 1
814 printf("xe%d: BPF listener attached\n", scp->unit);
815#endif
816 bpfattach(scp->ifp, DLT_EN10MB, sizeof(struct ether_header));
817#endif
818
819 /* Done */

--- 119 unchanged lines hidden (view full) ---

939 }
940
941 if (xe_pio_write_packet(scp, mbp) != 0) {
942 IF_PREPEND(&ifp->if_snd, mbp); /* Push the packet back onto the queue */
943 ifp->if_flags |= IFF_OACTIVE;
944 return;
945 }
946
812 /* If BPF is in the kernel, call the attach for it */
813#if XE_DEBUG > 1
814 printf("xe%d: BPF listener attached\n", scp->unit);
815#endif
816 bpfattach(scp->ifp, DLT_EN10MB, sizeof(struct ether_header));
817#endif
818
819 /* Done */

--- 119 unchanged lines hidden (view full) ---

939 }
940
941 if (xe_pio_write_packet(scp, mbp) != 0) {
942 IF_PREPEND(&ifp->if_snd, mbp); /* Push the packet back onto the queue */
943 ifp->if_flags |= IFF_OACTIVE;
944 return;
945 }
946
947#if NBPFILTER > 0
947#if NBPF > 0
948 /* Tap off here if there is a bpf listener */
949 if (ifp->if_bpf) {
950#if XE_DEBUG > 1
951 printf("xe%d: sending output packet to BPF\n", scp->unit);
952#endif
953 bpf_mtap(ifp, mbp);
954 }
948 /* Tap off here if there is a bpf listener */
949 if (ifp->if_bpf) {
950#if XE_DEBUG > 1
951 printf("xe%d: sending output packet to BPF\n", scp->unit);
952#endif
953 bpf_mtap(ifp, mbp);
954 }
955#endif /* NBPFILTER > 0 */
955#endif /* NBPF > 0 */
956
957 ifp->if_timer = 5; /* In case we don't hear from the card again */
958 scp->tx_queued++;
959
960 m_freem(mbp);
961 }
962}
963

--- 297 unchanged lines hidden (view full) ---

1261 }
1262 }
1263 else
1264 insw(scp->dev->id_iobase+XE_EDP, ehp, len >> 1);
1265 }
1266 else
1267 insw(scp->dev->id_iobase+XE_EDP, ehp, len >> 1);
1268
956
957 ifp->if_timer = 5; /* In case we don't hear from the card again */
958 scp->tx_queued++;
959
960 m_freem(mbp);
961 }
962}
963

--- 297 unchanged lines hidden (view full) ---

1261 }
1262 }
1263 else
1264 insw(scp->dev->id_iobase+XE_EDP, ehp, len >> 1);
1265 }
1266 else
1267 insw(scp->dev->id_iobase+XE_EDP, ehp, len >> 1);
1268
1269#if NBPFILTER > 0
1269#if NBPF > 0
1270 /*
1271 * Check if there's a BPF listener on this interface. If so, hand
1272 * off the raw packet to bpf.
1273 */
1274 if (ifp->if_bpf) {
1275#if XE_DEBUG > 1
1276 printf("xe%d: passing input packet to BPF\n", scp->unit);
1277#endif

--- 6 unchanged lines hidden (view full) ---

1284 */
1285 if ((ifp->if_flags & IFF_PROMISC) &&
1286 bcmp(ehp->ether_dhost, scp->arpcom.ac_enaddr, sizeof(ehp->ether_dhost)) != 0 &&
1287 (rsr & XE_RSR_PHYS_PACKET)) {
1288 m_freem(mbp);
1289 mbp = NULL;
1290 }
1291 }
1270 /*
1271 * Check if there's a BPF listener on this interface. If so, hand
1272 * off the raw packet to bpf.
1273 */
1274 if (ifp->if_bpf) {
1275#if XE_DEBUG > 1
1276 printf("xe%d: passing input packet to BPF\n", scp->unit);
1277#endif

--- 6 unchanged lines hidden (view full) ---

1284 */
1285 if ((ifp->if_flags & IFF_PROMISC) &&
1286 bcmp(ehp->ether_dhost, scp->arpcom.ac_enaddr, sizeof(ehp->ether_dhost)) != 0 &&
1287 (rsr & XE_RSR_PHYS_PACKET)) {
1288 m_freem(mbp);
1289 mbp = NULL;
1290 }
1291 }
1292#endif /* NBPFILTER > 0 */
1292#endif /* NBPF > 0 */
1293
1294 if (mbp != NULL) {
1295 mbp->m_pkthdr.len = mbp->m_len = len - ETHER_HDR_LEN;
1296 mbp->m_data += ETHER_HDR_LEN; /* Strip off Ethernet header */
1297 ether_input(ifp, ehp, mbp); /* Send the packet on its way */
1298 ifp->if_ipackets++; /* Success! */
1299 }
1300 XE_OUTW(XE_DO, 0x8000); /* skip_rx_packet command */

--- 1207 unchanged lines hidden ---
1293
1294 if (mbp != NULL) {
1295 mbp->m_pkthdr.len = mbp->m_len = len - ETHER_HDR_LEN;
1296 mbp->m_data += ETHER_HDR_LEN; /* Strip off Ethernet header */
1297 ether_input(ifp, ehp, mbp); /* Send the packet on its way */
1298 ifp->if_ipackets++; /* Success! */
1299 }
1300 XE_OUTW(XE_DO, 0x8000); /* skip_rx_packet command */

--- 1207 unchanged lines hidden ---