DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] net/ice: remove redundant code
@ 2020-03-09 12:12 Qi Zhang
  2020-03-10  9:12 ` Ye Xiaolong
  0 siblings, 1 reply; 2+ messages in thread
From: Qi Zhang @ 2020-03-09 12:12 UTC (permalink / raw)
  To: qiming.yang; +Cc: xiaolong.ye, dev, Qi Zhang

Remove function ice_clear_queues, since all equivalent code
has already be executed durring ice_rx|tx_queue_stop.

Also function ice_rx|tx_queue_release_mbufs simpley wrapped a
function pointer call which is not necessary, remove them.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
v2:
- function declare in ice_rxtx.h also need be removed.

 drivers/net/ice/ice_ethdev.c |  3 ---
 drivers/net/ice/ice_rxtx.c   | 43 +++++++------------------------------------
 drivers/net/ice/ice_rxtx.h   |  1 -
 3 files changed, 7 insertions(+), 40 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 85ef83e92..e59761c22 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2370,9 +2370,6 @@ ice_dev_stop(struct rte_eth_dev *dev)
 	/* disable all queue interrupts */
 	ice_vsi_disable_queues_intr(main_vsi);
 
-	/* Clear all queues and release mbufs */
-	ice_clear_queues(dev);
-
 	if (pf->init_link_up)
 		ice_dev_set_link_up(dev);
 	else
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 60c411bfa..198db6cb9 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -249,12 +249,6 @@ _ice_rx_queue_release_mbufs(struct ice_rx_queue *rxq)
 #endif /* RTE_LIBRTE_ICE_RX_ALLOW_BULK_ALLOC */
 }
 
-static void
-ice_rx_queue_release_mbufs(struct ice_rx_queue *rxq)
-{
-	rxq->rx_rel_mbufs(rxq);
-}
-
 /* turn on or off rx queue
  * @q_idx: queue index in pf scope
  * @on: turn on or off the queue
@@ -429,7 +423,7 @@ ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		PMD_DRV_LOG(ERR, "Failed to switch RX queue %u on",
 			    rx_queue_id);
 
-		ice_rx_queue_release_mbufs(rxq);
+		rxq->rx_rel_mbufs(rxq);
 		ice_reset_rx_queue(rxq);
 		return -EINVAL;
 	}
@@ -456,7 +450,7 @@ ice_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 				    rx_queue_id);
 			return -EINVAL;
 		}
-		ice_rx_queue_release_mbufs(rxq);
+		rxq->rx_rel_mbufs(rxq);
 		ice_reset_rx_queue(rxq);
 		dev->data->rx_queue_state[rx_queue_id] =
 			RTE_ETH_QUEUE_STATE_STOPPED;
@@ -719,11 +713,6 @@ _ice_tx_queue_release_mbufs(struct ice_tx_queue *txq)
 		}
 	}
 }
-static void
-ice_tx_queue_release_mbufs(struct ice_tx_queue *txq)
-{
-	txq->tx_rel_mbufs(txq);
-}
 
 static void
 ice_reset_tx_queue(struct ice_tx_queue *txq)
@@ -799,7 +788,7 @@ ice_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 		return -EINVAL;
 	}
 
-	ice_tx_queue_release_mbufs(txq);
+	txq->tx_rel_mbufs(txq);
 	ice_reset_tx_queue(txq);
 	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
 
@@ -822,7 +811,7 @@ ice_fdir_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 			    rx_queue_id);
 		return -EINVAL;
 	}
-	ice_rx_queue_release_mbufs(rxq);
+	rxq->rx_rel_mbufs(rxq);
 
 	return 0;
 }
@@ -858,7 +847,7 @@ ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 		return -EINVAL;
 	}
 
-	ice_tx_queue_release_mbufs(txq);
+	txq->tx_rel_mbufs(txq);
 
 	return 0;
 }
@@ -1005,7 +994,7 @@ ice_rx_queue_release(void *rxq)
 		return;
 	}
 
-	ice_rx_queue_release_mbufs(q);
+	q->rx_rel_mbufs(q);
 	rte_free(q->sw_ring);
 	rte_free(q);
 }
@@ -1201,7 +1190,7 @@ ice_tx_queue_release(void *txq)
 		return;
 	}
 
-	ice_tx_queue_release_mbufs(q);
+	q->tx_rel_mbufs(q);
 	rte_free(q->sw_ring);
 	rte_free(q);
 }
@@ -1946,24 +1935,6 @@ ice_tx_descriptor_status(void *tx_queue, uint16_t offset)
 }
 
 void
-ice_clear_queues(struct rte_eth_dev *dev)
-{
-	uint16_t i;
-
-	PMD_INIT_FUNC_TRACE();
-
-	for (i = 0; i < dev->data->nb_tx_queues; i++) {
-		ice_tx_queue_release_mbufs(dev->data->tx_queues[i]);
-		ice_reset_tx_queue(dev->data->tx_queues[i]);
-	}
-
-	for (i = 0; i < dev->data->nb_rx_queues; i++) {
-		ice_rx_queue_release_mbufs(dev->data->rx_queues[i]);
-		ice_reset_rx_queue(dev->data->rx_queues[i]);
-	}
-}
-
-void
 ice_free_queues(struct rte_eth_dev *dev)
 {
 	uint16_t i;
diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h
index 0946ee69e..2fdcfb7d0 100644
--- a/drivers/net/ice/ice_rxtx.h
+++ b/drivers/net/ice/ice_rxtx.h
@@ -156,7 +156,6 @@ int ice_fdir_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void ice_rx_queue_release(void *rxq);
 void ice_tx_queue_release(void *txq);
-void ice_clear_queues(struct rte_eth_dev *dev);
 void ice_free_queues(struct rte_eth_dev *dev);
 int ice_fdir_setup_tx_resources(struct ice_pf *pf);
 int ice_fdir_setup_rx_resources(struct ice_pf *pf);
-- 
2.13.6


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/ice: remove redundant code
  2020-03-09 12:12 [dpdk-dev] [PATCH v2] net/ice: remove redundant code Qi Zhang
@ 2020-03-10  9:12 ` Ye Xiaolong
  0 siblings, 0 replies; 2+ messages in thread
