]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
IPoIB: Set dev_id field of net_device
authorEli Cohen <eli@dev.mellanox.co.il>
Mon, 20 Sep 2010 07:05:06 +0000 (07:05 +0000)
committerRoland Dreier <rolandd@cisco.com>
Sat, 23 Oct 2010 20:35:48 +0000 (13:35 -0700)
Use the net device's dev_id field to encode the port number of the pci
device.  This can be used to to associate a net device with the pci
device's port. The encoding is: dev_id = port - 1.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/ipoib/ipoib_main.c

index b4b22576f12a0a0aba0c99f421fcdf7cd2699016..30d23334f967f934350ae53120c6c475a002015a 100644 (file)
@@ -1240,6 +1240,7 @@ static struct net_device *ipoib_add_port(const char *format,
                goto alloc_mem_failed;
 
        SET_NETDEV_DEV(priv->dev, hca->dma_device);
+       priv->dev->dev_id = port - 1;
 
        if (!ib_query_port(hca, port, &attr))
                priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu);