net/ice: fix Tx function selection
authorLeyi Rong <leyi.rong@intel.com>
Fri, 19 Apr 2019 03:03:50 +0000 (11:03 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 19 Apr 2019 12:51:55 +0000 (14:51 +0200)
Add ice_set_tx_function_flag() to configure tx_simple_allowed properly.

Fixes: 6eac0b7fde95 ("net/ice: support advance Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_rxtx.c
drivers/net/ice/ice_rxtx.h

index 8ef6a2f..ace766b 100644 (file)
@@ -885,6 +885,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev,
        txq->q_set = TRUE;
        dev->data->tx_queues[queue_idx] = txq;
        txq->tx_rel_mbufs = _ice_tx_queue_release_mbufs;
+       ice_set_tx_function_flag(dev, txq);
 
        return 0;
 }
@@ -2305,6 +2306,27 @@ ice_set_rx_function(struct rte_eth_dev *dev)
        }
 }
 
+void __attribute__((cold))
+ice_set_tx_function_flag(struct rte_eth_dev *dev, struct ice_tx_queue *txq)
+{
+       struct ice_adapter *ad =
+               ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+
+       /* Use a simple Tx queue if possible (only fast free is allowed) */
+       ad->tx_simple_allowed =
+               (txq->offloads ==
+               (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) &&
+               txq->tx_rs_thresh >= ICE_TX_MAX_BURST);
+
+       if (ad->tx_simple_allowed)
+               PMD_INIT_LOG(DEBUG, "Simple Tx can be enabled on Tx queue %u.",
+                            txq->queue_id);
+       else
+               PMD_INIT_LOG(DEBUG,
+                            "Simple Tx can NOT be enabled on Tx queue %u.",
+                            txq->queue_id);
+}
+
 /*********************************************************************
  *
  *  TX prep functions
index 64e9f20..9040e3f 100644 (file)
@@ -158,6 +158,8 @@ uint16_t ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 void ice_set_rx_function(struct rte_eth_dev *dev);
 uint16_t ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
                       uint16_t nb_pkts);
+void ice_set_tx_function_flag(struct rte_eth_dev *dev,
+                             struct ice_tx_queue *txq);
 void ice_set_tx_function(struct rte_eth_dev *dev);
 uint32_t ice_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 void ice_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,