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
This commit is contained in:
parent
ab47d79913
commit
db40c1aef4
@ -103,6 +103,10 @@ filtering that breaks the Path MTU Discovery mechanism.
|
||||
.Pp
|
||||
The NICs that support oversized frames are as follows:
|
||||
.Bl -tag -width ".Xr fxp 4 " -offset indent
|
||||
.It Xr dc 4
|
||||
supports long frames for the
|
||||
.Nm
|
||||
natively.
|
||||
.It Xr de 4
|
||||
requires defining
|
||||
.Dv BIG_PACKET
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user