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

Commit f5c4834d authored by Moni Shoua's avatar Moni Shoua Committed by Roland Dreier
Browse files

IB/mlx4: Don't duplicate the default RoCE GID



When reading the IPv6 addresses from the net-device, make sure to
avoid adding a duplicate entry to the GID table because of equality
between the default GID we generate and the default IPv6 link-local
address of the device.

Fixes: acc4fccf ("IB/mlx4: Make sure GID index 0 is always occupied")
Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent e381835c
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -1679,6 +1679,7 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev,
	struct inet6_dev *in6_dev;
	struct inet6_dev *in6_dev;
	union ib_gid  *pgid;
	union ib_gid  *pgid;
	struct inet6_ifaddr *ifp;
	struct inet6_ifaddr *ifp;
	union ib_gid default_gid;
#endif
#endif
	union ib_gid gid;
	union ib_gid gid;


@@ -1699,12 +1700,15 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev,
		in_dev_put(in_dev);
		in_dev_put(in_dev);
	}
	}
#if IS_ENABLED(CONFIG_IPV6)
#if IS_ENABLED(CONFIG_IPV6)
	mlx4_make_default_gid(dev, &default_gid);
	/* IPv6 gids */
	/* IPv6 gids */
	in6_dev = in6_dev_get(dev);
	in6_dev = in6_dev_get(dev);
	if (in6_dev) {
	if (in6_dev) {
		read_lock_bh(&in6_dev->lock);
		read_lock_bh(&in6_dev->lock);
		list_for_each_entry(ifp, &in6_dev->addr_list, if_list) {
		list_for_each_entry(ifp, &in6_dev->addr_list, if_list) {
			pgid = (union ib_gid *)&ifp->addr;
			pgid = (union ib_gid *)&ifp->addr;
			if (!memcmp(pgid, &default_gid, sizeof(*pgid)))
				continue;
			update_gid_table(ibdev, port, pgid, 0, 0);
			update_gid_table(ibdev, port, pgid, 0, 0);
		}
		}
		read_unlock_bh(&in6_dev->lock);
		read_unlock_bh(&in6_dev->lock);