DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] add support for check descriptor status APIs
@ 2018-02-08  8:36 Wei Zhao
  2018-02-08  8:36 ` [dpdk-dev] [PATCH 1/2] net/e1000: " Wei Zhao
  2018-02-08  8:36 ` [dpdk-dev] [PATCH 2/2] net/fm10k: " Wei Zhao
  0 siblings, 2 replies; 26+ messages in thread
From: Wei Zhao @ 2018-02-08  8:36 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang

The patches set mainly finish following functions:
Igb VF and fm10k nic add support check descriptor status APIs.

wei zhao (2):
  net/e1000: add support for check descriptor status APIs
  net/fm10k: add support for check descriptor status APIs

 drivers/net/e1000/igb_ethdev.c   |  3 ++
 drivers/net/fm10k/fm10k.h        |  7 +++++
 drivers/net/fm10k/fm10k_ethdev.c |  2 ++
 drivers/net/fm10k/fm10k_rxtx.c   | 65 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 77 insertions(+)

-- 
2.9.3

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

* [dpdk-dev] [PATCH 1/2] net/e1000: add support for check descriptor status APIs
  2018-02-08  8:36 [dpdk-dev] [PATCH 0/2] add support for check descriptor status APIs Wei Zhao
@ 2018-02-08  8:36 ` Wei Zhao
  2018-06-20  8:52   ` [dpdk-dev] [PATCH v2] " Wei Zhao
  2018-02-08  8:36 ` [dpdk-dev] [PATCH 2/2] net/fm10k: " Wei Zhao
  1 sibling, 1 reply; 26+ messages in thread
From: Wei Zhao @ 2018-02-08  8:36 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

Igb VF nic need to support check descriptor status APIs, they are
rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
So, this patch add ops with function pointer that enable feature.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/e1000/igb_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 3c5138d..d299f3d 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -432,6 +432,9 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.rx_queue_setup       = eth_igb_rx_queue_setup,
 	.rx_queue_release     = eth_igb_rx_queue_release,
+	.rx_descriptor_done   = eth_igb_rx_descriptor_done,
+	.rx_descriptor_status = eth_igb_rx_descriptor_status,
+	.tx_descriptor_status = eth_igb_tx_descriptor_status,
 	.tx_queue_setup       = eth_igb_tx_queue_setup,
 	.tx_queue_release     = eth_igb_tx_queue_release,
 	.set_mc_addr_list     = eth_igb_set_mc_addr_list,
-- 
2.9.3

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

* [dpdk-dev] [PATCH 2/2] net/fm10k: add support for check descriptor status APIs
  2018-02-08  8:36 [dpdk-dev] [PATCH 0/2] add support for check descriptor status APIs Wei Zhao
  2018-02-08  8:36 ` [dpdk-dev] [PATCH 1/2] net/e1000: " Wei Zhao
@ 2018-02-08  8:36 ` Wei Zhao
  2018-06-20  8:44   ` [dpdk-dev] [PATCH v2] " Wei Zhao
  1 sibling, 1 reply; 26+ messages in thread
From: Wei Zhao @ 2018-02-08  8:36 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

Fm10k nic need to support check descriptor status APIs, they are
rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
So, this patch add ops with function pointer that enable feature.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/fm10k/fm10k.h        |  7 +++++
 drivers/net/fm10k/fm10k_ethdev.c |  2 ++
 drivers/net/fm10k/fm10k_rxtx.c   | 65 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+)

diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index 30dad3e..65dc0bd 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -328,6 +328,13 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
 int
 fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
+int
+fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
+
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_pkts);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 9423761..9293828 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2784,6 +2784,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.tx_queue_setup		= fm10k_tx_queue_setup,
 	.tx_queue_release	= fm10k_tx_queue_release,
 	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
