Question about phys_port_id
Subsystems (2)
Hello,
I had a question regarding the phys_port_id attribute of net_device. Is that identifier supposed to be globally unique or just unique among devices that share a common device? For example, we have a single device that create two net_device s (one for each of it's macs). Would it be sufficient for this device to return a phys_port_id of 0 for the first net_device and 1 for the second? I noticed that the other implementations that use phys_port_id copy their mac address into the phys_port_id, but I'm not sure if that is just because that is an easy way to get a unique number or if it is because the ID needs to be globally unique.
If you're wondering the driver in question is the TI cpsw driver (drivers/net/ethernet/ti/cpsw.c). We are running the device in dual-emac mode and need to uniquely identify which emac is which in userspace (specifically, udev rules). The physical port identifier seems to be the logical choice to me, but I'm not sure if I'm missing something.
Thanks,
Joshua Watt
Quoted 6 lines · Joshua Watt
Hello,
I had a question regarding the
phys_port_idattribute ofnet_device. Is that identifier supposed to be globally unique or just unique among devices that share a common device? For example, we have a single device that create twonet_devices (one for each of it's macs). Would
Do the two net_device's share hardware or firmware resources? Can they be used independently at maximum capability, or when both are in use do they have degraded capability?
Quoted 2 lines
it be sufficient for this device to return a
phys_port_idof 0 for the firstnet_deviceand 1 for the second? I noticed that the other
If the two netdevs share resources, then they should have the *same* phys_port_id. If they do not have the same physical hardware or shared resources and are completely independent from each other at all levels, then you can either skip phy_port_id altogether.
One good use for this (and why it was originally added) was to indicate to userspace that it was pointless to bond two interfaces with the same underlying hardware or resources, because that totally defeats the purpose of both failover and aggregation.
Quoted 4 lines
implementations that use
phys_port_idcopy their mac address into thephys_port_id, but I'm not sure if that is just because that is an easy way to get a unique number or if it is because the ID needs to be globally unique.
Say you have two netdevs that share the same hardware or resources. You assign them both a phys_port_id of "1" to indicate this. What if there's a second cpsw device on the system, do both of its netdevs also get "1", or "2", or? Or how about a card from another vendor, how do you ensure that your device's phys_port_id won't conflict with that vendor's device/driver?
That's why most drivers currently use the MAC address or a GUID.
Dan
Quoted 13 lines
If you're wondering the driver in question is the TI cpsw driver (
drivers/net/ethernet/ti/cpsw.c). We are running the device in dual-emac mode and need to uniquely identify which emac is which in userspace (specifically, udev rules). The physical port identifier seems to be the logical choice to me, but I'm not sure if I'm missing something.Thanks,
Joshua Watt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 Documentation: clarify phys_port_id
--- Documentation/ABI/testing/sysfs-class-net | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/ABI/testing/sysfs-class-net +6 -1
@@ -186,7 +186,12 @@ KernelVersion: 3.12 Contact: [email protected] Description: Indicates the interface unique physical port identifier within - the NIC, as a string. + the NIC, as a string. If two net_device objects share physical + hardware or other resources, and/or do not operate independently + both net_device objects should be assigned the + same phys_port_id. phys_port_id should be as globally unique + as possible to prevent conflicts between different drivers and + vendors, eg with MAC addresses or hardware GUIDs. What: /sys/class/net/<iface>/speed Date: October 2009
Signature · 1 line
1.9.3
Re: [PATCH] Documentation: clarify phys_port_id
Quoted 1 line · Dan Williams
Signed-off-by Dan Williams <[email protected]>
Quoted 23 lines
--- Documentation/ABI/testing/sysfs-class-net | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)Documentation/ABI/testing/sysfs-class-net +6
-1@@ -186,7 +186,12 @@ KernelVersion: 3.12 Contact: [email protected] Description: Indicates the interface unique physical port identifier within - the NIC, as a string. + the NIC, as a string. If two net_device objects share physical + hardware or other resources, and/or do not operate independently + both net_device objects should be assigned the + same phys_port_id. phys_port_id should be as globally unique + as possible to prevent conflicts between different drivers and + vendors, eg with MAC addresses or hardware GUIDs. What: /sys/class/net/<iface>/speed Date: October 2009
RE: [PATCH] Documentation: clarify phys_port_id
In reply to Dan WilliamsQuoted 26 lines
-----Original Message-----
From: [email protected] [mailto:netdev-Signed-off-by Dan Williams <[email protected]>--- Documentation/ABI/testing/sysfs-class-net | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)Documentation/ABI/testing/sysfs-class-net +2
-1@@ -186,7 +186,12 @@ KernelVersion: 3.12 Contact: [email protected] Description: Indicates the interface unique physical port identifier within - the NIC, as a string. + the NIC, as a string. If two net_device objects share physical + hardware or other resources, and/or do not operateindependently
Documentation/ABI/testing/sysfs-class-net +2
-0+ both net_device objects should be assigned the + same phys_port_id. phys_port_id should be as globallyunique
Documentation/ABI/testing/sysfs-class-net +1
-0+ as possible to prevent conflicts between different driversand
Documentation/ABI/testing/sysfs-class-net KernelVersion: 3.12 · line 194
Quoted 1 line
Documentation/ABI/testing/sysfs-class-net +1
-0+ vendors, eg with MAC addresses or hardware GUIDs.
Dan, two interfaces -- on the same card/chip -- may share some chip resources, but as long as they use *separate* physical ports, it would be OK to bond them. So, in this case, it would be valid to report a different phys_port_id for these netdevs.
The text -- "share physical hardware or other resources" becomes too restrictive
^^^^^^^^^^^^^^^
and will not even allow bonding of two physical ports on a NIC card.
thks,
-Sathya
Quoted 11 lines
What: /sys/class/net/<iface>/speed
Date: October 2009
--
1.9.3--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Documentation: clarify phys_port_id
Quoted 32 lines · Sathya Perla
Quoted 26 lines
-----Original Message-----
From: [email protected] [mailto:netdev-Signed-off-by Dan Williams <[email protected]>--- Documentation/ABI/testing/sysfs-class-net | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)Documentation/ABI/testing/sysfs-class-net +2
-1@@ -186,7 +186,12 @@ KernelVersion: 3.12 Contact: [email protected] Description: Indicates the interface unique physical port identifier within - the NIC, as a string. + the NIC, as a string. If two net_device objects share physical + hardware or other resources, and/or do not operateindependently
Documentation/ABI/testing/sysfs-class-net +2
-0+ both net_device objects should be assigned the + same phys_port_id. phys_port_id should be as globallyunique
Documentation/ABI/testing/sysfs-class-net +1
-0+ as possible to prevent conflicts between different driversand
Documentation/ABI/testing/sysfs-class-net KernelVersion: 3.12 · line 194
Quoted 1 line
Documentation/ABI/testing/sysfs-class-net +1
-0+ vendors, eg with MAC addresses or hardware GUIDs.Dan, two interfaces -- on the same card/chip -- may share some chip resources, but as long as they use *separate* physical ports, it would be OK to bond them. So, in this case, it would be valid to report a different
phys_port_idfor these netdevs.
Quoted 3 lines
The text -- "share physical hardware or other resources" becomes too restrictive
^^^^^^^^^^^^^^^and will not even allow bonding of two physical ports on a NIC card.
Fair enough, I will reword and resubmit.
Dan
Quoted 13 lines
thks,
-SathyaQuoted 11 lines
What: /sys/class/net/<iface>/speed
Date: October 2009
--
1.9.3--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html