Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH net-next] net/mlx4: drop the unused is_supported callback
@ 2026-11-03 12:21 Peter Morrow
  2026-11-05  2:20 ` Narcisa Vasile
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Morrow @ 2026-11-03 12:21 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: Simon Horman, Leon Romanovsky, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-rdma,
	linux-kernel, Peter Morrow

Since commit 557d80138618 ("net/mlx4: always create the eth and ib
auxiliary devices"), both is_supported callbacks return true, so the
checks in add_drivers() and delete_drivers() no longer decide
anything. Drop the callbacks and keep the aux device table as an array
of suffixes.

Tested with this change applied to 6.12.113 on an Azure VM with two
ConnectX-3 VFs: both auxiliary devices are created at boot, and
removing mlx4_ib, mlx4_en and mlx4_core deletes them cleanly.

Suggested-by: Simon Horman <horms@kernel.org>
Signed-off-by: Peter Morrow <pdmorrow@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx4/intf.c | 44 ++++-------------------
 1 file changed, 6 insertions(+), 38 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/intf.c b/drivers/net/ethernet/mellanox/mlx4/intf.c
index 31860b4ab..1e136203b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/intf.c
+++ b/drivers/net/ethernet/mellanox/mlx4/intf.c
@@ -41,23 +41,7 @@
 static DEFINE_MUTEX(intf_mutex);
 static DEFINE_IDA(mlx4_adev_ida);
 
-static bool is_eth_supported(struct mlx4_dev *dev)
-{
-	return true;
-}
-
-static bool is_ib_supported(struct mlx4_dev *dev)
-{
-	return true;
-}
-
-static const struct mlx4_adev_device {
-	const char *suffix;
-	bool (*is_supported)(struct mlx4_dev *dev);
-} mlx4_adev_devices[] = {
-	{ "eth", is_eth_supported },
-	{ "ib", is_ib_supported },
-};
+static const char *const mlx4_adev_devices[] = { "eth", "ib" };
 
 int mlx4_adev_init(struct mlx4_dev *dev)
 {
@@ -98,8 +82,8 @@ static void adev_release(struct device *dev)
 
 static struct mlx4_adev *add_adev(struct mlx4_dev *dev, int idx)
 {
+	const char *suffix = mlx4_adev_devices[idx];
 	struct mlx4_priv *priv = mlx4_priv(dev);
-	const char *suffix = mlx4_adev_devices[idx].suffix;
 	struct auxiliary_device *adev;
 	struct mlx4_adev *madev;
 	int ret;
@@ -211,7 +195,7 @@ int mlx4_do_bond(struct mlx4_dev *dev, bool enable)
 		priv->adev[i] = add_adev(dev, i);
 		if (IS_ERR(priv->adev[i])) {
 			mlx4_warn(dev, "Device[%d] (%s) failed to load\n", i,
-				  mlx4_adev_devices[i].suffix);
+				  mlx4_adev_devices[i]);
 			priv->adev[i] = NULL;
 			continue;
 		}
@@ -258,21 +242,13 @@ static int add_drivers(struct mlx4_dev *dev)
 	int i, ret = 0;
 
 	for (i = 0; i < ARRAY_SIZE(mlx4_adev_devices); i++) {
-		bool is_supported = false;
-
 		if (priv->adev[i])
 			continue;
 
-		if (mlx4_adev_devices[i].is_supported)
-			is_supported = mlx4_adev_devices[i].is_supported(dev);
-
-		if (!is_supported)
-			continue;
-
 		priv->adev[i] = add_adev(dev, i);
 		if (IS_ERR(priv->adev[i])) {
 			mlx4_warn(dev, "Device[%d] (%s) failed to load\n", i,
-				  mlx4_adev_devices[i].suffix);
+				  mlx4_adev_devices[i]);
 			/* We continue to rescan drivers and leave to the caller
 			 * to make decision if to release everything or
 			 * continue. */
@@ -286,23 +262,15 @@ static int add_drivers(struct mlx4_dev *dev)
 static void delete_drivers(struct mlx4_dev *dev)
 {
 	struct mlx4_priv *priv = mlx4_priv(dev);
-	bool delete_all;
 	int i;
 
-	delete_all = !(dev->persist->interface_state & MLX4_INTERFACE_STATE_UP);
+	if (dev->persist->interface_state & MLX4_INTERFACE_STATE_UP)
+		return;
 
 	for (i = ARRAY_SIZE(mlx4_adev_devices) - 1; i >= 0; i--) {
-		bool is_supported = false;
-
 		if (!priv->adev[i])
 			continue;
 
-		if (mlx4_adev_devices[i].is_supported && !delete_all)
-			is_supported = mlx4_adev_devices[i].is_supported(dev);
-
-		if (is_supported)
-			continue;
-
 		del_adev(&priv->adev[i]->adev);
 		priv->adev[i] = NULL;
 	}
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net/mlx4: drop the unused is_supported callback
  2026-11-03 12:21 [PATCH net-next] net/mlx4: drop the unused is_supported callback Peter Morrow
@ 2026-11-05  2:20 ` Narcisa Vasile
  0 siblings, 0 replies; 2+ messages in thread
From: Narcisa Vasile @ 2026-11-05  2:20 UTC (permalink / raw)
  To: Peter Morrow
  Cc: Tariq Toukan, Simon Horman, Leon Romanovsky, Andrew Lunn,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-rdma, linux-kernel

On Tue, Nov 03, 2026 at 12:21:08PM +0000, Peter Morrow wrote:
> Since commit 557d80138618 ("net/mlx4: always create the eth and ib
> auxiliary devices"), both is_supported callbacks return true, so the
> checks in add_drivers() and delete_drivers() no longer decide
> anything. Drop the callbacks and keep the aux device table as an array
> of suffixes.
> 
> Tested with this change applied to 6.12.113 on an Azure VM with two
> ConnectX-3 VFs: both auxiliary devices are created at boot, and
> removing mlx4_ib, mlx4_en and mlx4_core deletes them cleanly.
> 
> Suggested-by: Simon Horman <horms@kernel.org>
> Signed-off-by: Peter Morrow <pdmorrow@gmail.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/intf.c | 44 ++++-------------------
>  1 file changed, 6 insertions(+), 38 deletions(-)
> 

Reviewed-by: Narcisa Vasile <narcisav.kernel@gmail.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-05  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 12:21 [PATCH net-next] net/mlx4: drop the unused is_supported callback Peter Morrow
2026-11-05  2:20 ` Narcisa Vasile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox