Skip to contentSkip to conversation

vdpa/mlx5: Add and remove debugfs in setup/teardown driver

PATCH Michael S. Tsirkin 1 participant 1 message Mar 27, 2023 1 message not in the archive virtio core

lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#1 lore raw
In reply to a message not in the archive
Quoted 1 line · Eli Cohen

The right place to add the debufs create is in

s/debufs/debugfs/

Quoted 43 lines

setup_driver() and remove it in teardown_driver().

Current code adds the debugfs when creating the device but resetting a device will remove the debugfs subtree and subsequent set_driver will not be able to create the files since the debugfs pointer is NULL.

Fixes 294221004322 ("vdpa/mlx5: Add debugfs subtree")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +3 -1
index 2805d58378fb..d012732e3835 100644
@@ -2547,6 +2547,7 @@ static int setup_driver(struct mlx5_vdpa_dev *mvdev)
 		err = 0;
 		goto out;
 	}
+	mlx5_vdpa_add_debugfs(ndev);
 	err = setup_virtqueues(mvdev);
 	if (err) {
 		mlx5_vdpa_warn(mvdev, "setup_virtqueues\n");
@@ -2593,6 +2594,8 @@ static void teardown_driver(struct mlx5_vdpa_net *ndev)
 	if (!ndev->setup)
 		return;
 
+	mlx5_vdpa_remove_debugfs(ndev->debugfs);
+	ndev->debugfs = NULL;
 	teardown_steering(ndev);
 	destroy_tir(ndev);
 	destroy_rqt(ndev);
@@ -3313,7 +3316,6 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
 	if (err)
 		goto err_reg;
 
-	mlx5_vdpa_add_debugfs(ndev);
 	mgtdev->ndev = ndev;
 	return 0;
 
Signature · 1 line
2.38.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization