From 0decb6fde848c856d32eace05f76ded0d75c9d20 Mon Sep 17 00:00:00 2001 From: arybchik Date: Fri, 30 Nov 2018 07:11:05 +0000 Subject: [PATCH] sfxge(4): rollback last seen VLAN TCI if Tx packet is dropped Early processing of a packet on transmit may change last seen VLAN TCI in the queue context. If such a packet is eventually dropped, last seen VLAN TCI must be set to its previous value. Submitted by: Ivan Malov Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18288 --- sys/dev/sfxge/sfxge_tx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/sfxge/sfxge_tx.c b/sys/dev/sfxge/sfxge_tx.c index dcd1c8baf86a..4fce5ca7e76a 100644 --- a/sys/dev/sfxge/sfxge_tx.c +++ b/sys/dev/sfxge/sfxge_tx.c @@ -361,6 +361,7 @@ static int sfxge_tx_queue_mbuf(struct sfxge_txq *txq, struct mbuf *mbuf) int rc; int i; int eop; + uint16_t hw_vlan_tci_prev; int vlan_tagged; KASSERT(!txq->blocked, ("txq->blocked")); @@ -412,6 +413,8 @@ static int sfxge_tx_queue_mbuf(struct sfxge_txq *txq, struct mbuf *mbuf) used_map = &stmp->map; + hw_vlan_tci_prev = txq->hw_vlan_tci; + vlan_tagged = sfxge_tx_maybe_insert_tag(txq, mbuf); if (vlan_tagged) { sfxge_next_stmp(txq, &stmp); @@ -463,6 +466,7 @@ static int sfxge_tx_queue_mbuf(struct sfxge_txq *txq, struct mbuf *mbuf) return (0); reject_mapped: + txq->hw_vlan_tci = hw_vlan_tci_prev; bus_dmamap_unload(txq->packet_dma_tag, *used_map); reject: /* Drop the packet on the floor. */