From: Dan Williams <dcbw@redhat.com>
To: Joshua Watt <jpewdev@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: Question about phys_port_id
Date: Wed, 17 Dec 2014 10:47:06 -0600 [thread overview]
Message-ID: <1418834826.1160.35.camel@dcbw.local> (raw)
In-Reply-To: <CAEPrYjTZ8SU1y4TwKHYtZju+4_-O5mazAjaFKaKmR2cYuAKHnA@mail.gmail.com>
On Wed, 2014-12-17 at 10:09 -0600, Joshua Watt wrote:
> 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
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?
> 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
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.
> 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.
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
> 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-12-17 16:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 16:09 Question about phys_port_id Joshua Watt
2014-12-17 16:47 ` Dan Williams [this message]
2014-12-17 16:59 ` [PATCH] Documentation: clarify phys_port_id Dan Williams
2014-12-17 23:24 ` Florian Fainelli
2014-12-18 5:57 ` Sathya Perla
2014-12-18 15:35 ` Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1418834826.1160.35.camel@dcbw.local \
--to=dcbw@redhat.com \
--cc=jpewdev@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).