* [dpdk-dev] [PATCH] net/fm10k: support Rx queue count API
@ 2019-04-24 7:51 Xiao Wang
2019-04-24 7:51 ` Xiao Wang
2019-05-06 2:06 ` Zhang, Qi Z
0 siblings, 2 replies; 4+ messages in thread
From: Xiao Wang @ 2019-04-24 7:51 UTC (permalink / raw)
To: qi.z.zhang; +Cc: dev, ferruh.yigit, Xiao Wang
Some application, e.g. the l3fwd-power sample uses rte_eth_rx_queue_count()
API to get the get the number of used descriptors of a Rx queue. This patch
adds fm10k implementation for this API.
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/net/fm10k/fm10k.h | 3 +++
drivers/net/fm10k/fm10k_ethdev.c | 1 +
drivers/net/fm10k/fm10k_rxtx.c | 27 +++++++++++++++++++++++++++
3 files changed, 31 insertions(+)
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index dc814855d..b633b307b 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -323,6 +323,9 @@ uint16_t fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+uint32_t
+fm10k_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+
int
fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index caf4d1bc0..47c20c5b2 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2819,6 +2819,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
.rx_queue_release = fm10k_rx_queue_release,
.tx_queue_setup = fm10k_tx_queue_setup,
.tx_queue_release = fm10k_tx_queue_release,
+ .rx_queue_count = fm10k_dev_rx_queue_count,
.rx_descriptor_done = fm10k_dev_rx_descriptor_done,
.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index fb02e1152..cc95f9589 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -366,6 +366,33 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
return nb_rcv;
}
+uint32_t
+fm10k_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+#define FM10K_RXQ_SCAN_INTERVAL 4
+ volatile union fm10k_rx_desc *rxdp;
+ struct fm10k_rx_queue *rxq;
+ uint16_t desc = 0;
+
+ rxq = dev->data->rx_queues[rx_queue_id];
+ rxdp = &rxq->hw_ring[rxq->next_dd];
+ while ((desc < rxq->nb_desc) &&
+ rxdp->w.status & rte_cpu_to_le_16(FM10K_RXD_STATUS_DD)) {
+ /**
+ * Check the DD bit of a rx descriptor of each group of 4 desc,
+ * to avoid checking too frequently and downgrading performance
+ * too much.
+ */
+ desc += FM10K_RXQ_SCAN_INTERVAL;
+ rxdp += FM10K_RXQ_SCAN_INTERVAL;
+ if (rxq->next_dd + desc >= rxq->nb_desc)
+ rxdp = &rxq->hw_ring[rxq->next_dd + desc -
+ rxq->nb_desc];
+ }
+
+ return desc;
+}
+
int
fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
{
--
2.15.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH] net/fm10k: support Rx queue count API
2019-04-24 7:51 [dpdk-dev] [PATCH] net/fm10k: support Rx queue count API Xiao Wang
@ 2019-04-24 7:51 ` Xiao Wang
2019-05-06 2:06 ` Zhang, Qi Z
1 sibling, 0 replies; 4+ messages in thread
From: Xiao Wang @ 2019-04-24 7:51 UTC (permalink / raw)
To: qi.z.zhang; +Cc: dev, ferruh.yigit, Xiao Wang
Some application, e.g. the l3fwd-power sample uses rte_eth_rx_queue_count()
API to get the get the number of used descriptors of a Rx queue. This patch
adds fm10k implementation for this API.
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/net/fm10k/fm10k.h | 3 +++
drivers/net/fm10k/fm10k_ethdev.c | 1 +
drivers/net/fm10k/fm10k_rxtx.c | 27 +++++++++++++++++++++++++++
3 files changed, 31 insertions(+)
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index dc814855d..b633b307b 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -323,6 +323,9 @@ uint16_t fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+uint32_t
+fm10k_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+
int
fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index caf4d1bc0..47c20c5b2 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2819,6 +2819,7 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
.rx_queue_release = fm10k_rx_queue_release,
.tx_queue_setup = fm10k_tx_queue_setup,
.tx_queue_release = fm10k_tx_queue_release,
+ .rx_queue_count = fm10k_dev_rx_queue_count,
.rx_descriptor_done = fm10k_dev_rx_descriptor_done,
.rx_descriptor_status = fm10k_dev_rx_descriptor_status,
.tx_descriptor_status = fm10k_dev_tx_descriptor_status,
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index fb02e1152..cc95f9589 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -366,6 +366,33 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
return nb_rcv;
}
+uint32_t
+fm10k_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+#define FM10K_RXQ_SCAN_INTERVAL 4
+ volatile union fm10k_rx_desc *rxdp;
+ struct fm10k_rx_queue *rxq;
+ uint16_t desc = 0;
+
+ rxq = dev->data->rx_queues[rx_queue_id];
+ rxdp = &rxq->hw_ring[rxq->next_dd];
+ while ((desc < rxq->nb_desc) &&
+ rxdp->w.status & rte_cpu_to_le_16(FM10K_RXD_STATUS_DD)) {
+ /**
+ * Check the DD bit of a rx descriptor of each group of 4 desc,
+ * to avoid checking too frequently and downgrading performance
+ * too much.
+ */
+ desc += FM10K_RXQ_SCAN_INTERVAL;
+ rxdp += FM10K_RXQ_SCAN_INTERVAL;
+ if (rxq->next_dd + desc >= rxq->nb_desc)
+ rxdp = &rxq->hw_ring[rxq->next_dd + desc -
+ rxq->nb_desc];
+ }
+
+ return desc;
+}
+
int
fm10k_dev_rx_descriptor_done(void *rx_queue, uint16_t offset)
{
--
2.15.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] net/fm10k: support Rx queue count API
2019-04-24 7:51 [dpdk-dev] [PATCH] net/fm10k: support Rx queue count API Xiao Wang
2019-04-24 7:51 ` Xiao Wang
@ 2019-05-06 2:06 ` Zhang, Qi Z
2019-05-06 2:06 ` Zhang, Qi Z
1 sibling, 1 reply; 4+ messages in thread
From: Zhang, Qi Z @ 2019-05-06 2:06 UTC (permalink / raw)
To: Wang, Xiao W; +Cc: dev, Yigit, Ferruh
> -----Original Message-----
> From: Wang, Xiao W
> Sent: Wednesday, April 24, 2019 3:52 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>
> Subject: [PATCH] net/fm10k: support Rx queue count API
>
> Some application, e.g. the l3fwd-power sample uses rte_eth_rx_queue_count()
> API to get the get the number of used descriptors of a Rx queue. This patch
> adds fm10k implementation for this API.
>
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] net/fm10k: support Rx queue count API
2019-05-06 2:06 ` Zhang, Qi Z
@ 2019-05-06 2:06 ` Zhang, Qi Z
0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2019-05-06 2:06 UTC (permalink / raw)
To: Wang, Xiao W; +Cc: dev, Yigit, Ferruh
> -----Original Message-----
> From: Wang, Xiao W
> Sent: Wednesday, April 24, 2019 3:52 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>
> Subject: [PATCH] net/fm10k: support Rx queue count API
>
> Some application, e.g. the l3fwd-power sample uses rte_eth_rx_queue_count()
> API to get the get the number of used descriptors of a Rx queue. This patch
> adds fm10k implementation for this API.
>
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-06 2:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24 7:51 [dpdk-dev] [PATCH] net/fm10k: support Rx queue count API Xiao Wang
2019-04-24 7:51 ` Xiao Wang
2019-05-06 2:06 ` Zhang, Qi Z
2019-05-06 2:06 ` Zhang, Qi Z
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).