Deleted Added
full compact
if_xl.c (51533) if_xl.c (51583)
1/*
2 * Copyright (c) 1997, 1998, 1999
3 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 *
1/*
2 * Copyright (c) 1997, 1998, 1999
3 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * $FreeBSD: head/sys/pci/if_xl.c 51533 1999-09-22 06:08:11Z wpaul $
32 * $FreeBSD: head/sys/pci/if_xl.c 51583 1999-09-23 03:32:57Z wpaul $
33 */
34
35/*
36 * 3Com 3c90x Etherlink XL PCI NIC driver
37 *
38 * Supports the 3Com "boomerang", "cyclone" and "hurricane" PCI
39 * bus-master chips (3c90x cards and embedded controllers) including
40 * the following:

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

86 * Since using bus master DMA is a big win, we use this driver to
87 * support the PCI "boomerang" chips even though they work with the
88 * "vortex" driver in order to obtain better performance.
89 *
90 * This driver is in the /sys/pci directory because it only supports
91 * PCI-based NICs.
92 */
93
33 */
34
35/*
36 * 3Com 3c90x Etherlink XL PCI NIC driver
37 *
38 * Supports the 3Com "boomerang", "cyclone" and "hurricane" PCI
39 * bus-master chips (3c90x cards and embedded controllers) including
40 * the following:

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

86 * Since using bus master DMA is a big win, we use this driver to
87 * support the PCI "boomerang" chips even though they work with the
88 * "vortex" driver in order to obtain better performance.
89 *
90 * This driver is in the /sys/pci directory because it only supports
91 * PCI-based NICs.
92 */
93
94#include "bpf.h"
95
96#include <sys/param.h>
97#include <sys/systm.h>
98#include <sys/sockio.h>
99#include <sys/mbuf.h>
100#include <sys/malloc.h>
101#include <sys/kernel.h>
102#include <sys/socket.h>
103
104#include <net/if.h>
105#include <net/if_arp.h>
106#include <net/ethernet.h>
107#include <net/if_dl.h>
108#include <net/if_media.h>
109
94#include <sys/param.h>
95#include <sys/systm.h>
96#include <sys/sockio.h>
97#include <sys/mbuf.h>
98#include <sys/malloc.h>
99#include <sys/kernel.h>
100#include <sys/socket.h>
101
102#include <net/if.h>
103#include <net/if_arp.h>
104#include <net/ethernet.h>
105#include <net/if_dl.h>
106#include <net/if_media.h>
107
110#if NBPF > 0
111#include <net/bpf.h>
108#include <net/bpf.h>
112#endif
113
114#include "opt_bdg.h"
115#ifdef BRIDGE
116#include <net/bridge.h>
117#endif
118
119#include <vm/vm.h> /* for vtophys */
120#include <vm/pmap.h> /* for vtophys */

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

146 * might not work on some devices.
147 */
148#define XL_USEIOSPACE
149
150#include <pci/if_xlreg.h>
151
152#if !defined(lint)
153static const char rcsid[] =
109
110#include "opt_bdg.h"
111#ifdef BRIDGE
112#include <net/bridge.h>
113#endif
114
115#include <vm/vm.h> /* for vtophys */
116#include <vm/pmap.h> /* for vtophys */

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

