net/cnxk: enable PTP processing in vector Tx
[dpdk.git] / drivers / net / iavf / iavf_rxtx.c
index 3f3cf63..0361af0 100644 (file)
@@ -1161,7 +1161,7 @@ iavf_update_rx_tail(struct iavf_rx_queue *rxq, uint16_t nb_hold, uint16_t rx_id)
                           rxq->port_id, rxq->queue_id, rx_id, nb_hold);
                rx_id = (uint16_t)((rx_id == 0) ?
                        (rxq->nb_rx_desc - 1) : (rx_id - 1));
-               IAVF_PCI_REG_WRITE(rxq->qrx_tail, rx_id);
+               IAVF_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id);
                nb_hold = 0;
        }
        rxq->nb_rx_hold = nb_hold;
@@ -1218,6 +1218,7 @@ iavf_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                rxd = *rxdp;
                nb_hold++;
                rxe = rxq->sw_ring[rx_id];
+               rxq->sw_ring[rx_id] = nmb;
                rx_id++;
                if (unlikely(rx_id == rxq->nb_rx_desc))
                        rx_id = 0;
@@ -1323,6 +1324,7 @@ iavf_recv_pkts_flex_rxd(void *rx_queue,
                rxd = *rxdp;
                nb_hold++;
                rxe = rxq->sw_ring[rx_id];
+               rxq->sw_ring[rx_id] = nmb;
                rx_id++;
                if (unlikely(rx_id == rxq->nb_rx_desc))
                        rx_id = 0;
@@ -1414,6 +1416,7 @@ iavf_recv_scattered_pkts_flex_rxd(void *rx_queue, struct rte_mbuf **rx_pkts,
                rxd = *rxdp;
                nb_hold++;
                rxe = rxq->sw_ring[rx_id];
+               rxq->sw_ring[rx_id] = nmb;
                rx_id++;
                if (rx_id == rxq->nb_rx_desc)
                        rx_id = 0;
@@ -1567,6 +1570,7 @@ iavf_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                rxd = *rxdp;
                nb_hold++;
                rxe = rxq->sw_ring[rx_id];
+               rxq->sw_ring[rx_id] = nmb;
                rx_id++;
                if (rx_id == rxq->nb_rx_desc)
                        rx_id = 0;
@@ -1906,7 +1910,7 @@ iavf_rx_alloc_bufs(struct iavf_rx_queue *rxq)
 
        /* Update rx tail register */
        rte_wmb();
-       IAVF_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rxq->rx_free_trigger);
+       IAVF_PCI_REG_WC_WRITE_RELAXED(rxq->qrx_tail, rxq->rx_free_trigger);
 
        rxq->rx_free_trigger =
                (uint16_t)(rxq->rx_free_trigger + rxq->rx_free_thresh);
@@ -2245,6 +2249,11 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
                                (volatile struct iavf_tx_context_desc *)
                                                        &txr[tx_id];
 
+                       /* clear QW0 or the previous writeback value
+                        * may impact next write
+                        */
+                       *(volatile uint64_t *)ctx_txd = 0;
+
                        txn = &sw_ring[txe->next_id];
                        RTE_MBUF_PREFETCH_TO_FREE(txn->mbuf);
                        if (txe->mbuf) {
@@ -2327,7 +2336,7 @@ end_of_tx:
        PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u",
                   txq->port_id, txq->queue_id, tx_id, nb_tx);
 
-       IAVF_PCI_REG_WRITE_RELAXED(txq->qtx_tail, tx_id);
+       IAVF_PCI_REG_WC_WRITE_RELAXED(txq->qtx_tail, tx_id);
        txq->tx_tail = tx_id;
 
        return nb_tx;
@@ -2393,7 +2402,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
        struct iavf_rx_queue *rxq;
        int i;
        int check_ret;
-       bool use_sse = false;
        bool use_avx2 = false;
        bool use_avx512 = false;
        bool use_flex = false;
@@ -2401,13 +2409,10 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
        check_ret = iavf_rx_vec_dev_check(dev);
        if (check_ret >= 0 &&
            rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-               if (check_ret == IAVF_VECTOR_PATH) {
-                       use_sse = true;
-                       if ((rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 ||
-                            rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) &&
-                           rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256)
-                               use_avx2 = true;
-               }
+               if ((rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 ||
+                    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) &&
+                   rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256)
+                       use_avx2 = true;
 
 #ifdef CC_AVX512_SUPPORT
                if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
@@ -2416,9 +2421,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
                        use_avx512 = true;
 #endif
 
-               if (!use_sse && !use_avx2 && !use_avx512)
-                       goto normal;
-
                if (vf->vf_res->vf_cap_flags &
                        VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
                        use_flex = true;
@@ -2522,7 +2524,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
                return;
        }
 
-normal:
 #endif
        if (dev->data->scattered_rx) {
                PMD_DRV_LOG(DEBUG, "Using a Scattered Rx callback (port=%d).",
@@ -2587,6 +2588,7 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
                                            iavf_xmit_pkts_vec_avx2 :
                                            iavf_xmit_pkts_vec;
                }
+               dev->tx_pkt_prepare = NULL;
 #ifdef CC_AVX512_SUPPORT
                if (use_avx512) {
                        if (check_ret == IAVF_VECTOR_PATH) {
@@ -2595,12 +2597,12 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
                                            dev->data->port_id);
                        } else {
                                dev->tx_pkt_burst = iavf_xmit_pkts_vec_avx512_offload;
+                               dev->tx_pkt_prepare = iavf_prep_pkts;
                                PMD_DRV_LOG(DEBUG, "Using AVX512 OFFLOAD Vector Tx (port %d).",
                                            dev->data->port_id);
                        }
                }
 #endif
-               dev->tx_pkt_prepare = NULL;
 
                for (i = 0; i < dev->data->nb_tx_queues; i++) {
                        txq = dev->data->tx_queues[i];