diff mbox

net/core: use net_device dev_id to indicate port number

Message ID 20100526095200.GA7370@mtldesk030.lab.mtl.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Eli Cohen May 26, 2010, 9:52 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
index 6c2b15b..612df1e 100644
--- a/drivers/net/mlx4/en_netdev.c
+++ b/drivers/net/mlx4/en_netdev.c
@@ -978,6 +978,7 @@  int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 	}
 
 	SET_NETDEV_DEV(dev, &mdev->dev->pdev->dev);
+	SET_NETDEV_DEV_ID(dev, port - 1);
 
 	/*
 	 * Initialize driver private data
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3857517..8d5f2c7 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1080,6 +1080,11 @@  static inline void *netdev_priv(const struct net_device *dev)
  */
 #define SET_NETDEV_DEVTYPE(net, devtype)	((net)->dev.type = (devtype))
 
+/*
+ * Set the port number of the physical device that this port net device uses
+ */
+#define SET_NETDEV_DEV_ID(net, devid)	((net)->dev_id = (devid))
+
 /**
  *	netif_napi_add - initialize a napi context
  *	@dev:  network device