summaryrefslogtreecommitdiffstats
path: root/sys/dev/dc
diff options
context:
space:
mode:
authorambrisko <ambrisko@FreeBSD.org>2002-01-16 16:33:58 +0000
committerambrisko <ambrisko@FreeBSD.org>2002-01-16 16:33:58 +0000
commit81dbce8cc90b1d59811638727e8e1e44455afb55 (patch)
tree3a8de1185c3f8aaadd2f4040ae64d08867ddd590 /sys/dev/dc
parent66616c46ce4a5ff8b05734a96d0a169ae26cd667 (diff)
downloadFreeBSD-src-81dbce8cc90b1d59811638727e8e1e44455afb55.zip
FreeBSD-src-81dbce8cc90b1d59811638727e8e1e44455afb55.tar.gz
Add VLAN for the dc(4) driver (ie long frame). The patch is 2 parts.
One to notify the system that the MTU for VLAN can be 1500 so the vlan will automatically be configured with a 1500 MTU the other is to ignore the error case if the received frame is to long. The frame size notification came from code in the SIS driver, and the support for long frames derived from the NetBSD Tulip driver. Tested on: 4 port D-Link adapter DFE-570TX 4 Intel 21143 Netgear card with 82c169 PNIC 10/100BaseTX Reviewed by: ru (manpage), wpaul (not objected to), archie Approved by: imp Obtained from: NetBSD
Diffstat (limited to 'sys/dev/dc')
-rw-r--r--sys/dev/dc/if_dc.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index 6ef8a98..abafb7e 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -103,6 +103,8 @@
#include <net/ethernet.h>
#include <net/if_dl.h>
#include <net/if_media.h>
+#include <net/if_types.h>
+#include <net/if_vlan_var.h>
#include <net/bpf.h>
@@ -2130,6 +2132,12 @@ static int dc_attach(dev)
* Call MI attach routine.
*/
ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
+
+ /*
+ * Tell the upper layer(s) we support long frames.
+ */
+ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
+
callout_init(&sc->dc_stat_ch, IS_MPSAFE);
#ifdef SRM_MEDIA
@@ -2505,19 +2513,25 @@ static void dc_rxeof(sc)
* If an error occurs, update stats, clear the
* status word and leave the mbuf cluster in place:
* it should simply get re-used next time this descriptor
- * comes up in the ring.
+ * comes up in the ring. However, don't report long
+ * frames as errors since they could be vlans
*/
- if (rxstat & DC_RXSTAT_RXERR) {
- ifp->if_ierrors++;
- if (rxstat & DC_RXSTAT_COLLSEEN)
- ifp->if_collisions++;
- dc_newbuf(sc, i, m);
- if (rxstat & DC_RXSTAT_CRCERR) {
- DC_INC(i, DC_RX_LIST_CNT);
- continue;
- } else {
- dc_init(sc);
- return;
+ if ((rxstat & DC_RXSTAT_RXERR)){
+ if (!(rxstat & DC_RXSTAT_GIANT) ||
+ (rxstat & (DC_RXSTAT_CRCERR | DC_RXSTAT_DRIBBLE |
+ DC_RXSTAT_MIIERE | DC_RXSTAT_COLLSEEN |
+ DC_RXSTAT_RUNT | DC_RXSTAT_DE))) {
+ ifp->if_ierrors++;
+ if (rxstat & DC_RXSTAT_COLLSEEN)
+ ifp->if_collisions++;
+ dc_newbuf(sc, i, m);
+ if (rxstat & DC_RXSTAT_CRCERR) {
+ DC_INC(i, DC_RX_LIST_CNT);
+ continue;
+ } else {
+ dc_init(sc);
+ return;
+ }
}
}
OpenPOWER on IntegriCloud