midway.c (162321) | midway.c (165632) |
---|---|
1/* $NetBSD: midway.c,v 1.30 1997/09/29 17:40:38 chuck Exp $ */ 2/* (sync'd to midway.c 1.68) */ 3 4/*- 5 * Copyright (c) 1996 Charles D. Cranor and Washington University. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34#include <sys/cdefs.h> | 1/* $NetBSD: midway.c,v 1.30 1997/09/29 17:40:38 chuck Exp $ */ 2/* (sync'd to midway.c 1.68) */ 3 4/*- 5 * Copyright (c) 1996 Charles D. Cranor and Washington University. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/dev/en/midway.c 162321 2006-09-15 15:16:12Z glebius $"); | 35__FBSDID("$FreeBSD: head/sys/dev/en/midway.c 165632 2006-12-29 13:59:50Z jhb $"); |
36 37/* 38 * 39 * m i d w a y . c e n i 1 5 5 d r i v e r 40 * 41 * author: Chuck Cranor <chuck@ccrc.wustl.edu> 42 * started: spring, 1996 (written from scratch). 43 * --- 727 unchanged lines hidden (view full) --- 771 772 EN_COUNT(sc->stats.launch); 773 sc->ifp->if_opackets++; 774 775 sc->vccs[tx.vci]->opackets++; 776 sc->vccs[tx.vci]->obytes += tx.datalen; 777 778#ifdef ENABLE_BPF | 36 37/* 38 * 39 * m i d w a y . c e n i 1 5 5 d r i v e r 40 * 41 * author: Chuck Cranor <chuck@ccrc.wustl.edu> 42 * started: spring, 1996 (written from scratch). 43 * --- 727 unchanged lines hidden (view full) --- 771 772 EN_COUNT(sc->stats.launch); 773 sc->ifp->if_opackets++; 774 775 sc->vccs[tx.vci]->opackets++; 776 sc->vccs[tx.vci]->obytes += tx.datalen; 777 778#ifdef ENABLE_BPF |
779 if (sc->ifp->if_bpf != NULL) { | 779 if (bpf_peers_present(sc->ifp->if_bpf)) { |
780 /* 781 * adjust the top of the mbuf to skip the TBD if present 782 * before passing the packet to bpf. 783 * Also remove padding and the PDU trailer. Assume both of 784 * them to be in the same mbuf. pktlen, m_len and m_data 785 * are not needed anymore so we can change them. 786 */ 787 if (tx.flags & TX_HAS_TBD) { 788 tx.m->m_data += MID_TBD_SIZE; 789 tx.m->m_len -= MID_TBD_SIZE; 790 } 791 tx.m->m_pkthdr.len = m_length(tx.m, &lastm); 792 if (tx.m->m_pkthdr.len > tx.datalen) { 793 lastm->m_len -= tx.m->m_pkthdr.len - tx.datalen; 794 tx.m->m_pkthdr.len = tx.datalen; 795 } 796 | 780 /* 781 * adjust the top of the mbuf to skip the TBD if present 782 * before passing the packet to bpf. 783 * Also remove padding and the PDU trailer. Assume both of 784 * them to be in the same mbuf. pktlen, m_len and m_data 785 * are not needed anymore so we can change them. 786 */ 787 if (tx.flags & TX_HAS_TBD) { 788 tx.m->m_data += MID_TBD_SIZE; 789 tx.m->m_len -= MID_TBD_SIZE; 790 } 791 tx.m->m_pkthdr.len = m_length(tx.m, &lastm); 792 if (tx.m->m_pkthdr.len > tx.datalen) { 793 lastm->m_len -= tx.m->m_pkthdr.len - tx.datalen; 794 tx.m->m_pkthdr.len = tx.datalen; 795 } 796 |
797 BPF_MTAP(sc->ifp, tx.m); | 797 bpf_mtap(sc->ifp, tx.m); |
798 } 799#endif 800 801 /* 802 * do some housekeeping and get the next packet 803 */ 804 slot->bfree -= tx.m->m_pkthdr.len; 805 _IF_ENQUEUE(&slot->indma, tx.m); --- 2571 unchanged lines hidden --- | 798 } 799#endif 800 801 /* 802 * do some housekeeping and get the next packet 803 */ 804 slot->bfree -= tx.m->m_pkthdr.len; 805 _IF_ENQUEUE(&slot->indma, tx.m); --- 2571 unchanged lines hidden --- |