Jason Wang
2023-Mar-30 03:47 UTC
[PATCH v2] vdpa/mlx5: Add and remove debugfs in setup/teardown driver
On Tue, Mar 28, 2023 at 3:18?PM Eli Cohen <elic at nvidia.com> wrote:> > The right place to add the debugfs create is in > 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") > Signed-off-by: Eli Cohen <elic at nvidia.com>Acked-by: Jason Wang <jasowang at redhat.com> Thanks> > --- > v1 -> v2: > Fix spelling errors > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index b73c5943aefd..f24aa7a7c735 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -2538,6 +2538,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"); > @@ -2584,6 +2585,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); > @@ -3304,7 +3307,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; > > -- > 2.38.1 >