142 * might not work on some devices.
143 */
144#define XL_USEIOSPACE
145
146#include <pci/if_xlreg.h>
147
148#if !defined(lint)
149static const char rcsid[] =
154 "$FreeBSD: head/sys/pci/if_xl.c 51533 1999-09-22 06:08:11Z wpaul $";
150 "$FreeBSD: head/sys/pci/if_xl.c 51583 1999-09-23 03:32:57Z wpaul $";
155#endif
156
157/*
158 * Various supported device vendors/types and their names.
159 */
160static struct xl_type xl_devs[] = {
161 { TC_VENDORID, TC_DEVICEID_BOOMERANG_10BT,
162 "3Com 3c900-TPO Etherlink XL" },

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

1491done:
1492
1493 /*
1494 * Call MI attach routines.
1495 */
1496 if_attach(ifp);
1497 ether_ifattach(ifp);
1498
151#endif
152
153/*
154 * Various supported device vendors/types and their names.
155 */
156static struct xl_type xl_devs[] = {
157 { TC_VENDORID, TC_DEVICEID_BOOMERANG_10BT,
158 "3Com 3c900-TPO Etherlink XL" },

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

1487done:
1488
1489 /*
1490 * Call MI attach routines.
1491 */
1492 if_attach(ifp);
1493 ether_ifattach(ifp);
1494
1499#if NBPF > 0
1500 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
1495 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
1501#endif
1502
1503fail:
1504 splx(s);
1505 return(error);
1506}
1507
1508static int xl_detach(dev)
1509 device_t dev;

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

1740 continue;
1741 }
1742
1743 ifp->if_ipackets++;
1744 eh = mtod(m, struct ether_header *);
1745 m->m_pkthdr.rcvif = ifp;
1746 m->m_pkthdr.len = m->m_len = total_len;
1747
1496
1497fail:
1498 splx(s);
1499 return(error);
1500}
1501
1502static int xl_detach(dev)
1503 device_t dev;

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

1734 continue;
1735 }
1736
1737 ifp->if_ipackets++;
1738 eh = mtod(m, struct ether_header *);
1739 m->m_pkthdr.rcvif = ifp;
1740 m->m_pkthdr.len = m->m_len = total_len;
1741
1748#if NBPF > 0
1749 /* Handle BPF listeners. Let the BPF user see the packet. */
1750 if (ifp->if_bpf)
1751 bpf_mtap(ifp, m);
1742 /* Handle BPF listeners. Let the BPF user see the packet. */
1743 if (ifp->if_bpf)
1744 bpf_mtap(ifp, m);
1752#endif
1753
1754#ifdef BRIDGE
1755 if (do_bridge) {
1756 struct ifnet *bdg_ifp ;
1757 bdg_ifp = bridge_in(m);
1758 if (bdg_ifp != BDG_LOCAL && bdg_ifp != BDG_DROP)
1759 bdg_forward(&m, bdg_ifp);
1760 if (((bdg_ifp != BDG_LOCAL) && (bdg_ifp != BDG_BCAST) &&
1761 (bdg_ifp != BDG_MCAST)) || bdg_ifp == BDG_DROP) {
1762 m_freem(m);
1763 continue;
1764 }
1765 }
1766#endif
1767
1745
1746#ifdef BRIDGE
1747 if (do_bridge) {
1748 struct ifnet *bdg_ifp ;
1749 bdg_ifp = bridge_in(m);
1750 if (bdg_ifp != BDG_LOCAL && bdg_ifp != BDG_DROP)
1751 bdg_forward(&m, bdg_ifp);
1752 if (((bdg_ifp != BDG_LOCAL) && (bdg_ifp != BDG_BCAST) &&
1753 (bdg_ifp != BDG_MCAST)) || bdg_ifp == BDG_DROP) {
1754 m_freem(m);
1755 continue;
1756 }
1757 }
1758#endif
1759
1768#if NBPF > 0
1769 /*
1770 * Don't pass packet up to the ether_input() layer unless it's
1771 * a broadcast packet, multicast packet, matches our ethernet
1772 * address or the interface is in promiscuous mode.
1773 */
1774 if (ifp->if_bpf) {
1775 if (ifp->if_flags & IFF_PROMISC &&
1776 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
1777 ETHER_ADDR_LEN) && (eh->ether_dhost[0] & 1) == 0)){
1778 m_freem(m);
1779 continue;
1780 }
1781 }
1760 /*
1761 * Don't pass packet up to the ether_input() layer unless it's
1762 * a broadcast packet, multicast packet, matches our ethernet
1763 * address or the interface is in promiscuous mode.
1764 */
1765 if (ifp->if_bpf) {
1766 if (ifp->if_flags & IFF_PROMISC &&
1767 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
1768 ETHER_ADDR_LEN) && (eh->ether_dhost[0] & 1) == 0)){
1769 m_freem(m);
1770 continue;
1771 }
1772 }
1782#endif
1783
1784 /* Remove header from mbuf and pass it on. */
1785 m_adj(m, sizeof(struct ether_header));
1786 ether_input(ifp, eh, m);
1787 }
1788
1789 /*
1790 * Handle the 'end of channel' condition. When the upload

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

2193
2194 /* Chain it together. */
2195 if (prev != NULL) {
2196 prev->xl_next = cur_tx;
2197 prev->xl_ptr->xl_next = vtophys(cur_tx->xl_ptr);
2198 }
2199 prev = cur_tx;
2200
1773
1774 /* Remove header from mbuf and pass it on. */
1775 m_adj(m, sizeof(struct ether_header));
1776 ether_input(ifp, eh, m);
1777 }
1778
1779 /*
1780 * Handle the 'end of channel' condition. When the upload

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

2183
2184 /* Chain it together. */
2185 if (prev != NULL) {
2186 prev->xl_next = cur_tx;
2187 prev->xl_ptr->xl_next = vtophys(cur_tx->xl_ptr);
2188 }
2189 prev = cur_tx;
2190
2201#if NBPF > 0
2202 /*
2203 * If there's a BPF listener, bounce a copy of this frame
2204 * to him.
2205 */
2206 if (ifp->if_bpf)
2207 bpf_mtap(ifp, cur_tx->xl_mbuf);
2191 /*
2192 * If there's a BPF listener, bounce a copy of this frame
2193 * to him.
2194 */
2195 if (ifp->if_bpf)
2196 bpf_mtap(ifp, cur_tx->xl_mbuf);
2208#endif
2209 }
2210
2211 /*
2212 * If there are no packets queued, bail.
2213 */
2214 if (cur_tx == NULL)
2215 return;
2216

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

