提交 3f85944f 编写于 作者: A Amir Vadai 提交者: David S. Miller

net: Add sysfs file for port number

Add a sysfs file to enable user space to query the device
port number used by a netdevice instance. This is needed for
devices that have multiple ports on the same PCI function.
Signed-off-by: NAmir Vadai <amirv@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f2ea0cfd
...@@ -1279,6 +1279,10 @@ struct net_device { ...@@ -1279,6 +1279,10 @@ struct net_device {
* that share the same link * that share the same link
* layer address * layer address
*/ */
unsigned short dev_port; /* Used to differentiate
* devices that share the same
* function
*/
spinlock_t addr_list_lock; spinlock_t addr_list_lock;
struct netdev_hw_addr_list uc; /* Unicast mac addresses */ struct netdev_hw_addr_list uc; /* Unicast mac addresses */
struct netdev_hw_addr_list mc; /* Multicast mac addresses */ struct netdev_hw_addr_list mc; /* Multicast mac addresses */
......
...@@ -104,6 +104,7 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr, ...@@ -104,6 +104,7 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr,
} }
NETDEVICE_SHOW_RO(dev_id, fmt_hex); NETDEVICE_SHOW_RO(dev_id, fmt_hex);
NETDEVICE_SHOW_RO(dev_port, fmt_dec);
NETDEVICE_SHOW_RO(addr_assign_type, fmt_dec); NETDEVICE_SHOW_RO(addr_assign_type, fmt_dec);
NETDEVICE_SHOW_RO(addr_len, fmt_dec); NETDEVICE_SHOW_RO(addr_len, fmt_dec);
NETDEVICE_SHOW_RO(iflink, fmt_dec); NETDEVICE_SHOW_RO(iflink, fmt_dec);
...@@ -373,6 +374,7 @@ static struct attribute *net_class_attrs[] = { ...@@ -373,6 +374,7 @@ static struct attribute *net_class_attrs[] = {
&dev_attr_netdev_group.attr, &dev_attr_netdev_group.attr,
&dev_attr_type.attr, &dev_attr_type.attr,
&dev_attr_dev_id.attr, &dev_attr_dev_id.attr,
&dev_attr_dev_port.attr,
&dev_attr_iflink.attr, &dev_attr_iflink.attr,
&dev_attr_ifindex.attr, &dev_attr_ifindex.attr,
&dev_attr_addr_assign_type.attr, &dev_attr_addr_assign_type.attr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册