Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e26dac2 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed
Browse files

net/mlx5: Limit scope of mlx5_get_next_phys_dev() to PCI PF devices



As mlx5_get_next_phys_dev is used only for PCI PF devices use case,
limit it to search only for PCI devices.

Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarVu Pham <vuhuong@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent d22663ed
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -290,13 +290,20 @@ static u32 mlx5_gen_pci_id(struct mlx5_core_dev *dev)
/* Must be called with intf_mutex held */
/* Must be called with intf_mutex held */
struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev)
struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev)
{
{
	u32 pci_id = mlx5_gen_pci_id(dev);
	struct mlx5_core_dev *res = NULL;
	struct mlx5_core_dev *res = NULL;
	struct mlx5_core_dev *tmp_dev;
	struct mlx5_core_dev *tmp_dev;
	struct mlx5_priv *priv;
	struct mlx5_priv *priv;
	u32 pci_id;


	if (!mlx5_core_is_pf(dev))
		return NULL;

	pci_id = mlx5_gen_pci_id(dev);
	list_for_each_entry(priv, &mlx5_dev_list, dev_list) {
	list_for_each_entry(priv, &mlx5_dev_list, dev_list) {
		tmp_dev = container_of(priv, struct mlx5_core_dev, priv);
		tmp_dev = container_of(priv, struct mlx5_core_dev, priv);
		if (!mlx5_core_is_pf(tmp_dev))
			continue;

		if ((dev != tmp_dev) && (mlx5_gen_pci_id(tmp_dev) == pci_id)) {
		if ((dev != tmp_dev) && (mlx5_gen_pci_id(tmp_dev) == pci_id)) {
			res = tmp_dev;
			res = tmp_dev;
			break;
			break;