Subject: Re: kern/32644: gsip(4) sends byte-swapped vlan tags
To: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 01/30/2006 10:32:47
On Jan 30, 4:15pm, pcah8322@artax.karlin.mff.cuni.cz (Pavel Cahyna) wrote:
-- Subject: Re: kern/32644: gsip(4) sends byte-swapped vlan tags
| > This does not seem right because in the first part of the patch you do:
| >
| > + htole32(EXTSTS_VPKT |
| > + (bswap16(VLAN_TAG_VALUE(mtag)) &
| > + EXTSTS_VTCI));
| >
| > and in the second:
| >
| > | + VLAN_INPUT_TAG(ifp, m, bswap16(extsts & EXTSTS_VTCI),
| >
| > because in the first patch you are not bswapping16 EXTSTS_VTCI and in the
| > second you do?
|
| I think it can be justified algebraically:
|
| The firts patched part does:
|
| mtag(host byte order) -> bswap16 -> &= EXTSTS_VTCI -> |= EXTSTS_VPKT ->
| -> htole32 -> tx descriptor
|
| while the second does:
|
| rx descriptor -> le32toh -> &= EXTSTS_VTCI -> bswap16 -> mtag(host byte
| order)
|
| So, the second sequence is inverse to the first.
Thanks, I see it now.
christos