net/sfc: discard last seen VLAN TCI if Tx packet is dropped
authorIvan Malov <ivan.malov@oktetlabs.ru>
Wed, 9 Jan 2019 11:06:39 +0000 (11:06 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 Jan 2019 16:44:29 +0000 (17:44 +0100)
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.

Fixes: 7fd636815a43 ("net/sfc: support VLAN offload on transmit path")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/sfc_tx.c

index cce8239..aa73d26 100644 (file)
@@ -712,6 +712,7 @@ sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
        for (pkts_sent = 0, pktp = &tx_pkts[0];
             (pkts_sent < nb_pkts) && (fill_level <= soft_max_fill);
             pkts_sent++, pktp++) {
+               uint16_t                hw_vlan_tci_prev = txq->hw_vlan_tci;
                struct rte_mbuf         *m_seg = *pktp;
                size_t                  pkt_len = m_seg->pkt_len;
                unsigned int            pkt_descs = 0;
@@ -750,6 +751,7 @@ sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
                                 * mbuf shouldn't be orphaned
                                 */
                                pend -= pkt_descs;
+                               txq->hw_vlan_tci = hw_vlan_tci_prev;
 
                                rte_pktmbuf_free(*pktp);
 
@@ -819,10 +821,12 @@ sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
                                fill_level = added - txq->completed;
                                if (fill_level > hard_max_fill) {
                                        pend -= pkt_descs;
+                                       txq->hw_vlan_tci = hw_vlan_tci_prev;
                                        break;
                                }
                        } else {
                                pend -= pkt_descs;
+                               txq->hw_vlan_tci = hw_vlan_tci_prev;
                                break;
                        }
                }