summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-10-26 23:55:59 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-10-26 23:55:59 +0000
commitae16c85257c7893d9ec585c5fe60f6060ed27c7f (patch)
treedbd4357f47a64a74db51387e3870a8e06b992ec1 /sys
parent5bf68ca5b136300ba765cab751964b68d6e18b70 (diff)
put vlan tag offload back in
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_vmx.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/dev/pci/if_vmx.c b/sys/dev/pci/if_vmx.c
index 1e03126f879..d81b61367ea 100644
--- a/sys/dev/pci/if_vmx.c
+++ b/sys/dev/pci/if_vmx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vmx.c,v 1.52 2019/10/26 23:40:29 dlg Exp $ */
+/* $OpenBSD: if_vmx.c,v 1.53 2019/10/26 23:55:58 dlg Exp $ */
/*
* Copyright (c) 2013 Tsubai Masanari
@@ -297,9 +297,9 @@ vmxnet3_attach(struct device *parent, struct device *self, void *aux)
ifp->if_watchdog = vmxnet3_watchdog;
ifp->if_hardmtu = VMXNET3_MAX_MTU;
ifp->if_capabilities = IFCAP_VLAN_MTU;
-#if 0
if (sc->sc_ds->upt_features & UPT1_F_CSUM)
ifp->if_capabilities |= IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
+#if 0
if (sc->sc_ds->upt_features & UPT1_F_VLAN)
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
#endif
@@ -1155,7 +1155,6 @@ vmxnet3_start(struct ifqueue *ifq)
free += NTXDESC;
free -= prod;
- sop = &ring->txd[prod];
rgen = ring->gen;
gen = rgen ^ VMX_TX_GEN;
@@ -1187,6 +1186,7 @@ vmxnet3_start(struct ifqueue *ifq)
bus_dmamap_sync(sc->sc_dmat, map, 0,
map->dm_mapsize, BUS_DMASYNC_PREWRITE);
+ sop = &ring->txd[prod];
for (i = 0; i < map->dm_nsegs; i++) {
txd = &ring->txd[prod];
txd->tx_addr = htole64(map->dm_segs[i].ds_addr);
@@ -1203,6 +1203,16 @@ vmxnet3_start(struct ifqueue *ifq)
}
txd->tx_word3 = htole32(VMXNET3_TX_EOP | VMXNET3_TX_COMPREQ);
+ if (ISSET(m->m_flags, M_VLANTAG)) {
+ sop->tx_word3 |= htole32(VMXNET3_TX_VTAG_MODE);
+ sop->tx_word3 |= htole32((m->m_pkthdr.ether_vtag &
+ VMXNET3_TX_VLANTAG_M) << VMXNET3_TX_VLANTAG_S);
+ }
+
+ /* Change the ownership by flipping the "generation" bit */
+ membar_producer();
+ sop->tx_word2 ^= VMX_TX_GEN;
+
free -= i;
post = 1;
}
@@ -1210,9 +1220,6 @@ vmxnet3_start(struct ifqueue *ifq)
if (!post)
return;
- /* Change the ownership by flipping the "generation" bit */
- sop->tx_word2 ^= VMX_TX_GEN;
-
ring->prod = prod;
ring->gen = rgen;