DPDK patches and discussions
 help / color / mirror / Atom feed
From: Amine Kherbouche <amine.kherbouche@6wind.com>
To: dev@dpdk.org
Cc: amine.kherbouche@6wind.com
Subject: [dpdk-dev] [dpdk-dev, PATCHv6 3/6] virtio: add support for eth_(rxq|txq)_info_get
Date: Tue, 20 Oct 2015 00:06:21 +0200	[thread overview]
Message-ID: <1445292384-19815-4-git-send-email-amine.kherbouche@6wind.com> (raw)
In-Reply-To: <1445292384-19815-1-git-send-email-amine.kherbouche@6wind.com>

In the case of virtio, there are many fields in rte_eth_(tx|rxq)_info
struct that aren't set in this function because those fields are
missed in virtqueue struct.

Signed-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>
---
 drivers/net/virtio/virtio_ethdev.c |   28 ++++++++++++++++++++++++++++
 drivers/net/virtio/virtio_ethdev.h |    4 ++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 465d3cd..6118913 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -580,6 +580,8 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {
 	.mac_addr_add            = virtio_mac_addr_add,
 	.mac_addr_remove         = virtio_mac_addr_remove,
 	.mac_addr_set            = virtio_mac_addr_set,
+	.rxq_info_get            = virtio_rxq_info_get,
+	.txq_info_get            = virtio_txq_info_get,
 };
 
 static inline int
@@ -1574,4 +1576,30 @@ static struct rte_driver rte_virtio_driver = {
 	.init = rte_virtio_pmd_init,
 };
 
+void
+virtio_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			struct rte_eth_rxq_info *qinfo)
+{
+	struct virtqueue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->nb_desc = rxq->vq_nentries;
+	qinfo->used_desc = rxq->vq_nentries - rxq->vq_free_cnt;
+	qinfo->free_desc= rxq->vq_free_cnt;
+}
+
+void
+virtio_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			struct rte_eth_txq_info *qinfo)
+{
+	struct virtqueue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->vq_nentries;
+	qinfo->used_desc = txq->vq_nentries - txq->vq_free_cnt;
+	qinfo->free_desc= txq->vq_free_cnt;
+}
+
 PMD_REGISTER_DRIVER(rte_virtio_driver);
diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h
index 9026d42..1bbe421 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -107,7 +107,11 @@ uint16_t virtio_recv_mergeable_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 uint16_t virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
+void virtio_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+                        struct rte_eth_rxq_info *qinfo);
 
+void virtio_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+                        struct rte_eth_txq_info *qinfo);
 
 /*
  * The VIRTIO_NET_F_GUEST_TSO[46] features permit the host to send us
-- 
1.7.10.4

  parent reply	other threads:[~2015-10-19 22:06 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 19:54 [dpdk-dev] [PATCHv5 0/8] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
2015-10-01 19:54 ` [dpdk-dev] [PATCHv5 1/8] " Konstantin Ananyev
2015-10-14 11:39   ` [dpdk-dev] [dpdk-dev, PATCHv5, " Amine Kherbouche
2015-10-14 11:49     ` Ananyev, Konstantin
2015-10-14 12:21       ` Amine Kherbouche
2015-10-14 12:42         ` Ananyev, Konstantin
2015-10-14 12:47           ` Amine Kherbouche
2015-10-14 12:48             ` Ananyev, Konstantin
2015-10-20  7:53       ` Qiu, Michael
2015-10-20  8:09         ` Vincent JARDIN
2015-10-20  8:32           ` Qiu, Michael
2015-10-14 12:44   ` [dpdk-dev] [PATCHv5 " Remy Horton
2015-10-14 16:09   ` Stephen Hemminger
2015-10-14 18:44     ` Ananyev, Konstantin
2015-10-16 13:16       ` Bruce Richardson
2015-10-19 22:06   ` [dpdk-dev] [dpdk-dev,PATCHv6 0/6] Enhance queue information API Amine Kherbouche
2015-10-19 22:06     ` [dpdk-dev] [dpdk-dev, PATCHv6 1/6] ethdev: enhance rte_eth_(tx|rx)q_info struct Amine Kherbouche
2015-10-19 22:44       ` Stephen Hemminger
2015-10-20  9:52         ` Ananyev, Konstantin
2015-10-20 14:55           ` Amine Kherbouche
2015-10-20  9:36       ` Ananyev, Konstantin
2015-10-20 15:16         ` Thomas Monjalon
2015-10-19 22:06     ` [dpdk-dev] [dpdk-dev, PATCHv6 2/6] testpmd: enhance the command to display RX/TX queue information Amine Kherbouche
2015-10-19 22:06     ` Amine Kherbouche [this message]
2015-10-20  7:31       ` [dpdk-dev] [dpdk-dev, PATCHv6 3/6] virtio: add support for eth_(rxq|txq)_info_get Tan, Jianfeng
2015-10-19 22:06     ` [dpdk-dev] [dpdk-dev, PATCHv6 4/6] e1000: enhance eth_(rxq|txq)_info_get to retrieve more queue information Amine Kherbouche
2015-10-19 22:06     ` [dpdk-dev] [dpdk-dev, PATCHv6 5/6] i40e: " Amine Kherbouche
2015-10-19 22:43       ` Stephen Hemminger
2015-10-19 22:06     ` [dpdk-dev] [dpdk-dev, PATCHv6 6/6] ixgbe: " Amine Kherbouche
2015-10-01 19:54 ` [dpdk-dev] [PATCHv5 2/8] i40e: add support for eth_(rxq|txq)_info_get and (rx|tx)_desc_lim Konstantin Ananyev
2015-10-14 12:46   ` Remy Horton
2015-10-01 19:54 ` [dpdk-dev] [PATCHv5 3/8] ixgbe: " Konstantin Ananyev
2015-10-14 12:47   ` Remy Horton
2015-10-01 19:54 ` [dpdk-dev] [PATCHv5 4/8] e1000: " Konstantin Ananyev
2015-10-14 12:48   ` Remy Horton
2015-10-01 19:54 ` [dpdk-dev] [PATCHv5 5/8] fm10k: add HW specific desc_lim data into dev_info Konstantin Ananyev
2015-10-14 12:48   ` Remy Horton
2015-10-01 19:54 ` [dpdk-dev] [PATCHv5 6/8] cxgbe: " Konstantin Ananyev
2015-10-14 12:49   ` Remy Horton
2015-10-01 19:54 ` [dpdk-dev] [PATCHv5 7/8] vmxnet3: " Konstantin Ananyev
2015-10-14 12:49   ` Remy Horton
2015-10-01 19:54 ` [dpdk-dev] [PATCHv5 8/8] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
2015-10-14 12:49   ` Remy Horton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445292384-19815-4-git-send-email-amine.kherbouche@6wind.com \
    --to=amine.kherbouche@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).