From: Ye Xiaolong @ 2020-03-10  9:12 UTC (permalink / raw)
  To: Qi Zhang; +Cc: qiming.yang, dev

On 03/09, Qi Zhang wrote:
>Remove function ice_clear_queues, since all equivalent code
>has already be executed durring ice_rx|tx_queue_stop.

s/be/been
s/durring/during

>
>Also function ice_rx|tx_queue_release_mbufs simpley wrapped a

s/simpley/simply

>function pointer call which is not necessary, remove them.
>
>Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
>---
>v2:
>- function declare in ice_rxtx.h also need be removed.
>
> drivers/net/ice/ice_ethdev.c |  3 ---
> drivers/net/ice/ice_rxtx.c   | 43 +++++++------------------------------------
> drivers/net/ice/ice_rxtx.h   |  1 -
> 3 files changed, 7 insertions(+), 40 deletions(-)
>
>diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
>index 85ef83e92..e59761c22 100644
>--- a/drivers/net/ice/ice_ethdev.c
>+++ b/drivers/net/ice/ice_ethdev.c
>@@ -2370,9 +2370,6 @@ ice_dev_stop(struct rte_eth_dev *dev)
> 	/* disable all queue interrupts */
> 	ice_vsi_disable_queues_intr(main_vsi);
> 
>-	/* Clear all queues and release mbufs */
>-	ice_clear_queues(dev);
>-
> 	if (pf->init_link_up)
> 		ice_dev_set_link_up(dev);
> 	else
>diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
>index 60c411bfa..198db6cb9 100644
>--- a/drivers/net/ice/ice_rxtx.c
>+++ b/drivers/net/ice/ice_rxtx.c
>@@ -249,12 +249,6 @@ _ice_rx_queue_release_mbufs(struct ice_rx_queue *rxq)
> #endif /* RTE_LIBRTE_ICE_RX_ALLOW_BULK_ALLOC */
> }
> 
>-static void
>-ice_rx_queue_release_mbufs(struct ice_rx_queue *rxq)
>-{
>-	rxq->rx_rel_mbufs(rxq);
>-}
>-
> /* turn on or off rx queue
>  * @q_idx: queue index in pf scope
>  * @on: turn on or off the queue
>@@ -429,7 +423,7 @@ ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
> 		PMD_DRV_LOG(ERR, "Failed to switch RX queue %u on",
> 			    rx_queue_id);
> 
>-		ice_rx_queue_release_mbufs(rxq);
>+		rxq->rx_rel_mbufs(rxq);
> 		ice_reset_rx_queue(rxq);
> 		return -EINVAL;
> 	}
>@@ -456,7 +450,7 @@ ice_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
> 				    rx_queue_id);
> 			return -EINVAL;
> 		}
>-		ice_rx_queue_release_mbufs(rxq);
>+		rxq->rx_rel_mbufs(rxq);
> 		ice_reset_rx_queue(rxq);
> 		dev->data->rx_queue_state[rx_queue_id] =
> 			RTE_ETH_QUEUE_STATE_STOPPED;
>@@ -719,11 +713,6 @@ _ice_tx_queue_release_mbufs(struct ice_tx_queue *txq)
> 		}
> 	}
> }
>-static void
>-ice_tx_queue_release_mbufs(struct ice_tx_queue *txq)
>-{
>-	txq->tx_rel_mbufs(txq);
>-}
> 
> static void
> ice_reset_tx_queue(struct ice_tx_queue *txq)
>@@ -799,7 +788,7 @@ ice_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
> 		return -EINVAL;
> 	}
> 
>-	ice_tx_queue_release_mbufs(txq);
>+	txq->tx_rel_mbufs(txq);
> 	ice_reset_tx_queue(txq);
> 	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
> 
>@@ -822,7 +811,7 @@ ice_fdir_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
> 			    rx_queue_id);
> 		return -EINVAL;
> 	}
>-	ice_rx_queue_release_mbufs(rxq);
>+	rxq->rx_rel_mbufs(rxq);
> 
> 	return 0;
> }
>@@ -858,7 +847,7 @@ ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
> 		return -EINVAL;
> 	}
> 
>-	ice_tx_queue_release_mbufs(txq);
>+	txq->tx_rel_mbufs(txq);
> 
> 	return 0;
> }
>@@ -1005,7 +994,7 @@ ice_rx_queue_release(void *rxq)
> 		return;
> 	}
> 
>-	ice_rx_queue_release_mbufs(q);
>+	q->rx_rel_mbufs(q);
> 	rte_free(q->sw_ring);
> 	rte_free(q);
> }
>@@ -1201,7 +1190,7 @@ ice_tx_queue_release(void *txq)
> 		return;
> 	}
> 
>-	ice_tx_queue_release_mbufs(q);
>+	q->tx_rel_mbufs(q);
> 	rte_free(q->sw_ring);
> 	rte_free(q);
> }
>@@ -1946,24 +1935,6 @@ ice_tx_descriptor_status(void *tx_queue, uint16_t offset)
> }
> 
> void
>-ice_clear_queues(struct rte_eth_dev *dev)
>-{
>-	uint16_t i;
>-
>-	PMD_INIT_FUNC_TRACE();
>-
>-	for (i = 0; i < dev->data->nb_tx_queues; i++) {
>-		ice_tx_queue_release_mbufs(dev->data->tx_queues[i]);
>-		ice_reset_tx_queue(dev->data->tx_queues[i]);
>-	}
>-
>-	for (i = 0; i < dev->data->nb_rx_queues; i++) {
>-		ice_rx_queue_release_mbufs(dev->data->rx_queues[i]);
>-		ice_reset_rx_queue(dev->data->rx_queues[i]);
>-	}
>-}
>-
>-void
> ice_free_queues(struct rte_eth_dev *dev)
> {
> 	uint16_t i;
>diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h
>index 0946ee69e..2fdcfb7d0 100644
>--- a/drivers/net/ice/ice_rxtx.h
>+++ b/drivers/net/ice/ice_rxtx.h
>@@ -156,7 +156,6 @@ int ice_fdir_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
> int ice_fdir_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
> void ice_rx_queue_release(void *rxq);
> void ice_tx_queue_release(void *txq);
>-void ice_clear_queues(struct rte_eth_dev *dev);
> void ice_free_queues(struct rte_eth_dev *dev);
> int ice_fdir_setup_tx_resources(struct ice_pf *pf);
> int ice_fdir_setup_rx_resources(struct ice_pf *pf);
>-- 
>2.13.6
>

Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel, Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-10  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 12:12 [dpdk-dev] [PATCH v2] net/ice: remove redundant code Qi Zhang
2020-03-10  9:12 ` Ye Xiaolong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).