]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
IB/mlx4: default gid should respect dev_id
authorMatan Barak <matanb@mellanox.com>
Wed, 18 Dec 2013 17:34:38 +0000 (19:34 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:17 +0000 (14:45 -0700)
The default gid should match the true ipv6 link
local address which respects the dev_id.

Signed-off-by: Matan Barak <matanb@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/infiniband/hw/mlx4/main.c

index 199cfa15fde5a85bc773c5b266e6b30dfd98473a..445f418990697d5c1810407f6660690ff5efeea4 100644 (file)
@@ -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)