diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-07-29 12:16:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-07-30 20:31:24 -0400 |
commit | 66b52b0dc82c5c88d769dc1c7d44cf45d0deb07c (patch) | |
tree | 2fa19024bd1afefcc0fc4a09ea7ae1b6c095edcd /net | |
parent | 9ad8fef6c61a9dfcaa8444e526020de88c540fa9 (diff) |
net: add ndo to get id of physical port of the device
This patch adds a ndo for getting physical port of the device. Driver
which is aware of being virtual function of some physical port should
implement this ndo. This is applicable not only for IOV, but for other
solutions (NPAR, multichannel) as well. Basically if there is possible
to have multiple netdevs on the single hw port.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index dfd9f5d56ae0..58eb802584b9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -4989,6 +4989,24 @@ int dev_change_carrier(struct net_device *dev, bool new_carrier) | |||
4989 | EXPORT_SYMBOL(dev_change_carrier); | 4989 | EXPORT_SYMBOL(dev_change_carrier); |
4990 | 4990 | ||
4991 | /** | 4991 | /** |
4992 | * dev_get_phys_port_id - Get device physical port ID | ||
4993 | * @dev: device | ||
4994 | * @ppid: port ID | ||
4995 | * | ||
4996 | * Get device physical port ID | ||
4997 | */ | ||
4998 | int dev_get_phys_port_id(struct net_device *dev, | ||
4999 | struct netdev_phys_port_id *ppid) | ||
5000 | { | ||
5001 | const struct net_device_ops *ops = dev->netdev_ops; | ||
5002 | |||
5003 | if (!ops->ndo_get_phys_port_id) | ||
5004 | return -EOPNOTSUPP; | ||
5005 | return ops->ndo_get_phys_port_id(dev, ppid); | ||
5006 | } | ||
5007 | EXPORT_SYMBOL(dev_get_phys_port_id); | ||
5008 | |||
5009 | /** | ||
4992 | * dev_new_index - allocate an ifindex | 5010 | * dev_new_index - allocate an ifindex |
4993 | * @net: the applicable net namespace | 5011 | * @net: the applicable net namespace |
4994 | * | 5012 | * |