Deleted Added
full compact
if_tx.c (48528) if_tx.c (48645)
1/* $OpenBSD: if_tx.c,v 1.3 1998/10/10 04:30:09 jason Exp $ */
1/* $OpenBSD: if_tx.c,v 1.3 1998/10/10 04:30:09 jason Exp $ */
2/* $Id: if_tx.c,v 1.27 1999/05/10 00:20:46 peter Exp $ */
2/* $Id: if_tx.c,v 1.28 1999/07/03 20:17:05 peter Exp $ */
3
4/*-
5 * Copyright (c) 1997 Semen Ustimenko (semen@iclub.nsu.ru)
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:

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

62 MCLGET((m),M_DONTWAIT); \
63 if( NULL == ((m)->m_flags & M_EXT) ){ \
64 m_freem(m); \
65 (m) = NULL; \
66 } \
67 } \
68 }
69
3
4/*-
5 * Copyright (c) 1997 Semen Ustimenko (semen@iclub.nsu.ru)
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:

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

62 MCLGET((m),M_DONTWAIT); \
63 if( NULL == ((m)->m_flags & M_EXT) ){ \
64 m_freem(m); \
65 (m) = NULL; \
66 } \
67 } \
68 }
69
70#include "bpfilter.h"
70#include "bpf.h"
71#include "opt_bdg.h"
72
73#include <sys/param.h>
74#include <sys/systm.h>
75#include <sys/mbuf.h>
76#include <sys/malloc.h>
77#include <sys/kernel.h>
78#include <sys/socket.h>

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

100#include <netipx/ipx_if.h>
101#endif
102
103#ifdef NS
104#include <netns/ns.h>
105#include <netns/ns_if.h>
106#endif
107
71#include "opt_bdg.h"
72
73#include <sys/param.h>
74#include <sys/systm.h>
75#include <sys/mbuf.h>
76#include <sys/malloc.h>
77#include <sys/kernel.h>
78#include <sys/socket.h>

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

100#include <netipx/ipx_if.h>
101#endif
102
103#ifdef NS
104#include <netns/ns.h>
105#include <netns/ns_if.h>
106#endif
107
108#if NBPFILTER > 0
108#if NBPF > 0
109#include <net/bpf.h>
110#include <net/bpfdesc.h>
111#endif
112
113#if defined(__OpenBSD__)
114#include <sys/ioctl.h>
115#include <sys/errno.h>
116#include <sys/device.h>

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

350 ifmedia_add(&sc->ifmedia,epic_mtypes[i],0,NULL);
351
352 ifmedia_set(&sc->ifmedia, tmp);
353#endif
354
355 /* Attach os interface and bpf */
356 if_attach(ifp);
357 ether_ifattach(ifp);
109#include <net/bpf.h>
110#include <net/bpfdesc.h>
111#endif
112
113#if defined(__OpenBSD__)
114#include <sys/ioctl.h>
115#include <sys/errno.h>
116#include <sys/device.h>

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

350 ifmedia_add(&sc->ifmedia,epic_mtypes[i],0,NULL);
351
352 ifmedia_set(&sc->ifmedia, tmp);
353#endif
354
355 /* Attach os interface and bpf */
356 if_attach(ifp);
357 ether_ifattach(ifp);
358#if NBPFILTER > 0
358#if NBPF > 0
359 bpfattach(&sc->sc_if.if_bpf, ifp, DLT_EN10MB,
360 sizeof(struct ether_header));
361#endif
362
363 /* Set shutdown routine to stop DMA process */
364 shutdownhook_establish(epic_shutdown, sc);
365 printf("\n");
366}

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

547
548 /* Set shut down routine to stop DMA processes on reboot */
549 at_shutdown(epic_shutdown, sc, SHUTDOWN_POST_SYNC);
550
551 /* Attach to if manager */
552 if_attach(ifp);
553 ether_ifattach(ifp);
554
359 bpfattach(&sc->sc_if.if_bpf, ifp, DLT_EN10MB,
360 sizeof(struct ether_header));
361#endif
362
363 /* Set shutdown routine to stop DMA process */
364 shutdownhook_establish(epic_shutdown, sc);
365 printf("\n");
366}

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

547
548 /* Set shut down routine to stop DMA processes on reboot */
549 at_shutdown(epic_shutdown, sc, SHUTDOWN_POST_SYNC);
550
551 /* Attach to if manager */
552 if_attach(ifp);
553 ether_ifattach(ifp);
554
555#if NBPFILTER > 0
555#if NBPF > 0
556 bpfattach(ifp,DLT_EN10MB, sizeof(struct ether_header));
557#endif
558
559 splx(s);
560
561 printf("\n");
562
563 return;

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

843 desc->txlength =
844 max(m0->m_pkthdr.len,ETHER_MIN_LEN-ETHER_CRC_LEN);
845 desc->status = 0x8000;
846 CSR_WRITE_4( sc, COMMAND, COMMAND_TXQUEUED );
847
848 /* Set watchdog timer */
849 ifp->if_timer = 8;
850
556 bpfattach(ifp,DLT_EN10MB, sizeof(struct ether_header));
557#endif
558
559 splx(s);
560
561 printf("\n");
562
563 return;

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

