net/octeontx2: add Tx queue rate limit
[dpdk.git] / drivers / net / bnx2x / bnx2x_rxtx.c
index ae97dfe..e201b68 100644 (file)
@@ -346,6 +346,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
        uint16_t len, pad;
        struct rte_mbuf *rx_mb = NULL;
 
+       rte_spinlock_lock(&(fp)->rx_mtx);
+
        hw_cq_cons = le16toh(*fp->rx_cq_cons_sb);
        if ((hw_cq_cons & USABLE_RCQ_ENTRIES_PER_PAGE) ==
                        USABLE_RCQ_ENTRIES_PER_PAGE) {
@@ -357,8 +359,10 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
        sw_cq_cons = rxq->rx_cq_head;
        sw_cq_prod = rxq->rx_cq_tail;
 
-       if (sw_cq_cons == hw_cq_cons)
+       if (sw_cq_cons == hw_cq_cons) {
+               rte_spinlock_unlock(&(fp)->rx_mtx);
                return 0;
+       }
 
        while (nb_rx < nb_pkts && sw_cq_cons != hw_cq_cons) {
 
@@ -414,7 +418,7 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                 */
                if (cqe_fp->pars_flags.flags & PARSING_FLAGS_VLAN) {
                        rx_mb->vlan_tci = cqe_fp->vlan_tag;
-                       rx_mb->ol_flags |= PKT_RX_VLAN;
+                       rx_mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
                }
 
                rx_pkts[nb_rx] = rx_mb;
@@ -439,6 +443,8 @@ next_rx:
 
        bnx2x_upd_rx_prod_fast(sc, fp, bd_prod, sw_cq_prod);
 
+       rte_spinlock_unlock(&(fp)->rx_mtx);
+
        return nb_rx;
 }