Deleted Added
full compact
if_sk.c (51533) if_sk.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/sk/if_sk.c 51533 1999-09-22 06:08:11Z wpaul $
32 * $FreeBSD: head/sys/dev/sk/if_sk.c 51583 1999-09-23 03:32:57Z wpaul $
33 */
34
35/*
36 * SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports
37 * the SK-984x series adapters, both single port and dual port.
38 * References:
39 * The XaQti XMAC II datasheet, http://www.xaqti.com
40 * The SysKonnect GEnesis manual, http://www.syskonnect.com

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

56 * chips connected to it, allowing single or dual port NIC configurations.
57 * SysKonnect has the distinction of being the only vendor on the market
58 * with a dual port gigabit ethernet NIC. The GEnesis provides dual FIFOs,
59 * dual DMA queues, packet/MAC/transmit arbiters and direct access to the
60 * XMAC registers. This driver takes advantage of these features to allow
61 * both XMACs to operate as independent interfaces.
62 */
63
33 */
34
35/*
36 * SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports
37 * the SK-984x series adapters, both single port and dual port.
38 * References:
39 * The XaQti XMAC II datasheet, http://www.xaqti.com
40 * The SysKonnect GEnesis manual, http://www.syskonnect.com

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

56 * chips connected to it, allowing single or dual port NIC configurations.
57 * SysKonnect has the distinction of being the only vendor on the market
58 * with a dual port gigabit ethernet NIC. The GEnesis provides dual FIFOs,
59 * dual DMA queues, packet/MAC/transmit arbiters and direct access to the
60 * XMAC registers. This driver takes advantage of these features to allow
61 * both XMACs to operate as independent interfaces.
62 */
63
64#include "bpf.h"
65
66#include <sys/param.h>
67#include <sys/systm.h>
68#include <sys/sockio.h>
69#include <sys/mbuf.h>
70#include <sys/malloc.h>
71#include <sys/kernel.h>
72#include <sys/socket.h>
73#include <sys/queue.h>
74
75#include <net/if.h>
76#include <net/if_arp.h>
77#include <net/ethernet.h>
78#include <net/if_dl.h>
79#include <net/if_media.h>
80
64#include <sys/param.h>
65#include <sys/systm.h>
66#include <sys/sockio.h>
67#include <sys/mbuf.h>
68#include <sys/malloc.h>
69#include <sys/kernel.h>
70#include <sys/socket.h>
71#include <sys/queue.h>
72
73#include <net/if.h>
74#include <net/if_arp.h>
75#include <net/ethernet.h>
76#include <net/if_dl.h>
77#include <net/if_media.h>
78
81#if NBPF > 0
82#include <net/bpf.h>
79#include <net/bpf.h>
83#endif
84
85#include <vm/vm.h> /* for vtophys */
86#include <vm/pmap.h> /* for vtophys */
87#include <machine/clock.h> /* for DELAY */
88#include <machine/bus_pio.h>
89#include <machine/bus_memio.h>
90#include <machine/bus.h>
91#include <machine/resource.h>

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

97
98#define SK_USEIOSPACE
99
100#include <pci/if_skreg.h>
101#include <pci/xmaciireg.h>
102
103#ifndef lint
104static const char rcsid[] =
80
81#include <vm/vm.h> /* for vtophys */
82#include <vm/pmap.h> /* for vtophys */
83#include <machine/clock.h> /* for DELAY */
84#include <machine/bus_pio.h>
85#include <machine/bus_memio.h>
86#include <machine/bus.h>
87#include <machine/resource.h>

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

93
94#define SK_USEIOSPACE
95
96#include <pci/if_skreg.h>
97#include <pci/xmaciireg.h>
98
99#ifndef lint
100static const char rcsid[] =
105 "$FreeBSD: head/sys/dev/sk/if_sk.c 51533 1999-09-22 06:08:11Z wpaul $";
101 "$FreeBSD: head/sys/dev/sk/if_sk.c 51583 1999-09-23 03:32:57Z wpaul $";
106#endif
107
108static struct sk_type sk_devs[] = {
109 { SK_VENDORID, SK_DEVICEID_GE, "SysKonnect Gigabit Ethernet" },
110 { 0, 0, NULL }
111};
112
113static int sk_probe __P((device_t));

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

