From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Rongwei Liu <rongweil@nvidia.com>,
Mark Bloch <mbloch@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 13/13] net/mlx5: Use system_image_guid to determine bonding
Date: Fri, 15 Oct 2021 17:39:02 -0700 [thread overview]
Message-ID: <20211016003902.57116-14-saeed@kernel.org> (raw)
In-Reply-To: <20211016003902.57116-1-saeed@kernel.org>
From: Rongwei Liu <rongweil@nvidia.com>
With specific NICs, the PFs may have different PCIe ids like
0001:01:00.0/1 and 0002:02:00:00/1.
For PFs with the same system_image_guid, driver should consider
them under the same physical NIC and they are legal to bond together.
If firmware doesn't support system_image_guid, set it to zero and
fallback to use PCIe ids.
Signed-off-by: Rongwei Liu <rongweil@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 | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
index e8093c4e09d4..a8b84d53dfb0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
@@ -33,6 +33,7 @@
#include <linux/mlx5/driver.h>
#include <linux/mlx5/eswitch.h>
#include <linux/mlx5/mlx5_ifc_vdpa.h>
+#include <linux/mlx5/vport.h>
#include "mlx5_core.h"
/* intf dev list mutex */
@@ -537,6 +538,16 @@ int mlx5_rescan_drivers_locked(struct mlx5_core_dev *dev)
return add_drivers(dev);
}
+static bool mlx5_same_hw_devs(struct mlx5_core_dev *dev, struct mlx5_core_dev *peer_dev)
+{
+ u64 fsystem_guid, psystem_guid;
+
+ fsystem_guid = mlx5_query_nic_system_image_guid(dev);
+ psystem_guid = mlx5_query_nic_system_image_guid(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) |
@@ -556,7 +567,8 @@ static int next_phys_dev(struct device *dev, const void *data)
if (mdev == curr)
return 0;
- if (mlx5_gen_pci_id(mdev) != mlx5_gen_pci_id(curr))
+ 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;
--
2.31.1
prev parent reply other threads:[~2021-10-16 0:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-16 0:38 [pull request][net-next 00/13] mlx5 updates 2021-10-15 Saeed Mahameed
2021-10-16 0:38 ` [net-next 01/13] net/mlx5: Add layout to support default timeouts register Saeed Mahameed
2021-10-16 8:00 ` patchwork-bot+netdevbpf
2021-10-16 0:38 ` [net-next 02/13] net/mlx5: Read timeout values from init segment Saeed Mahameed
2021-10-16 0:38 ` [net-next 03/13] net/mlx5: Read timeout values from DTOR Saeed Mahameed
2021-10-16 0:38 ` [net-next 04/13] net/mlx5: Bridge, provide flow source hints Saeed Mahameed
2021-10-16 0:38 ` [net-next 05/13] net/mlx5i: Enable Rx steering for IPoIB via ethtool Saeed Mahameed
2021-10-16 0:38 ` [net-next 06/13] net/mlx5: Disable roce at HCA level Saeed Mahameed
2021-10-16 0:38 ` [net-next 07/13] net/mlx5: CT: Fix missing cleanup of ct nat table on init failure Saeed Mahameed
2021-10-16 0:38 ` [net-next 08/13] net/mlx5e: Add extack msgs related to TC for better debug Saeed Mahameed
2021-10-16 0:38 ` [net-next 09/13] net/mlx5: DR, Prefer kcalloc over open coded arithmetic Saeed Mahameed
2021-10-16 0:38 ` [net-next 10/13] net/mlx5: Check return status first when querying system_image_guid Saeed Mahameed
2021-10-16 0:39 ` [net-next 11/13] net/mlx5: Introduce new device index wrapper Saeed Mahameed
2021-10-16 0:39 ` [net-next 12/13] net/mlx5: Use native_port_num as 1st option of device index Saeed Mahameed
2021-10-16 0:39 ` Saeed Mahameed [this message]
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=20211016003902.57116-14-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=rongweil@nvidia.com \
--cc=saeedm@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).