From d2ab39c136d2869c17166e81fb75504600d7c472 Mon Sep 17 00:00:00 2001 From: jan Date: Fri, 9 Feb 2024 15:22:41 +0000 Subject: [PATCH] vmx(4): add missing NVLAN checks ok bluhm@ --- sys/dev/pci/if_vmx.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/if_vmx.c b/sys/dev/pci/if_vmx.c index 30e5b124d09..4a9c762350b 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.79 2023/11/10 15:51:24 bluhm Exp $ */ +/* $OpenBSD: if_vmx.c,v 1.80 2024/02/09 15:22:41 jan Exp $ */ /* * Copyright (c) 2013 Tsubai Masanari @@ -404,8 +404,10 @@ vmxnet3_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_ds->upt_features & UPT1_F_CSUM) ifp->if_capabilities |= IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4; #endif +#if NVLAN > 0 if (sc->sc_ds->upt_features & UPT1_F_VLAN) ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; +#endif ifq_init_maxlen(&ifp->if_snd, NTXDESC); @@ -503,7 +505,10 @@ vmxnet3_dma_init(struct vmxnet3_softc *sc) #endif ds->vmxnet3_revision = 1; ds->upt_version = 1; - ds->upt_features = UPT1_F_CSUM | UPT1_F_VLAN; + ds->upt_features = UPT1_F_CSUM; +#if NVLAN > 0 + ds->upt_features |= UPT1_F_VLAN; +#endif ds->driver_data = ~0ULL; ds->driver_data_len = 0; ds->queue_shared = qs_pa; @@ -1117,11 +1122,13 @@ vmxnet3_rxintr(struct vmxnet3_softc *sc, struct vmxnet3_rxqueue *rq) m->m_pkthdr.len = m->m_len = len; vmxnet3_rx_csum(rxcd, m); +#if NVLAN > 0 if (letoh32(rxcd->rxc_word2 & VMXNET3_RXC_VLAN)) { m->m_flags |= M_VLANTAG; m->m_pkthdr.ether_vtag = letoh32((rxcd->rxc_word2 >> VMXNET3_RXC_VLANTAG_S) & VMXNET3_RXC_VLANTAG_M); } +#endif if (((letoh32(rxcd->rxc_word0) >> VMXNET3_RXC_RSSTYPE_S) & VMXNET3_RXC_RSSTYPE_M) != VMXNET3_RXC_RSSTYPE_NONE) { m->m_pkthdr.ph_flowid = letoh32(rxcd->rxc_word1); @@ -1462,11 +1469,13 @@ vmxnet3_start(struct ifqueue *ifq) } txd->tx_word3 = htole32(VMXNET3_TX_EOP | VMXNET3_TX_COMPREQ); +#if NVLAN > 0 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); } +#endif ring->prod = prod; /* Change the ownership by flipping the "generation" bit */ -- 2.20.1