if_ti.c (51533) | if_ti.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/dev/ti/if_ti.c 51533 1999-09-22 06:08:11Z wpaul $ | 32 * $FreeBSD: head/sys/dev/ti/if_ti.c 51583 1999-09-23 03:32:57Z wpaul $ |
33 */ 34 35/* 36 * Alteon Networks Tigon PCI gigabit ethernet driver for FreeBSD. 37 * Manuals, sample driver and firmware source kits are available 38 * from http://www.alteon.com/support/openkits. 39 * 40 * Written by Bill Paul <wpaul@ctr.columbia.edu> --- 32 unchanged lines hidden (view full) --- 73 * for testing 74 * - Raymond Lee of Netgear, for providing a pair of Netgear 75 * GA620 Tigon 2 boards for testing 76 * - Ulf Zimmermann, for bringing the GA260 to my attention and 77 * convincing me to write this driver. 78 * - Andrew Gallatin for providing FreeBSD/Alpha support. 79 */ 80 | 33 */ 34 35/* 36 * Alteon Networks Tigon PCI gigabit ethernet driver for FreeBSD. 37 * Manuals, sample driver and firmware source kits are available 38 * from http://www.alteon.com/support/openkits. 39 * 40 * Written by Bill Paul <wpaul@ctr.columbia.edu> --- 32 unchanged lines hidden (view full) --- 73 * for testing 74 * - Raymond Lee of Netgear, for providing a pair of Netgear 75 * GA620 Tigon 2 boards for testing 76 * - Ulf Zimmermann, for bringing the GA260 to my attention and 77 * convincing me to write this driver. 78 * - Andrew Gallatin for providing FreeBSD/Alpha support. 79 */ 80 |
81#include "bpf.h" | |
82#include "vlan.h" 83 84#include <sys/param.h> 85#include <sys/systm.h> 86#include <sys/sockio.h> 87#include <sys/mbuf.h> 88#include <sys/malloc.h> 89#include <sys/kernel.h> 90#include <sys/socket.h> 91#include <sys/queue.h> 92 93#include <net/if.h> 94#include <net/if_arp.h> 95#include <net/ethernet.h> 96#include <net/if_dl.h> 97#include <net/if_media.h> 98 | 81#include "vlan.h" 82 83#include <sys/param.h> 84#include <sys/systm.h> 85#include <sys/sockio.h> 86#include <sys/mbuf.h> 87#include <sys/malloc.h> 88#include <sys/kernel.h> 89#include <sys/socket.h> 90#include <sys/queue.h> 91 92#include <net/if.h> 93#include <net/if_arp.h> 94#include <net/ethernet.h> 95#include <net/if_dl.h> 96#include <net/if_media.h> 97 |
99#if NBPF > 0 | |
100#include <net/bpf.h> | 98#include <net/bpf.h> |
101#endif | |
102 103#if NVLAN > 0 104#include <net/if_types.h> 105#include <net/if_vlan_var.h> 106#endif 107 108#include <netinet/in_systm.h> 109#include <netinet/in.h> --- 16 unchanged lines hidden (view full) --- 126#include <pci/ti_fw2.h> 127 128#ifdef M_HWCKSUM 129/*#define TI_CSUM_OFFLOAD*/ 130#endif 131 132#if !defined(lint) 133static const char rcsid[] = | 99 100#if NVLAN > 0 101#include <net/if_types.h> 102#include <net/if_vlan_var.h> 103#endif 104 105#include <netinet/in_systm.h> 106#include <netinet/in.h> --- 16 unchanged lines hidden (view full) --- 123#include <pci/ti_fw2.h> 124 125#ifdef M_HWCKSUM 126/*#define TI_CSUM_OFFLOAD*/ 127#endif 128 129#if !defined(lint) 130static const char rcsid[] = |
134 "$FreeBSD: head/sys/dev/ti/if_ti.c 51533 1999-09-22 06:08:11Z wpaul $"; | 131 "$FreeBSD: head/sys/dev/ti/if_ti.c 51583 1999-09-23 03:32:57Z wpaul $"; |
135#endif 136 137/* 138 * Various supported device vendors/types and their names. 139 */ 140 141static struct ti_type ti_devs[] = { 142 { ALT_VENDORID, ALT_DEVICEID_ACENIC, --- 1580 unchanged lines hidden (view full) --- 1723 ifmedia_set(&sc->ifmedia, IFM_ETHER|IFM_AUTO); 1724 1725 /* 1726 * Call MI attach routines. 1727 */ 1728 if_attach(ifp); 1729 ether_ifattach(ifp); 1730 | 132#endif 133 134/* 135 * Various supported device vendors/types and their names. 136 */ 137 138static struct ti_type ti_devs[] = { 139 { ALT_VENDORID, ALT_DEVICEID_ACENIC, --- 1580 unchanged lines hidden (view full) --- 1720 ifmedia_set(&sc->ifmedia, IFM_ETHER|IFM_AUTO); 1721 1722 /* 1723 * Call MI attach routines. 1724 */ 1725 if_attach(ifp); 1726 ether_ifattach(ifp); 1727 |
1731#if NBPF > 0 | |
1732 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); | 1728 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); |
1733#endif | |
1734 1735fail: 1736 splx(s); 1737 1738 return(error); 1739} 1740 1741static int ti_detach(dev) --- 112 unchanged lines hidden (view full) --- 1854 } 1855 } 1856 1857 m->m_pkthdr.len = m->m_len = cur_rx->ti_len; 1858 ifp->if_ipackets++; 1859 eh = mtod(m, struct ether_header *); 1860 m->m_pkthdr.rcvif = ifp; 1861 | 1729 1730fail: 1731 splx(s); 1732 1733 return(error); 1734} 1735 1736static int ti_detach(dev) --- 112 unchanged lines hidden (view full) --- 1849 } 1850 } 1851 1852 m->m_pkthdr.len = m->m_len = cur_rx->ti_len; 1853 ifp->if_ipackets++; 1854 eh = mtod(m, struct ether_header *); 1855 m->m_pkthdr.rcvif = ifp; 1856 |
1862#if NBPF > 0 | |
1863 /* 1864 * Handle BPF listeners. Let the BPF user see the packet, but 1865 * don't pass it up to the ether_input() layer unless it's 1866 * a broadcast packet, multicast packet, matches our ethernet 1867 * address or the interface is in promiscuous mode. 1868 */ 1869 if (ifp->if_bpf) { 1870 bpf_mtap(ifp, m); 1871 if (ifp->if_flags & IFF_PROMISC && 1872 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, 1873 ETHER_ADDR_LEN) && 1874 (eh->ether_dhost[0] & 1) == 0)) { 1875 m_freem(m); 1876 continue; 1877 } 1878 } | 1857 /* 1858 * Handle BPF listeners. Let the BPF user see the packet, but 1859 * don't pass it up to the ether_input() layer unless it's 1860 * a broadcast packet, multicast packet, matches our ethernet 1861 * address or the interface is in promiscuous mode. 1862 */ 1863 if (ifp->if_bpf) { 1864 bpf_mtap(ifp, m); 1865 if (ifp->if_flags & IFF_PROMISC && 1866 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, 1867 ETHER_ADDR_LEN) && 1868 (eh->ether_dhost[0] & 1) == 0)) { 1869 m_freem(m); 1870 continue; 1871 } 1872 } |
1879#endif | |
1880 1881 /* Remove header from mbuf and pass it on. */ 1882 m_adj(m, sizeof(struct ether_header)); 1883 1884#ifdef TI_CSUM_OFFLOAD 1885 ip = mtod(m, struct ip *); 1886 if (!(cur_rx->ti_tcp_udp_cksum ^ 0xFFFF) && 1887 !(ip->ip_off & htons(IP_MF | IP_OFFMASK | IP_RF))) --- 251 unchanged lines hidden (view full) --- 2139 ifp->if_flags |= IFF_OACTIVE; 2140 break; 2141 } 2142 2143 /* 2144 * If there's a BPF listener, bounce a copy of this frame 2145 * to him. 2146 */ | 1873 1874 /* Remove header from mbuf and pass it on. */ 1875 m_adj(m, sizeof(struct ether_header)); 1876 1877#ifdef TI_CSUM_OFFLOAD 1878 ip = mtod(m, struct ip *); 1879 if (!(cur_rx->ti_tcp_udp_cksum ^ 0xFFFF) && 1880 !(ip->ip_off & htons(IP_MF | IP_OFFMASK | IP_RF))) --- 251 unchanged lines hidden (view full) --- 2132 ifp->if_flags |= IFF_OACTIVE; 2133 break; 2134 } 2135 2136 /* 2137 * If there's a BPF listener, bounce a copy of this frame 2138 * to him. 2139 */ |
2147#if NBPF > 0 | |
2148 if (ifp->if_bpf) 2149 bpf_mtap(ifp, m_head); | 2140 if (ifp->if_bpf) 2141 bpf_mtap(ifp, m_head); |
2150#endif | |
2151 } 2152 2153 /* Transmit */ 2154 CSR_WRITE_4(sc, TI_MB_SENDPROD_IDX, prodidx); 2155 2156 /* 2157 * Set a timeout in case the chip goes out to lunch. 2158 */ --- 359 unchanged lines hidden --- | 2142 } 2143 2144 /* Transmit */ 2145 CSR_WRITE_4(sc, TI_MB_SENDPROD_IDX, prodidx); 2146 2147 /* 2148 * Set a timeout in case the chip goes out to lunch. 2149 */ --- 359 unchanged lines hidden --- |