From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <wenzhuo.lu@intel.com>
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id D799511A4
 for <dev@dpdk.org>; Fri, 15 Mar 2019 07:17:32 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 14 Mar 2019 23:17:32 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.58,481,1544515200"; d="scan'208";a="131827208"
Received: from dpdk26.sh.intel.com ([10.67.110.164])
 by fmsmga008.fm.intel.com with ESMTP; 14 Mar 2019 23:17:31 -0700
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
To: dev@dpdk.org
Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>
Date: Fri, 15 Mar 2019 14:22:49 +0800
Message-Id: <1552630975-62900-3-git-send-email-wenzhuo.lu@intel.com>
X-Mailer: git-send-email 1.9.3
In-Reply-To: <1552630975-62900-1-git-send-email-wenzhuo.lu@intel.com>
References: <1551340136-83843-1-git-send-email-wenzhuo.lu@intel.com>
 <1552630975-62900-1-git-send-email-wenzhuo.lu@intel.com>
Subject: [dpdk-dev] [PATCH v3 2/8] net/ice: add pointer for queue buffer
	release
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 15 Mar 2019 06:17:33 -0000

Add function pointers of buffer releasing for RX and
TX queues, for vector functions will be added for RX
and TX.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ice/ice_rxtx.c | 24 +++++++++++++++---------
 drivers/net/ice/ice_rxtx.h |  5 +++++
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index c794ee8..d540ed1 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -366,7 +366,7 @@
 		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;
 	}
@@ -393,7 +393,7 @@
 				    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;
@@ -555,7 +555,7 @@
 		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;
 
@@ -669,6 +669,7 @@
 	ice_reset_rx_queue(rxq);
 	rxq->q_set = TRUE;
 	dev->data->rx_queues[queue_idx] = rxq;
+	rxq->rx_rel_mbufs = ice_rx_queue_release_mbufs;
 
 	use_def_burst_func = ice_check_rx_burst_bulk_alloc_preconditions(rxq);
 
@@ -701,7 +702,7 @@
 		return;
 	}
 
-	ice_rx_queue_release_mbufs(q);
+	q->rx_rel_mbufs(q);
 	rte_free(q->sw_ring);
 	rte_free(q);
 }
@@ -866,6 +867,7 @@
 	ice_reset_tx_queue(txq);
 	txq->q_set = TRUE;
 	dev->data->tx_queues[queue_idx] = txq;
+	txq->tx_rel_mbufs = ice_tx_queue_release_mbufs;
 
 	return 0;
 }
@@ -880,7 +882,7 @@
 		return;
 	}
 
-	ice_tx_queue_release_mbufs(q);
+	q->tx_rel_mbufs(q);
 	rte_free(q->sw_ring);
 	rte_free(q);
 }
@@ -1552,18 +1554,22 @@
 void
 ice_clear_queues(struct rte_eth_dev *dev)
 {
+	struct ice_rx_queue *rxq;
+	struct ice_tx_queue *txq;
 	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]);
+		txq = dev->data->tx_queues[i];
+		txq->tx_rel_mbufs(txq);
+		ice_reset_tx_queue(txq);
 	}
 
 	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]);
+		rxq = dev->data->rx_queues[i];
+		rxq->rx_rel_mbufs(rxq);
+		ice_reset_rx_queue(rxq);
 	}
 }
 
diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h
index ec0e52e..26380d3 100644
--- a/drivers/net/ice/ice_rxtx.h
+++ b/drivers/net/ice/ice_rxtx.h
@@ -27,6 +27,9 @@
 
 #define ICE_SUPPORT_CHAIN_NUM 5
 
+typedef void (*ice_rx_release_mbufs)(struct ice_rx_queue *rxq);
+typedef void (*ice_tx_release_mbufs)(struct ice_tx_queue *txq);
+
 struct ice_rx_entry {
 	struct rte_mbuf *mbuf;
 };
