[dpdk-dev] [PATCH] net/ice: cleanup for vec path check

Xiaolong Ye xiaolong.ye at intel.com
Thu Jan 16 08:09:48 CET 2020


Move the conditional compilation block to the inner check helper, so we
can reduce the number of multiple ifdef check pairs used.

Signed-off-by: Xiaolong Ye <xiaolong.ye at intel.com>
---
 drivers/net/ice/ice_rxtx.c            | 9 ---------
 drivers/net/ice/ice_rxtx_vec_common.h | 8 ++++++++
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 71adba809..8feeeb828 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2753,14 +2753,12 @@ ice_tx_done_cleanup_full(struct ice_tx_queue *txq,
 	return (int)pkt_cnt;
 }
 
-#ifdef RTE_ARCH_X86
 static int
 ice_tx_done_cleanup_vec(struct ice_tx_queue *txq __rte_unused,
 			uint32_t free_cnt __rte_unused)
 {
 	return -ENOTSUP;
 }
-#endif
 
 static int
 ice_tx_done_cleanup_simple(struct ice_tx_queue *txq,
@@ -2794,10 +2792,8 @@ ice_tx_done_cleanup(void *txq, uint32_t free_cnt)
 	struct ice_adapter *ad =
 		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 
-#ifdef RTE_ARCH_X86
 	if (ad->tx_vec_allowed)
 		return ice_tx_done_cleanup_vec(q, free_cnt);
-#endif
 	if (ad->tx_simple_allowed)
 		return ice_tx_done_cleanup_simple(q, free_cnt);
 	else
@@ -2953,7 +2949,6 @@ ice_set_rx_function(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 	struct ice_adapter *ad =
 		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-#ifdef RTE_ARCH_X86
 	struct ice_rx_queue *rxq;
 	int i;
 	bool use_avx2 = false;
@@ -2998,8 +2993,6 @@ ice_set_rx_function(struct rte_eth_dev *dev)
 		return;
 	}
 
-#endif
-
 	if (dev->data->scattered_rx) {
 		/* Set the non-LRO scattered function */
 		PMD_INIT_LOG(DEBUG,
@@ -3131,7 +3124,6 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 {
 	struct ice_adapter *ad =
 		ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-#ifdef RTE_ARCH_X86
 	struct ice_tx_queue *txq;
 	int i;
 	bool use_avx2 = false;
@@ -3167,7 +3159,6 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 
 		return;
 	}
-#endif
 
 	if (ad->tx_simple_allowed) {
 		PMD_INIT_LOG(DEBUG, "Simple tx finally be used.");
diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index 6b57ff2ae..223aac878 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -267,6 +267,7 @@ ice_tx_vec_queue_default(struct ice_tx_queue *txq)
 static inline int
 ice_rx_vec_dev_check_default(struct rte_eth_dev *dev)
 {
+#ifdef RTE_ARCH_X86
 	int i;
 	struct ice_rx_queue *rxq;
 	struct ice_adapter *ad =
@@ -283,11 +284,15 @@ ice_rx_vec_dev_check_default(struct rte_eth_dev *dev)
 	}
 
 	return 0;
+#else
+	return -1;
+#endif
 }
 
 static inline int
 ice_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 {
+#ifdef RTE_ARCH_X86
 	int i;
 	struct ice_tx_queue *txq;
 
@@ -298,6 +303,9 @@ ice_tx_vec_dev_check_default(struct rte_eth_dev *dev)
 	}
 
 	return 0;
+#else
+	return -1;
+#endif
 }
 
 #endif
-- 
2.17.1



More information about the dev mailing list