From c9c4c00b714142b34e034eccf1c6957b7b21dead Mon Sep 17 00:00:00 2001 From: Matan Barak Date: Wed, 18 Dec 2013 19:34:38 +0200 Subject: [PATCH] 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 --- drivers/infiniband/hw/mlx4/main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 199cfa15fde5..445f41899069 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) -- 2.50.1