kern/105054: vge driver sends VLAN IDs in wrong endian.
Ruslan Ermilov
ru at FreeBSD.org
Thu Nov 2 14:00:48 UTC 2006
The following reply was made to PR kern/105054; it has been noted by GNATS.
From: Ruslan Ermilov <ru at FreeBSD.org>
To: Ian <yoitsmeremember at users.sourceforge.net>
Cc: bug-followup at FreeBSD.org
Subject: Re: kern/105054: vge driver sends VLAN IDs in wrong endian.
Date: Thu, 2 Nov 2006 16:58:31 +0300
--jL2BoiuKMElzg3CS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
I looked at the VIA provided Linux driver sources, and it appears that
VTAG should be inserted in little-endian.
Unfortunately, your suggested fix is incorrect. Please try the following
patch instead (pick up the right version) and report back.
This is for RELENG_6:
%%%
Index: if_vge.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/dev/vge/if_vge.c,v
retrieving revision 1.14.2.8
diff -u -p -r1.14.2.8 if_vge.c
--- if_vge.c 5 Sep 2006 07:06:15 -0000 1.14.2.8
+++ if_vge.c 2 Nov 2006 13:40:02 -0000
@@ -1490,8 +1490,7 @@ vge_rxeof(sc)
}
=20
if (rxstat & VGE_RDSTS_VTAG) {
- VLAN_INPUT_TAG_NEW(ifp, m,
- ntohs((rxctl & VGE_RDCTL_VLANID)));
+ VLAN_INPUT_TAG_NEW(ifp, m, rxctl & VGE_RDCTL_VLANID);
if (m =3D=3D NULL)
continue;
}
@@ -1819,7 +1818,7 @@ vge_encap(sc, m_head, idx)
mtag =3D VLAN_OUTPUT_TAG(sc->vge_ifp, m_head);
if (mtag !=3D NULL)
sc->vge_ldata.vge_tx_list[idx].vge_ctl |=3D
- htole32(htons(VLAN_TAG_VALUE(mtag)) | VGE_TDCTL_VTAG);
+ htole32((uint16_t)VLAN_TAG_VALUE(mtag) | VGE_TDCTL_VTAG);
=20
sc->vge_ldata.vge_tx_list[idx].vge_sts |=3D htole32(VGE_TDSTS_OWN);
=20
%%%
This is for HEAD:
%%%
Index: if_vge.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/dev/vge/if_vge.c,v
retrieving revision 1.26
diff -u -p -r1.26 if_vge.c
--- if_vge.c 17 Sep 2006 13:33:29 -0000 1.26
+++ if_vge.c 2 Nov 2006 13:41:51 -0000
@@ -1490,8 +1490,7 @@ vge_rxeof(sc)
}
=20
if (rxstat & VGE_RDSTS_VTAG) {
- m->m_pkthdr.ether_vtag =3D
- ntohs((rxctl & VGE_RDCTL_VLANID));
+ m->m_pkthdr.ether_vtag =3D rxctl & VGE_RDCTL_VLANID;
m->m_flags |=3D M_VLANTAG;
}
=20
@@ -1816,7 +1815,7 @@ vge_encap(sc, m_head, idx)
=20
if (m_head->m_flags & M_VLANTAG)
sc->vge_ldata.vge_tx_list[idx].vge_ctl |=3D
- htole32(htons(m_head->m_pkthdr.ether_vtag) | VGE_TDCTL_VTAG);
+ htole32(m_head->m_pkthdr.ether_vtag | VGE_TDCTL_VTAG);
=20
sc->vge_ldata.vge_tx_list[idx].vge_sts |=3D htole32(VGE_TDSTS_OWN);
=20
%%%
Cheers,
--=20
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
--jL2BoiuKMElzg3CS
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)
iD8DBQFFSfmHqRfpzJluFF4RAvf0AJ9QVxk5QHLDcX4amiO3cANwablO+QCcDOTi
fhfE2wnkrEoV7cNLzb3SaXU=
=IpyW
-----END PGP SIGNATURE-----
--jL2BoiuKMElzg3CS--
More information about the freebsd-bugs
mailing list