Skip to contentSkip to conversation

net: mana: Expose hardware diagnostic info via debugfs

PATCH Superseded Erni Sri Satya Vennela 3 participants 7 messages Mar 19 – Mar 31

Subsystems (5)

v4 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net: mana: Expose hardware diagnostic info via debugfs

Add debugfs entries to expose hardware configuration and diagnostic information that aids in debugging driver initialization and runtime operations without adding noise to dmesg.

The debugfs directory creation and removal for each PCI device is integrated into mana_gd_setup() and mana_gd_cleanup_device() respectively, so that all callers (probe, remove, suspend, resume, shutdown) share a single code path.

Device-level entries (under /sys/kernel/debug/mana/<slot>/):
- num_msix_usable, max_num_queues: Max resources from hardware
- gdma_protocol_ver, pf_cap_flags1: VF version negotiation results
- num_vports, bm_hostmode: Device configuration

Per-vPort entries (under /sys/kernel/debug/mana/<slot>/vportN/):
- port_handle: Hardware vPort handle
- max_sq, max_rq: Max queues from vPort config
- indir_table_sz: Indirection table size
- steer_rx, steer_rss, steer_update_tab, steer_cqe_coalescing:
Last applied steering configuration parameters

---
Changes in v4:
* Rebase and fix conflicts.
Changes in v3:
* Rename mana_gd_cleanup to mana_gd_cleanup_device.
* Add creation of debugfs entries in mana_gd_setup.
* Add removal of debugfs entries in mana_gd_cleanup_device.
* Remove bm_hostmode and num_vports from debugfs in mana_remove itself, because "ac" gets freed before debugfs_remove_recursive, to avoid Use-After-Free error.
* Add "goto out:" in mana_cfg_vport_steering to avoid populating apc values when resp.hdr.status is not NULL.
Changes in v2:
* Add debugfs_remove_recursice for gc>mana_pci_debugfs in mana_gd_suspend to handle multiple duplicates creation in mana_gd_setup and mana_gd_resume path.
* Move debugfs creation for num_vports and bm_hostmode out of if(!resuming) condition since we have to create it again even for resume.
* Recreate mana_pci_debugfs in mana_gd_resume.

---
 .../net/ethernet/microsoft/mana/gdma_main.c   | 65 ++++++++++---------
 drivers/net/ethernet/microsoft/mana/mana_en.c | 34 ++++++++++
 include/net/mana/gdma.h                       |  1 +
 include/net/mana/mana.h                       |  8 +++
 4 files changed, 78 insertions(+), 30 deletions(-)
drivers/net/ethernet/microsoft/mana/gdma_main.c +35 -30
index 2ba1fa3336f9..5028858febef 100644
@@ -169,6 +169,11 @@ static int mana_gd_query_max_resources(struct pci_dev *pdev)
 	if (gc->max_num_queues > gc->num_msix_usable - 1)
 		gc->max_num_queues = gc->num_msix_usable - 1;
 
+	debugfs_create_u32("num_msix_usable", 0400, gc->mana_pci_debugfs,
+			   &gc->num_msix_usable);
+	debugfs_create_u32("max_num_queues", 0400, gc->mana_pci_debugfs,
+			   &gc->max_num_queues);
+
 	return 0;
 }
 
@@ -1239,6 +1244,13 @@ int mana_gd_verify_vf_version(struct pci_dev *pdev)
 		return err ? err : -EPROTO;
 	}
 	gc->pf_cap_flags1 = resp.pf_cap_flags1;
