[2/2] net/vhost: support private dump

Message ID 20230119123056.14338-3-fengchengwen@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series add private dump for vhost and virtio |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

fengchengwen Jan. 19, 2023, 12:30 p.m. UTC
  This patch implements eth_dev_priv_dump callback which could use for
debugging.

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

Comments

Maxime Coquelin Feb. 1, 2023, 10:29 a.m. UTC | #1
On 1/19/23 13:30, Chengwen Feng wrote:
> This patch implements eth_dev_priv_dump callback which could use for
> debugging.
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
>   drivers/net/vhost/rte_eth_vhost.c | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index b152279fac..9c609b45a3 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -1484,6 +1484,26 @@ vhost_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc)
>   	return 0;
>   }
>   
> +static int
> +vhost_dev_priv_dump(struct rte_eth_dev *dev, FILE *f)
> +{
> +	struct pmd_internal *internal = dev->data->dev_private;
> +
> +	fprintf(f, "iface_name: %s\n", internal->iface_name);
> +	fprintf(f, "flags: 0x%" PRIx64 "\n", internal->flags);
> +	fprintf(f, "disable_flags: 0x%" PRIx64 "\n", internal->disable_flags);
> +	fprintf(f, "features: 0x%" PRIx64 "\n", internal->features);
> +	fprintf(f, "max_queues: %u\n", internal->max_queues);
> +	fprintf(f, "vid: %d\n", internal->vid);
> +	fprintf(f, "started: %d\n", rte_atomic32_read(&internal->started));
> +	fprintf(f, "dev_attached: %d\n", rte_atomic32_read(&internal->dev_attached));
> +	fprintf(f, "vlan_strip: %d\n", internal->vlan_strip);
> +	fprintf(f, "rx_sw_csum: %d\n", internal->rx_sw_csum);
> +	fprintf(f, "tx_sw_csum: %d\n", internal->tx_sw_csum);
> +
> +	return 0;
> +}
> +
>   static const struct eth_dev_ops ops = {
>   	.dev_start = eth_dev_start,
>   	.dev_stop = eth_dev_stop,
> @@ -1504,6 +1524,7 @@ static const struct eth_dev_ops ops = {
>   	.rx_queue_intr_enable = eth_rxq_intr_enable,
>   	.rx_queue_intr_disable = eth_rxq_intr_disable,
>   	.get_monitor_addr = vhost_get_monitor_addr,
> +	.eth_dev_priv_dump = vhost_dev_priv_dump,
>   };
>   
>   static int

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  

Patch

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index b152279fac..9c609b45a3 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -1484,6 +1484,26 @@  vhost_get_monitor_addr(void *rx_queue, struct rte_power_monitor_cond *pmc)
 	return 0;
 }
 
+static int
+vhost_dev_priv_dump(struct rte_eth_dev *dev, FILE *f)
+{
+	struct pmd_internal *internal = dev->data->dev_private;
+
+	fprintf(f, "iface_name: %s\n", internal->iface_name);
+	fprintf(f, "flags: 0x%" PRIx64 "\n", internal->flags);
+	fprintf(f, "disable_flags: 0x%" PRIx64 "\n", internal->disable_flags);
+	fprintf(f, "features: 0x%" PRIx64 "\n", internal->features);
+	fprintf(f, "max_queues: %u\n", internal->max_queues);
+	fprintf(f, "vid: %d\n", internal->vid);
+	fprintf(f, "started: %d\n", rte_atomic32_read(&internal->started));
+	fprintf(f, "dev_attached: %d\n", rte_atomic32_read(&internal->dev_attached));
+	fprintf(f, "vlan_strip: %d\n", internal->vlan_strip);
+	fprintf(f, "rx_sw_csum: %d\n", internal->rx_sw_csum);
+	fprintf(f, "tx_sw_csum: %d\n", internal->tx_sw_csum);
+
+	return 0;
+}
+
 static const struct eth_dev_ops ops = {
 	.dev_start = eth_dev_start,
 	.dev_stop = eth_dev_stop,
@@ -1504,6 +1524,7 @@  static const struct eth_dev_ops ops = {
 	.rx_queue_intr_enable = eth_rxq_intr_enable,
 	.rx_queue_intr_disable = eth_rxq_intr_disable,
 	.get_monitor_addr = vhost_get_monitor_addr,
+	.eth_dev_priv_dump = vhost_dev_priv_dump,
 };
 
 static int