@@ -61,6 +64,7 @@ struct ice_rx_queue {
 	uint16_t max_pkt_len; /* Maximum packet length */
 	bool q_set; /* indicate if rx queue has been configured */
 	bool rx_deferred_start; /* don't start this queue in dev start */
+	ice_rx_release_mbufs rx_rel_mbufs;
 };
 
 struct ice_tx_entry {
@@ -100,6 +104,7 @@ struct ice_tx_queue {
 	uint16_t tx_next_rs;
 	bool tx_deferred_start; /* don't start this queue in dev start */
 	bool q_set; /* indicate if tx queue has been configured */
+	ice_tx_release_mbufs tx_rel_mbufs;
 };
 
 /* Offload features */
-- 
1.9.3

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id AEA4AA0096
	for <public@inbox.dpdk.org>; Fri, 15 Mar 2019 07:17:47 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 022AD4CA7;
	Fri, 15 Mar 2019 07:17:38 +0100 (CET)
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id D799511A4
 for <dev@dpdk.org>; Fri, 15 Mar 2019 07:17:32 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 14 Mar 2019 23:17:32 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.58,481,1544515200"; d="scan'208";a="131827208"
Received: from dpdk26.sh.intel.com ([10.67.110.164])
 by fmsmga008.fm.intel.com with ESMTP; 14 Mar 2019 23:17:31 -0700
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
To: dev@dpdk.org
Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>
Date: Fri, 15 Mar 2019 14:22:49 +0800
Message-Id: <1552630975-62900-3-git-send-email-wenzhuo.lu@intel.com>
X-Mailer: git-send-email 1.9.3
In-Reply-To: <1552630975-62900-1-git-send-email-wenzhuo.lu@intel.com>
References: <1551340136-83843-1-git-send-email-wenzhuo.lu@intel.com>
 <1552630975-62900-1-git-send-email-wenzhuo.lu@intel.com>
Subject: [dpdk-dev] [PATCH v3 2/8] net/ice: add pointer for queue buffer
	release
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <20190315062249.Am93kjUBC1yjRMCkY9-yTStBXU6FMTh1fxCEtfZ23zk@z>

Add function pointers of buffer releasing for RX and
TX queues, for vector functions will be added for RX
and TX.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ice/ice_rxtx.c | 24 +++++++++++++++---------
 drivers/net/ice/ice_rxtx.h |  5 +++++
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index c794ee8..d540ed1 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -366,7 +366,7 @@
 		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;
 	}
@@ -393,7 +393,7 @@
 				    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;
@@ -555,7 +555,7 @@
 		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;
 
@@ -669,6 +669,7 @@
 	ice_reset_rx_queue(rxq);
 	rxq->q_set = TRUE;
 	dev->data->rx_queues[queue_idx] = rxq;
+	rxq->rx_rel_mbufs = ice_rx_queue_release_mbufs;
 
 	use_def_burst_func = ice_check_rx_burst_bulk_alloc_preconditions(rxq);
 
@@ -701,7 +702,7 @@
 		return;
 	}
 
-	ice_rx_queue_release_mbufs(q);
+	q->rx_rel_mbufs(q);
 	rte_free(q->sw_ring);
 	rte_free(q);
 }
@@ -866,6 +867,7 @@
 	ice_reset_tx_queue(txq);
 	txq->q_set = TRUE;
 	dev->data->tx_queues[queue_idx] = txq;
+	txq->tx_rel_mbufs = ice_tx_queue_release_mbufs;
 
 	return 0;
 }
@@ -880,7 +882,7 @@
 		return;
 	}
 
-	ice_tx_queue_release_mbufs(q);
+	q->tx_rel_mbufs(q);
 	rte_free(q->sw_ring);
 	rte_free(q);
 }
@@ -1552,18 +1554,22 @@
 void
 ice_clear_queues(struct rte_eth_dev *dev)
 {
+	struct ice_rx_queue *rxq;
+	struct ice_tx_queue *txq;
 	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]);
+		txq = dev->data->tx_queues[i];
+		txq->tx_rel_mbufs(txq);
+		ice_reset_tx_queue(txq);
 	}
 
 	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]);
+		rxq = dev->data->rx_queues[i];
+		rxq->rx_rel_mbufs(rxq);
+		ice_reset_rx_queue(rxq);
 	}
 }
 
diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h
index ec0e52e..26380d3 100644
--- a/drivers/net/ice/ice_rxtx.h
+++ b/drivers/net/ice/ice_rxtx.h
@@ -27,6 +27,9 @@
 
 #define ICE_SUPPORT_CHAIN_NUM 5
 
+typedef void (*ice_rx_release_mbufs)(struct ice_rx_queue *rxq);
+typedef void (*ice_tx_release_mbufs)(struct ice_tx_queue *txq);
+
 struct ice_rx_entry {
 	struct rte_mbuf *mbuf;
 };
@@ -61,6 +64,7 @@ struct ice_rx_queue {
 	uint16_t max_pkt_len; /* Maximum packet length */
 	bool q_set; /* indicate if rx queue has been configured */
 	bool rx_deferred_start; /* don't start this queue in dev start */
+	ice_rx_release_mbufs rx_rel_mbufs;
 };
 
 struct ice_tx_entry {
@@ -100,6 +104,7 @@ struct ice_tx_queue {
 	uint16_t tx_next_rs;
 	bool tx_deferred_start; /* don't start this queue in dev start */
 	bool q_set; /* indicate if tx queue has been configured */
+	ice_tx_release_mbufs tx_rel_mbufs;
 };
 
 /* Offload features */
-- 
1.9.3