From: Eli Cohen Date: Mon, 20 Sep 2010 07:05:06 +0000 (+0000) Subject: IPoIB: Set dev_id field of net_device X-Git-Tag: firefly_0821_release~7613^2~3618^2^7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c3aa9b186b95025d4ba4e90d6140c9887dfaae0a;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index b4b22576f12a..30d23334f967 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/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; 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);