Deleted Added
full compact
if_rl.c (40516) if_rl.c (41243)
1/*
2 * Copyright (c) 1997, 1998
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
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 * $Id: if_rl.c,v 1.13 1998/10/07 22:51:30 wpaul Exp $
32 * $Id: if_rl.c,v 1.14 1998/11/18 20:27:28 wpaul Exp $
33 */
34
35/*
36 * RealTek 8129/8139 PCI NIC driver
37 *
38 * Supports several extremely cheap PCI 10/100 adapters based on
39 * the RealTek chipset. Datasheets can be obtained from
40 * www.realtek.com.tw.

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

128 * uniprocessor systems though.
129 */
130#define RL_USEIOSPACE
131
132#include <pci/if_rlreg.h>
133
134#ifndef lint
135static char rcsid[] =
33 */
34
35/*
36 * RealTek 8129/8139 PCI NIC driver
37 *
38 * Supports several extremely cheap PCI 10/100 adapters based on
39 * the RealTek chipset. Datasheets can be obtained from
40 * www.realtek.com.tw.

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

128 * uniprocessor systems though.
129 */
130#define RL_USEIOSPACE
131
132#include <pci/if_rlreg.h>
133
134#ifndef lint
135static char rcsid[] =
136 "$Id: if_rl.c,v 1.13 1998/10/07 22:51:30 wpaul Exp $";
136 "$Id: if_rl.c,v 1.14 1998/11/18 20:27:28 wpaul Exp $";
137#endif
138
139/*
140 * Various supported device vendors/types and their names.
141 */
142static struct rl_type rl_devs[] = {
143 { RT_VENDORID, RT_DEVICEID_8129,
144 "RealTek 8129 10/100BaseTX" },
145 { RT_VENDORID, RT_DEVICEID_8139,
146 "RealTek 8139 10/100BaseTX" },
137#endif
138
139/*
140 * Various supported device vendors/types and their names.
141 */
142static struct rl_type rl_devs[] = {
143 { RT_VENDORID, RT_DEVICEID_8129,
144 "RealTek 8129 10/100BaseTX" },
145 { RT_VENDORID, RT_DEVICEID_8139,
146 "RealTek 8139 10/100BaseTX" },
147 { RT_VENDORID_ALT, RT_DEVICEID_8139_ALT,
148 "RealTek 8139 10/100BaseTX" },
147 { ACCTON_VENDORID, ACCTON_DEVICEID_5030,
148 "Accton MPX 5030/5038 10/100BaseTX" },
149 { 0, 0, NULL }
150};
151
152/*
153 * Various supported PHY vendors/types and their names. Note that
154 * this driver will work with pretty much any MII-compliant PHY,
155 * so failure to positively identify the chip is not a fatal error.
156 */

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

1566 * pointers to the fragment pointers.
1567 */
1568static int rl_encap(sc, c, m_head)
1569 struct rl_softc *sc;
1570 struct rl_chain *c;
1571 struct mbuf *m_head;
1572{
1573 struct mbuf *m;
149 { 0, 0, NULL }
150};
151
152/*
153 * Various supported PHY vendors/types and their names. Note that
154 * this driver will work with pretty much any MII-compliant PHY,
155 * so failure to positively identify the chip is not a fatal error.
156 */

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

1566 * pointers to the fragment pointers.
1567 */
1568static int rl_encap(sc, c, m_head)
1569 struct rl_softc *sc;
1570 struct rl_chain *c;
1571 struct mbuf *m_head;
1572{
1573 struct mbuf *m;
1574 struct mbuf *m_new = NULL;
1574
1575 /*
1576 * There are two possible encapsulation mechanisms
1577 * that we can use: an efficient one, and a very lossy
1578 * one. The efficient one only happens very rarely,
1579 * whereas the lossy one can and most likely will happen
1580 * all the time.
1581 * The efficient case happens if:
1582 * - the packet fits in a single mbuf
1583 * - the packet is 32-bit aligned within the mbuf data area
1584 * In this case, we can DMA from the mbuf directly.
1585 * The lossy case covers everything else. Bah.
1586 */
1587
1588 m = m_head;
1589
1575
1576 /*
1577 * There are two possible encapsulation mechanisms
1578 * that we can use: an efficient one, and a very lossy
1579 * one. The efficient one only happens very rarely,
1580 * whereas the lossy one can and most likely will happen
1581 * all the time.
1582 * The efficient case happens if:
1583 * - the packet fits in a single mbuf
1584 * - the packet is 32-bit aligned within the mbuf data area
1585 * In this case, we can DMA from the mbuf directly.
1586 * The lossy case covers everything else. Bah.
1587 */
1588
1589 m = m_head;
1590
1590 if (m->m_pkthdr.len > MHLEN || (mtod(m, u_int32_t) & 0x00000003)) {
1591 struct mbuf *m_new = NULL;
1592
1593 MGETHDR(m_new, M_DONTWAIT, MT_DATA);
1594 if (m_new == NULL) {
1595 printf("rl%d: no memory for tx list", sc->rl_unit);
1591 MGETHDR(m_new, M_DONTWAIT, MT_DATA);
1592 if (m_new == NULL) {
1593 printf("rl%d: no memory for tx list", sc->rl_unit);
1594 return(1);
1595 }
1596 if (m_head->m_pkthdr.len > MHLEN) {
1597 MCLGET(m_new, M_DONTWAIT);
1598 if (!(m_new->m_flags & M_EXT)) {
1599 m_freem(m_new);
1600 printf("rl%d: no memory for tx list",
1601 sc->rl_unit);
1596 return(1);
1597 }
1602 return(1);
1603 }
1598 if (m_head->m_pkthdr.len > MHLEN) {
1599 MCLGET(m_new, M_DONTWAIT);
1600 if (!(m_new->m_flags & M_EXT)) {
1601 m_freem(m_new);
1602 printf("rl%d: no memory for tx list",
1603 sc->rl_unit);
1604 return(1);
1605 }
1606 }
1607 m_copydata(m_head, 0, m_head->m_pkthdr.len,
1608 mtod(m_new, caddr_t));
1609 m_new->m_pkthdr.len = m_new->m_len = m_head->m_pkthdr.len;
1610 m_freem(m_head);
1611 m_head = m_new;
1612 }
1604 }
1605 m_copydata(m_head, 0, m_head->m_pkthdr.len,
1606 mtod(m_new, caddr_t));
1607 m_new->m_pkthdr.len = m_new->m_len = m_head->m_pkthdr.len;
1608 m_freem(m_head);
1609 m_head = m_new;
1613
1614 /* Pad frames to at least 60 bytes. */
1610
1611 /* Pad frames to at least 60 bytes. */
1615 if (m_head->m_pkthdr.len < RL_MIN_FRAMELEN)
1612 if (m_head->m_pkthdr.len < RL_MIN_FRAMELEN) {
1616 m_head->m_pkthdr.len +=
1617 (RL_MIN_FRAMELEN - m_head->m_pkthdr.len);
1613 m_head->m_pkthdr.len +=
1614 (RL_MIN_FRAMELEN - m_head->m_pkthdr.len);
1615 m_head->m_len = m_head->m_pkthdr.len;
1616 }
1618
1619 c->rl_mbuf = m_head;
1620
1621 return(0);
1622}
1623
1624/*
1625 * Main transmit routine.

--- 364 unchanged lines hidden ---
1617
1618 c->rl_mbuf = m_head;
1619
1620 return(0);
1621}
1622
1623/*
1624 * Main transmit routine.

--- 364 unchanged lines hidden ---