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 * $FreeBSD: head/sys/pci/if_rl.c 78508 2001-06-20 19:48:35Z bmilekic $ |
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 const char rcsid[] = |
136 "$FreeBSD: head/sys/pci/if_rl.c 78508 2001-06-20 19:48:35Z bmilekic $"; |
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" }, --- 913 unchanged lines hidden (view full) --- 1058 * The chip then begins copying frames into the RX buffer. Each frame 1059 * is preceded by a 32-bit RX status word which specifies the length 1060 * of the frame and certain other status bits. Each frame (starting with 1061 * the status word) is also 32-bit aligned. The frame length is in the 1062 * first 16 bits of the status word; the lower 15 bits correspond with 1063 * the 'rx status register' mentioned in the datasheet. 1064 * 1065 * Note: to make the Alpha happy, the frame payload needs to be aligned |
1066 * on a 32-bit boundary. To achieve this, we pass RL_ETHER_ALIGN (2 bytes) 1067 * as the offset argument to m_devget(). |
1068 */ 1069static void rl_rxeof(sc) 1070 struct rl_softc *sc; 1071{ 1072 struct ether_header *eh; 1073 struct mbuf *m; 1074 struct ifnet *ifp; 1075 int total_len = 0; --- 61 unchanged lines hidden (view full) --- 1137 ((cur_rx + sizeof(u_int32_t)) % RL_RXBUFLEN); 1138 1139 if (rxbufpos == (sc->rl_cdata.rl_rx_buf + RL_RXBUFLEN)) 1140 rxbufpos = sc->rl_cdata.rl_rx_buf; 1141 1142 wrap = (sc->rl_cdata.rl_rx_buf + RL_RXBUFLEN) - rxbufpos; 1143 1144 if (total_len > wrap) { |
1145 m = m_devget(rxbufpos, total_len, RL_ETHER_ALIGN, ifp, 1146 NULL); |
1147 if (m == NULL) { 1148 ifp->if_ierrors++; 1149 printf("rl%d: out of mbufs, tried to " 1150 "copy %d bytes\n", sc->rl_unit, wrap); 1151 } else { |
1152 m_copyback(m, wrap, total_len - wrap, 1153 sc->rl_cdata.rl_rx_buf); 1154 } 1155 cur_rx = (total_len - wrap + ETHER_CRC_LEN); 1156 } else { |
1157 m = m_devget(rxbufpos, total_len, RL_ETHER_ALIGN, ifp, 1158 NULL); |
1159 if (m == NULL) { 1160 ifp->if_ierrors++; 1161 printf("rl%d: out of mbufs, tried to " 1162 "copy %d bytes\n", sc->rl_unit, total_len); |
1163 } |
1164 cur_rx += total_len + 4 + ETHER_CRC_LEN; 1165 } 1166 1167 /* 1168 * Round up to 32-bit boundary. 1169 */ 1170 cur_rx = (cur_rx + 3) & ~3; 1171 CSR_WRITE_2(sc, RL_CURRXADDR, cur_rx - 16); --- 502 unchanged lines hidden --- |