+	gc->gdma_protocol_ver = resp.gdma_protocol_ver;
+
+	debugfs_create_x64("gdma_protocol_ver", 0400, gc->mana_pci_debugfs,
+			   &gc->gdma_protocol_ver);
+	debugfs_create_x64("pf_cap_flags1", 0400, gc->mana_pci_debugfs,
+			   &gc->pf_cap_flags1);
+
 	if (resp.pf_cap_flags1 & GDMA_DRV_CAP_FLAG_1_HWC_TIMEOUT_RECONFIG) {
 		err = mana_gd_query_hwc_timeout(pdev, &hwc->hwc_timeout);
 		if (err) {
@@ -1918,15 +1930,23 @@ static int mana_gd_setup(struct pci_dev *pdev)
 	struct gdma_context *gc = pci_get_drvdata(pdev);
 	int err;
 
+	if (gc->is_pf)
+		gc->mana_pci_debugfs = debugfs_create_dir("0", mana_debugfs_root);
+	else
+		gc->mana_pci_debugfs = debugfs_create_dir(pci_slot_name(pdev->slot),
+							  mana_debugfs_root);
+
 	err = mana_gd_init_registers(pdev);
 	if (err)
-		return err;
+		goto remove_debugfs;
 
 	mana_smc_init(&gc->shm_channel, gc->dev, gc->shm_base);
 
 	gc->service_wq = alloc_ordered_workqueue("gdma_service_wq", 0);
-	if (!gc->service_wq)
-		return -ENOMEM;
+	if (!gc->service_wq) {
+		err = -ENOMEM;
+		goto remove_debugfs;
+	}
 
 	err = mana_gd_setup_hwc_irqs(pdev);
 	if (err) {
@@ -1967,11 +1987,14 @@ static int mana_gd_setup(struct pci_dev *pdev)
 free_workqueue:
 	destroy_workqueue(gc->service_wq);
 	gc->service_wq = NULL;
+remove_debugfs:
+	debugfs_remove_recursive(gc->mana_pci_debugfs);
+	gc->mana_pci_debugfs = NULL;
 	dev_err(&pdev->dev, "%s failed (error %d)\n", __func__, err);
 	return err;
 }
 
-static void mana_gd_cleanup(struct pci_dev *pdev)
+static void mana_gd_cleanup_device(struct pci_dev *pdev)
 {
 	struct gdma_context *gc = pci_get_drvdata(pdev);
 
@@ -1983,6 +2006,10 @@ static void mana_gd_cleanup(struct pci_dev *pdev)
 		destroy_workqueue(gc->service_wq);
 		gc->service_wq = NULL;
 	}
+
+	debugfs_remove_recursive(gc->mana_pci_debugfs);
+	gc->mana_pci_debugfs = NULL;
+
 	dev_dbg(&pdev->dev, "mana gdma cleanup successful\n");
 }
 
@@ -2040,12 +2067,6 @@ static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	gc->dev = &pdev->dev;
 	xa_init(&gc->irq_contexts);
 
-	if (gc->is_pf)
-		gc->mana_pci_debugfs = debugfs_create_dir("0", mana_debugfs_root);
-	else
-		gc->mana_pci_debugfs = debugfs_create_dir(pci_slot_name(pdev->slot),
-							  mana_debugfs_root);
-
 	err = mana_gd_setup(pdev);
 	if (err)
 		goto unmap_bar;
@@ -2074,16 +2095,8 @@ static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 cleanup_mana:
 	mana_remove(&gc->mana, false);
 cleanup_gd:
-	mana_gd_cleanup(pdev);
+	mana_gd_cleanup_device(pdev);
 unmap_bar:
-	/*
-	 * at this point we know that the other debugfs child dir/files
-	 * are either not yet created or are already cleaned up.
-	 * The pci debugfs folder clean-up now, will only be cleaning up
-	 * adapter-MTU file and apc->mana_pci_debugfs folder.
-	 */
-	debugfs_remove_recursive(gc->mana_pci_debugfs);
-	gc->mana_pci_debugfs = NULL;
 	xa_destroy(&gc->irq_contexts);
 	pci_iounmap(pdev, bar0_va);
 free_gc:
@@ -2133,11 +2146,7 @@ static void mana_gd_remove(struct pci_dev *pdev)
 	mana_rdma_remove(&gc->mana_ib);
 	mana_remove(&gc->mana, false);
 
-	mana_gd_cleanup(pdev);
-
-	debugfs_remove_recursive(gc->mana_pci_debugfs);
-
-	gc->mana_pci_debugfs = NULL;
+	mana_gd_cleanup_device(pdev);
 
 	xa_destroy(&gc->irq_contexts);
 
@@ -2159,7 +2168,7 @@ int mana_gd_suspend(struct pci_dev *pdev, pm_message_t state)
 	mana_rdma_remove(&gc->mana_ib);
 	mana_remove(&gc->mana, true);
 
-	mana_gd_cleanup(pdev);
+	mana_gd_cleanup_device(pdev);
 
 	return 0;
 }