+	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
+	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
 	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
 	.reta_update		= fm10k_reta_update,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 9320748..fa4f028 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -389,6 +389,71 @@ fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
 	return ret;
 }
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	volatile union fm10k_rx_desc *rxdp;
+	struct fm10k_rx_queue *rxq = rx_queue;
+	uint16_t nb_hold, trigger_last;
+	uint16_t desc;
+	int ret;
+
+	if (unlikely(offset >= rxq->nb_desc)) {
+		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
+		return 0;
+	}
+
+	if (rxq->next_trigger < rxq->alloc_thresh)
+		trigger_last = rxq->next_trigger +
+					rxq->nb_desc - rxq->alloc_thresh;
+	else
+		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
+
+	if (rxq->next_dd < trigger_last)
+		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
+	else
+		nb_hold = rxq->next_dd - trigger_last;
+
+	if (offset >= rxq->nb_desc - nb_hold)
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	desc = rxq->next_dd + offset;
+	if (desc >= rxq->nb_desc)
+		desc -= rxq->nb_desc;
+
+	rxdp = &rxq->hw_ring[desc];
+
+	ret = !!(rxdp->w.status &
+			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+	return ret;
+}
+
+int
+fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+	volatile struct fm10k_tx_desc *txdp;
+	struct fm10k_tx_queue *txq = tx_queue;
+	uint16_t desc;
+	int ret;
+
+	if (unlikely(offset >= txq->nb_desc)) {
+		PMD_DRV_LOG(ERR, "Invalid TX descriptor offset %u", offset);
+		return 0;
+	}
+
+	desc = txq->next_dd + offset;
+	if (desc >= txq->nb_desc)
+		desc -= txq->nb_desc;
+
+	txdp = &txq->hw_ring[desc];
+
+	ret = !!(txdp->flags &
+			rte_cpu_to_le_16(FM10K_TXD_FLAG_DONE));
+
+	return ret;
+}
+
 /*
  * Free multiple TX mbuf at a time if they are in the same pool
  *
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2] net/fm10k: add support for check descriptor status APIs
  2018-02-08  8:36 ` [dpdk-dev] [PATCH 2/2] net/fm10k: " Wei Zhao
@ 2018-06-20  8:44   ` Wei Zhao
  2018-06-22  7:53     ` [dpdk-dev] [PATCH v3] " Wei Zhao
  0 siblings, 1 reply; 26+ messages in thread
From: Wei Zhao @ 2018-06-20  8:44 UTC (permalink / raw)
  To: dev; +Cc: wenzhuo.lu, qi.z.zhang, Wei Zhao

Fm10k nic need to support check descriptor status APIs, they are
rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
So, this patch add ops with function pointer that enable feature.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
-fix DD check error in tx descriptor

---
 doc/guides/rel_notes/release_18_08.rst |  6 +++
 drivers/net/fm10k/fm10k.h              |  7 ++++
 drivers/net/fm10k/fm10k_ethdev.c       |  2 +
 drivers/net/fm10k/fm10k_rxtx.c         | 67 ++++++++++++++++++++++++++++++++++
 4 files changed, 82 insertions(+)

diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index 5bc23c5..5baa09e 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -41,6 +41,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added fm10k ethernet driver to support check descriptor status APIs.**
+
+    Fm10k nic need to support check descriptor status APIs, they are
+    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
+    add ops pointer with new function which enable feature.
+
 
 API Changes
 -----------
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index ef30780..1bc2c18 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
 int
 fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
+int
+fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
+
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_pkts);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 3ff1b0e..ea2f2bf 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2837,6 +2837,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.tx_queue_setup		= fm10k_tx_queue_setup,
 	.tx_queue_release	= fm10k_tx_queue_release,
 	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
+	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
+	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
 	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
 	.reta_update		= fm10k_reta_update,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 9320748..fb0ac55 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -389,6 +389,73 @@ fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
 	return ret;
 }
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	volatile union fm10k_rx_desc *rxdp;
+	struct fm10k_rx_queue *rxq = rx_queue;
+	uint16_t nb_hold, trigger_last;
+	uint16_t desc;
+	int ret;
+
+	if (unlikely(offset >= rxq->nb_desc)) {
+		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
+		return 0;
+	}
+
+	if (rxq->next_trigger < rxq->alloc_thresh)
+		trigger_last = rxq->next_trigger +
+					rxq->nb_desc - rxq->alloc_thresh;
+	else
+		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
+
+	if (rxq->next_dd < trigger_last)
+		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
+	else
+		nb_hold = rxq->next_dd - trigger_last;
+
+	if (offset >= rxq->nb_desc - nb_hold)
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	desc = rxq->next_dd + offset;
+	if (desc >= rxq->nb_desc)
+		desc -= rxq->nb_desc;
+
+	rxdp = &rxq->hw_ring[desc];
+
+	ret = !!(rxdp->w.status &
+			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+	return ret;
+}
+
+int
+fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+	volatile struct fm10k_tx_desc *txdp;
+	struct fm10k_tx_queue *txq = tx_queue;
+	uint16_t desc;
+
+	if (unlikely(offset >= txq->nb_desc))
+		return -EINVAL;
+
+	desc = txq->next_free + offset;
+	/* go to next desc that has the RS bit */
+	desc = (desc / txq->rs_thresh + 1) *
+		txq->rs_thresh - 1;
+	if (desc >= txq->nb_desc) {
+		desc -= txq->nb_desc;
+		if (desc >= txq->nb_desc)
+			desc -= txq->nb_desc;
+	}
+
+	txdp = &txq->hw_ring[desc];
+	if (txdp->flags & FM10K_TXD_FLAG_DONE)
+		return RTE_ETH_TX_DESC_DONE;
+
+	return RTE_ETH_TX_DESC_FULL;
+}
+
 /*
  * Free multiple TX mbuf at a time if they are in the same pool
  *
-- 
2.7.5

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

* [dpdk-dev] [PATCH v2] net/e1000: add support for check descriptor status APIs
  2018-02-08  8:36 ` [dpdk-dev] [PATCH 1/2] net/e1000: " Wei Zhao
@ 2018-06-20  8:52   ` Wei Zhao
  2018-06-27  8:37     ` [dpdk-dev] [PATCH v3] " Wei Zhao
  0 siblings, 1 reply; 26+ messages in thread
From: Wei Zhao @ 2018-06-20  8:52 UTC (permalink / raw)
  To: dev; +Cc: wenzhuo.lu, qi.z.zhang, Wei Zhao

Igb VF nic need to support check descriptor status APIs, they are
rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
So, this patch add ops with function pointer that enable feature.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
add release note document info.
---
 doc/guides/rel_notes/release_18_08.rst | 4 ++--
 drivers/net/e1000/igb_ethdev.c         | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index 5baa09e..f9bb135 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -41,9 +41,9 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
-* **Added fm10k ethernet driver to support check descriptor status APIs.**
+* **Added fm10k and igb VF ethernet driver to support check descriptor status APIs.**
 
-    Fm10k nic need to support check descriptor status APIs, they are
+    Fm10k and igb VF nic need to support check descriptor status APIs, they are
     rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
     add ops pointer with new function which enable feature.
 
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index edc7be3..f5b02b2 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -435,6 +435,9 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.rx_queue_setup       = eth_igb_rx_queue_setup,
 	.rx_queue_release     = eth_igb_rx_queue_release,
+	.rx_descriptor_done   = eth_igb_rx_descriptor_done,
+	.rx_descriptor_status = eth_igb_rx_descriptor_status,
+	.tx_descriptor_status = eth_igb_tx_descriptor_status,
 	.tx_queue_setup       = eth_igb_tx_queue_setup,
 	.tx_queue_release     = eth_igb_tx_queue_release,
 	.set_mc_addr_list     = eth_igb_set_mc_addr_list,
-- 
2.7.5

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

* [dpdk-dev] [PATCH v3] net/fm10k: add support for check descriptor status APIs
  2018-06-20  8:44   ` [dpdk-dev] [PATCH v2] " Wei Zhao
@ 2018-06-22  7:53     ` Wei Zhao
  2018-06-22  8:20       ` [dpdk-dev] [PATCH v4] " Wei Zhao
  0 siblings, 1 reply; 26+ messages in thread
From: Wei Zhao @ 2018-06-22  7:53 UTC (permalink / raw)
  To: dev; +Cc: wenzhuo.lu, qi.z.zhang, Wei Zhao

Fm10k nic need to support check descriptor status APIs, they are
rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
So, this patch add ops with function pointer that enable feature.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
-fix DD check error in tx descriptor

v3:
-fix DD check index error

---
 doc/guides/rel_notes/release_18_08.rst |  6 +++
 drivers/net/fm10k/fm10k.h              |  7 +++
 drivers/net/fm10k/fm10k_ethdev.c       |  2 +
 drivers/net/fm10k/fm10k_rxtx.c         | 78 ++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)

diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index 5bc23c5..5baa09e 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -41,6 +41,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added fm10k ethernet driver to support check descriptor status APIs.**
+
+    Fm10k nic need to support check descriptor status APIs, they are
+    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
+    add ops pointer with new function which enable feature.
+
 
 API Changes
 -----------
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index ef30780..1bc2c18 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
 int
 fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
+int
+fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
+
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_pkts);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 3ff1b0e..ea2f2bf 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2837,6 +2837,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.tx_queue_setup		= fm10k_tx_queue_setup,
 	.tx_queue_release	= fm10k_tx_queue_release,
 	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
+	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
+	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
 	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
 	.reta_update		= fm10k_reta_update,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 9320748..cb06e43 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
 	return ret;
 }
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	volatile union fm10k_rx_desc *rxdp;
+	struct fm10k_rx_queue *rxq = rx_queue;
+	uint16_t nb_hold, trigger_last;
+	uint16_t desc;
+	int ret;
+
+	if (unlikely(offset >= rxq->nb_desc)) {
+		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
+		return 0;
+	}
+
+	if (rxq->next_trigger < rxq->alloc_thresh)
+		trigger_last = rxq->next_trigger +
+					rxq->nb_desc - rxq->alloc_thresh;
+	else
+		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
+
+	if (rxq->next_dd < trigger_last)
+		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
+	else
+		nb_hold = rxq->next_dd - trigger_last;
+
+	if (offset >= rxq->nb_desc - nb_hold)
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	desc = rxq->next_dd + offset;
+	if (desc >= rxq->nb_desc)
+		desc -= rxq->nb_desc;
+
+	rxdp = &rxq->hw_ring[desc];
+
+	ret = !!(rxdp->w.status &
+			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+	return ret;
+}
+
+int
+fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+	volatile struct fm10k_tx_desc *txdp;
+	struct fm10k_tx_queue *txq = tx_queue;
+	uint16_t desc;
+	uint16_t count, next_rs = txq->nb_desc;
+	struct fifo rs_tracker = txq->rs_tracker;
+	struct fifo *r = &rs_tracker;
+
+	if (unlikely(offset >= txq->nb_desc))
+		return -EINVAL;
+
+	desc = txq->next_free + offset;
+	/* go to next desc that has the RS bit */
+	desc = (desc / txq->rs_thresh + 1) *
+		txq->rs_thresh - 1;
+
+	if (desc >= txq->nb_desc) {
+		desc -= txq->nb_desc;
+		if (desc >= txq->nb_desc)
+			desc -= txq->nb_desc;
+	}
+
+	r->head = r->list;
+	for (count = 0; count < txq->nb_desc; count++) {
+		if (*r->head >= desc && *r->head < next_rs)
+			next_rs = *r->tail;
+		++r->head;
+	}
+
+	txdp = &txq->hw_ring[next_rs];
+	if (txdp->flags & FM10K_TXD_FLAG_DONE)
+		return RTE_ETH_TX_DESC_DONE;
+
+	return RTE_ETH_TX_DESC_FULL;
+}
+
 /*
  * Free multiple TX mbuf at a time if they are in the same pool
  *
-- 
2.7.5

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

* [dpdk-dev] [PATCH v4] net/fm10k: add support for check descriptor status APIs
  2018-06-22  7:53     ` [dpdk-dev] [PATCH v3] " Wei Zhao
@ 2018-06-22  8:20       ` Wei Zhao
  2018-06-27  8:10         ` Zhang, Qi Z
                           ` (4 more replies)
  0 siblings, 5 replies; 26+ messages in thread
From: Wei Zhao @ 2018-06-22  8:20 UTC (permalink / raw)
  To: dev; +Cc: wenzhuo.lu, qi.z.zhang, Wei Zhao

Fm10k nic need to support check descriptor status APIs, they are
rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
So, this patch add ops with function pointer that enable feature.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
-fix DD check error in tx descriptor

v3:
-fix DD check index error

v4:
-fix error in RS bit list poll

---
---
 doc/guides/rel_notes/release_18_08.rst |  6 +++
 drivers/net/fm10k/fm10k.h              |  7 +++
 drivers/net/fm10k/fm10k_ethdev.c       |  2 +
 drivers/net/fm10k/fm10k_rxtx.c         | 78 ++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)

diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index 5bc23c5..5baa09e 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -41,6 +41,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added fm10k ethernet driver to support check descriptor status APIs.**
+
+    Fm10k nic need to support check descriptor status APIs, they are
+    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
+    add ops pointer with new function which enable feature.
+
 
 API Changes
 -----------
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index ef30780..1bc2c18 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
 int
 fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
+int
+fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
+
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_pkts);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 3ff1b0e..ea2f2bf 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2837,6 +2837,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.tx_queue_setup		= fm10k_tx_queue_setup,
 	.tx_queue_release	= fm10k_tx_queue_release,
 	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
+	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
+	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
 	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
 	.reta_update		= fm10k_reta_update,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 9320748..daa2b32 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
 	return ret;
 }
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	volatile union fm10k_rx_desc *rxdp;
+	struct fm10k_rx_queue *rxq = rx_queue;
+	uint16_t nb_hold, trigger_last;
+	uint16_t desc;
+	int ret;
+
+	if (unlikely(offset >= rxq->nb_desc)) {
+		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
+		return 0;
+	}
+
+	if (rxq->next_trigger < rxq->alloc_thresh)
+		trigger_last = rxq->next_trigger +
+					rxq->nb_desc - rxq->alloc_thresh;
+	else
+		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
+
+	if (rxq->next_dd < trigger_last)
+		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
+	else
+		nb_hold = rxq->next_dd - trigger_last;
+
+	if (offset >= rxq->nb_desc - nb_hold)
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	desc = rxq->next_dd + offset;
+	if (desc >= rxq->nb_desc)
+		desc -= rxq->nb_desc;
+
+	rxdp = &rxq->hw_ring[desc];
+
+	ret = !!(rxdp->w.status &
+			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+	return ret;
+}
+
+int
+fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+	volatile struct fm10k_tx_desc *txdp;
+	struct fm10k_tx_queue *txq = tx_queue;
+	uint16_t desc;
+	uint16_t count, next_rs = txq->nb_desc;
+	struct fifo rs_tracker = txq->rs_tracker;
+	struct fifo *r = &rs_tracker;
+
+	if (unlikely(offset >= txq->nb_desc))
+		return -EINVAL;
+
+	desc = txq->next_free + offset;
+	/* go to next desc that has the RS bit */
+	desc = (desc / txq->rs_thresh + 1) *
+		txq->rs_thresh - 1;
+
+	if (desc >= txq->nb_desc) {
+		desc -= txq->nb_desc;
+		if (desc >= txq->nb_desc)
+			desc -= txq->nb_desc;
+	}
+
+	r->head = r->list;
+	for (count = 0; r->head != r->endp; count++) {
+		if (*r->head >= desc && *r->head < next_rs)
+			next_rs = *r->head;
+		++r->head;
+	}
+
+	txdp = &txq->hw_ring[next_rs];
+	if (txdp->flags & FM10K_TXD_FLAG_DONE)
+		return RTE_ETH_TX_DESC_DONE;
+
+	return RTE_ETH_TX_DESC_FULL;
+}
+
 /*
  * Free multiple TX mbuf at a time if they are in the same pool
  *
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH v4] net/fm10k: add support for check descriptor status APIs
  2018-06-22  8:20       ` [dpdk-dev] [PATCH v4] " Wei Zhao
@ 2018-06-27  8:10         ` Zhang, Qi Z
  2018-06-27  8:18           ` Zhao1, Wei
  2018-06-27  8:18         ` Zhang, Qi Z
                           ` (3 subsequent siblings)
  4 siblings, 1 reply; 26+ messages in thread
From: Zhang, Qi Z @ 2018-06-27  8:10 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: Lu, Wenzhuo

Hi Wei:

> -----Original Message-----
> From: Zhao1, Wei
> Sent: Friday, June 22, 2018 4:20 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v4] net/fm10k: add support for check descriptor status APIs
> 
> Fm10k nic need to support check descriptor status APIs, they are
> rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> So, this patch add ops with function pointer that enable feature.
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> 
> ---
> 
> v2:
> -fix DD check error in tx descriptor
> 
> v3:
> -fix DD check index error
> 
> v4:
> -fix error in RS bit list poll
> 
> ---
> ---
>  doc/guides/rel_notes/release_18_08.rst |  6 +++
>  drivers/net/fm10k/fm10k.h              |  7 +++
>  drivers/net/fm10k/fm10k_ethdev.c       |  2 +
>  drivers/net/fm10k/fm10k_rxtx.c         | 78
> ++++++++++++++++++++++++++++++++++
>  4 files changed, 93 insertions(+)
> 
> diff --git a/doc/guides/rel_notes/release_18_08.rst
> b/doc/guides/rel_notes/release_18_08.rst
> index 5bc23c5..5baa09e 100644
> --- a/doc/guides/rel_notes/release_18_08.rst
> +++ b/doc/guides/rel_notes/release_18_08.rst
> @@ -41,6 +41,12 @@ New Features
>       Also, make sure to start the actual text at the margin.
>       =========================================================
> 
> +* **Added fm10k ethernet driver to support check descriptor status
> +APIs.**
> +
> +    Fm10k nic need to support check descriptor status APIs, they are
> +    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> +    add ops pointer with new function which enable feature.
> +
> 
>  API Changes
>  -----------
> diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index
> ef30780..1bc2c18 100644
> --- a/drivers/net/fm10k/fm10k.h
> +++ b/drivers/net/fm10k/fm10k.h
> @@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
> int  fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
> 
> +int
> +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
> +
> +int
> +fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
> +
> +
>  uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
>  	uint16_t nb_pkts);
> 
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> b/drivers/net/fm10k/fm10k_ethdev.c
> index 3ff1b0e..ea2f2bf 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -2837,6 +2837,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops
> = {
>  	.tx_queue_setup		= fm10k_tx_queue_setup,
>  	.tx_queue_release	= fm10k_tx_queue_release,
>  	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
> +	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
> +	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
>  	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
>  	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
>  	.reta_update		= fm10k_reta_update,
> diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
> index 9320748..daa2b32 100644
> --- a/drivers/net/fm10k/fm10k_rxtx.c
> +++ b/drivers/net/fm10k/fm10k_rxtx.c
> @@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue,
> uint16_t offset)
>  	return ret;
>  }
> 
> +int
> +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) {
> +	volatile union fm10k_rx_desc *rxdp;
> +	struct fm10k_rx_queue *rxq = rx_queue;
> +	uint16_t nb_hold, trigger_last;
> +	uint16_t desc;
> +	int ret;
> +
> +	if (unlikely(offset >= rxq->nb_desc)) {
> +		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
> +		return 0;
> +	}
> +
> +	if (rxq->next_trigger < rxq->alloc_thresh)
> +		trigger_last = rxq->next_trigger +
> +					rxq->nb_desc - rxq->alloc_thresh;
> +	else
> +		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
> +
> +	if (rxq->next_dd < trigger_last)
> +		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
> +	else
> +		nb_hold = rxq->next_dd - trigger_last;
> +
> +	if (offset >= rxq->nb_desc - nb_hold)
> +		return RTE_ETH_RX_DESC_UNAVAIL;
> +
> +	desc = rxq->next_dd + offset;
> +	if (desc >= rxq->nb_desc)
> +		desc -= rxq->nb_desc;
> +
> +	rxdp = &rxq->hw_ring[desc];
> +
> +	ret = !!(rxdp->w.status &
> +			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
> +
> +	return ret;
> +}
> +
> +int
> +fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) {
> +	volatile struct fm10k_tx_desc *txdp;
> +	struct fm10k_tx_queue *txq = tx_queue;
> +	uint16_t desc;
> +	uint16_t count, next_rs = txq->nb_desc;
> +	struct fifo rs_tracker = txq->rs_tracker;
> +	struct fifo *r = &rs_tracker;
> +
> +	if (unlikely(offset >= txq->nb_desc))
> +		return -EINVAL;
> +
> +	desc = txq->next_free + offset;
> +	/* go to next desc that has the RS bit */
> +	desc = (desc / txq->rs_thresh + 1) *
> +		txq->rs_thresh - 1;
> +
> +	if (desc >= txq->nb_desc) {
> +		desc -= txq->nb_desc;
> +		if (desc >= txq->nb_desc)
> +			desc -= txq->nb_desc;
> +	}
> +
> +	r->head = r->list;
> +	for (count = 0; r->head != r->endp; count++) {

I didn't see the necessary to have "count" here.

Others I didn't see issue, btw, could you rebase on dpdk-next-net-intel?

Thanks
Qi


> +		if (*r->head >= desc && *r->head < next_rs)
> +			next_rs = *r->head;
> +		++r->head;
> +	}
> +
> +	txdp = &txq->hw_ring[next_rs];
> +	if (txdp->flags & FM10K_TXD_FLAG_DONE)
> +		return RTE_ETH_TX_DESC_DONE;
> +
> +	return RTE_ETH_TX_DESC_FULL;
> +}
> +
>  /*
>   * Free multiple TX mbuf at a time if they are in the same pool
>   *
> --
> 2.7.5

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

* Re: [dpdk-dev] [PATCH v4] net/fm10k: add support for check descriptor status APIs
  2018-06-27  8:10         ` Zhang, Qi Z
@ 2018-06-27  8:18           ` Zhao1, Wei
  0 siblings, 0 replies; 26+ messages in thread
From: Zhao1, Wei @ 2018-06-27  8:18 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: Lu, Wenzhuo

Hi, qi

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, June 27, 2018 4:11 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [PATCH v4] net/fm10k: add support for check descriptor status
> APIs
> 
> Hi Wei:
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Friday, June 22, 2018 4:20 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> > Subject: [PATCH v4] net/fm10k: add support for check descriptor status
> > APIs
> >
> > Fm10k nic need to support check descriptor status APIs, they are
> > rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> > So, this patch add ops with function pointer that enable feature.
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> >
> > ---
> >
> > v2:
> > -fix DD check error in tx descriptor
> >
> > v3:
> > -fix DD check index error
> >
> > v4:
> > -fix error in RS bit list poll
> >
> > ---
> > ---
> >  doc/guides/rel_notes/release_18_08.rst |  6 +++
> >  drivers/net/fm10k/fm10k.h              |  7 +++
> >  drivers/net/fm10k/fm10k_ethdev.c       |  2 +
> >  drivers/net/fm10k/fm10k_rxtx.c         | 78
> > ++++++++++++++++++++++++++++++++++
> >  4 files changed, 93 insertions(+)
> >
> > diff --git a/doc/guides/rel_notes/release_18_08.rst
> > b/doc/guides/rel_notes/release_18_08.rst
> > index 5bc23c5..5baa09e 100644
> > --- a/doc/guides/rel_notes/release_18_08.rst
> > +++ b/doc/guides/rel_notes/release_18_08.rst
> > @@ -41,6 +41,12 @@ New Features
> >       Also, make sure to start the actual text at the margin.
> >
> =========================================================
> >
> > +* **Added fm10k ethernet driver to support check descriptor status
> > +APIs.**
> > +
> > +    Fm10k nic need to support check descriptor status APIs, they are
> > +    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> > +    add ops pointer with new function which enable feature.
> > +
> >
> >  API Changes
> >  -----------
> > diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
> > index
> > ef30780..1bc2c18 100644
> > --- a/drivers/net/fm10k/fm10k.h
> > +++ b/drivers/net/fm10k/fm10k.h
> > @@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void
> > *rx_queue, int  fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t
> > offset);
> >
> > +int
> > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
> > +
> > +int
> > +fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
> > +
> > +
> >  uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> >  	uint16_t nb_pkts);
> >
> > diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> > b/drivers/net/fm10k/fm10k_ethdev.c
> > index 3ff1b0e..ea2f2bf 100644
> > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > @@ -2837,6 +2837,8 @@ static const struct eth_dev_ops
> > fm10k_eth_dev_ops = {
> >  	.tx_queue_setup		= fm10k_tx_queue_setup,
> >  	.tx_queue_release	= fm10k_tx_queue_release,
> >  	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
> > +	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
> > +	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
> >  	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
> >  	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
> >  	.reta_update		= fm10k_reta_update,
> > diff --git a/drivers/net/fm10k/fm10k_rxtx.c
> > b/drivers/net/fm10k/fm10k_rxtx.c index 9320748..daa2b32 100644
> > --- a/drivers/net/fm10k/fm10k_rxtx.c
> > +++ b/drivers/net/fm10k/fm10k_rxtx.c
> > @@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue,
> > uint16_t offset)
> >  	return ret;
> >  }
> >
> > +int
> > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) {
> > +	volatile union fm10k_rx_desc *rxdp;
> > +	struct fm10k_rx_queue *rxq = rx_queue;
> > +	uint16_t nb_hold, trigger_last;
> > +	uint16_t desc;
> > +	int ret;
> > +
> > +	if (unlikely(offset >= rxq->nb_desc)) {
> > +		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u",
> offset);
> > +		return 0;
> > +	}
> > +
> > +	if (rxq->next_trigger < rxq->alloc_thresh)
> > +		trigger_last = rxq->next_trigger +
> > +					rxq->nb_desc - rxq->alloc_thresh;
> > +	else
> > +		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
> > +
> > +	if (rxq->next_dd < trigger_last)
> > +		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
> > +	else
> > +		nb_hold = rxq->next_dd - trigger_last;
> > +
> > +	if (offset >= rxq->nb_desc - nb_hold)
> > +		return RTE_ETH_RX_DESC_UNAVAIL;
> > +
> > +	desc = rxq->next_dd + offset;
> > +	if (desc >= rxq->nb_desc)
> > +		desc -= rxq->nb_desc;
> > +
> > +	rxdp = &rxq->hw_ring[desc];
> > +
> > +	ret = !!(rxdp->w.status &
> > +			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
> > +
> > +	return ret;
> > +}
> > +
> > +int
> > +fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) {
> > +	volatile struct fm10k_tx_desc *txdp;
> > +	struct fm10k_tx_queue *txq = tx_queue;
> > +	uint16_t desc;
> > +	uint16_t count, next_rs = txq->nb_desc;
> > +	struct fifo rs_tracker = txq->rs_tracker;
> > +	struct fifo *r = &rs_tracker;
> > +
> > +	if (unlikely(offset >= txq->nb_desc))
> > +		return -EINVAL;
> > +
> > +	desc = txq->next_free + offset;
> > +	/* go to next desc that has the RS bit */
> > +	desc = (desc / txq->rs_thresh + 1) *
> > +		txq->rs_thresh - 1;
> > +
> > +	if (desc >= txq->nb_desc) {
> > +		desc -= txq->nb_desc;
> > +		if (desc >= txq->nb_desc)
> > +			desc -= txq->nb_desc;
> > +	}
> > +
> > +	r->head = r->list;
> > +	for (count = 0; r->head != r->endp; count++) {
> 
> I didn't see the necessary to have "count" here.
> 
> Others I didn't see issue, btw, could you rebase on dpdk-next-net-intel?

Ok, I will commit v5 later.
> 
> Thanks
> Qi
> 
> 
> > +		if (*r->head >= desc && *r->head < next_rs)
> > +			next_rs = *r->head;
> > +		++r->head;
> > +	}
> > +
> > +	txdp = &txq->hw_ring[next_rs];
> > +	if (txdp->flags & FM10K_TXD_FLAG_DONE)
> > +		return RTE_ETH_TX_DESC_DONE;
> > +
> > +	return RTE_ETH_TX_DESC_FULL;
> > +}
> > +
> >  /*
> >   * Free multiple TX mbuf at a time if they are in the same pool
> >   *
> > --
> > 2.7.5


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

* Re: [dpdk-dev] [PATCH v4] net/fm10k: add support for check descriptor status APIs
  2018-06-22  8:20       ` [dpdk-dev] [PATCH v4] " Wei Zhao
  2018-06-27  8:10         ` Zhang, Qi Z
@ 2018-06-27  8:18         ` Zhang, Qi Z
  2018-06-27  9:09           ` Zhao1, Wei
  2018-06-27  8:24         ` [dpdk-dev] [PATCH v5] " Wei Zhao
                           ` (2 subsequent siblings)
  4 siblings, 1 reply; 26+ messages in thread
From: Zhang, Qi Z @ 2018-06-27  8:18 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: Lu, Wenzhuo



> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, June 27, 2018 4:11 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [PATCH v4] net/fm10k: add support for check descriptor status
> APIs
> 
> Hi Wei:
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Friday, June 22, 2018 4:20 PM
> > To: dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> > Subject: [PATCH v4] net/fm10k: add support for check descriptor status
> > APIs
> >
> > Fm10k nic need to support check descriptor status APIs, they are
> > rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> > So, this patch add ops with function pointer that enable feature.
> >

How about just simplified to 
"rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status is 
supported by fm10K?"

> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> >
> > ---
> >
> > v2:
> > -fix DD check error in tx descriptor
> >
> > v3:
> > -fix DD check index error
> >
> > v4:
> > -fix error in RS bit list poll
> >
> > ---
> > ---
> >  doc/guides/rel_notes/release_18_08.rst |  6 +++
> >  drivers/net/fm10k/fm10k.h              |  7 +++
> >  drivers/net/fm10k/fm10k_ethdev.c       |  2 +
> >  drivers/net/fm10k/fm10k_rxtx.c         | 78
> > ++++++++++++++++++++++++++++++++++
> >  4 files changed, 93 insertions(+)
> >
> > diff --git a/doc/guides/rel_notes/release_18_08.rst
> > b/doc/guides/rel_notes/release_18_08.rst
> > index 5bc23c5..5baa09e 100644
> > --- a/doc/guides/rel_notes/release_18_08.rst
> > +++ b/doc/guides/rel_notes/release_18_08.rst
> > @@ -41,6 +41,12 @@ New Features
> >       Also, make sure to start the actual text at the margin.
> >       =========================================================
> >
> > +* **Added fm10k ethernet driver to support check descriptor status
> > +APIs.**
> > +
> > +    Fm10k nic need to support check descriptor status APIs, they are
> > +    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> > +    add ops pointer with new function which enable feature.
> > +
> >
> >  API Changes
> >  -----------
> > diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
> > index
> > ef30780..1bc2c18 100644
> > --- a/drivers/net/fm10k/fm10k.h
> > +++ b/drivers/net/fm10k/fm10k.h
> > @@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void
> > *rx_queue, int  fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t
> > offset);
> >
> > +int
> > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
> > +
> > +int
> > +fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
> > +
> > +
> >  uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> >  	uint16_t nb_pkts);
> >
> > diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> > b/drivers/net/fm10k/fm10k_ethdev.c
> > index 3ff1b0e..ea2f2bf 100644
> > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > @@ -2837,6 +2837,8 @@ static const struct eth_dev_ops
> > fm10k_eth_dev_ops = {
> >  	.tx_queue_setup		= fm10k_tx_queue_setup,
> >  	.tx_queue_release	= fm10k_tx_queue_release,
> >  	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
> > +	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
> > +	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
> >  	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
> >  	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
> >  	.reta_update		= fm10k_reta_update,
> > diff --git a/drivers/net/fm10k/fm10k_rxtx.c
> > b/drivers/net/fm10k/fm10k_rxtx.c index 9320748..daa2b32 100644
> > --- a/drivers/net/fm10k/fm10k_rxtx.c
> > +++ b/drivers/net/fm10k/fm10k_rxtx.c
> > @@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue,
> > uint16_t offset)
> >  	return ret;
> >  }
> >
> > +int
> > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) {
> > +	volatile union fm10k_rx_desc *rxdp;
> > +	struct fm10k_rx_queue *rxq = rx_queue;
> > +	uint16_t nb_hold, trigger_last;
> > +	uint16_t desc;
> > +	int ret;
> > +
> > +	if (unlikely(offset >= rxq->nb_desc)) {
> > +		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
> > +		return 0;
> > +	}
> > +
> > +	if (rxq->next_trigger < rxq->alloc_thresh)
> > +		trigger_last = rxq->next_trigger +
> > +					rxq->nb_desc - rxq->alloc_thresh;
> > +	else
> > +		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
> > +
> > +	if (rxq->next_dd < trigger_last)
> > +		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
> > +	else
> > +		nb_hold = rxq->next_dd - trigger_last;
> > +
> > +	if (offset >= rxq->nb_desc - nb_hold)
> > +		return RTE_ETH_RX_DESC_UNAVAIL;
> > +
> > +	desc = rxq->next_dd + offset;
> > +	if (desc >= rxq->nb_desc)
> > +		desc -= rxq->nb_desc;
> > +
> > +	rxdp = &rxq->hw_ring[desc];
> > +
> > +	ret = !!(rxdp->w.status &
> > +			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
> > +
> > +	return ret;
> > +}
> > +
> > +int
> > +fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) {
> > +	volatile struct fm10k_tx_desc *txdp;
> > +	struct fm10k_tx_queue *txq = tx_queue;
> > +	uint16_t desc;
> > +	uint16_t count, next_rs = txq->nb_desc;
> > +	struct fifo rs_tracker = txq->rs_tracker;
> > +	struct fifo *r = &rs_tracker;
> > +
> > +	if (unlikely(offset >= txq->nb_desc))
> > +		return -EINVAL;
> > +
> > +	desc = txq->next_free + offset;
> > +	/* go to next desc that has the RS bit */
> > +	desc = (desc / txq->rs_thresh + 1) *
> > +		txq->rs_thresh - 1;
> > +
> > +	if (desc >= txq->nb_desc) {
> > +		desc -= txq->nb_desc;
> > +		if (desc >= txq->nb_desc)
> > +			desc -= txq->nb_desc;
> > +	}
> > +
> > +	r->head = r->list;
> > +	for (count = 0; r->head != r->endp; count++) {
> 
> I didn't see the necessary to have "count" here.
> 
> Others I didn't see issue, btw, could you rebase on dpdk-next-net-intel?
> 
> Thanks
> Qi
> 
> 
> > +		if (*r->head >= desc && *r->head < next_rs)
> > +			next_rs = *r->head;
> > +		++r->head;
> > +	}
> > +
> > +	txdp = &txq->hw_ring[next_rs];
> > +	if (txdp->flags & FM10K_TXD_FLAG_DONE)
> > +		return RTE_ETH_TX_DESC_DONE;
> > +
> > +	return RTE_ETH_TX_DESC_FULL;
> > +}
> > +
> >  /*
> >   * Free multiple TX mbuf at a time if they are in the same pool
> >   *
> > --
> > 2.7.5

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

* [dpdk-dev] [PATCH v5] net/fm10k: add support for check descriptor status APIs
  2018-06-22  8:20       ` [dpdk-dev] [PATCH v4] " Wei Zhao
  2018-06-27  8:10         ` Zhang, Qi Z
  2018-06-27  8:18         ` Zhang, Qi Z
@ 2018-06-27  8:24         ` Wei Zhao
  2018-06-27  8:26         ` Wei Zhao
  2018-06-27 12:49         ` [dpdk-dev] [PATCH v4] " Zhang, Qi Z
  4 siblings, 0 replies; 26+ messages in thread
From: Wei Zhao @ 2018-06-27  8:24 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Zhao Wei

From: Zhao Wei <wei.zhao1@intel.com>

rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
are supported by fm10K.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---

v2:
-fix DD check error in tx descriptor

v3:
-fix DD check index error

v4:
-fix error in RS bit list poll

v5:
-rebase code to branch and delete useless variable
---
 doc/guides/rel_notes/release_18_08.rst |  6 +++
 drivers/net/fm10k/fm10k.h              |  7 +++
 drivers/net/fm10k/fm10k_ethdev.c       |  2 +
 drivers/net/fm10k/fm10k_rxtx.c         | 78 ++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)

diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index bc01242..951d1aa 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -46,6 +46,12 @@ New Features
   Flow API support has been added to CXGBE Poll Mode Driver to offload
   flows to Chelsio T5/T6 NICs.
 
+* **Added fm10k ethernet driver to support check descriptor status APIs.**
+
+    Fm10k nic need to support check descriptor status APIs, they are
+    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
+    add ops pointer with new function which enable feature.
+
 
 API Changes
 -----------
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index ef30780..1bc2c18 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
 int
 fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
+int
+fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
+
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_pkts);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 3ff1b0e..ea2f2bf 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2837,6 +2837,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.tx_queue_setup		= fm10k_tx_queue_setup,
 	.tx_queue_release	= fm10k_tx_queue_release,
 	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
+	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
+	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
 	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
 	.reta_update		= fm10k_reta_update,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 9320748..4a5b46e 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
 	return ret;
 }
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	volatile union fm10k_rx_desc *rxdp;
+	struct fm10k_rx_queue *rxq = rx_queue;
+	uint16_t nb_hold, trigger_last;
+	uint16_t desc;
+	int ret;
+
+	if (unlikely(offset >= rxq->nb_desc)) {
+		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
+		return 0;
+	}
+
+	if (rxq->next_trigger < rxq->alloc_thresh)
+		trigger_last = rxq->next_trigger +
+					rxq->nb_desc - rxq->alloc_thresh;
+	else
+		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
+
+	if (rxq->next_dd < trigger_last)
+		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
+	else
+		nb_hold = rxq->next_dd - trigger_last;
+
+	if (offset >= rxq->nb_desc - nb_hold)
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	desc = rxq->next_dd + offset;
+	if (desc >= rxq->nb_desc)
+		desc -= rxq->nb_desc;
+
+	rxdp = &rxq->hw_ring[desc];
+
+	ret = !!(rxdp->w.status &
+			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+	return ret;
+}
+
+int
+fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+	volatile struct fm10k_tx_desc *txdp;
+	struct fm10k_tx_queue *txq = tx_queue;
+	uint16_t desc;
+	uint16_t next_rs = txq->nb_desc;
+	struct fifo rs_tracker = txq->rs_tracker;
+	struct fifo *r = &rs_tracker;
+
+	if (unlikely(offset >= txq->nb_desc))
+		return -EINVAL;
+
+	desc = txq->next_free + offset;
+	/* go to next desc that has the RS bit */
+	desc = (desc / txq->rs_thresh + 1) *
+		txq->rs_thresh - 1;
+
+	if (desc >= txq->nb_desc) {
+		desc -= txq->nb_desc;
+		if (desc >= txq->nb_desc)
+			desc -= txq->nb_desc;
+	}
+
+	r->head = r->list;
+	for ( ; r->head != r->endp; ) {
+		if (*r->head >= desc && *r->head < next_rs)
+			next_rs = *r->head;
+		++r->head;
+	}
+
+	txdp = &txq->hw_ring[next_rs];
+	if (txdp->flags & FM10K_TXD_FLAG_DONE)
+		return RTE_ETH_TX_DESC_DONE;
+
+	return RTE_ETH_TX_DESC_FULL;
+}
+
 /*
  * Free multiple TX mbuf at a time if they are in the same pool
  *
-- 
2.7.5

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

* [dpdk-dev] [PATCH v5] net/fm10k: add support for check descriptor status APIs
  2018-06-22  8:20       ` [dpdk-dev] [PATCH v4] " Wei Zhao
                           ` (2 preceding siblings ...)
  2018-06-27  8:24         ` [dpdk-dev] [PATCH v5] " Wei Zhao
@ 2018-06-27  8:26         ` Wei Zhao
  2018-06-29  1:48           ` [dpdk-dev] [PATCH v6] " Wei Zhao
  2018-06-27 12:49         ` [dpdk-dev] [PATCH v4] " Zhang, Qi Z
  4 siblings, 1 reply; 26+ messages in thread
From: Wei Zhao @ 2018-06-27  8:26 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
are supported by fm10K.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---

v2:
-fix DD check error in tx descriptor

v3:
-fix DD check index error

v4:
-fix error in RS bit list poll

v5:
-rebase code to branch and delete useless variable
---
 doc/guides/rel_notes/release_18_08.rst |  6 +++
 drivers/net/fm10k/fm10k.h              |  7 +++
 drivers/net/fm10k/fm10k_ethdev.c       |  2 +
 drivers/net/fm10k/fm10k_rxtx.c         | 78 ++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)

diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index bc01242..951d1aa 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -46,6 +46,12 @@ New Features
   Flow API support has been added to CXGBE Poll Mode Driver to offload
   flows to Chelsio T5/T6 NICs.
 
+* **Added fm10k ethernet driver to support check descriptor status APIs.**
+
+    Fm10k nic need to support check descriptor status APIs, they are
+    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
+    add ops pointer with new function which enable feature.
+
 
 API Changes
 -----------
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index ef30780..1bc2c18 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
 int
 fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
+int
+fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
+
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_pkts);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 3ff1b0e..ea2f2bf 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2837,6 +2837,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.tx_queue_setup		= fm10k_tx_queue_setup,
 	.tx_queue_release	= fm10k_tx_queue_release,
 	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
+	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
+	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
 	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
 	.reta_update		= fm10k_reta_update,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 9320748..4a5b46e 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
 	return ret;
 }
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	volatile union fm10k_rx_desc *rxdp;
+	struct fm10k_rx_queue *rxq = rx_queue;
+	uint16_t nb_hold, trigger_last;
+	uint16_t desc;
+	int ret;
+
+	if (unlikely(offset >= rxq->nb_desc)) {
+		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
+		return 0;
+	}
+
+	if (rxq->next_trigger < rxq->alloc_thresh)
+		trigger_last = rxq->next_trigger +
+					rxq->nb_desc - rxq->alloc_thresh;
+	else
+		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
+
+	if (rxq->next_dd < trigger_last)
+		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
+	else
+		nb_hold = rxq->next_dd - trigger_last;
+
+	if (offset >= rxq->nb_desc - nb_hold)
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	desc = rxq->next_dd + offset;
+	if (desc >= rxq->nb_desc)
+		desc -= rxq->nb_desc;
+
+	rxdp = &rxq->hw_ring[desc];
+
+	ret = !!(rxdp->w.status &
+			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+	return ret;
+}
+
+int
+fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+	volatile struct fm10k_tx_desc *txdp;
+	struct fm10k_tx_queue *txq = tx_queue;
+	uint16_t desc;
+	uint16_t next_rs = txq->nb_desc;
+	struct fifo rs_tracker = txq->rs_tracker;
+	struct fifo *r = &rs_tracker;
+
+	if (unlikely(offset >= txq->nb_desc))
+		return -EINVAL;
+
+	desc = txq->next_free + offset;
+	/* go to next desc that has the RS bit */
+	desc = (desc / txq->rs_thresh + 1) *
+		txq->rs_thresh - 1;
+
+	if (desc >= txq->nb_desc) {
+		desc -= txq->nb_desc;
+		if (desc >= txq->nb_desc)
+			desc -= txq->nb_desc;
+	}
+
+	r->head = r->list;
+	for ( ; r->head != r->endp; ) {
+		if (*r->head >= desc && *r->head < next_rs)
+			next_rs = *r->head;
+		++r->head;
+	}
+
+	txdp = &txq->hw_ring[next_rs];
+	if (txdp->flags & FM10K_TXD_FLAG_DONE)
+		return RTE_ETH_TX_DESC_DONE;
+
+	return RTE_ETH_TX_DESC_FULL;
+}
+
 /*
  * Free multiple TX mbuf at a time if they are in the same pool
  *
-- 
2.7.5

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

* [dpdk-dev] [PATCH v3] net/e1000: add support for check descriptor status APIs
  2018-06-20  8:52   ` [dpdk-dev] [PATCH v2] " Wei Zhao
@ 2018-06-27  8:37     ` Wei Zhao
  2018-06-29  1:52       ` [dpdk-dev] [PATCH v4] " Wei Zhao
  0 siblings, 1 reply; 26+ messages in thread
From: Wei Zhao @ 2018-06-27  8:37 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
are supported by igb VF.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
-add release note document info

v3:
-rebase code and change git log
---
 doc/guides/rel_notes/release_18_08.rst | 4 ++--
 drivers/net/e1000/igb_ethdev.c         | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index 951d1aa..998cb5f 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -46,9 +46,9 @@ New Features
   Flow API support has been added to CXGBE Poll Mode Driver to offload
   flows to Chelsio T5/T6 NICs.
 
-* **Added fm10k ethernet driver to support check descriptor status APIs.**
+* **Added fm10k and igb VF ethernet driver to support check descriptor status APIs.**
 
-    Fm10k nic need to support check descriptor status APIs, they are
+    Fm10k and igb VF nic need to support check descriptor status APIs, they are
     rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
     add ops pointer with new function which enable feature.
 
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index edc7be3..f5b02b2 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -435,6 +435,9 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.rx_queue_setup       = eth_igb_rx_queue_setup,
 	.rx_queue_release     = eth_igb_rx_queue_release,
+	.rx_descriptor_done   = eth_igb_rx_descriptor_done,
+	.rx_descriptor_status = eth_igb_rx_descriptor_status,
+	.tx_descriptor_status = eth_igb_tx_descriptor_status,
 	.tx_queue_setup       = eth_igb_tx_queue_setup,
 	.tx_queue_release     = eth_igb_tx_queue_release,
 	.set_mc_addr_list     = eth_igb_set_mc_addr_list,
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH v4] net/fm10k: add support for check descriptor status APIs
  2018-06-27  8:18         ` Zhang, Qi Z
@ 2018-06-27  9:09           ` Zhao1, Wei
  0 siblings, 0 replies; 26+ messages in thread
From: Zhao1, Wei @ 2018-06-27  9:09 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: Lu, Wenzhuo


Hi, qi
> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, June 27, 2018 4:19 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [PATCH v4] net/fm10k: add support for check descriptor status
> APIs
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z
> > Sent: Wednesday, June 27, 2018 4:11 PM
> > To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> > Subject: RE: [PATCH v4] net/fm10k: add support for check descriptor
> > status APIs
> >
> > Hi Wei:
> >
> > > -----Original Message-----
> > > From: Zhao1, Wei
> > > Sent: Friday, June 22, 2018 4:20 PM
> > > To: dev@dpdk.org
> > > Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Zhang, Qi Z
> > > <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> > > Subject: [PATCH v4] net/fm10k: add support for check descriptor
> > > status APIs
> > >
> > > Fm10k nic need to support check descriptor status APIs, they are
> > > rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> > > So, this patch add ops with function pointer that enable feature.
> > >
> 
> How about just simplified to
> "rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status is supported
> by fm10K?"
> 

Ok, I have also update this git log in igb patch
https://patches.dpdk.org/patch/41645/

> > > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > >
> > > ---
> > >
> > > v2:
> > > -fix DD check error in tx descriptor
> > >
> > > v3:
> > > -fix DD check index error
> > >
> > > v4:
> > > -fix error in RS bit list poll
> > >
> > > ---
> > > ---
> > >  doc/guides/rel_notes/release_18_08.rst |  6 +++
> > >  drivers/net/fm10k/fm10k.h              |  7 +++
> > >  drivers/net/fm10k/fm10k_ethdev.c       |  2 +
> > >  drivers/net/fm10k/fm10k_rxtx.c         | 78
> > > ++++++++++++++++++++++++++++++++++
> > >  4 files changed, 93 insertions(+)
> > >
> > > diff --git a/doc/guides/rel_notes/release_18_08.rst
> > > b/doc/guides/rel_notes/release_18_08.rst
> > > index 5bc23c5..5baa09e 100644
> > > --- a/doc/guides/rel_notes/release_18_08.rst
> > > +++ b/doc/guides/rel_notes/release_18_08.rst
> > > @@ -41,6 +41,12 @@ New Features
> > >       Also, make sure to start the actual text at the margin.
> > >
> =========================================================
> > >
> > > +* **Added fm10k ethernet driver to support check descriptor status
> > > +APIs.**
> > > +
> > > +    Fm10k nic need to support check descriptor status APIs, they are
> > > +    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> > > +    add ops pointer with new function which enable feature.
> > > +
> > >
> > >  API Changes
> > >  -----------
> > > diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
> > > index
> > > ef30780..1bc2c18 100644
> > > --- a/drivers/net/fm10k/fm10k.h
> > > +++ b/drivers/net/fm10k/fm10k.h
> > > @@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void
> > > *rx_queue, int  fm10k_dev_rx_descriptor_done(void *rx_queue,
> > > uint16_t offset);
> > >
> > > +int
> > > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
> > > +
> > > +int
> > > +fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
> > > +
> > > +
> > >  uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> > >  	uint16_t nb_pkts);
> > >
> > > diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> > > b/drivers/net/fm10k/fm10k_ethdev.c
> > > index 3ff1b0e..ea2f2bf 100644
> > > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > > @@ -2837,6 +2837,8 @@ static const struct eth_dev_ops
> > > fm10k_eth_dev_ops = {
> > >  	.tx_queue_setup		= fm10k_tx_queue_setup,
> > >  	.tx_queue_release	= fm10k_tx_queue_release,
> > >  	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
> > > +	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
> > > +	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
> > >  	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
> > >  	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
> > >  	.reta_update		= fm10k_reta_update,
> > > diff --git a/drivers/net/fm10k/fm10k_rxtx.c
> > > b/drivers/net/fm10k/fm10k_rxtx.c index 9320748..daa2b32 100644
> > > --- a/drivers/net/fm10k/fm10k_rxtx.c
> > > +++ b/drivers/net/fm10k/fm10k_rxtx.c
> > > @@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void
> *rx_queue,
> > > uint16_t offset)
> > >  	return ret;
> > >  }
> > >
> > > +int
> > > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) {
> > > +	volatile union fm10k_rx_desc *rxdp;
> > > +	struct fm10k_rx_queue *rxq = rx_queue;
> > > +	uint16_t nb_hold, trigger_last;
> > > +	uint16_t desc;
> > > +	int ret;
> > > +
> > > +	if (unlikely(offset >= rxq->nb_desc)) {
> > > +		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u",
> offset);
> > > +		return 0;
> > > +	}
> > > +
> > > +	if (rxq->next_trigger < rxq->alloc_thresh)
> > > +		trigger_last = rxq->next_trigger +
> > > +					rxq->nb_desc - rxq->alloc_thresh;
> > > +	else
> > > +		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
> > > +
> > > +	if (rxq->next_dd < trigger_last)
> > > +		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
> > > +	else
> > > +		nb_hold = rxq->next_dd - trigger_last;
> > > +
> > > +	if (offset >= rxq->nb_desc - nb_hold)
> > > +		return RTE_ETH_RX_DESC_UNAVAIL;
> > > +
> > > +	desc = rxq->next_dd + offset;
> > > +	if (desc >= rxq->nb_desc)
> > > +		desc -= rxq->nb_desc;
> > > +
> > > +	rxdp = &rxq->hw_ring[desc];
> > > +
> > > +	ret = !!(rxdp->w.status &
> > > +			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +int
> > > +fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) {
> > > +	volatile struct fm10k_tx_desc *txdp;
> > > +	struct fm10k_tx_queue *txq = tx_queue;
> > > +	uint16_t desc;
> > > +	uint16_t count, next_rs = txq->nb_desc;
> > > +	struct fifo rs_tracker = txq->rs_tracker;
> > > +	struct fifo *r = &rs_tracker;
> > > +
> > > +	if (unlikely(offset >= txq->nb_desc))
> > > +		return -EINVAL;
> > > +
> > > +	desc = txq->next_free + offset;
> > > +	/* go to next desc that has the RS bit */
> > > +	desc = (desc / txq->rs_thresh + 1) *
> > > +		txq->rs_thresh - 1;
> > > +
> > > +	if (desc >= txq->nb_desc) {
> > > +		desc -= txq->nb_desc;
> > > +		if (desc >= txq->nb_desc)
> > > +			desc -= txq->nb_desc;
> > > +	}
> > > +
> > > +	r->head = r->list;
> > > +	for (count = 0; r->head != r->endp; count++) {
> >
> > I didn't see the necessary to have "count" here.
> >
> > Others I didn't see issue, btw, could you rebase on dpdk-next-net-intel?
> >
> > Thanks
> > Qi
> >
> >
> > > +		if (*r->head >= desc && *r->head < next_rs)
> > > +			next_rs = *r->head;
> > > +		++r->head;
> > > +	}
> > > +
> > > +	txdp = &txq->hw_ring[next_rs];
> > > +	if (txdp->flags & FM10K_TXD_FLAG_DONE)
> > > +		return RTE_ETH_TX_DESC_DONE;
> > > +
> > > +	return RTE_ETH_TX_DESC_FULL;
> > > +}
> > > +
> > >  /*
> > >   * Free multiple TX mbuf at a time if they are in the same pool
> > >   *
> > > --
> > > 2.7.5


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

* Re: [dpdk-dev] [PATCH v4] net/fm10k: add support for check descriptor status APIs
  2018-06-22  8:20       ` [dpdk-dev] [PATCH v4] " Wei Zhao
                           ` (3 preceding siblings ...)
  2018-06-27  8:26         ` Wei Zhao
@ 2018-06-27 12:49         ` Zhang, Qi Z
  2018-06-29  1:22           ` Zhao1, Wei
  4 siblings, 1 reply; 26+ messages in thread
From: Zhang, Qi Z @ 2018-06-27 12:49 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: Lu, Wenzhuo

> > > diff --git a/doc/guides/rel_notes/release_18_08.rst
> > > b/doc/guides/rel_notes/release_18_08.rst
> > > index 5bc23c5..5baa09e 100644
> > > --- a/doc/guides/rel_notes/release_18_08.rst
> > > +++ b/doc/guides/rel_notes/release_18_08.rst
> > > @@ -41,6 +41,12 @@ New Features
> > >       Also, make sure to start the actual text at the margin.
> > >
> =========================================================
> > >
> > > +* **Added fm10k ethernet driver to support check descriptor status
> > > +APIs.**
> > > +
> > > +    Fm10k nic need to support check descriptor status APIs, they are
> > > +    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> > > +    add ops pointer with new function which enable feature.

Sorry, I think the description in release note also nee be changed.
Btw, could you rebase to dpdk-next-net-intel?

Thanks!
Qi

> > > +
> > >
> > >  API Changes
> > >  -----------
> > > diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
> > > index
> > > ef30780..1bc2c18 100644
> > > --- a/drivers/net/fm10k/fm10k.h
> > > +++ b/drivers/net/fm10k/fm10k.h
> > > @@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void
> > > *rx_queue, int  fm10k_dev_rx_descriptor_done(void *rx_queue,
> > > uint16_t offset);
> > >
> > > +int
> > > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
> > > +
> > > +int
> > > +fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
> > > +
> > > +
> > >  uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> > >  	uint16_t nb_pkts);
> > >
> > > diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> > > b/drivers/net/fm10k/fm10k_ethdev.c
> > > index 3ff1b0e..ea2f2bf 100644
> > > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > > @@ -2837,6 +2837,8 @@ static const struct eth_dev_ops
> > > fm10k_eth_dev_ops = {
> > >  	.tx_queue_setup		= fm10k_tx_queue_setup,
> > >  	.tx_queue_release	= fm10k_tx_queue_release,
> > >  	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
> > > +	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
> > > +	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
> > >  	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
> > >  	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
> > >  	.reta_update		= fm10k_reta_update,
> > > diff --git a/drivers/net/fm10k/fm10k_rxtx.c
> > > b/drivers/net/fm10k/fm10k_rxtx.c index 9320748..daa2b32 100644
> > > --- a/drivers/net/fm10k/fm10k_rxtx.c
> > > +++ b/drivers/net/fm10k/fm10k_rxtx.c
> > > @@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue,
> > > uint16_t offset)
> > >  	return ret;
> > >  }
> > >
> > > +int
> > > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) {
> > > +	volatile union fm10k_rx_desc *rxdp;
> > > +	struct fm10k_rx_queue *rxq = rx_queue;
> > > +	uint16_t nb_hold, trigger_last;
> > > +	uint16_t desc;
> > > +	int ret;
> > > +
> > > +	if (unlikely(offset >= rxq->nb_desc)) {
> > > +		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
> > > +		return 0;
> > > +	}
> > > +
> > > +	if (rxq->next_trigger < rxq->alloc_thresh)
> > > +		trigger_last = rxq->next_trigger +
> > > +					rxq->nb_desc - rxq->alloc_thresh;
> > > +	else
> > > +		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
> > > +
> > > +	if (rxq->next_dd < trigger_last)
> > > +		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
> > > +	else
> > > +		nb_hold = rxq->next_dd - trigger_last;
> > > +
> > > +	if (offset >= rxq->nb_desc - nb_hold)
> > > +		return RTE_ETH_RX_DESC_UNAVAIL;
> > > +
> > > +	desc = rxq->next_dd + offset;
> > > +	if (desc >= rxq->nb_desc)
> > > +		desc -= rxq->nb_desc;
> > > +
> > > +	rxdp = &rxq->hw_ring[desc];
> > > +
> > > +	ret = !!(rxdp->w.status &
> > > +			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +int
> > > +fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) {
> > > +	volatile struct fm10k_tx_desc *txdp;
> > > +	struct fm10k_tx_queue *txq = tx_queue;
> > > +	uint16_t desc;
> > > +	uint16_t count, next_rs = txq->nb_desc;
> > > +	struct fifo rs_tracker = txq->rs_tracker;
> > > +	struct fifo *r = &rs_tracker;
> > > +
> > > +	if (unlikely(offset >= txq->nb_desc))
> > > +		return -EINVAL;
> > > +
> > > +	desc = txq->next_free + offset;
> > > +	/* go to next desc that has the RS bit */
> > > +	desc = (desc / txq->rs_thresh + 1) *
> > > +		txq->rs_thresh - 1;
> > > +
> > > +	if (desc >= txq->nb_desc) {
> > > +		desc -= txq->nb_desc;
> > > +		if (desc >= txq->nb_desc)
> > > +			desc -= txq->nb_desc;
> > > +	}
> > > +
> > > +	r->head = r->list;
> > > +	for (count = 0; r->head != r->endp; count++) {
> >
> > I didn't see the necessary to have "count" here.
> >
> > Others I didn't see issue, btw, could you rebase on dpdk-next-net-intel?
> >
> > Thanks
> > Qi
> >
> >
> > > +		if (*r->head >= desc && *r->head < next_rs)
> > > +			next_rs = *r->head;
> > > +		++r->head;
> > > +	}
> > > +
> > > +	txdp = &txq->hw_ring[next_rs];
> > > +	if (txdp->flags & FM10K_TXD_FLAG_DONE)
> > > +		return RTE_ETH_TX_DESC_DONE;
> > > +
> > > +	return RTE_ETH_TX_DESC_FULL;
> > > +}
> > > +
> > >  /*
> > >   * Free multiple TX mbuf at a time if they are in the same pool
> > >   *
> > > --
> > > 2.7.5

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

* Re: [dpdk-dev] [PATCH v4] net/fm10k: add support for check descriptor status APIs
  2018-06-27 12:49         ` [dpdk-dev] [PATCH v4] " Zhang, Qi Z
@ 2018-06-29  1:22           ` Zhao1, Wei
  0 siblings, 0 replies; 26+ messages in thread
From: Zhao1, Wei @ 2018-06-29  1:22 UTC (permalink / raw)
  To: Zhang, Qi Z, dev; +Cc: Lu, Wenzhuo


> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, June 27, 2018 8:50 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: RE: [PATCH v4] net/fm10k: add support for check descriptor status
> APIs
> 
> > > > diff --git a/doc/guides/rel_notes/release_18_08.rst
> > > > b/doc/guides/rel_notes/release_18_08.rst
> > > > index 5bc23c5..5baa09e 100644
> > > > --- a/doc/guides/rel_notes/release_18_08.rst
> > > > +++ b/doc/guides/rel_notes/release_18_08.rst
> > > > @@ -41,6 +41,12 @@ New Features
> > > >       Also, make sure to start the actual text at the margin.
> > > >
> > =========================================================
> > > >
> > > > +* **Added fm10k ethernet driver to support check descriptor
> > > > +status
> > > > +APIs.**
> > > > +
> > > > +    Fm10k nic need to support check descriptor status APIs, they are
> > > > +    rte_eth_rx_descriptor_status and rte_eth_tx_descriptor_status.
> > > > +    add ops pointer with new function which enable feature.
> 
> Sorry, I think the description in release note also nee be changed.
> Btw, could you rebase to dpdk-next-net-intel?

Ok, I  will commit later.

> 
> Thanks!
> Qi
> 
> > > > +
> > > >
> > > >  API Changes
> > > >  -----------
> > > > diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
> > > > index
> > > > ef30780..1bc2c18 100644
> > > > --- a/drivers/net/fm10k/fm10k.h
> > > > +++ b/drivers/net/fm10k/fm10k.h
> > > > @@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void
> > > > *rx_queue, int  fm10k_dev_rx_descriptor_done(void *rx_queue,
> > > > uint16_t offset);
> > > >
> > > > +int
> > > > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
> > > > +
> > > > +int
> > > > +fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
> > > > +
> > > > +
> > > >  uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
> > > >  	uint16_t nb_pkts);
> > > >
> > > > diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> > > > b/drivers/net/fm10k/fm10k_ethdev.c
> > > > index 3ff1b0e..ea2f2bf 100644
> > > > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > > > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > > > @@ -2837,6 +2837,8 @@ static const struct eth_dev_ops
> > > > fm10k_eth_dev_ops = {
> > > >  	.tx_queue_setup		= fm10k_tx_queue_setup,
> > > >  	.tx_queue_release	= fm10k_tx_queue_release,
> > > >  	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
> > > > +	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
> > > > +	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
> > > >  	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
> > > >  	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
> > > >  	.reta_update		= fm10k_reta_update,
> > > > diff --git a/drivers/net/fm10k/fm10k_rxtx.c
> > > > b/drivers/net/fm10k/fm10k_rxtx.c index 9320748..daa2b32 100644
> > > > --- a/drivers/net/fm10k/fm10k_rxtx.c
> > > > +++ b/drivers/net/fm10k/fm10k_rxtx.c
> > > > @@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void
> *rx_queue,
> > > > uint16_t offset)
> > > >  	return ret;
> > > >  }
> > > >
> > > > +int
> > > > +fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) {
> > > > +	volatile union fm10k_rx_desc *rxdp;
> > > > +	struct fm10k_rx_queue *rxq = rx_queue;
> > > > +	uint16_t nb_hold, trigger_last;
> > > > +	uint16_t desc;
> > > > +	int ret;
> > > > +
> > > > +	if (unlikely(offset >= rxq->nb_desc)) {
> > > > +		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u",
> offset);
> > > > +		return 0;
> > > > +	}
> > > > +
> > > > +	if (rxq->next_trigger < rxq->alloc_thresh)
> > > > +		trigger_last = rxq->next_trigger +
> > > > +					rxq->nb_desc - rxq->alloc_thresh;
> > > > +	else
> > > > +		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
> > > > +
> > > > +	if (rxq->next_dd < trigger_last)
> > > > +		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
> > > > +	else
> > > > +		nb_hold = rxq->next_dd - trigger_last;
> > > > +
> > > > +	if (offset >= rxq->nb_desc - nb_hold)
> > > > +		return RTE_ETH_RX_DESC_UNAVAIL;
> > > > +
> > > > +	desc = rxq->next_dd + offset;
> > > > +	if (desc >= rxq->nb_desc)
> > > > +		desc -= rxq->nb_desc;
> > > > +
> > > > +	rxdp = &rxq->hw_ring[desc];
> > > > +
> > > > +	ret = !!(rxdp->w.status &
> > > > +			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
> > > > +
> > > > +	return ret;
> > > > +}
> > > > +
> > > > +int
> > > > +fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) {
> > > > +	volatile struct fm10k_tx_desc *txdp;
> > > > +	struct fm10k_tx_queue *txq = tx_queue;
> > > > +	uint16_t desc;
> > > > +	uint16_t count, next_rs = txq->nb_desc;
> > > > +	struct fifo rs_tracker = txq->rs_tracker;
> > > > +	struct fifo *r = &rs_tracker;
> > > > +
> > > > +	if (unlikely(offset >= txq->nb_desc))
> > > > +		return -EINVAL;
> > > > +
> > > > +	desc = txq->next_free + offset;
> > > > +	/* go to next desc that has the RS bit */
> > > > +	desc = (desc / txq->rs_thresh + 1) *
> > > > +		txq->rs_thresh - 1;
> > > > +
> > > > +	if (desc >= txq->nb_desc) {
> > > > +		desc -= txq->nb_desc;
> > > > +		if (desc >= txq->nb_desc)
> > > > +			desc -= txq->nb_desc;
> > > > +	}
> > > > +
> > > > +	r->head = r->list;
> > > > +	for (count = 0; r->head != r->endp; count++) {
> > >
> > > I didn't see the necessary to have "count" here.
> > >
> > > Others I didn't see issue, btw, could you rebase on dpdk-next-net-intel?
> > >
> > > Thanks
> > > Qi
> > >
> > >
> > > > +		if (*r->head >= desc && *r->head < next_rs)
> > > > +			next_rs = *r->head;
> > > > +		++r->head;
> > > > +	}
> > > > +
> > > > +	txdp = &txq->hw_ring[next_rs];
> > > > +	if (txdp->flags & FM10K_TXD_FLAG_DONE)
> > > > +		return RTE_ETH_TX_DESC_DONE;
> > > > +
> > > > +	return RTE_ETH_TX_DESC_FULL;
> > > > +}
> > > > +
> > > >  /*
> > > >   * Free multiple TX mbuf at a time if they are in the same pool
> > > >   *
> > > > --
> > > > 2.7.5

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

* [dpdk-dev] [PATCH v6] net/fm10k: add support for check descriptor status APIs
  2018-06-27  8:26         ` Wei Zhao
@ 2018-06-29  1:48           ` Wei Zhao
  2018-06-29 11:03             ` Ferruh Yigit
  2018-07-02  7:15             ` [dpdk-dev] [PATCH v7] " Zhao Wei
  0 siblings, 2 replies; 26+ messages in thread
From: Wei Zhao @ 2018-06-29  1:48 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
are supported by fm10K.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
-fix DD check error in tx descriptor

v3:
-fix DD check index error

v4:
-fix error in RS bit list poll

v5:
-rebase code to branch and delete useless variable

v6:
-change release note
---
 doc/guides/rel_notes/release_18_08.rst |  6 +++
 drivers/net/fm10k/fm10k.h              |  7 +++
 drivers/net/fm10k/fm10k_ethdev.c       |  2 +
 drivers/net/fm10k/fm10k_rxtx.c         | 78 ++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)

diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index 68aaee8..ac54121 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -54,6 +54,12 @@ New Features
   PMD does not provide any. The provision of such tuned values now includes
   the ixgbe PMD.
 
+* **Added fm10k ethernet driver to support check descriptor status APIs.**
+
+  rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
+  are supported by fm10K.
+
+
 API Changes
 -----------
 
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index ef30780..1bc2c18 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
 int
 fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
+int
+fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
+
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_pkts);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 3ff1b0e..ea2f2bf 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2837,6 +2837,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.tx_queue_setup		= fm10k_tx_queue_setup,
 	.tx_queue_release	= fm10k_tx_queue_release,
 	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
+	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
+	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
 	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
 	.reta_update		= fm10k_reta_update,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 9320748..4a5b46e 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
 	return ret;
 }
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	volatile union fm10k_rx_desc *rxdp;
+	struct fm10k_rx_queue *rxq = rx_queue;
+	uint16_t nb_hold, trigger_last;
+	uint16_t desc;
+	int ret;
+
+	if (unlikely(offset >= rxq->nb_desc)) {
+		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
+		return 0;
+	}
+
+	if (rxq->next_trigger < rxq->alloc_thresh)
+		trigger_last = rxq->next_trigger +
+					rxq->nb_desc - rxq->alloc_thresh;
+	else
+		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
+
+	if (rxq->next_dd < trigger_last)
+		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
+	else
+		nb_hold = rxq->next_dd - trigger_last;
+
+	if (offset >= rxq->nb_desc - nb_hold)
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	desc = rxq->next_dd + offset;
+	if (desc >= rxq->nb_desc)
+		desc -= rxq->nb_desc;
+
+	rxdp = &rxq->hw_ring[desc];
+
+	ret = !!(rxdp->w.status &
+			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+	return ret;
+}
+
+int
+fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+	volatile struct fm10k_tx_desc *txdp;
+	struct fm10k_tx_queue *txq = tx_queue;
+	uint16_t desc;
+	uint16_t next_rs = txq->nb_desc;
+	struct fifo rs_tracker = txq->rs_tracker;
+	struct fifo *r = &rs_tracker;
+
+	if (unlikely(offset >= txq->nb_desc))
+		return -EINVAL;
+
+	desc = txq->next_free + offset;
+	/* go to next desc that has the RS bit */
+	desc = (desc / txq->rs_thresh + 1) *
+		txq->rs_thresh - 1;
+
+	if (desc >= txq->nb_desc) {
+		desc -= txq->nb_desc;
+		if (desc >= txq->nb_desc)
+			desc -= txq->nb_desc;
+	}
+
+	r->head = r->list;
+	for ( ; r->head != r->endp; ) {
+		if (*r->head >= desc && *r->head < next_rs)
+			next_rs = *r->head;
+		++r->head;
+	}
+
+	txdp = &txq->hw_ring[next_rs];
+	if (txdp->flags & FM10K_TXD_FLAG_DONE)
+		return RTE_ETH_TX_DESC_DONE;
+
+	return RTE_ETH_TX_DESC_FULL;
+}
+
 /*
  * Free multiple TX mbuf at a time if they are in the same pool
  *
-- 
2.7.5

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

* [dpdk-dev] [PATCH v4] net/e1000: add support for check descriptor status APIs
  2018-06-27  8:37     ` [dpdk-dev] [PATCH v3] " Wei Zhao
@ 2018-06-29  1:52       ` Wei Zhao
  2018-07-02  7:42         ` Zhao1, Wei
  0 siblings, 1 reply; 26+ messages in thread
From: Wei Zhao @ 2018-06-29  1:52 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Wei Zhao

rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
are supported by igb VF.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
-add release note document info

v3:
-rebase code and change git log

v4:
-rebase code
---
 doc/guides/rel_notes/release_18_08.rst | 4 ++--
 drivers/net/e1000/igb_ethdev.c         | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index ac54121..d7613a2 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -54,10 +54,10 @@ New Features
   PMD does not provide any. The provision of such tuned values now includes
   the ixgbe PMD.
 
-* **Added fm10k ethernet driver to support check descriptor status APIs.**
+* **Added fm10k and igb VF ethernet driver to support check descriptor status APIs.**
 
   rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
-  are supported by fm10K.
+  are supported by fm10K and igb VF.
 
 
 API Changes
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index edc7be3..f5b02b2 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -435,6 +435,9 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.rx_queue_setup       = eth_igb_rx_queue_setup,
 	.rx_queue_release     = eth_igb_rx_queue_release,
+	.rx_descriptor_done   = eth_igb_rx_descriptor_done,
+	.rx_descriptor_status = eth_igb_rx_descriptor_status,
+	.tx_descriptor_status = eth_igb_tx_descriptor_status,
 	.tx_queue_setup       = eth_igb_tx_queue_setup,
 	.tx_queue_release     = eth_igb_tx_queue_release,
 	.set_mc_addr_list     = eth_igb_set_mc_addr_list,
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH v6] net/fm10k: add support for check descriptor status APIs
  2018-06-29  1:48           ` [dpdk-dev] [PATCH v6] " Wei Zhao
@ 2018-06-29 11:03             ` Ferruh Yigit
  2018-07-02  1:46               ` Zhao1, Wei
  2018-07-02  7:15             ` [dpdk-dev] [PATCH v7] " Zhao Wei
  1 sibling, 1 reply; 26+ messages in thread
From: Ferruh Yigit @ 2018-06-29 11:03 UTC (permalink / raw)
  To: Wei Zhao, dev; +Cc: qi.z.zhang

On 6/29/2018 2:48 AM, Wei Zhao wrote:
> rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
> are supported by fm10K.
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> 
> ---
> 
> v2:
> -fix DD check error in tx descriptor
> 
> v3:
> -fix DD check index error
> 
> v4:
> -fix error in RS bit list poll
> 
> v5:
> -rebase code to branch and delete useless variable
> 
> v6:
> -change release note
> ---
>  doc/guides/rel_notes/release_18_08.rst |  6 +++
>  drivers/net/fm10k/fm10k.h              |  7 +++
>  drivers/net/fm10k/fm10k_ethdev.c       |  2 +
>  drivers/net/fm10k/fm10k_rxtx.c         | 78 ++++++++++++++++++++++++++++++++++

Can you please update fm10k*.ini files to announce newly added "Rx descriptor
status" & "Tx descriptor status" features?

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

* Re: [dpdk-dev] [PATCH v6] net/fm10k: add support for check descriptor status APIs
  2018-06-29 11:03             ` Ferruh Yigit
@ 2018-07-02  1:46               ` Zhao1, Wei
  0 siblings, 0 replies; 26+ messages in thread
From: Zhao1, Wei @ 2018-07-02  1:46 UTC (permalink / raw)
  To: Yigit, Ferruh, dev; +Cc: Zhang, Qi Z

Hi, Ferruh

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Friday, June 29, 2018 7:04 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v6] net/fm10k: add support for check
> descriptor status APIs
> 
> On 6/29/2018 2:48 AM, Wei Zhao wrote:
> > rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status are
> > supported by fm10K.
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> >
> > ---
> >
> > v2:
> > -fix DD check error in tx descriptor
> >
> > v3:
> > -fix DD check index error
> >
> > v4:
> > -fix error in RS bit list poll
> >
> > v5:
> > -rebase code to branch and delete useless variable
> >
> > v6:
> > -change release note
> > ---
> >  doc/guides/rel_notes/release_18_08.rst |  6 +++
> >  drivers/net/fm10k/fm10k.h              |  7 +++
> >  drivers/net/fm10k/fm10k_ethdev.c       |  2 +
> >  drivers/net/fm10k/fm10k_rxtx.c         | 78
> ++++++++++++++++++++++++++++++++++
> 
> Can you please update fm10k*.ini files to announce newly added "Rx
> descriptor status" & "Tx descriptor status" features?

Ok, thank you. I will commit new patch.

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

* [dpdk-dev] [PATCH v7] net/fm10k: add support for check descriptor status APIs
  2018-06-29  1:48           ` [dpdk-dev] [PATCH v6] " Wei Zhao
  2018-06-29 11:03             ` Ferruh Yigit
@ 2018-07-02  7:15             ` Zhao Wei
  2018-07-02 13:07               ` Zhang, Qi Z
  1 sibling, 1 reply; 26+ messages in thread
From: Zhao Wei @ 2018-07-02  7:15 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, ferruh.yigit, Wei Zhao

rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
are supported by fm10K.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---

v2:
-fix DD check error in tx descriptor

v3:
-fix DD check index error

v4:
-fix error in RS bit list poll

v5:
-rebase code to branch and delete useless variable

v6:
-change release note

v7:
-update update fm10k.ini file
---
 doc/guides/nics/features/fm10k.ini     |  2 +
 doc/guides/rel_notes/release_18_08.rst |  6 +++
 drivers/net/fm10k/fm10k.h              |  7 +++
 drivers/net/fm10k/fm10k_ethdev.c       |  2 +
 drivers/net/fm10k/fm10k_rxtx.c         | 78 ++++++++++++++++++++++++++++++++++
 5 files changed, 95 insertions(+)

diff --git a/doc/guides/nics/features/fm10k.ini b/doc/guides/nics/features/fm10k.ini
index 58f58b9..0acdf0d 100644
--- a/doc/guides/nics/features/fm10k.ini
+++ b/doc/guides/nics/features/fm10k.ini
@@ -26,6 +26,8 @@ VLAN offload         = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
+Rx descriptor status = Y
+Tx descriptor status = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst
index 68aaee8..ac54121 100644
--- a/doc/guides/rel_notes/release_18_08.rst
+++ b/doc/guides/rel_notes/release_18_08.rst
@@ -54,6 +54,12 @@ New Features
   PMD does not provide any. The provision of such tuned values now includes
   the ixgbe PMD.
 
+* **Added fm10k ethernet driver to support check descriptor status APIs.**
+
+  rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
+  are supported by fm10K.
+
+
 API Changes
 -----------
 
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index ef30780..1bc2c18 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -329,6 +329,13 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
 int
 fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+
+int
+fm10k_dev_tx_descriptor_status(void *rx_queue, uint16_t offset);
+
+
 uint16_t fm10k_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	uint16_t nb_pkts);
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 3ff1b0e..ea2f2bf 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2837,6 +2837,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.tx_queue_setup		= fm10k_tx_queue_setup,
 	.tx_queue_release	= fm10k_tx_queue_release,
 	.rx_descriptor_done	= fm10k_dev_rx_descriptor_done,
+	.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
+	.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
 	.rx_queue_intr_enable	= fm10k_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable	= fm10k_dev_rx_queue_intr_disable,
 	.reta_update		= fm10k_reta_update,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 9320748..4a5b46e 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -389,6 +389,84 @@ fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
 	return ret;
 }
 
+int
+fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset)
+{
+	volatile union fm10k_rx_desc *rxdp;
+	struct fm10k_rx_queue *rxq = rx_queue;
+	uint16_t nb_hold, trigger_last;
+	uint16_t desc;
+	int ret;
+
+	if (unlikely(offset >= rxq->nb_desc)) {
+		PMD_DRV_LOG(ERR, "Invalid RX descriptor offset %u", offset);
+		return 0;
+	}
+
+	if (rxq->next_trigger < rxq->alloc_thresh)
+		trigger_last = rxq->next_trigger +
+					rxq->nb_desc - rxq->alloc_thresh;
+	else
+		trigger_last = rxq->next_trigger - rxq->alloc_thresh;
+
+	if (rxq->next_dd < trigger_last)
+		nb_hold = rxq->next_dd + rxq->nb_desc - trigger_last;
+	else
+		nb_hold = rxq->next_dd - trigger_last;
+
+	if (offset >= rxq->nb_desc - nb_hold)
+		return RTE_ETH_RX_DESC_UNAVAIL;
+
+	desc = rxq->next_dd + offset;
+	if (desc >= rxq->nb_desc)
+		desc -= rxq->nb_desc;
+
+	rxdp = &rxq->hw_ring[desc];
+
+	ret = !!(rxdp->w.status &
+			rte_cpu_to_le_16(FM10K_RXD_STATUS_DD));
+
+	return ret;
+}
+
+int
+fm10k_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
+{
+	volatile struct fm10k_tx_desc *txdp;
+	struct fm10k_tx_queue *txq = tx_queue;
+	uint16_t desc;
+	uint16_t next_rs = txq->nb_desc;
+	struct fifo rs_tracker = txq->rs_tracker;
+	struct fifo *r = &rs_tracker;
+
+	if (unlikely(offset >= txq->nb_desc))
+		return -EINVAL;
+
+	desc = txq->next_free + offset;
+	/* go to next desc that has the RS bit */
+	desc = (desc / txq->rs_thresh + 1) *
+		txq->rs_thresh - 1;
+
+	if (desc >= txq->nb_desc) {
+		desc -= txq->nb_desc;
+		if (desc >= txq->nb_desc)
+			desc -= txq->nb_desc;
+	}
+
+	r->head = r->list;
+	for ( ; r->head != r->endp; ) {
+		if (*r->head >= desc && *r->head < next_rs)
+			next_rs = *r->head;
+		++r->head;
+	}
+
+	txdp = &txq->hw_ring[next_rs];
+	if (txdp->flags & FM10K_TXD_FLAG_DONE)
+		return RTE_ETH_TX_DESC_DONE;
+
+	return RTE_ETH_TX_DESC_FULL;
+}
+
 /*
  * Free multiple TX mbuf at a time if they are in the same pool
  *
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH v4] net/e1000: add support for check descriptor status APIs
  2018-06-29  1:52       ` [dpdk-dev] [PATCH v4] " Wei Zhao
@ 2018-07-02  7:42         ` Zhao1, Wei
  2018-07-02 13:03           ` Zhang, Qi Z
  0 siblings, 1 reply; 26+ messages in thread
From: Zhao1, Wei @ 2018-07-02  7:42 UTC (permalink / raw)
  To: Yigit, Ferruh; +Cc: Zhang, Qi Z, dev

Hi,  Ferruh

	The doc of igb_vf.ini has enable "Rx  descriptor status" & "Tx descriptor status" features, so I do not need update this doc in this patch.

Thanks

> -----Original Message-----
> From: Zhao1, Wei
> Sent: Friday, June 29, 2018 9:53 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v4] net/e1000: add support for check descriptor status APIs
> 
> rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status are
> supported by igb VF.
> 
> Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> 
> ---
> 
> v2:
> -add release note document info
> 
> v3:
> -rebase code and change git log
> 
> v4:
> -rebase code
> ---
>  doc/guides/rel_notes/release_18_08.rst | 4 ++--
>  drivers/net/e1000/igb_ethdev.c         | 3 +++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_18_08.rst
> b/doc/guides/rel_notes/release_18_08.rst
> index ac54121..d7613a2 100644
> --- a/doc/guides/rel_notes/release_18_08.rst
> +++ b/doc/guides/rel_notes/release_18_08.rst
> @@ -54,10 +54,10 @@ New Features
>    PMD does not provide any. The provision of such tuned values now
> includes
>    the ixgbe PMD.
> 
> -* **Added fm10k ethernet driver to support check descriptor status
> APIs.**
> +* **Added fm10k and igb VF ethernet driver to support check descriptor
> +status APIs.**
> 
>    rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status
> -  are supported by fm10K.
> +  are supported by fm10K and igb VF.
> 
> 
>  API Changes
> diff --git a/drivers/net/e1000/igb_ethdev.c
> b/drivers/net/e1000/igb_ethdev.c index edc7be3..f5b02b2 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -435,6 +435,9 @@ static const struct eth_dev_ops igbvf_eth_dev_ops =
> {
>  	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
>  	.rx_queue_setup       = eth_igb_rx_queue_setup,
>  	.rx_queue_release     = eth_igb_rx_queue_release,
> +	.rx_descriptor_done   = eth_igb_rx_descriptor_done,
> +	.rx_descriptor_status = eth_igb_rx_descriptor_status,
> +	.tx_descriptor_status = eth_igb_tx_descriptor_status,
>  	.tx_queue_setup       = eth_igb_tx_queue_setup,
>  	.tx_queue_release     = eth_igb_tx_queue_release,
>  	.set_mc_addr_list     = eth_igb_set_mc_addr_list,
> --
> 2.7.5

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

* Re: [dpdk-dev] [PATCH v4] net/e1000: add support for check descriptor status APIs
  2018-07-02  7:42         ` Zhao1, Wei
@ 2018-07-02 13:03           ` Zhang, Qi Z
  2018-07-02 13:12             ` Zhang, Qi Z
  0 siblings, 1 reply; 26+ messages in thread
From: Zhang, Qi Z @ 2018-07-02 13:03 UTC (permalink / raw)
  To: Zhao1, Wei, Yigit, Ferruh; +Cc: dev



> -----Original Message-----
> From: Zhao1, Wei
> Sent: Monday, July 2, 2018 3:42 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; dev@dpdk.org
> Subject: RE: [PATCH v4] net/e1000: add support for check descriptor status
> APIs
> 
> Hi,  Ferruh
> 
> 	The doc of igb_vf.ini has enable "Rx  descriptor status" & "Tx descriptor
> status" features, so I do not need update this doc in this patch.

> 
> Thanks
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Friday, June 29, 2018 9:53 AM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> > <wei.zhao1@intel.com>
> > Subject: [PATCH v4] net/e1000: add support for check descriptor status
> > APIs
> >
> > rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status are
> > supported by igb VF.
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

So the patch looks like a fix, but not new feature enable, so I will remove the release notes update.

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

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

* Re: [dpdk-dev] [PATCH v7] net/fm10k: add support for check descriptor status APIs
  2018-07-02  7:15             ` [dpdk-dev] [PATCH v7] " Zhao Wei
@ 2018-07-02 13:07               ` Zhang, Qi Z
  2018-07-02 13:11                 ` Zhang, Qi Z
  0 siblings, 1 reply; 26+ messages in thread
From: Zhang, Qi Z @ 2018-07-02 13:07 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: Yigit, Ferruh

> -----Original Message-----
> From: Zhao1, Wei
> Sent: Monday, July 2, 2018 3:16 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> Zhao1, Wei <wei.zhao1@intel.com>
> Subject: [PATCH v7] net/fm10k: add support for check descriptor status APIs

<...>

> diff --git a/doc/guides/rel_notes/release_18_08.rst
> b/doc/guides/rel_notes/release_18_08.rst
> index 68aaee8..ac54121 100644
> --- a/doc/guides/rel_notes/release_18_08.rst
> +++ b/doc/guides/rel_notes/release_18_08.rst
> @@ -54,6 +54,12 @@ New Features
>    PMD does not provide any. The provision of such tuned values now
> includes
>    the ixgbe PMD.
> 
> +* **Added fm10k ethernet driver to support check descriptor status
> +APIs.**

Will change to "Added descriptor status check support for fm10k"

> +
> +  rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status  are
> + supported by fm10K.

API in release notes need be ``rte_eth.....``, will fix during apply.

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

<...>

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

* Re: [dpdk-dev] [PATCH v7] net/fm10k: add support for check descriptor status APIs
  2018-07-02 13:07               ` Zhang, Qi Z
@ 2018-07-02 13:11                 ` Zhang, Qi Z
  0 siblings, 0 replies; 26+ messages in thread
From: Zhang, Qi Z @ 2018-07-02 13:11 UTC (permalink / raw)
  To: Zhang, Qi Z, Zhao1, Wei, dev; +Cc: Yigit, Ferruh



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhang, Qi Z
> Sent: Monday, July 2, 2018 9:08 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v7] net/fm10k: add support for check
> descriptor status APIs
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Monday, July 2, 2018 3:16 PM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yigit, Ferruh
> > <ferruh.yigit@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> > Subject: [PATCH v7] net/fm10k: add support for check descriptor status
> > APIs
> 
> <...>
> 
> > diff --git a/doc/guides/rel_notes/release_18_08.rst
> > b/doc/guides/rel_notes/release_18_08.rst
> > index 68aaee8..ac54121 100644
> > --- a/doc/guides/rel_notes/release_18_08.rst
> > +++ b/doc/guides/rel_notes/release_18_08.rst
> > @@ -54,6 +54,12 @@ New Features
> >    PMD does not provide any. The provision of such tuned values now
> > includes
> >    the ixgbe PMD.
> >
> > +* **Added fm10k ethernet driver to support check descriptor status
> > +APIs.**
> 
> Will change to "Added descriptor status check support for fm10k"
> 
> > +
> > +  rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status  are
> > + supported by fm10K.
> 
> API in release notes need be ``rte_eth.....``, will fix during apply.
> 
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel

Thanks!
Qi

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

* Re: [dpdk-dev] [PATCH v4] net/e1000: add support for check descriptor status APIs
  2018-07-02 13:03           ` Zhang, Qi Z
@ 2018-07-02 13:12             ` Zhang, Qi Z
  0 siblings, 0 replies; 26+ messages in thread
From: Zhang, Qi Z @ 2018-07-02 13:12 UTC (permalink / raw)
  To: Zhang, Qi Z, Zhao1, Wei, Yigit, Ferruh; +Cc: dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhang, Qi Z
> Sent: Monday, July 2, 2018 9:04 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4] net/e1000: add support for check
> descriptor status APIs
> 
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei
> > Sent: Monday, July 2, 2018 3:42 PM
> > To: Yigit, Ferruh <ferruh.yigit@intel.com>
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; dev@dpdk.org
> > Subject: RE: [PATCH v4] net/e1000: add support for check descriptor
> > status APIs
> >
> > Hi,  Ferruh
> >
> > 	The doc of igb_vf.ini has enable "Rx  descriptor status" & "Tx
> > descriptor status" features, so I do not need update this doc in this patch.
> 
> >
> > Thanks
> >
> > > -----Original Message-----
> > > From: Zhao1, Wei
> > > Sent: Friday, June 29, 2018 9:53 AM
> > > To: dev@dpdk.org
> > > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zhao1, Wei
> > > <wei.zhao1@intel.com>
> > > Subject: [PATCH v4] net/e1000: add support for check descriptor
> > > status APIs
> > >
> > > rte_eth_rx_descritpr_status and rte_eth_tx_descriptor_status are
> > > supported by igb VF.
> > >
> > > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> 
> So the patch looks like a fix, but not new feature enable, so I will remove the
> release notes update.
> 
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel

Thanks!
Qi

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

end of thread, other threads:[~2018-07-02 13:12 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08  8:36 [dpdk-dev] [PATCH 0/2] add support for check descriptor status APIs Wei Zhao
2018-02-08  8:36 ` [dpdk-dev] [PATCH 1/2] net/e1000: " Wei Zhao
2018-06-20  8:52   ` [dpdk-dev] [PATCH v2] " Wei Zhao
2018-06-27  8:37     ` [dpdk-dev] [PATCH v3] " Wei Zhao
2018-06-29  1:52       ` [dpdk-dev] [PATCH v4] " Wei Zhao
2018-07-02  7:42         ` Zhao1, Wei
2018-07-02 13:03           ` Zhang, Qi Z
2018-07-02 13:12             ` Zhang, Qi Z
2018-02-08  8:36 ` [dpdk-dev] [PATCH 2/2] net/fm10k: " Wei Zhao
2018-06-20  8:44   ` [dpdk-dev] [PATCH v2] " Wei Zhao
2018-06-22  7:53     ` [dpdk-dev] [PATCH v3] " Wei Zhao
2018-06-22  8:20       ` [dpdk-dev] [PATCH v4] " Wei Zhao
2018-06-27  8:10         ` Zhang, Qi Z
2018-06-27  8:18           ` Zhao1, Wei
2018-06-27  8:18         ` Zhang, Qi Z
2018-06-27  9:09           ` Zhao1, Wei
2018-06-27  8:24         ` [dpdk-dev] [PATCH v5] " Wei Zhao
2018-06-27  8:26         ` Wei Zhao
2018-06-29  1:48           ` [dpdk-dev] [PATCH v6] " Wei Zhao
2018-06-29 11:03             ` Ferruh Yigit
2018-07-02  1:46               ` Zhao1, Wei
2018-07-02  7:15             ` [dpdk-dev] [PATCH v7] " Zhao Wei
2018-07-02 13:07               ` Zhang, Qi Z
2018-07-02 13:11                 ` Zhang, Qi Z
2018-06-27 12:49         ` [dpdk-dev] [PATCH v4] " Zhang, Qi Z
2018-06-29  1:22           ` Zhao1, Wei

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).