Skip to contentSkip to conversation

vdpa/mlx5: Extract correct pointer from driver data

PATCH In review Eli Cohen 3 participants 9 messages Feb 16, 2021 – Feb 23, 2021

Subsystems (4)
lore
Share & tools
lore

Eli Cohen

author
#0 lore raw

PATCH 1/1 vdpa/mlx5: Extract correct pointer from driver data

struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well in mlx5v_remove().

Fixes 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -2
index 6b0a42183622..4103d3b64a2a 100644
@@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 
 static void mlx5v_remove(struct auxiliary_device *adev)
 {
-	struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev);
+	struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev);
 
-	vdpa_unregister_device(&mvdev->vdev);
+	vdpa_unregister_device(&ndev->mvdev.vdev);
 }
 
 static const struct auxiliary_device_id mlx5v_id_table[] = {
Signature · 1 line
2.29.2
author
#1 lore raw

PATCH 1/1 vdpa/mlx5: Extract correct pointer from driver data

struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well in mlx5v_remove().

Fixes 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -2
index 6b0a42183622..4103d3b64a2a 100644
@@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 
 static void mlx5v_remove(struct auxiliary_device *adev)
 {
-	struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev);
+	struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev);
 
-	vdpa_unregister_device(&mvdev->vdev);
+	vdpa_unregister_device(&ndev->mvdev.vdev);
 }
 
 static const struct auxiliary_device_id mlx5v_id_table[] = {
Signature · 1 line
2.29.2
#2 lore raw
Quoted 14 lines · Eli Cohen

struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well in mlx5v_remove().

Fixes 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
index 6b0a42183622..4103d3b64a2a 100644

drivers/vdpa/mlx5/net/mlx5_vnet.c static int mlx5v_probe(struct auxiliary_device *adev, · line 2042

Quoted 9 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -2
@@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 
 static void mlx5v_remove(struct auxiliary_device *adev)
 {
-	struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev);
+	struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev);
 
-	vdpa_unregister_device(&mvdev->vdev);
+	vdpa_unregister_device(&ndev->mvdev.vdev);
 }

IMHO, The more correct solution is to fix dev_set_drvdata() call, because we are regustering/unregistering/allocating "struct mlx5_vdpa_dev".

drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
index 88dde3455bfd..079b8fe669af 100644
@@ -1995,7 +1995,7 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 	if (err)
 		goto err_reg;
 
-	dev_set_drvdata(&adev->dev, ndev);
+	dev_set_drvdata(&adev->dev, mvdev);
 	return 0;
 
 err_reg:
Quoted 6 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -1
 static const struct auxiliary_device_id mlx5v_id_table[] = {
 
--

2.29.2

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

author
#3 lore raw
Quoted 21 lines · Leon Romanovsky
Quoted 20 lines · Eli Cohen

struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well in mlx5v_remove().

Fixes 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
index 6b0a42183622..4103d3b64a2a 100644
@@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 
 static void mlx5v_remove(struct auxiliary_device *adev)
 {
-	struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev);
+	struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev);
 
Quoted 7 lines

drivers/vdpa/mlx5/net/mlx5_vnet.c static int mlx5v_probe(struct auxiliary_device *adev, · line 2042

Quoted 3 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
-	vdpa_unregister_device(&mvdev->vdev);
+	vdpa_unregister_device(&ndev->mvdev.vdev);
 }

IMHO, The more correct solution is to fix dev_set_drvdata() call, because we are regustering/unregistering/allocating "struct mlx5_vdpa_dev".

We're allocating "struct mlx5_vdpa_net". "struct mlx5_vdpa_dev" is just a member field of "struct mlx5_vdpa_net".

Quoted 20 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
index 88dde3455bfd..079b8fe669af 100644
@@ -1995,7 +1995,7 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 	if (err)
 		goto err_reg;
 
-	dev_set_drvdata(&adev->dev, ndev);
+	dev_set_drvdata(&adev->dev, mvdev);
 	return 0;
 
 err_reg:
Quoted 7 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -1
 static const struct auxiliary_device_id mlx5v_id_table[] = {
 
--

2.29.2

#4 lore raw
Quoted 30 lines · Eli Cohen
Quoted 21 lines · Leon Romanovsky
Quoted 20 lines · Eli Cohen

struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well in mlx5v_remove().

Fixes 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
index 6b0a42183622..4103d3b64a2a 100644
@@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 
 static void mlx5v_remove(struct auxiliary_device *adev)
 {
-	struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev);
+	struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev);
 
Quoted 7 lines

drivers/vdpa/mlx5/net/mlx5_vnet.c static int mlx5v_probe(struct auxiliary_device *adev, · line 2042

Quoted 3 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
-	vdpa_unregister_device(&mvdev->vdev);
+	vdpa_unregister_device(&ndev->mvdev.vdev);
 }

IMHO, The more correct solution is to fix dev_set_drvdata() call, because we are regustering/unregistering/allocating "struct mlx5_vdpa_dev".

Quoted 2 lines

We're allocating "struct mlx5_vdpa_net". "struct mlx5_vdpa_dev" is just a member field of "struct mlx5_vdpa_net".

I referred to these lines in the mlx5v_probe():
1986 err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
1987 if (err)
1988 goto err_mtu;
1989
1990 err = alloc_resources(ndev);
1991 if (err)
1992 goto err_res;
1993
1994 err = vdpa_register_device(&mvdev->vdev);

So mlx5v_remove() is better to be symmetrical.

Thanks

Quoted 13 lines
Quoted 13 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
index 88dde3455bfd..079b8fe669af 100644
@@ -1995,7 +1995,7 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 	if (err)
 		goto err_reg;
 