843 desc->txlength =
844 max(m0->m_pkthdr.len,ETHER_MIN_LEN-ETHER_CRC_LEN);
845 desc->status = 0x8000;
846 CSR_WRITE_4( sc, COMMAND, COMMAND_TXQUEUED );
847
848 /* Set watchdog timer */
849 ifp->if_timer = 8;
850
851#if NBPFILTER > 0
851#if NBPF > 0
852 if( ifp->if_bpf )
853#if defined(__FreeBSD__)
854 bpf_mtap( ifp, m0 );
855#else /* __OpenBSD__ */
856 bpf_mtap( ifp->if_bpf, m0 );
857#endif /* __FreeBSD__ */
858#endif
859 }

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

913 desc->bufaddr = vtophys( mtod( buf->mbuf, caddr_t ) );
914 desc->status = 0x8000;
915
916 /* First mbuf in packet holds the ethernet and packet headers */
917 eh = mtod( m, struct ether_header * );
918 m->m_pkthdr.rcvif = &(sc->sc_if);
919 m->m_pkthdr.len = m->m_len = len;
920
852 if( ifp->if_bpf )
853#if defined(__FreeBSD__)
854 bpf_mtap( ifp, m0 );
855#else /* __OpenBSD__ */
856 bpf_mtap( ifp->if_bpf, m0 );
857#endif /* __FreeBSD__ */
858#endif
859 }

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

913 desc->bufaddr = vtophys( mtod( buf->mbuf, caddr_t ) );
914 desc->status = 0x8000;
915
916 /* First mbuf in packet holds the ethernet and packet headers */
917 eh = mtod( m, struct ether_header * );
918 m->m_pkthdr.rcvif = &(sc->sc_if);
919 m->m_pkthdr.len = m->m_len = len;
920
921#if NBPFILTER > 0
922 /* Give mbuf to BPFILTER */
921#if NBPF > 0
922 /* Give mbuf to BPF */
923 if( sc->sc_if.if_bpf )
924#if defined(__FreeBSD__)
925 bpf_mtap( &sc->sc_if, m );
926#else /* __OpenBSD__ */
927 bpf_mtap( sc->sc_if.if_bpf, m );
928#endif /* __FreeBSD__ */
923 if( sc->sc_if.if_bpf )
924#if defined(__FreeBSD__)
925 bpf_mtap( &sc->sc_if, m );
926#else /* __OpenBSD__ */
927 bpf_mtap( sc->sc_if.if_bpf, m );
928#endif /* __FreeBSD__ */
929#endif /* NBPFILTER */
929#endif /* NBPF */
930
931#ifdef BRIDGE
932 if (do_bridge) {
933 struct ifnet *bdg_ifp ;
934 bdg_ifp = bridge_in(m);
935 if (bdg_ifp == BDG_DROP) {
936 if (m)
937 m_free(m);

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

944 if (m)
945 m_free(m);
946 continue; /* and drop */
947 }
948 /* all others accepted locally */
949 }
950#endif
951
930
931#ifdef BRIDGE
932 if (do_bridge) {
933 struct ifnet *bdg_ifp ;
934 bdg_ifp = bridge_in(m);
935 if (bdg_ifp == BDG_DROP) {
936 if (m)
937 m_free(m);

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

944 if (m)
945 m_free(m);
946 continue; /* and drop */
947 }
948 /* all others accepted locally */
949 }
950#endif
951
952#if NBPFILTER > 0
952#if NBPF > 0
953#ifdef BRIDGE
954 /*
955 * This deserves explanation
956 * If the bridge is _on_, then the following check
957 * must not be done because occasionally the bridge
958 * gets packets that are local but have the ethernet
959 * address of one of the other interfaces.
960 *
961 * But if the bridge is off, then we have to drop
953#ifdef BRIDGE
954 /*
955 * This deserves explanation
956 * If the bridge is _on_, then the following check
957 * must not be done because occasionally the bridge
958 * gets packets that are local but have the ethernet
959 * address of one of the other interfaces.
960 *
961 * But if the bridge is off, then we have to drop
962 * stuff that came in just via bpfilter.
962 * stuff that came in just via bpf.
963 */
964 if (!do_bridge)
965#endif
966 /* Accept only our packets, broadcasts and multicasts */
967 if( (eh->ether_dhost[0] & 1) == 0 &&
968 bcmp(eh->ether_dhost,sc->sc_macaddr,ETHER_ADDR_LEN)){
969 m_freem(m);
970 continue;

--- 1070 unchanged lines hidden ---
963 */
964 if (!do_bridge)
965#endif
966 /* Accept only our packets, broadcasts and multicasts */
967 if( (eh->ether_dhost[0] & 1) == 0 &&
968 bcmp(eh->ether_dhost,sc->sc_macaddr,ETHER_ADDR_LEN)){
969 m_freem(m);
970 continue;

--- 1070 unchanged lines hidden ---