All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Petr Pavlu <petr.pavlu@suse.com>
Cc: tariqt@nvidia.com, yishaih@nvidia.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	jgg@ziepe.ca, netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 01/10] mlx4: Get rid of the mlx4_interface.get_dev callback
Date: Tue, 8 Aug 2023 21:55:17 +0300	[thread overview]
Message-ID: <20230808185517.GG94631@unreal> (raw)
In-Reply-To: <20230804150527.6117-2-petr.pavlu@suse.com>

On Fri, Aug 04, 2023 at 05:05:18PM +0200, Petr Pavlu wrote:
> Simplify the mlx4 driver interface by removing mlx4_get_protocol_dev()
> and the associated mlx4_interface.get_dev callbacks. This is done in
> preparation to use an auxiliary bus to model the mlx4 driver structure.
> 
> The change is motivated by the following situation:
> * The mlx4_en interface is being initialized by mlx4_en_add() and
>   mlx4_en_activate().
> * The latter activate function calls mlx4_en_init_netdev() ->
>   register_netdev() to register a new net_device.
> * A netdev event NETDEV_REGISTER is raised for the device.
> * The netdev notififier mlx4_ib_netdev_event() is called and it invokes
>   mlx4_ib_scan_netdevs() -> mlx4_get_protocol_dev() ->
>   mlx4_en_get_netdev() [via mlx4_interface.get_dev].
> 
> This chain creates a problem when mlx4_en gets switched to be an
> auxiliary driver. It contains two device calls which would both need to
> take a respective device lock.
> 
> Avoid this situation by updating mlx4_ib_scan_netdevs() to no longer
> call mlx4_get_protocol_dev() but instead to utilize the information
> passed in net_device.parent and net_device.dev_port. This data is
> sufficient to determine that an updated port is one that the mlx4_ib
> driver should take care of and to keep mlx4_ib_dev.iboe.netdevs up to
> date.
> 
> Following that, update mlx4_ib_get_netdev() to also not call
> mlx4_get_protocol_dev() and instead scan all current netdevs to find
> find a matching one. Note that mlx4_ib_get_netdev() is called early from
> ib_register_device() and cannot use data tracked in
> mlx4_ib_dev.iboe.netdevs which is not at that point yet set.
> 
> Finally, remove function mlx4_get_protocol_dev() and the
> mlx4_interface.get_dev callbacks (only mlx4_en_get_netdev()) as they
> became unused.
> 
> Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
> Tested-by: Leon Romanovsky <leon@kernel.org>
> ---
>  drivers/infiniband/hw/mlx4/main.c            | 89 ++++++++++----------
>  drivers/net/ethernet/mellanox/mlx4/en_main.c |  8 --
>  drivers/net/ethernet/mellanox/mlx4/intf.c    | 21 -----
>  include/linux/mlx4/driver.h                  |  3 -
>  4 files changed, 43 insertions(+), 78 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

  reply	other threads:[~2023-08-08 19:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04 15:05 [PATCH net-next 00/10] Convert mlx4 to use auxiliary bus Petr Pavlu
2023-08-04 15:05 ` [PATCH net-next 01/10] mlx4: Get rid of the mlx4_interface.get_dev callback Petr Pavlu
2023-08-08 18:55   ` Leon Romanovsky [this message]
2023-08-04 15:05 ` [PATCH net-next 02/10] mlx4: Rename member mlx4_en_dev.nb to netdev_nb Petr Pavlu
2023-08-08 18:55   ` Leon Romanovsky
2023-08-04 15:05 ` [PATCH net-next 03/10] mlx4: Replace the mlx4_interface.event callback with a notifier Petr Pavlu
2023-08-05 14:29   ` Zhu Yanjun
2023-08-08 12:13     ` Petr Pavlu
2023-08-07 13:58   ` Simon Horman
2023-08-08 12:15     ` Petr Pavlu
2023-08-04 15:05 ` [PATCH net-next 04/10] mlx4: Get rid of the mlx4_interface.activate callback Petr Pavlu
2023-08-08 18:56   ` Leon Romanovsky
2023-08-04 15:05 ` [PATCH net-next 05/10] mlx4: Move the bond work to the core driver Petr Pavlu
2023-08-08 18:56   ` Leon Romanovsky
2023-08-04 15:05 ` [PATCH net-next 06/10] mlx4: Avoid resetting MLX4_INTFF_BONDING per driver Petr Pavlu
2023-08-08 18:57   ` Leon Romanovsky
2023-08-04 15:05 ` [PATCH net-next 07/10] mlx4: Register mlx4 devices to an auxiliary virtual bus Petr Pavlu
2023-08-06  3:16   ` Zhu Yanjun
2023-08-08 12:17     ` Petr Pavlu
2023-08-08 18:57   ` Leon Romanovsky
2023-08-04 15:05 ` [PATCH net-next 08/10] mlx4: Connect the ethernet part to the auxiliary bus Petr Pavlu
2023-08-08 18:57   ` Leon Romanovsky
2023-08-04 15:05 ` [PATCH net-next 09/10] mlx4: Connect the infiniband " Petr Pavlu
2023-08-08 18:58   ` Leon Romanovsky
2023-08-04 15:05 ` [PATCH net-next 10/10] mlx4: Delete custom device management logic Petr Pavlu
2023-08-08 18:58   ` Leon Romanovsky
2023-08-04 16:49 ` [PATCH net-next 00/10] Convert mlx4 to use auxiliary bus Jason Gunthorpe
2023-08-09 11:12 ` Tariq Toukan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230808185517.GG94631@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jgg@ziepe.ca \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petr.pavlu@suse.com \
    --cc=tariqt@nvidia.com \
    --cc=yishaih@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.