@@ -2198,11 +2207,7 @@ static void mana_gd_shutdown(struct pci_dev *pdev)
 	mana_rdma_remove(&gc->mana_ib);
 	mana_remove(&gc->mana, true);
 
-	mana_gd_cleanup(pdev);
-
-	debugfs_remove_recursive(gc->mana_pci_debugfs);
-
-	gc->mana_pci_debugfs = NULL;
+	mana_gd_cleanup_device(pdev);
 
 	pci_disable_device(pdev);
 }
drivers/net/ethernet/microsoft/mana/mana_en.c +34 -0
index 49c65cc1697c..ae80e9fb66b7 100644
@@ -1263,6 +1263,9 @@ static int mana_query_vport_cfg(struct mana_port_context *apc, u32 vport_index,
 	apc->port_handle = resp.vport;
 	ether_addr_copy(apc->mac_addr, resp.mac_addr);
 
+	apc->vport_max_sq = *max_sq;
+	apc->vport_max_rq = *max_rq;
+
 	return 0;
 }
 
@@ -1417,6 +1420,11 @@ static int mana_cfg_vport_steering(struct mana_port_context *apc,
 
 	netdev_info(ndev, "Configured steering vPort %llu entries %u\n",
 		    apc->port_handle, apc->indir_table_sz);
+
+	apc->steer_rx = rx;
+	apc->steer_rss = apc->rss_state;
+	apc->steer_update_tab = update_tab;
+	apc->steer_cqe_coalescing = req->cqe_coalescing_enable;
 out:
 	kfree(req);
 	return err;
@@ -3141,6 +3149,24 @@ static int mana_init_port(struct net_device *ndev)
 	eth_hw_addr_set(ndev, apc->mac_addr);
 	sprintf(vport, "vport%d", port_idx);
 	apc->mana_port_debugfs = debugfs_create_dir(vport, gc->mana_pci_debugfs);
+
+	debugfs_create_u64("port_handle", 0400, apc->mana_port_debugfs,
+			   &apc->port_handle);
+	debugfs_create_u32("max_sq", 0400, apc->mana_port_debugfs,
+			   &apc->vport_max_sq);
+	debugfs_create_u32("max_rq", 0400, apc->mana_port_debugfs,
+			   &apc->vport_max_rq);
+	debugfs_create_u32("indir_table_sz", 0400, apc->mana_port_debugfs,
+			   &apc->indir_table_sz);
+	debugfs_create_u32("steer_rx", 0400, apc->mana_port_debugfs,
+			   &apc->steer_rx);
+	debugfs_create_u32("steer_rss", 0400, apc->mana_port_debugfs,
+			   &apc->steer_rss);
+	debugfs_create_u32("steer_update_tab", 0400, apc->mana_port_debugfs,
+			   &apc->steer_update_tab);
+	debugfs_create_u32("steer_cqe_coalescing", 0400, apc->mana_port_debugfs,
+			   &apc->steer_cqe_coalescing);
+
 	return 0;
 
 reset_apc:
@@ -3630,6 +3656,11 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
 
 	ac->bm_hostmode = bm_hostmode;
 
+	debugfs_create_u16("num_vports", 0400, gc->mana_pci_debugfs,
+			   &ac->num_ports);
+	debugfs_create_u8("bm_hostmode", 0400, gc->mana_pci_debugfs,
+			  &ac->bm_hostmode);
+
 	if (!resuming) {
 		ac->num_ports = num_ports;
 
@@ -3770,6 +3801,9 @@ void mana_remove(struct gdma_dev *gd, bool suspending)
 
 	mana_gd_deregister_device(gd);
 
+	debugfs_lookup_and_remove("bm_hostmode", gc->mana_pci_debugfs);
+	debugfs_lookup_and_remove("num_vports", gc->mana_pci_debugfs);
+
 	if (suspending)
 		return;
 
include/net/mana/gdma.h +1 -0
index 7fe3a1b61b2d..c4e3ce5147f7 100644
@@ -442,6 +442,7 @@ struct gdma_context {
 	struct gdma_dev		mana_ib;
 
 	u64 pf_cap_flags1;
+	u64 gdma_protocol_ver;
 
 	struct workqueue_struct *service_wq;
 
include/net/mana/mana.h +8 -0
index 3336688fed5e..1d4223a78010 100644
@@ -568,6 +568,14 @@ struct mana_port_context {
 
 	/* Debugfs */
 	struct dentry *mana_port_debugfs;
+
+	/* Cached vport/steering config for debugfs */
+	u32 vport_max_sq;
+	u32 vport_max_rq;
+	u32 steer_rx;
+	u32 steer_rss;
+	u32 steer_update_tab;
+	u32 steer_cqe_coalescing;
 };
 
 netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev);
Signature · 1 line
2.34.1
reviewer Reviewed-by on v4 1/1
#1 lore raw
Quoted 22 lines · Erni Sri Satya Vennela

Add debugfs entries to expose hardware configuration and diagnostic information that aids in debugging driver initialization and runtime operations without adding noise to dmesg.

The debugfs directory creation and removal for each PCI device is integrated into mana_gd_setup() and mana_gd_cleanup_device() respectively, so that all callers (probe, remove, suspend, resume, shutdown) share a single code path.

Device-level entries (under /sys/kernel/debug/mana/<slot>/):
- num_msix_usable, max_num_queues: Max resources from hardware
- gdma_protocol_ver, pf_cap_flags1: VF version negotiation results
- num_vports, bm_hostmode: Device configuration

Per-vPort entries (under /sys/kernel/debug/mana/<slot>/vportN/):
- port_handle: Hardware vPort handle
- max_sq, max_rq: Max queues from vPort config
- indir_table_sz: Indirection table size
- steer_rx, steer_rss, steer_update_tab, steer_cqe_coalescing:
Last applied steering configuration parameters

Quoted 12 lines

---
Changes in v4:
* Rebase and fix conflicts.
Changes in v3:
* Rename mana_gd_cleanup to mana_gd_cleanup_device.
* Add creation of debugfs entries in mana_gd_setup.
* Add removal of debugfs entries in mana_gd_cleanup_device.
* Remove bm_hostmode and num_vports from debugfs in mana_remove itself, because "ac" gets freed before debugfs_remove_recursive, to avoid Use-After-Free error.
* Add "goto out:" in mana_cfg_vport_steering to avoid populating apc values when resp.hdr.status is not NULL.

Thanks for the updates.

maintainer
#2 lore raw
In reply to Erni Sri Satya Vennela
Quoted 14 lines · On Thu, 19 Mar 2026 00:09:13 -0700 Erni Sri Satya Vennela wrote:

Add debugfs entries to expose hardware configuration and diagnostic information that aids in debugging driver initialization and runtime operations without adding noise to dmesg.

The debugfs directory creation and removal for each PCI device is integrated into mana_gd_setup() and mana_gd_cleanup_device() respectively, so that all callers (probe, remove, suspend, resume, shutdown) share a single code path.

Device-level entries (under /sys/kernel/debug/mana/<slot>/):
- num_msix_usable, max_num_queues: Max resources from hardware
- gdma_protocol_ver, pf_cap_flags1: VF version negotiation results
- num_vports, bm_hostmode: Device configuration

Quoted 6 lines

Per-vPort entries (under /sys/kernel/debug/mana/<slot>/vportN/):
- port_handle: Hardware vPort handle
- max_sq, max_rq: Max queues from vPort config
- indir_table_sz: Indirection table size
- steer_rx, steer_rss, steer_update_tab, steer_cqe_coalescing:
Last applied steering configuration parameters

AI says:

drivers/net/ethernet/microsoft/mana/gdma_main.c static int mana_gd_setup(struct pci_dev *pdev) · line 1937

Quoted 9 lines
drivers/net/ethernet/microsoft/mana/gdma_main.c +5 -0
@@ -1918,15 +1930,23 @@ static int mana_gd_setup(struct pci_dev *pdev)
 	struct gdma_context *gc = pci_get_drvdata(pdev);
 	int err;
 
+	if (gc->is_pf)
+		gc->mana_pci_debugfs = debugfs_create_dir("0", mana_debugfs_root);
+	else
+		gc->mana_pci_debugfs = debugfs_create_dir(pci_slot_name(pdev->slot),
+							  mana_debugfs_root);

If pdev->slot is NULL (which can happen for VFs in environments like generic VFIO passthrough or nested KVM), will pci_slot_name(pdev->slot) cause a NULL pointer dereference?

Also, could this naming scheme cause name collisions? If multiple PFs are present, they would all try to use "0". Similarly, VFs across different PCI domains or buses might share the same physical slot identifier, leading to -EEXIST errors. Would it be safer to use the unique PCI BDF via pci_name(pdev) instead?

drivers/net/ethernet/microsoft/mana/mana_en.c static int mana_init_port(struct net_device *ndev) · line 3154

Quoted 7 lines
drivers/net/ethernet/microsoft/mana/mana_en.c +3 -0
@@ -3141,6 +3149,24 @@ static int mana_init_port(struct net_device *ndev)
 	eth_hw_addr_set(ndev, apc->mac_addr);
 	sprintf(vport, "vport%d", port_idx);
 	apc->mana_port_debugfs = debugfs_create_dir(vport, gc->mana_pci_debugfs);
+
+	debugfs_create_u64("port_handle", 0400, apc->mana_port_debugfs,
+			   &apc->port_handle);

When operations like changing the MTU or setting an XDP program trigger a detach/attach cycle, mana_detach() invokes mana_cleanup_port_context(), which recursively removes the apc->mana_port_debugfs directory. During re-attachment, mana_attach() calls mana_init_port(), which recreates the directory and the new files added in this patch. However, the pre-existing current_speed file (created in mana_probe_port()) is not recreated here.

Does this cause the current_speed file to be permanently lost after a detach/attach cycle? Should the creation of current_speed be moved to mana_init_port() so it survives the cycle?

Signature · 1 line
pw-bot: cr
#3 lore raw
Quoted 38 lines · Jakub Kicinski
Quoted 14 lines · On Thu, 19 Mar 2026 00:09:13 -0700 Erni Sri Satya Vennela wrote:

Add debugfs entries to expose hardware configuration and diagnostic information that aids in debugging driver initialization and runtime operations without adding noise to dmesg.

The debugfs directory creation and removal for each PCI device is integrated into mana_gd_setup() and mana_gd_cleanup_device() respectively, so that all callers (probe, remove, suspend, resume, shutdown) share a single code path.

Device-level entries (under /sys/kernel/debug/mana/<slot>/):
- num_msix_usable, max_num_queues: Max resources from hardware
- gdma_protocol_ver, pf_cap_flags1: VF version negotiation results
- num_vports, bm_hostmode: Device configuration

Quoted 6 lines

Per-vPort entries (under /sys/kernel/debug/mana/<slot>/vportN/):
- port_handle: Hardware vPort handle
- max_sq, max_rq: Max queues from vPort config
- indir_table_sz: Indirection table size
- steer_rx, steer_rss, steer_update_tab, steer_cqe_coalescing:
Last applied steering configuration parameters

AI says:

drivers/net/ethernet/microsoft/mana/gdma_main.c static int mana_gd_setup(struct pci_dev *pdev) · line 1937

Quoted 9 lines
drivers/net/ethernet/microsoft/mana/gdma_main.c +5 -0
@@ -1918,15 +1930,23 @@ static int mana_gd_setup(struct pci_dev *pdev)
 	struct gdma_context *gc = pci_get_drvdata(pdev);
 	int err;
 
+	if (gc->is_pf)
+		gc->mana_pci_debugfs = debugfs_create_dir("0", mana_debugfs_root);
+	else
+		gc->mana_pci_debugfs = debugfs_create_dir(pci_slot_name(pdev->slot),
+							  mana_debugfs_root);

If pdev->slot is NULL (which can happen for VFs in environments like generic VFIO passthrough or nested KVM), will pci_slot_name(pdev->slot) cause a NULL pointer dereference?

Quoted 5 lines

Also, could this naming scheme cause name collisions? If multiple PFs are present, they would all try to use "0". Similarly, VFs across different PCI domains or buses might share the same physical slot identifier, leading to -EEXIST errors. Would it be safer to use the unique PCI BDF via pci_name(pdev) instead?

Yes. that is a better way to handle it. I will use pci_name. We can remove if-else and use only one for both the cases.

Quoted 17 lines

drivers/net/ethernet/microsoft/mana/mana_en.c static int mana_init_port(struct net_device *ndev) · line 3154

Quoted 8 lines
drivers/net/ethernet/microsoft/mana/mana_en.c +3 -0
@@ -3141,6 +3149,24 @@ static int mana_init_port(struct net_device *ndev)
 	eth_hw_addr_set(ndev, apc->mac_addr);
 	sprintf(vport, "vport%d", port_idx);
 	apc->mana_port_debugfs = debugfs_create_dir(vport, gc->mana_pci_debugfs);
+
+	debugfs_create_u64("port_handle", 0400, apc->mana_port_debugfs,
+			   &apc->port_handle);

When operations like changing the MTU or setting an XDP program trigger a detach/attach cycle, mana_detach() invokes mana_cleanup_port_context(), which recursively removes the apc->mana_port_debugfs directory. During re-attachment, mana_attach() calls mana_init_port(), which recreates the directory and the new files added in this patch. However, the pre-existing current_speed file (created in mana_probe_port()) is not recreated here.

Quoted 3 lines

Does this cause the current_speed file to be permanently lost after a detach/attach cycle? Should the creation of current_speed be moved to mana_init_port() so it survives the cycle?

Yes that is correct.

Since these issues are pre-existing and not introduced from my patch. I'll plan to send them as different patch with fixes tag.

Quoted 2 lines
Signature · 1 line
pw-bot: cr
#4 lore raw
Quoted 63 lines · Erni Sri Satya Vennela
Quoted 38 lines · Jakub Kicinski
Quoted 14 lines · On Thu, 19 Mar 2026 00:09:13 -0700 Erni Sri Satya Vennela wrote:

Add debugfs entries to expose hardware configuration and diagnostic information that aids in debugging driver initialization and runtime operations without adding noise to dmesg.

The debugfs directory creation and removal for each PCI device is integrated into mana_gd_setup() and mana_gd_cleanup_device() respectively, so that all callers (probe, remove, suspend, resume, shutdown) share a single code path.

Device-level entries (under /sys/kernel/debug/mana/<slot>/):
- num_msix_usable, max_num_queues: Max resources from hardware
- gdma_protocol_ver, pf_cap_flags1: VF version negotiation results
- num_vports, bm_hostmode: Device configuration

Quoted 6 lines

Per-vPort entries (under /sys/kernel/debug/mana/<slot>/vportN/):
- port_handle: Hardware vPort handle
- max_sq, max_rq: Max queues from vPort config
- indir_table_sz: Indirection table size
- steer_rx, steer_rss, steer_update_tab, steer_cqe_coalescing:
Last applied steering configuration parameters

AI says:

drivers/net/ethernet/microsoft/mana/gdma_main.c static int mana_gd_setup(struct pci_dev *pdev) · line 1937

Quoted 9 lines
drivers/net/ethernet/microsoft/mana/gdma_main.c +5 -0
@@ -1918,15 +1930,23 @@ static int mana_gd_setup(struct pci_dev *pdev)
 	struct gdma_context *gc = pci_get_drvdata(pdev);
 	int err;
 
+	if (gc->is_pf)
+		gc->mana_pci_debugfs = debugfs_create_dir("0", mana_debugfs_root);
+	else
+		gc->mana_pci_debugfs = debugfs_create_dir(pci_slot_name(pdev->slot),
+							  mana_debugfs_root);

If pdev->slot is NULL (which can happen for VFs in environments like generic VFIO passthrough or nested KVM), will pci_slot_name(pdev->slot) cause a NULL pointer dereference?

Quoted 5 lines

Also, could this naming scheme cause name collisions? If multiple PFs are present, they would all try to use "0". Similarly, VFs across different PCI domains or buses might share the same physical slot identifier, leading to -EEXIST errors. Would it be safer to use the unique PCI BDF via pci_name(pdev) instead?

Yes. that is a better way to handle it. I will use pci_name. We can remove if-else and use only one for both the cases.

Quoted 17 lines

drivers/net/ethernet/microsoft/mana/mana_en.c static int mana_init_port(struct net_device *ndev) · line 3154

Quoted 8 lines
drivers/net/ethernet/microsoft/mana/mana_en.c +3 -0
@@ -3141,6 +3149,24 @@ static int mana_init_port(struct net_device *ndev)
 	eth_hw_addr_set(ndev, apc->mac_addr);
 	sprintf(vport, "vport%d", port_idx);
 	apc->mana_port_debugfs = debugfs_create_dir(vport, gc->mana_pci_debugfs);
+
+	debugfs_create_u64("port_handle", 0400, apc->mana_port_debugfs,
+			   &apc->port_handle);

When operations like changing the MTU or setting an XDP program trigger a detach/attach cycle, mana_detach() invokes mana_cleanup_port_context(), which recursively removes the apc->mana_port_debugfs directory. During re-attachment, mana_attach() calls mana_init_port(), which recreates the directory and the new files added in this patch. However, the pre-existing current_speed file (created in mana_probe_port()) is not recreated here.

Quoted 9 lines
Quoted 3 lines

Does this cause the current_speed file to be permanently lost after a detach/attach cycle? Should the creation of current_speed be moved to mana_init_port() so it survives the cycle?

Yes that is correct.

Since these issues are pre-existing and not introduced from my patch. I'll plan to send them as different patch with fixes tag.

Quoted 2 lines
Signature · 1 line
pw-bot: cr

Hi Jakub,

Just a quick follow‑up on this. Since these issues were pre‑existing and not introduced by this patch, would you prefer that I send them as a separate fix patch, or fold the fixes into the current patch?

Thanks,
Vennela

maintainer
#5 lore raw
Quoted 3 lines · On Mon, 30 Mar 2026 12:09:52 -0700 Erni Sri Satya Vennela wrote:

Just a quick follow‑up on this. Since these issues were pre‑existing and not introduced by this patch, would you prefer that I send them as a separate fix patch, or fold the fixes into the current patch?

Anything that's pre-existing should be a separate patch, before any new code. If the bug exists only in net-next - earlier in the same series, if the bug exists in net - posted separately for the net tree.

#6 lore raw
Quoted 8 lines · Jakub Kicinski
Quoted 3 lines · On Mon, 30 Mar 2026 12:09:52 -0700 Erni Sri Satya Vennela wrote:

Just a quick follow‑up on this. Since these issues were pre‑existing and not introduced by this patch, would you prefer that I send them as a separate fix patch, or fold the fixes into the current patch?

Anything that's pre-existing should be a separate patch, before any new code. If the bug exists only in net-next - earlier in the same series, if the bug exists in net - posted separately for the net tree.

Thankyou for the explanation.
I will send it in a separate patch.

- Vennela