-	dev_set_drvdata(&adev->dev, ndev);
+	dev_set_drvdata(&adev->dev, mvdev);
 	return 0;
 
Quoted 8 lines
Quoted 8 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -0
 err_reg:
Quoted 7 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -1
 static const struct auxiliary_device_id mlx5v_id_table[] = {
 
--

2.29.2

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

author
#5 lore raw
Quoted 45 lines · Leon Romanovsky
Quoted 30 lines · Eli Cohen
Quoted 21 lines · Leon Romanovsky
Quoted 20 lines · Eli Cohen

struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well in mlx5v_remove().

Fixes 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
index 6b0a42183622..4103d3b64a2a 100644
@@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 
 static void mlx5v_remove(struct auxiliary_device *adev)
 {
-	struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev);
+	struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev);
 
Quoted 7 lines

drivers/vdpa/mlx5/net/mlx5_vnet.c static int mlx5v_probe(struct auxiliary_device *adev, · line 2042

Quoted 3 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
-	vdpa_unregister_device(&mvdev->vdev);
+	vdpa_unregister_device(&ndev->mvdev.vdev);
 }

IMHO, The more correct solution is to fix dev_set_drvdata() call, because we are regustering/unregistering/allocating "struct mlx5_vdpa_dev".

Quoted 2 lines

We're allocating "struct mlx5_vdpa_net". "struct mlx5_vdpa_dev" is just a member field of "struct mlx5_vdpa_net".

I referred to these lines in the mlx5v_probe():
1986 err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
1987 if (err)
1988 goto err_mtu;
1989
1990 err = alloc_resources(ndev);
1991 if (err)
1992 goto err_res;
1993
1994 err = vdpa_register_device(&mvdev->vdev);

Quoted 2 lines

So mlx5v_remove() is better to be symmetrical.

It's "struct mlx5_vdpa_net" that is being allocated here so it makes sense to set this pointer as the the driver data.

Quoted 23 lines

Thanks

Quoted 21 lines
Quoted 21 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
index 88dde3455bfd..079b8fe669af 100644
@@ -1995,7 +1995,7 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 	if (err)
 		goto err_reg;
 
-	dev_set_drvdata(&adev->dev, ndev);
+	dev_set_drvdata(&adev->dev, mvdev);
 	return 0;
 
 err_reg:
Quoted 7 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -1
 static const struct auxiliary_device_id mlx5v_id_table[] = {
 
--

2.29.2

Reviewed-by
#6 lore raw
Quoted 46 lines · Eli Cohen
Quoted 45 lines · Leon Romanovsky
Quoted 30 lines · Eli Cohen
Quoted 21 lines · Leon Romanovsky
Quoted 20 lines · Eli Cohen

struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well in mlx5v_remove().

Fixes 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
index 6b0a42183622..4103d3b64a2a 100644
@@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 
 static void mlx5v_remove(struct auxiliary_device *adev)
 {
-	struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev);
+	struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev);
 
Quoted 7 lines

drivers/vdpa/mlx5/net/mlx5_vnet.c static int mlx5v_probe(struct auxiliary_device *adev, · line 2042

Quoted 3 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
-	vdpa_unregister_device(&mvdev->vdev);
+	vdpa_unregister_device(&ndev->mvdev.vdev);
 }

IMHO, The more correct solution is to fix dev_set_drvdata() call, because we are regustering/unregistering/allocating "struct mlx5_vdpa_dev".

Quoted 2 lines

We're allocating "struct mlx5_vdpa_net". "struct mlx5_vdpa_dev" is just a member field of "struct mlx5_vdpa_net".

I referred to these lines in the mlx5v_probe():
1986 err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
1987 if (err)
1988 goto err_mtu;
1989
1990 err = alloc_resources(ndev);
1991 if (err)
1992 goto err_res;
1993
1994 err = vdpa_register_device(&mvdev->vdev);

Quoted 5 lines
Quoted 2 lines

So mlx5v_remove() is better to be symmetrical.

It's "struct mlx5_vdpa_net" that is being allocated here so it makes sense to set this pointer as the the driver data.

Anyway, it doesn't important.

Thanks, for the original patch.

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

#7 lore raw
In reply to Eli Cohen
Quoted 5 lines · Eli Cohen

struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well in mlx5v_remove().

Fixes 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus")

Sorry which tree this is for? Couldn't apply.

Quoted 22 lines
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -2
index 6b0a42183622..4103d3b64a2a 100644
@@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 
 static void mlx5v_remove(struct auxiliary_device *adev)
 {
-	struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev);
+	struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev);
 
-	vdpa_unregister_device(&mvdev->vdev);
+	vdpa_unregister_device(&ndev->mvdev.vdev);
 }
 
 static const struct auxiliary_device_id mlx5v_id_table[] = {
Signature · 1 line
2.29.2

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

author
#8 lore raw
Quoted 9 lines · Michael S. Tsirkin
Quoted 5 lines · Eli Cohen

struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well in mlx5v_remove().

Fixes 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus")

Sorry which tree this is for? Couldn't apply.

Drop it. The patch that adds support for management bus implicitly addresses the issue.

Quoted 23 lines
Quoted 22 lines
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +2 -2
index 6b0a42183622..4103d3b64a2a 100644
@@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev,
 
 static void mlx5v_remove(struct auxiliary_device *adev)
 {
-	struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev);
+	struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev);
 
-	vdpa_unregister_device(&mvdev->vdev);
+	vdpa_unregister_device(&ndev->mvdev.vdev);
 }
 
 static const struct auxiliary_device_id mlx5v_id_table[] = {
Signature · 1 line
2.29.2