DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@amd.com>,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 1/2] net/virtio: support private dump
Date: Thu, 19 Jan 2023 12:30:55 +0000	[thread overview]
Message-ID: <20230119123056.14338-2-fengchengwen@huawei.com> (raw)
In-Reply-To: <20230119123056.14338-1-fengchengwen@huawei.com>

This patch implements eth_dev_priv_dump callback which could use for
debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/virtio/virtio_ethdev.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 760ba4e368..0ad740b253 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1019,6 +1019,24 @@ virtio_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
 	return 0;
 }
 
+static int
+virtio_dev_priv_dump(struct rte_eth_dev *dev, FILE *f)
+{
+	struct virtio_hw *hw = dev->data->dev_private;
+
+	fprintf(f, "guest_features: 0x%" PRIx64 "\n", hw->guest_features);
+	fprintf(f, "vtnet_hdr_size: %u\n", hw->vtnet_hdr_size);
+	fprintf(f, "use_vec: rx-%u tx-%u\n", hw->use_vec_rx, hw->use_vec_tx);
+	fprintf(f, "use_inorder: rx-%u tx-%u\n", hw->use_inorder_rx, hw->use_inorder_tx);
+	fprintf(f, "intr_lsc: %u\n", hw->intr_lsc);
+	fprintf(f, "max_mtu: %u\n", hw->max_mtu);
+	fprintf(f, "max_rx_pkt_len: %zu\n", hw->max_rx_pkt_len);
+	fprintf(f, "max_queue_pairs: %u\n", hw->max_queue_pairs);
+	fprintf(f, "req_guest_features: 0x%" PRIx64 "\n", hw->req_guest_features);
+
+	return 0;
+}
+
 /*
  * dev_ops for virtio, bare necessities for basic operation
  */
@@ -1055,6 +1073,7 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {
 	.mac_addr_remove         = virtio_mac_addr_remove,
 	.mac_addr_set            = virtio_mac_addr_set,
 	.get_monitor_addr        = virtio_get_monitor_addr,
+	.eth_dev_priv_dump       = virtio_dev_priv_dump,
 };
 
 /*
-- 
2.17.1


  reply	other threads:[~2023-01-19 12:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 12:30 [PATCH 0/2] add private dump for vhost and virtio Chengwen Feng
2023-01-19 12:30 ` Chengwen Feng [this message]
2023-02-01 10:29   ` [PATCH 1/2] net/virtio: support private dump Maxime Coquelin
2023-01-19 12:30 ` [PATCH 2/2] net/vhost: " Chengwen Feng
2023-02-01 10:29   ` Maxime Coquelin
2023-02-03 14:59 ` [PATCH 0/2] add private dump for vhost and virtio Maxime Coquelin

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=20230119123056.14338-2-fengchengwen@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=thomas@monjalon.net \
    /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).