Disable hw VLAN tagging, in a similar way that it was done in OpenBSD
(src/sys/dev/ic/re.c rev. 1.15). The disabled VLAN stripping is mine. (The OpenBSD driver forgot to do this.) The reason is that untagged packets get sometimes tagged incorrectly. PR 32643. Approved by martin@.
This commit is contained in:
parent
0cbf19486a
commit
dbbc553deb
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rtl8169.c,v 1.22 2005/12/11 12:21:28 christos Exp $ */
|
||||
/* $NetBSD: rtl8169.c,v 1.23 2006/05/16 22:39:24 pavel Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998-2003
|
||||
@ -745,8 +745,16 @@ re_attach(struct rtk_softc *sc)
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
ifp->if_ioctl = re_ioctl;
|
||||
sc->ethercom.ec_capabilities |=
|
||||
ETHERCAP_VLAN_MTU | ETHERCAP_VLAN_HWTAGGING;
|
||||
sc->ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
|
||||
|
||||
/*
|
||||
* This is a way to disable hw VLAN tagging by default
|
||||
* (RE_VLAN is undefined), as it is problematic. PR 32643
|
||||
*/
|
||||
|
||||
#ifdef RE_VLAN
|
||||
sc->ethercom.ec_capabilities |= ETHERCAP_VLAN_HWTAGGING;
|
||||
#endif
|
||||
ifp->if_start = re_start;
|
||||
ifp->if_stop = re_stop;
|
||||
|
||||
@ -1276,11 +1284,13 @@ re_rxeof(struct rtk_softc *sc)
|
||||
m->m_pkthdr.csum_flags |= M_CSUM_TCP_UDP_BAD;
|
||||
}
|
||||
|
||||
#ifdef RE_VLAN
|
||||
if (rxvlan & RTK_RDESC_VLANCTL_TAG) {
|
||||
VLAN_INPUT_TAG(ifp, m,
|
||||
be16toh(rxvlan & RTK_RDESC_VLANCTL_DATA),
|
||||
continue);
|
||||
}
|
||||
#endif
|
||||
#if NBPFILTER > 0
|
||||
if (ifp->if_bpf)
|
||||
bpf_mtap(ifp->if_bpf, m);
|
||||
@ -1518,7 +1528,9 @@ re_encap(struct rtk_softc *sc, struct mbuf *m, int *idx)
|
||||
{
|
||||
bus_dmamap_t map;
|
||||
int error, i, startidx, curidx;
|
||||
#ifdef RE_VLAN
|
||||
struct m_tag *mtag;
|
||||
#endif
|
||||
struct rtk_desc *d;
|
||||
u_int32_t cmdstat, rtk_flags;
|
||||
struct rtk_txq *txq;
|
||||
@ -1640,11 +1652,13 @@ re_encap(struct rtk_softc *sc, struct mbuf *m, int *idx)
|
||||
* transmission attempt.
|
||||
*/
|
||||
|
||||
#ifdef RE_VLAN
|
||||
if ((mtag = VLAN_OUTPUT_TAG(&sc->ethercom, m)) != NULL) {
|
||||
sc->rtk_ldata.rtk_tx_list[startidx].rtk_vlanctl =
|
||||
htole32(htons(VLAN_TAG_VALUE(mtag)) |
|
||||
RTK_TDESC_VLANCTL_TAG);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Transfer ownership of packet to the chip. */
|
||||
|
||||
@ -1796,7 +1810,10 @@ re_init(struct ifnet *ifp)
|
||||
reg |= (0x1 << 14) | RTK_CPLUSCMD_PCI_MRW;;
|
||||
|
||||
if (1) {/* not for 8169S ? */
|
||||
reg |= RTK_CPLUSCMD_VLANSTRIP |
|
||||
reg |=
|
||||
#ifdef RE_VLAN
|
||||
RTK_CPLUSCMD_VLANSTRIP |
|
||||
#endif
|
||||
(ifp->if_capenable &
|
||||
(IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_TCPv4_Rx |
|
||||
IFCAP_CSUM_UDPv4_Rx) ?
|
||||
|
Loading…
x
Reference in New Issue
Block a user