!353 [sync] PR-329: add private dump for bonding, virtio, and vhost

From: @openeuler-sync-bot 
Reviewed-by: @li-huisong 
Signed-off-by: @li-huisong
This commit is contained in:
openeuler-ci-bot 2023-04-26 07:21:26 +00:00 committed by Gitee
commit 415d81ef3a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 547 additions and 1 deletions

View File

@ -0,0 +1,150 @@
From fdbebc668c5df36d34a64ba627b6e373263c1fca Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Wed, 14 Dec 2022 06:13:23 +0000
Subject: net/bonding: support private dump operation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[ upstream commit 29e89fb1e30cf12937dec8a3f4f7ab86f0303d24 ]
This patch implements eth_dev_priv_dump ops which could enhance the
debug capability.
The dump output is similar to testpmd command
"show bonding config [port]".
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-byMin Hu (Connor) <humin29@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
drivers/net/bonding/rte_eth_bond_pmd.c | 105 ++++++++++++++++++++++++-
1 file changed, 104 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 29871cf8a3..cf7d275bf5 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3297,6 +3297,108 @@ bond_ethdev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
rte_spinlock_unlock(&internals->lock);
}
+static const char *
+bond_mode_name(uint8_t mode)
+{
+ switch (mode) {
+ case BONDING_MODE_ROUND_ROBIN:
+ return "ROUND_ROBIN";
+ case BONDING_MODE_ACTIVE_BACKUP:
+ return "ACTIVE_BACKUP";
+ case BONDING_MODE_BALANCE:
+ return "BALANCE";
+ case BONDING_MODE_BROADCAST:
+ return "BROADCAST";
+ case BONDING_MODE_8023AD:
+ return "8023AD";
+ case BONDING_MODE_TLB:
+ return "TLB";
+ case BONDING_MODE_ALB:
+ return "ALB";
+ default:
+ return "Unknown";
+ }
+}
+
+static int
+bond_ethdev_priv_dump(struct rte_eth_dev *dev, FILE *f)
+{
+ struct bond_dev_private instant_priv;
+ const struct bond_dev_private *internals = &instant_priv;
+ int mode, i;
+
+ /* Obtain a instance of dev_private to prevent data from being modified. */
+ memcpy(&instant_priv, dev->data->dev_private, sizeof(struct bond_dev_private));
+ mode = internals->mode;
+
+ fprintf(f, " - Dev basic:\n");
+ fprintf(f, "\tBonding mode: %s(%d)\n", bond_mode_name(mode), mode);
+
+ if (mode == BONDING_MODE_BALANCE || mode == BONDING_MODE_8023AD) {
+ fprintf(f, "\tBalance Xmit Policy: ");
+ switch (internals->balance_xmit_policy) {
+ case BALANCE_XMIT_POLICY_LAYER2:
+ fprintf(f, "BALANCE_XMIT_POLICY_LAYER2");
+ break;
+ case BALANCE_XMIT_POLICY_LAYER23:
+ fprintf(f, "BALANCE_XMIT_POLICY_LAYER23");
+ break;
+ case BALANCE_XMIT_POLICY_LAYER34:
+ fprintf(f, "BALANCE_XMIT_POLICY_LAYER34");
+ break;
+ default:
+ fprintf(f, "Unknown");
+ }
+ fprintf(f, "\n");
+ }
+
+ if (mode == BONDING_MODE_8023AD) {
+ fprintf(f, "\tIEEE802.3AD Aggregator Mode: ");
+ switch (internals->mode4.agg_selection) {
+ case AGG_BANDWIDTH:
+ fprintf(f, "bandwidth");
+ break;
+ case AGG_STABLE:
+ fprintf(f, "stable");
+ break;
+ case AGG_COUNT:
+ fprintf(f, "count");
+ break;
+ default:
+ fprintf(f, "unknown");
+ }
+ fprintf(f, "\n");
+ }
+
+ if (internals->slave_count > 0) {
+ fprintf(f, "\tSlaves (%u): [", internals->slave_count);
+ for (i = 0; i < internals->slave_count - 1; i++)
+ fprintf(f, "%u ", internals->slaves[i].port_id);
+
+ fprintf(f, "%u]\n", internals->slaves[internals->slave_count - 1].port_id);
+ } else {
+ fprintf(f, "\tSlaves: []\n");
+ }
+
+ if (internals->active_slave_count > 0) {
+ fprintf(f, "\tActive Slaves (%u): [", internals->active_slave_count);
+ for (i = 0; i < internals->active_slave_count - 1; i++)
+ fprintf(f, "%u ", internals->active_slaves[i]);
+
+ fprintf(f, "%u]\n", internals->active_slaves[internals->active_slave_count - 1]);
+
+ } else {
+ fprintf(f, "\tActive Slaves: []\n");
+ }
+
+ if (internals->user_defined_primary_port)
+ fprintf(f, "\tUser Defined Primary: [%u]\n", internals->primary_port);
+ if (internals->slave_count > 0)
+ fprintf(f, "\tCurrent Primary: [%u]\n", internals->current_primary_port);
+
+ return 0;
+}
+
const struct eth_dev_ops default_dev_ops = {
.dev_start = bond_ethdev_start,
.dev_stop = bond_ethdev_stop,
@@ -3323,7 +3425,8 @@ const struct eth_dev_ops default_dev_ops = {
.mac_addr_set = bond_ethdev_mac_address_set,
.mac_addr_add = bond_ethdev_mac_addr_add,
.mac_addr_remove = bond_ethdev_mac_addr_remove,
- .flow_ops_get = bond_flow_ops_get
+ .flow_ops_get = bond_flow_ops_get,
+ .eth_dev_priv_dump = bond_ethdev_priv_dump,
};
static int
--
2.23.0

View File

@ -0,0 +1,187 @@
From a74801e4c1d59a8e40317c8ea9e4ba3a5472d633 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Wed, 14 Dec 2022 06:13:24 +0000
Subject: net/bonding: add LACP info dump
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[ upstream commit b00119fc03dc585213236ea7f550662befa68fbe ]
This patch adds dump lacp info in eth_dev_priv_dump ops.
The extra dump output is similar to testpmd command
"show bonding lacp info [port]".
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-byMin Hu (Connor) <humin29@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
drivers/net/bonding/rte_eth_bond_pmd.c | 143 ++++++++++++++++++++++++-
1 file changed, 141 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index cf7d275bf5..0f2b21a568 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3320,8 +3320,8 @@ bond_mode_name(uint8_t mode)
}
}
-static int
-bond_ethdev_priv_dump(struct rte_eth_dev *dev, FILE *f)
+static void
+dump_basic(const struct rte_eth_dev *dev, FILE *f)
{
struct bond_dev_private instant_priv;
const struct bond_dev_private *internals = &instant_priv;
@@ -3395,6 +3395,145 @@ bond_ethdev_priv_dump(struct rte_eth_dev *dev, FILE *f)
fprintf(f, "\tUser Defined Primary: [%u]\n", internals->primary_port);
if (internals->slave_count > 0)
fprintf(f, "\tCurrent Primary: [%u]\n", internals->current_primary_port);
+}
+
+static void
+dump_lacp_conf(const struct rte_eth_bond_8023ad_conf *conf, FILE *f)
+{
+ fprintf(f, "\tfast period: %u ms\n", conf->fast_periodic_ms);
+ fprintf(f, "\tslow period: %u ms\n", conf->slow_periodic_ms);
+ fprintf(f, "\tshort timeout: %u ms\n", conf->short_timeout_ms);
+ fprintf(f, "\tlong timeout: %u ms\n", conf->long_timeout_ms);
+ fprintf(f, "\taggregate wait timeout: %u ms\n",
+ conf->aggregate_wait_timeout_ms);
+ fprintf(f, "\ttx period: %u ms\n", conf->tx_period_ms);
+ fprintf(f, "\trx marker period: %u ms\n", conf->rx_marker_period_ms);
+ fprintf(f, "\tupdate timeout: %u ms\n", conf->update_timeout_ms);
+ switch (conf->agg_selection) {
+ case AGG_BANDWIDTH:
+ fprintf(f, "\taggregation mode: bandwidth\n");
+ break;
+ case AGG_STABLE:
+ fprintf(f, "\taggregation mode: stable\n");
+ break;
+ case AGG_COUNT:
+ fprintf(f, "\taggregation mode: count\n");
+ break;
+ default:
+ fprintf(f, "\taggregation mode: invalid\n");
+ break;
+ }
+ fprintf(f, "\n");
+}
+
+static void
+dump_lacp_port_param(const struct port_params *params, FILE *f)
+{
+ char buf[RTE_ETHER_ADDR_FMT_SIZE];
+ fprintf(f, "\t\tsystem priority: %u\n", params->system_priority);
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, &params->system);
+ fprintf(f, "\t\tsystem mac address: %s\n", buf);
+ fprintf(f, "\t\tport key: %u\n", params->key);
+ fprintf(f, "\t\tport priority: %u\n", params->port_priority);
+ fprintf(f, "\t\tport number: %u\n", params->port_number);
+}
+
+static void
+dump_lacp_slave(const struct rte_eth_bond_8023ad_slave_info *info, FILE *f)
+{
+ char a_state[256] = { 0 };
+ char p_state[256] = { 0 };
+ int a_len = 0;
+ int p_len = 0;
+ uint32_t i;
+
+ static const char * const state[] = {
+ "ACTIVE",
+ "TIMEOUT",
+ "AGGREGATION",
+ "SYNCHRONIZATION",
+ "COLLECTING",
+ "DISTRIBUTING",
+ "DEFAULTED",
+ "EXPIRED"
+ };
+ static const char * const selection[] = {
+ "UNSELECTED",
+ "STANDBY",
+ "SELECTED"
+ };
+
+ for (i = 0; i < RTE_DIM(state); i++) {
+ if ((info->actor_state >> i) & 1)
+ a_len += snprintf(&a_state[a_len],
+ RTE_DIM(a_state) - a_len, "%s ",
+ state[i]);
+
+ if ((info->partner_state >> i) & 1)
+ p_len += snprintf(&p_state[p_len],
+ RTE_DIM(p_state) - p_len, "%s ",
+ state[i]);
+ }
+ fprintf(f, "\tAggregator port id: %u\n", info->agg_port_id);
+ fprintf(f, "\tselection: %s\n", selection[info->selected]);
+ fprintf(f, "\tActor detail info:\n");
+ dump_lacp_port_param(&info->actor, f);
+ fprintf(f, "\t\tport state: %s\n", a_state);
+ fprintf(f, "\tPartner detail info:\n");
+ dump_lacp_port_param(&info->partner, f);
+ fprintf(f, "\t\tport state: %s\n", p_state);
+ fprintf(f, "\n");
+}
+
+static void
+dump_lacp(uint16_t port_id, FILE *f)
+{
+ struct rte_eth_bond_8023ad_slave_info slave_info;
+ struct rte_eth_bond_8023ad_conf port_conf;
+ uint16_t slaves[RTE_MAX_ETHPORTS];
+ int num_active_slaves;
+ int i, ret;
+
+ fprintf(f, " - Lacp info:\n");
+
+ num_active_slaves = rte_eth_bond_active_slaves_get(port_id, slaves,
+ RTE_MAX_ETHPORTS);
+ if (num_active_slaves < 0) {
+ fprintf(f, "\tFailed to get active slave list for port %u\n",
+ port_id);
+ return;
+ }
+
+ fprintf(f, "\tIEEE802.3 port: %u\n", port_id);
+ ret = rte_eth_bond_8023ad_conf_get(port_id, &port_conf);
+ if (ret) {
+ fprintf(f, "\tGet bonded device %u 8023ad config failed\n",
+ port_id);
+ return;
+ }
+ dump_lacp_conf(&port_conf, f);
+
+ for (i = 0; i < num_active_slaves; i++) {
+ ret = rte_eth_bond_8023ad_slave_info(port_id, slaves[i],
+ &slave_info);
+ if (ret) {
+ fprintf(f, "\tGet slave device %u 8023ad info failed\n",
+ slaves[i]);
+ return;
+ }
+ fprintf(f, "\tSlave Port: %u\n", slaves[i]);
+ dump_lacp_slave(&slave_info, f);
+ }
+}
+
+static int
+bond_ethdev_priv_dump(struct rte_eth_dev *dev, FILE *f)
+{
+ const struct bond_dev_private *internals = dev->data->dev_private;
+
+ dump_basic(dev, f);
+ if (internals->mode == BONDING_MODE_8023AD)
+ dump_lacp(dev->data->port_id, f);
return 0;
}
--
2.23.0

