dpdk/0258-net-bonding-support-private-dump-operation.patch
chenjiji09 ca33ddf86e add private dump for bonding, virtio and vhost
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.

(cherry picked from commit cf2e60ea2545fa9c52a6778ad230e3d8dca703e3)
2023-04-23 17:24:14 +08:00

151 lines
4.4 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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