1145 ifmedia_set(&sc_if->ifmedia, IFM_ETHER|IFM_AUTO);
1146
1147 /*
1148 * Call MI attach routines.
1149 */
1150 if_attach(ifp);
1151 ether_ifattach(ifp);
1152
102#endif
103
104static struct sk_type sk_devs[] = {
105 { SK_VENDORID, SK_DEVICEID_GE, "SysKonnect Gigabit Ethernet" },
106 { 0, 0, NULL }
107};
108
109static int sk_probe __P((device_t));

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

1141 ifmedia_set(&sc_if->ifmedia, IFM_ETHER|IFM_AUTO);
1142
1143 /*
1144 * Call MI attach routines.
1145 */
1146 if_attach(ifp);
1147 ether_ifattach(ifp);
1148
1153#if NBPF > 0
1154 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
1149 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
1155#endif
1156
1157 return(0);
1158}
1159
1160/*
1161 * Attach the interface. Allocate softc structures, do ifmedia
1162 * setup and ethernet/BPF attach.
1163 */

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

1450 ifp->if_flags |= IFF_OACTIVE;
1451 break;
1452 }
1453
1454 /*
1455 * If there's a BPF listener, bounce a copy of this frame
1456 * to him.
1457 */
1150
1151 return(0);
1152}
1153
1154/*
1155 * Attach the interface. Allocate softc structures, do ifmedia
1156 * setup and ethernet/BPF attach.
1157 */

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

1444 ifp->if_flags |= IFF_OACTIVE;
1445 break;
1446 }
1447
1448 /*
1449 * If there's a BPF listener, bounce a copy of this frame
1450 * to him.
1451 */
1458#if NBPF > 0
1459 if (ifp->if_bpf)
1460 bpf_mtap(ifp, m_head);
1452 if (ifp->if_bpf)
1453 bpf_mtap(ifp, m_head);
1461#endif
1462 }
1463
1464 /* Transmit */
1465 sc_if->sk_cdata.sk_tx_prod = idx;
1466 CSR_WRITE_4(sc, sc_if->sk_tx_bmu, SK_TXBMU_TX_START);
1467
1468 /* Set a timeout in case the chip goes out to lunch. */
1469 ifp->if_timer = 5;

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

1558 } else {
1559 m->m_pkthdr.rcvif = ifp;
1560 m->m_pkthdr.len = m->m_len = total_len;
1561 }
1562
1563 ifp->if_ipackets++;
1564 eh = mtod(m, struct ether_header *);
1565
1454 }
1455
1456 /* Transmit */
1457 sc_if->sk_cdata.sk_tx_prod = idx;
1458 CSR_WRITE_4(sc, sc_if->sk_tx_bmu, SK_TXBMU_TX_START);
1459
1460 /* Set a timeout in case the chip goes out to lunch. */
1461 ifp->if_timer = 5;

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

1550 } else {
1551 m->m_pkthdr.rcvif = ifp;
1552 m->m_pkthdr.len = m->m_len = total_len;
1553 }
1554
1555 ifp->if_ipackets++;
1556 eh = mtod(m, struct ether_header *);
1557
1566#if NBPF > 0
1567 if (ifp->if_bpf) {
1568 bpf_mtap(ifp, m);
1569 if (ifp->if_flags & IFF_PROMISC &&
1570 (bcmp(eh->ether_dhost, sc_if->arpcom.ac_enaddr,
1571 ETHER_ADDR_LEN) && !(eh->ether_dhost[0] & 1))) {
1572 m_freem(m);
1573 continue;
1574 }
1575 }
1558 if (ifp->if_bpf) {
1559 bpf_mtap(ifp, m);
1560 if (ifp->if_flags & IFF_PROMISC &&
1561 (bcmp(eh->ether_dhost, sc_if->arpcom.ac_enaddr,
1562 ETHER_ADDR_LEN) && !(eh->ether_dhost[0] & 1))) {
1563 m_freem(m);
1564 continue;
1565 }
1566 }
1576#endif
1567
1577 /* Remove header from mbuf and pass it on. */
1578 m_adj(m, sizeof(struct ether_header));
1579 ether_input(ifp, eh, m);
1580 }
1581
1582 sc_if->sk_cdata.sk_rx_prod = i;
1583
1584 return;

--- 403 unchanged lines hidden ---
1568 /* Remove header from mbuf and pass it on. */
1569 m_adj(m, sizeof(struct ether_header));
1570 ether_input(ifp, eh, m);
1571 }
1572
1573 sc_if->sk_cdata.sk_rx_prod = i;
1574
1575 return;

--- 403 unchanged lines hidden ---