My newer sparc64 boxes come with Intel 82576 rev 0x01 em(4) interfaces.
There is a bug in the HW_VLAN_TAGGING support that does a double big to
little endian change of the vlan tag and so the outgoing packets vlan tag
is all wrong.
The below diff fixes this for me on sparc64, on little endian archs this
is a nop so I doubt it will changing there. Since the code shifts the vlan
tag by 16 I changed to type to uint32_t just to be clear.
The vlan_macip_lens remains in host byte order until much later in
em_tx_ctx_setup() when the descriptor is set so there is no need to
htole16() the mp->m_pkthdr.ether_vtag.
With this my sparc64 can finally handle send proper vlan packets out.
OK?
--
:wq Claudio
Index: dev/pci/if_em.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.363
diff -u -p -r1.363 if_em.c
--- dev/pci/if_em.c 6 Nov 2022 18:17:56 -0000 1.363
+++ dev/pci/if_em.c 2 Feb 2023 11:40:21 -0000
@@ -2411,7 +2411,7 @@ em_tx_ctx_setup(struct em_queue *que, st
#if NVLAN > 0
if (ISSET(mp->m_flags, M_VLANTAG)) {
- uint16_t vtag = htole16(mp->m_pkthdr.ether_vtag);
+ uint32_t vtag = mp->m_pkthdr.ether_vtag;
vlan_macip_lens |= vtag << E1000_ADVTXD_VLAN_SHIFT;
*cmd_type_len |= E1000_ADVTXD_DCMD_VLE;
off = 1;