Bladeren bron

IPoIB: Set dev_id field of net_device

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>
Eli Cohen 14 jaren geleden
bovenliggende
commit
c3aa9b186b
1 gewijzigde bestanden met toevoegingen van 1 en 0 verwijderingen
  1. 1 0
      drivers/infiniband/ulp/ipoib/ipoib_main.c

+ 1 - 0
drivers/infiniband/ulp/ipoib/ipoib_main.c

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