2342 /* Pack the data into the descriptor. */
2343 xl_encap_90xB(sc, cur_tx, m_head);
2344
2345 /* Chain it together. */
2346 if (prev != NULL)
2347 prev->xl_ptr->xl_next = cur_tx->xl_phys;
2348 prev = cur_tx;
2349
2197 }
2198
2199 /*
2200 * If there are no packets queued, bail.
2201 */
2202 if (cur_tx == NULL)
2203 return;
2204

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

2330 /* Pack the data into the descriptor. */
2331 xl_encap_90xB(sc, cur_tx, m_head);
2332
2333 /* Chain it together. */
2334 if (prev != NULL)
2335 prev->xl_ptr->xl_next = cur_tx->xl_phys;
2336 prev = cur_tx;
2337
2350#if NBPF > 0
2351 /*
2352 * If there's a BPF listener, bounce a copy of this frame
2353 * to him.
2354 */
2355 if (ifp->if_bpf)
2356 bpf_mtap(ifp, cur_tx->xl_mbuf);
2338 /*
2339 * If there's a BPF listener, bounce a copy of this frame
2340 * to him.
2341 */
2342 if (ifp->if_bpf)
2343 bpf_mtap(ifp, cur_tx->xl_mbuf);
2357#endif
2358
2359 XL_INC(idx, XL_TX_LIST_CNT);
2360 sc->xl_cdata.xl_tx_cnt++;
2361 }
2362
2363 /*
2364 * If there are no packets queued, bail.
2365 */

--- 490 unchanged lines hidden ---
2344
2345 XL_INC(idx, XL_TX_LIST_CNT);
2346 sc->xl_cdata.xl_tx_cnt++;
2347 }
2348
2349 /*
2350 * If there are no packets queued, bail.
2351 */

--- 490 unchanged lines hidden ---