Deleted Added
full compact
if_ed.c (17416) if_ed.c (17455)
1/*
2 * Copyright (c) 1995, David Greenman
3 * 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

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

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*
2 * Copyright (c) 1995, David Greenman
3 * 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

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

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $Id: if_ed.c,v 1.101 1996/06/25 20:30:05 bde Exp $
27 * $Id: if_ed.c,v 1.102 1996/08/04 10:57:29 phk Exp $
28 */
29
30/*
31 * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
32 * adapters. By David Greenman, 29-April-1993
33 *
34 * Currently supports the Western Digital/SMC 8003 and 8013 series,
35 * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,

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

320 IRQ3,
321 IRQ5,
322 IRQ7,
323 IRQ10,
324 IRQ11,
325 IRQ15
326};
327
28 */
29
30/*
31 * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
32 * adapters. By David Greenman, 29-April-1993
33 *
34 * Currently supports the Western Digital/SMC 8003 and 8013 series,
35 * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,

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

320 IRQ3,
321 IRQ5,
322 IRQ7,
323 IRQ10,
324 IRQ11,
325 IRQ15
326};
327
328#define ETHER_MIN_LEN 60
329#define ETHER_MAX_LEN 1514
330#define ETHER_ADDR_LEN 6
331#define ETHER_HDR_SIZE 14
332
333static struct kern_devconf kdc_ed_template = {
334 0, 0, 0, /* filled in by dev_attach */
335 "ed", 0, { MDDT_ISA, 0, "net" },
336 isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
337 &kdc_isa0, /* parent */
338 0, /* parentdata */
339 DC_UNCONFIGURED, /* state */
340 "", /* description */

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

1939 }
1940 }
1941 } else {
1942 len = ed_pio_write_mbufs(sc, m, (int)buffer);
1943 if (len == 0)
1944 goto outloop;
1945 }
1946
328static struct kern_devconf kdc_ed_template = {
329 0, 0, 0, /* filled in by dev_attach */
330 "ed", 0, { MDDT_ISA, 0, "net" },
331 isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
332 &kdc_isa0, /* parent */
333 0, /* parentdata */
334 DC_UNCONFIGURED, /* state */
335 "", /* description */

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

1934 }
1935 }
1936 } else {
1937 len = ed_pio_write_mbufs(sc, m, (int)buffer);
1938 if (len == 0)
1939 goto outloop;
1940 }
1941
1947 sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN);
1942 sc->txb_len[sc->txb_new] = max(len, (ETHER_MIN_LEN-ETHER_CRC_LEN));
1948
1949 sc->txb_inuse++;
1950
1951 /*
1952 * Point to next buffer slot and wrap if necessary.
1953 */
1954 sc->txb_new++;
1955 if (sc->txb_new == sc->txb_cnt)

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

2015 * the NIC.
2016 */
2017 if (sc->mem_shared)
2018 packet_hdr = *(struct ed_ring *) packet_ptr;
2019 else
2020 ed_pio_readmem(sc, (int)packet_ptr, (char *) &packet_hdr,
2021 sizeof(packet_hdr));
2022 len = packet_hdr.count;
1943
1944 sc->txb_inuse++;
1945
1946 /*
1947 * Point to next buffer slot and wrap if necessary.
1948 */
1949 sc->txb_new++;
1950 if (sc->txb_new == sc->txb_cnt)

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

2010 * the NIC.
2011 */
2012 if (sc->mem_shared)
2013 packet_hdr = *(struct ed_ring *) packet_ptr;
2014 else
2015 ed_pio_readmem(sc, (int)packet_ptr, (char *) &packet_hdr,
2016 sizeof(packet_hdr));
2017 len = packet_hdr.count;
2023 if (len > (ETHER_MAX_LEN + sizeof(struct ed_ring)) ||
2024 len < (ETHER_HDR_SIZE + sizeof(struct ed_ring))) {
2018 if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN + sizeof(struct ed_ring)) ||
2019 len < (ETHER_MIN_LEN - ETHER_CRC_LEN + sizeof(struct ed_ring))) {
2025 /*
2026 * Length is a wild value. There's a good chance that
2027 * this was caused by the NIC being old and buggy.
2028 * The bug is that the length low byte is duplicated in
2029 * the high byte. Try to recalculate the length based on
2030 * the pointer to the next packet.
2031 */
2032 /*

--- 841 unchanged lines hidden ---
2020 /*
2021 * Length is a wild value. There's a good chance that
2022 * this was caused by the NIC being old and buggy.
2023 * The bug is that the length low byte is duplicated in
2024 * the high byte. Try to recalculate the length based on
2025 * the pointer to the next packet.
2026 */
2027 /*

--- 841 unchanged lines hidden ---