if_rl.c (176757) | if_rl.c (178054) |
---|---|
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 --- 17 unchanged lines hidden (view full) --- 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 33#include <sys/cdefs.h> | 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 --- 17 unchanged lines hidden (view full) --- 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 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/pci/if_rl.c 176757 2008-03-03 04:15:08Z yongari $"); | 34__FBSDID("$FreeBSD: head/sys/pci/if_rl.c 178054 2008-04-10 01:06:05Z yongari $"); |
35 36/* 37 * RealTek 8129/8139 PCI NIC driver 38 * 39 * Supports several extremely cheap PCI 10/100 adapters based on 40 * the RealTek chipset. Datasheets can be obtained from 41 * www.realtek.com.tw. 42 * --- 1069 unchanged lines hidden (view full) --- 1112 /* 1113 * Here's a totally undocumented fact for you. When the 1114 * RealTek chip is in the process of copying a packet into 1115 * RAM for you, the length will be 0xfff0. If you spot a 1116 * packet header with this value, you need to stop. The 1117 * datasheet makes absolutely no mention of this and 1118 * RealTek should be shot for this. 1119 */ | 35 36/* 37 * RealTek 8129/8139 PCI NIC driver 38 * 39 * Supports several extremely cheap PCI 10/100 adapters based on 40 * the RealTek chipset. Datasheets can be obtained from 41 * www.realtek.com.tw. 42 * --- 1069 unchanged lines hidden (view full) --- 1112 /* 1113 * Here's a totally undocumented fact for you. When the 1114 * RealTek chip is in the process of copying a packet into 1115 * RAM for you, the length will be 0xfff0. If you spot a 1116 * packet header with this value, you need to stop. The 1117 * datasheet makes absolutely no mention of this and 1118 * RealTek should be shot for this. 1119 */ |
1120 if ((uint16_t)(rxstat >> 16) == RL_RXSTAT_UNFINISHED) | 1120 total_len = rxstat >> 16; 1121 if (total_len == RL_RXSTAT_UNFINISHED) |
1121 break; 1122 | 1122 break; 1123 |
1123 if (!(rxstat & RL_RXSTAT_RXOK)) { | 1124 if (!(rxstat & RL_RXSTAT_RXOK) || 1125 total_len < ETHER_MIN_LEN || 1126 total_len > ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) { |
1124 ifp->if_ierrors++; 1125 rl_init_locked(sc); 1126 return; 1127 } 1128 1129 /* No errors; receive the packet. */ | 1127 ifp->if_ierrors++; 1128 rl_init_locked(sc); 1129 return; 1130 } 1131 1132 /* No errors; receive the packet. */ |
1130 total_len = rxstat >> 16; | |
1131 rx_bytes += total_len + 4; 1132 1133 /* 1134 * XXX The RealTek chip includes the CRC with every 1135 * received frame, and there's no way to turn this 1136 * behavior off (at least, I can't find anything in 1137 * the manual that explains how to do it) so we have 1138 * to trim off the CRC manually. --- 655 unchanged lines hidden --- | 1133 rx_bytes += total_len + 4; 1134 1135 /* 1136 * XXX The RealTek chip includes the CRC with every 1137 * received frame, and there's no way to turn this 1138 * behavior off (at least, I can't find anything in 1139 * the manual that explains how to do it) so we have 1140 * to trim off the CRC manually. --- 655 unchanged lines hidden --- |