summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authoryamaguchi <yamaguchi@NetBSD.org>2022-06-17 06:18:09 +0000
committeryamaguchi <yamaguchi@NetBSD.org>2022-06-17 06:18:09 +0000
commit8a6d97fb256b5860bb9691618ae1fe9acecf14da (patch)
tree9514ded3210132827b8e79a623f2a0ff6c3903ed /sys/dev
parentc3d988518eb5a1f720d0d26f2eee01fd11987e6e (diff)
ixl(4), iavf(4): fix endian bug in vlan tag
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_iavf.c14
-rw-r--r--sys/dev/pci/if_ixl.c13
2 files changed, 16 insertions, 11 deletions
diff --git a/sys/dev/pci/if_iavf.c b/sys/dev/pci/if_iavf.c
index 9ecf80b68ef..e0b2c909052 100644
--- a/sys/dev/pci/if_iavf.c
+++ b/sys/dev/pci/if_iavf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iavf.c,v 1.15 2021/11/06 22:11:39 andvar Exp $ */
+/* $NetBSD: if_iavf.c,v 1.16 2022/06/17 06:18:09 yamaguchi Exp $ */
/*
* Copyright (c) 2013-2015, Intel Corporation
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.15 2021/11/06 22:11:39 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.16 2022/06/17 06:18:09 yamaguchi Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -2699,8 +2699,9 @@ iavf_rxeof(struct iavf_softc *sc, struct iavf_rx_ring *rxr, u_int rxlimit,
word0 = le64toh(rxd->qword0);
if (ISSET(word, IXL_RX_DESC_L2TAG1P)) {
- vlan_set_tag(m,
- __SHIFTOUT(word0, IXL_RX_DESC_L2TAG1_MASK));
+ uint16_t vtag;
+ vtag = __SHIFTOUT(word0, IXL_RX_DESC_L2TAG1_MASK);
+ vlan_set_tag(m, le16toh(vtag));
}
if ((ifp->if_capenable & IAVF_IFCAP_RXCSUM) != 0)
@@ -3032,9 +3033,10 @@ iavf_tx_common_locked(struct ifnet *ifp, struct iavf_tx_ring *txr,
iavf_tx_setup_offloads(m, &cmd_txd);
}
if (vlan_has_tag(m)) {
+ uint16_t vtag;
+ vtag = htole16(vlan_get_tag(m));
cmd_txd |= IXL_TX_DESC_CMD_IL2TAG1 |
- ((uint64_t)vlan_get_tag(m)
- << IXL_TX_DESC_L2TAG1_SHIFT);
+ ((uint64_t)vtag << IXL_TX_DESC_L2TAG1_SHIFT);
}
bus_dmamap_sync(sc->sc_dmat, map, 0,
diff --git a/sys/dev/pci/if_ixl.c b/sys/dev/pci/if_ixl.c
index 00363472884..bb450452916 100644
--- a/sys/dev/pci/if_ixl.c
+++ b/sys/dev/pci/if_ixl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ixl.c,v 1.83 2022/05/23 13:53:37 rin Exp $ */
+/* $NetBSD: if_ixl.c,v 1.84 2022/06/17 06:18:09 yamaguchi Exp $ */
/*
* Copyright (c) 2013-2015, Intel Corporation
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.83 2022/05/23 13:53:37 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.84 2022/06/17 06:18:09 yamaguchi Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -2714,7 +2714,9 @@ ixl_tx_common_locked(struct ifnet *ifp, struct ixl_tx_ring *txr,
}
if (vlan_has_tag(m)) {
- cmd_txd |= (uint64_t)vlan_get_tag(m) <<
+ uint16_t vtag;
+ vtag = htole16(vlan_get_tag(m));
+ cmd_txd |= (uint64_t)vtag <<
IXL_TX_DESC_L2TAG1_SHIFT;
cmd_txd |= IXL_TX_DESC_CMD_IL2TAG1;
}
@@ -3223,8 +3225,9 @@ ixl_rxeof(struct ixl_softc *sc, struct ixl_rx_ring *rxr, u_int rxlimit)
word0 = le64toh(rxd->qword0);
if (ISSET(word, IXL_RX_DESC_L2TAG1P)) {
- vlan_set_tag(m,
- __SHIFTOUT(word0, IXL_RX_DESC_L2TAG1_MASK));
+ uint16_t vtag;
+ vtag = __SHIFTOUT(word0, IXL_RX_DESC_L2TAG1_MASK);
+ vlan_set_tag(m, le16toh(vtag));
}
if ((ifp->if_capenable & IXL_IFCAP_RXCSUM) != 0)