|
@@ -418,6 +418,28 @@ static ssize_t phys_port_id_show(struct device *dev,
|
|
|
}
|
|
|
static DEVICE_ATTR_RO(phys_port_id);
|
|
|
|
|
|
+static ssize_t phys_port_name_show(struct device *dev,
|
|
|
+ struct device_attribute *attr, char *buf)
|
|
|
+{
|
|
|
+ struct net_device *netdev = to_net_dev(dev);
|
|
|
+ ssize_t ret = -EINVAL;
|
|
|
+
|
|
|
+ if (!rtnl_trylock())
|
|
|
+ return restart_syscall();
|
|
|
+
|
|
|
+ if (dev_isalive(netdev)) {
|
|
|
+ char name[IFNAMSIZ];
|
|
|
+
|
|
|
+ ret = dev_get_phys_port_name(netdev, name, sizeof(name));
|
|
|
+ if (!ret)
|
|
|
+ ret = sprintf(buf, "%s\n", name);
|
|
|
+ }
|
|
|
+ rtnl_unlock();
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+static DEVICE_ATTR_RO(phys_port_name);
|
|
|
+
|
|
|
static ssize_t phys_switch_id_show(struct device *dev,
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
{
|
|
@@ -465,6 +487,7 @@ static struct attribute *net_class_attrs[] = {
|
|
|
&dev_attr_tx_queue_len.attr,
|
|
|
&dev_attr_gro_flush_timeout.attr,
|
|
|
&dev_attr_phys_port_id.attr,
|
|
|
+ &dev_attr_phys_port_name.attr,
|
|
|
&dev_attr_phys_switch_id.attr,
|
|
|
NULL,
|
|
|
};
|