View File

@ -0,0 +1,56 @@
From a247b89fe26e5bae41159dfa59475c04ae53e8e2 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Thu, 19 Jan 2023 12:30:55 +0000
Subject: net/virtio: support private dump
[ upstream commit 426858d6a9975a26539f0398037558dcb418947a ]
This patch implements eth_dev_priv_dump callback which could use for
debugging.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.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 b317649d7e..a38b15d01c 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1018,6 +1018,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
*/
@@ -1054,6 +1072,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.23.0

View File

@ -0,0 +1,55 @@
From 423959cfe25c9dc231b80f3df59318585df3a023 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Thu, 19 Jan 2023 12:30:56 +0000
Subject: net/vhost: support private dump
[ upstream commit 47b9fb64c15d60e1c8c2c8f6e63824fd2cada428 ]
This patch implements eth_dev_priv_dump callback which could use for
debugging.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
drivers/net/vhost/rte_eth_vhost.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 070f0e6dfd..b120341d0c 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -1429,6 +1429,23 @@ 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, "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);
+
+ return 0;
+}
+
static const struct eth_dev_ops ops = {
.dev_start = eth_dev_start,
.dev_stop = eth_dev_stop,
@@ -1449,6 +1466,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
--
2.23.0

View File

@ -0,0 +1,37 @@
From 9f1acbbbe8050c3b8794d45a4af610f9e0774211 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Thu, 16 Mar 2023 09:32:16 +0000
Subject: app/testpmd: show private info in port info
[ upstream commit d0aa6cd7a43d737797ba139a7f18b879cc44dac3 ]
This patch adds dump private info in 'show port info [port_id]' cmd.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Aman Singh <aman.deep.singh@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
app/test-pmd/config.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 12386c4d82..873d1f1357 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -891,6 +891,13 @@ port_infos_display(portid_t port_id)
printf("Switch Rx domain: %u\n",
dev_info.switch_info.rx_domain);
}
+ printf("Device private info:\n");
+ ret = rte_eth_dev_priv_dump(port_id, stdout);
+ if (ret == -ENOTSUP)
+ printf(" none\n");
+ else if (ret < 0)
+ fprintf(stderr, " Failed to dump private info with error (%d): %s\n",
+ ret, strerror(-ret));
}
void
--
2.23.0

