From: Matan Barak Date: Wed, 18 Dec 2013 17:34:38 +0000 (+0200) Subject: IB/mlx4: default gid should respect dev_id X-Git-Tag: v4.1.12-92~293^2~1^2~48 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c9c4c00b714142b34e034eccf1c6957b7b21dead;p=users%2Fjedix%2Flinux-maple.git IB/mlx4: default gid should respect dev_id The default gid should match the true ipv6 link local address which respects the dev_id. Signed-off-by: Matan Barak (Ported from Mellanox OFED 2.4) Signed-off-by: Mukesh Kacker --- diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 199cfa15fde5a..445f418990697 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -1502,16 +1502,18 @@ static struct device_attribute *mlx4_class_attributes[] = { static void mlx4_addrconf_ifid_eui48(u8 *eui, u16 vlan_id, struct net_device *dev) { + u16 id = (vlan_id < 0x1000) ? vlan_id : dev->dev_id; memcpy(eui, dev->dev_addr, 3); memcpy(eui + 5, dev->dev_addr + 3, 3); - if (vlan_id < 0x1000) { - eui[3] = vlan_id >> 8; - eui[4] = vlan_id & 0xff; - } else { + if (id || vlan_id == 0) { + eui[3] = (id >> 8) & 0xff; + eui[4] = id & 0xff; + } else if (!dev->dev_id) { eui[3] = 0xff; eui[4] = 0xfe; } - eui[0] ^= 2; + if (vlan_id < 0x1000 || !dev->dev_id) + eui[0] ^= 2; } static void update_gids_task(struct work_struct *work)