From: Jacob Keller <jacob.e.keller@intel.com>
To: Saeed Mahameed <saeed@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>, <netdev@vger.kernel.org>,
Tariq Toukan <tariqt@nvidia.com>, Shay Drory <shayd@nvidia.com>,
Mark Bloch <mbloch@nvidia.com>
Subject: Re: [net-next V2 04/15] net/mlx5: Refactor LAG peer device lookout bus logic to mlx5 devcom
Date: Thu, 12 Oct 2023 14:26:24 -0700 [thread overview]
Message-ID: <ff42e84c-0859-4e7f-b8e7-1b4e1f7d1c8f@intel.com> (raw)
In-Reply-To: <20231012192750.124945-5-saeed@kernel.org>
On 10/12/2023 12:27 PM, Saeed Mahameed wrote:
> From: Shay Drory <shayd@nvidia.com>
>
> LAG peer device lookout bus logic required the usage of global lock,
> mlx5_intf_mutex.
> As part of the effort to remove this global lock, refactor LAG peer
> device lookout to use mlx5 devcom layer.
>
> Signed-off-by: Shay Drory <shayd@nvidia.com>
> Reviewed-by: Mark Bloch <mbloch@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/dev.c | 68 -------------------
> .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 12 ++--
> .../ethernet/mellanox/mlx5/core/lib/devcom.c | 14 ++++
> .../ethernet/mellanox/mlx5/core/lib/devcom.h | 4 ++
> .../net/ethernet/mellanox/mlx5/core/main.c | 25 +++++++
> .../ethernet/mellanox/mlx5/core/mlx5_core.h | 1 -
> include/linux/mlx5/driver.h | 1 +
> 7 files changed, 52 insertions(+), 73 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> index 1fc03480c2ff..6e3a8c22881f 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
> @@ -566,74 +566,6 @@ bool mlx5_same_hw_devs(struct mlx5_core_dev *dev, struct mlx5_core_dev *peer_dev
> return (fsystem_guid && psystem_guid && fsystem_guid == psystem_guid);
> }
>
> -static u32 mlx5_gen_pci_id(const struct mlx5_core_dev *dev)
> -{
> - return (u32)((pci_domain_nr(dev->pdev->bus) << 16) |
> - (dev->pdev->bus->number << 8) |
> - PCI_SLOT(dev->pdev->devfn));
> -}
> -
> -static int _next_phys_dev(struct mlx5_core_dev *mdev,
> - const struct mlx5_core_dev *curr)
> -{
> - if (!mlx5_core_is_pf(mdev))
> - return 0;
> -
> - if (mdev == curr)
> - return 0;
> -
> - if (!mlx5_same_hw_devs(mdev, (struct mlx5_core_dev *)curr) &&
> - mlx5_gen_pci_id(mdev) != mlx5_gen_pci_id(curr))
> - return 0;
> -
> - return 1;
> -}
> -
> -static void *pci_get_other_drvdata(struct device *this, struct device *other)
> -{
> - if (this->driver != other->driver)
> - return NULL;
> -
> - return pci_get_drvdata(to_pci_dev(other));
> -}
> -
> -static int next_phys_dev_lag(struct device *dev, const void *data)
> -{
> - struct mlx5_core_dev *mdev, *this = (struct mlx5_core_dev *)data;
> -
> - mdev = pci_get_other_drvdata(this->device, dev);
> - if (!mdev)
> - return 0;
> -
> - if (!mlx5_lag_is_supported(mdev))
> - return 0;
> -
> - return _next_phys_dev(mdev, data);
> -}
> -
> -static struct mlx5_core_dev *mlx5_get_next_dev(struct mlx5_core_dev *dev,
> - int (*match)(struct device *dev, const void *data))
> -{
> - struct device *next;
> -
> - if (!mlx5_core_is_pf(dev))
> - return NULL;
> -
> - next = bus_find_device(&pci_bus_type, NULL, dev, match);
> - if (!next)
> - return NULL;
> -
> - put_device(next);
> - return pci_get_drvdata(to_pci_dev(next));
> -}
> -
> -/* Must be called with intf_mutex held */
> -struct mlx5_core_dev *mlx5_get_next_phys_dev_lag(struct mlx5_core_dev *dev)
> -{
> - lockdep_assert_held(&mlx5_intf_mutex);
The old flow had a lockdep_assert_held
> - return mlx5_get_next_dev(dev, &next_phys_dev_lag);
> -}
> -
> void mlx5_dev_list_lock(void)
> {
> mutex_lock(&mlx5_intf_mutex);
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> index af3fac090b82..f0b57f97739f 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> @@ -1212,13 +1212,14 @@ static void mlx5_ldev_remove_mdev(struct mlx5_lag *ldev,
> dev->priv.lag = NULL;
> }
>
> -/* Must be called with intf_mutex held */
> +/* Must be called with HCA devcom component lock held */
> static int __mlx5_lag_dev_add_mdev(struct mlx5_core_dev *dev)
> {
> + struct mlx5_devcom_comp_dev *pos = NULL;
> struct mlx5_lag *ldev = NULL;
> struct mlx5_core_dev *tmp_dev;
>
> - tmp_dev = mlx5_get_next_phys_dev_lag(dev);
> + tmp_dev = mlx5_devcom_get_next_peer_data(dev->priv.hca_devcom_comp, &pos);
> if (tmp_dev)
> ldev = mlx5_lag_dev(tmp_dev);
>
But you didn't bother to add one here? Does
mlx5_devcom_get_next_peer_data already do that?
Not a big deal either way to me.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
next prev parent reply other threads:[~2023-10-12 21:26 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 19:27 [pull request][net-next V2 00/15] mlx5 updates 2023-10-10 Saeed Mahameed
2023-10-12 19:27 ` [net-next V2 01/15] net/mlx5: Parallelize vhca event handling Saeed Mahameed
2023-10-12 21:13 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 02/15] net/mlx5: Redesign SF active work to remove table_lock Saeed Mahameed
2023-10-12 21:18 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 03/15] net/mlx5: Avoid false positive lockdep warning by adding lock_class_key Saeed Mahameed
2023-10-12 21:23 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 04/15] net/mlx5: Refactor LAG peer device lookout bus logic to mlx5 devcom Saeed Mahameed
2023-10-12 21:26 ` Jacob Keller [this message]
2023-10-12 21:46 ` Saeed Mahameed
2023-10-12 19:27 ` [net-next V2 05/15] net/mlx5: Replace global mlx5_intf_lock with HCA devcom component lock Saeed Mahameed
2023-10-12 21:28 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 06/15] net/mlx5: Remove unused declaration Saeed Mahameed
2023-10-12 21:29 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 07/15] net/mlx5: fix config name in Kconfig parameter documentation Saeed Mahameed
2023-10-12 19:27 ` [net-next V2 08/15] net/mlx5: Use PTR_ERR_OR_ZERO() to simplify code Saeed Mahameed
2023-10-12 19:27 ` [net-next V2 09/15] net/mlx5e: " Saeed Mahameed
2023-10-12 21:30 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 10/15] net/mlx5e: Refactor rx_res_init() and rx_res_free() APIs Saeed Mahameed
2023-10-12 21:31 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 11/15] net/mlx5e: Refactor mlx5e_rss_set_rxfh() and mlx5e_rss_get_rxfh() Saeed Mahameed
2023-10-12 21:32 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 12/15] net/mlx5e: Refactor mlx5e_rss_init() and mlx5e_rss_free() API's Saeed Mahameed
2023-10-12 21:33 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 13/15] net/mlx5e: Preparations for supporting larger number of channels Saeed Mahameed
2023-10-12 21:35 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 14/15] net/mlx5e: Increase max supported channels number to 256 Saeed Mahameed
2023-10-12 21:35 ` Jacob Keller
2023-10-12 19:27 ` [net-next V2 15/15] net/mlx5e: Allow IPsec soft/hard limits in bytes Saeed Mahameed
2023-10-12 21:37 ` Jacob Keller
2023-10-14 1:10 ` [pull request][net-next V2 00/15] mlx5 updates 2023-10-10 Jakub Kicinski
2023-10-14 17:19 ` Saeed Mahameed
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=ff42e84c-0859-4e7f-b8e7-1b4e1f7d1c8f@intel.com \
--to=jacob.e.keller@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeed@kernel.org \
--cc=saeedm@nvidia.com \
--cc=shayd@nvidia.com \
--cc=tariqt@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).