View File

@ -0,0 +1,48 @@
From 491333ae684b8303e019536900bb931b9f64b1ce Mon Sep 17 00:00:00 2001
From: Huisong Li <lihuisong@huawei.com>
Date: Thu, 16 Mar 2023 20:58:14 +0800
Subject: app/testpmd: display RSS hash key of flow rule
[ upstream commit f958bbe2210dcc888032e81ec1326c0df5e5c518 ]
There are two ways to set RSS hash key with rte flow rule:
1. 'key_len' isn't zero and 'key' is NULL.
2. 'key_len' isn't zero and 'key' isn't NULL.
This patch adds displaying for the hash key of rte flow rule.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
app/test-pmd/config.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 873d1f1357..78af232a8a 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1651,6 +1651,21 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
return;
}
+ printf(" RSS key:\n");
+ if (rss_conf->key_len == 0) {
+ printf(" none");
+ } else {
+ printf(" key_len: %u\n", rss_conf->key_len);
+ printf(" key: ");
+ if (rss_conf->key == NULL) {
+ printf("none");
+ } else {
+ for (i = 0; i < rss_conf->key_len; i++)
+ printf("%02X", rss_conf->key[i]);
+ }
+ }
+ printf("\n");
+
printf(" types:\n");
if (rss_conf->types == 0) {
printf(" none\n");
--
2.23.0

View File

@ -1,6 +1,6 @@
Name: dpdk
Version: 21.11
Release: 38
Release: 39
Packager: packaging@6wind.com
URL: http://dpdk.org
%global source_version 21.11
@ -276,6 +276,12 @@ Patch9254: 0254-net-hns3-add-verification-of-RSS-types.patch
Patch9255: 0255-test-mbuf-fix-mbuf-reset-test.patch
Patch9256: 0256-examples-l3fwd-power-support-CPPC-cpufreq.patch
Patch9257: 0257-hinic-free-mbuf-use-rte_pktmbuf_free_seg.patch
Patch9258: 0258-net-bonding-support-private-dump-operation.patch
Patch9259: 0259-net-bonding-add-LACP-info-dump.patch
Patch9260: 0260-net-virtio-support-private-dump.patch
Patch9261: 0261-net-vhost-support-private-dump.patch
Patch9262: 0262-app-testpmd-show-private-info-in-port-info.patch
Patch9263: 0263-app-testpmd-display-RSS-hash-key-of-flow-rule.patch
Summary: Data Plane Development Kit core
Group: System Environment/Libraries
@ -420,6 +426,13 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko
/usr/sbin/depmod
%changelog
* Tue Apr 04 2023 chenjiji <chenjiji09@163.com> - 21.11-39
Sync some patchs from upstreaming branch and modifies
are as follow:
1. Add private dump for bonding, virtio and vhost.
2. Support LACP info dump for bonding.
3. Display RSS hash key of flow rule in testpmd.
* Sat Apr 01 2023 jiangheng <jiangheng14@huawei.com> - 21.11-38
- build as shared libraries to reduce the size of debug packet