All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Daniel Jurgens <danielj@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net 07/10] net/mlx5: Consider PCI domain in search for next dev
Date: Wed,  5 Sep 2018 21:09:49 -0700	[thread overview]
Message-ID: <20180906040952.29684-8-saeedm@mellanox.com> (raw)
In-Reply-To: <20180906040952.29684-1-saeedm@mellanox.com>

From: Daniel Jurgens <danielj@mellanox.com>

The PCI BDF is not unique. PCI domain must also be considered when
searching for the next physical device during lag setup. Example below:

mlx5_core 0000:01:00.0: MLX5E: StrdRq(1) RqSz(8) StrdSz(128) RxCqeCmprss(0)
mlx5_core 0000:01:00.1: MLX5E: StrdRq(1) RqSz(8) StrdSz(128) RxCqeCmprss(0)
mlx5_core 0001:01:00.0: MLX5E: StrdRq(1) RqSz(8) StrdSz(128) RxCqeCmprss(0)
mlx5_core 0001:01:00.1: MLX5E: StrdRq(1) RqSz(8) StrdSz(128) RxCqeCmprss(0)

Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Reviewed-by: Aviv Heller <avivh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/dev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
index b994b80d5714..ada723bd91b6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
@@ -391,16 +391,17 @@ void mlx5_remove_dev_by_protocol(struct mlx5_core_dev *dev, int protocol)
 		}
 }
 
-static u16 mlx5_gen_pci_id(struct mlx5_core_dev *dev)
+static u32 mlx5_gen_pci_id(struct mlx5_core_dev *dev)
 {
-	return (u16)((dev->pdev->bus->number << 8) |
+	return (u32)((pci_domain_nr(dev->pdev->bus) << 16) |
+		     (dev->pdev->bus->number << 8) |
 		     PCI_SLOT(dev->pdev->devfn));
 }
 
 /* Must be called with intf_mutex held */
 struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev)
 {
-	u16 pci_id = mlx5_gen_pci_id(dev);
+	u32 pci_id = mlx5_gen_pci_id(dev);
 	struct mlx5_core_dev *res = NULL;
 	struct mlx5_core_dev *tmp_dev;
 	struct mlx5_priv *priv;
-- 
2.17.1

  parent reply	other threads:[~2018-09-06  8:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06  4:09 [pull request][net 00/10] Mellanox, mlx5 fixes 2018-09-05 Saeed Mahameed
2018-09-06  4:09 ` [net 01/10] net/mlx5: Fix use-after-free in self-healing flow Saeed Mahameed
2018-09-06  4:09 ` [net 02/10] net/mlx5: Fix debugfs cleanup in the device init/remove flow Saeed Mahameed
2018-09-06  4:09 ` [net 03/10] net/mlx5: Use u16 for Work Queue buffer fragment size Saeed Mahameed
2018-09-06  4:09 ` [net 04/10] net/mlx5: Use u16 for Work Queue buffer strides offset Saeed Mahameed
2018-09-06  4:09 ` [net 05/10] net/mlx5: E-Switch, Fix memory leak when creating switchdev mode FDB tables Saeed Mahameed
2018-09-06  4:09 ` [net 06/10] net/mlx5: Fix not releasing read lock when adding flow rules Saeed Mahameed
2018-09-06  4:09 ` Saeed Mahameed [this message]
2018-09-06  4:09 ` [net 08/10] net/mlx5: Check for error in mlx5_attach_interface Saeed Mahameed
2018-09-06  4:09 ` [net 09/10] net/mlx5e: Ethtool steering, fix udp source port value Saeed Mahameed
2018-09-06  4:09 ` [net 10/10] net/mlx5: Fix possible deadlock from lockdep when adding fte to fg Saeed Mahameed
2018-09-06 14:57 ` [pull request][net 00/10] Mellanox, mlx5 fixes 2018-09-05 David Miller

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=20180906040952.29684-8-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=danielj@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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.