From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH] net: rtl8169: allow multiple devices
Date: Tue, 26 Apr 2016 11:14:06 -0600 [thread overview]
Message-ID: <571FA1DE.3080809@wwwdotorg.org> (raw)
In-Reply-To: <571F9D0E.8070705@wwwdotorg.org>
On 04/26/2016 10:53 AM, Stephen Warren wrote:
> On 04/25/2016 11:08 AM, Joe Hershberger wrote:
>> Hi Stephen,
>>
>> On Wed, Apr 20, 2016 at 6:31 PM, Stephen Warren
>> <swarren@wwwdotorg.org> wrote:
>>> From: Stephen Warren <swarren@nvidia.com>
>>>
>>> Currently, if multiple rtl8169 devices exist on the PCI bus, they all
>>> get the same name, which prevents the user from selecting which to use
>>> via the ethact environment variable. Port the auto-naming code from the
>>> e1000 driver to solve this.
>
> ... (issues with ethprime/ethact)
>>> Equally,
>>> simply running e.g. "dhcp zImage" twice in a row doesn't seem to work;
>>> perhaps the subsequent attempts perform another lookup by name from
>>> ethact
>>> rather than just using the same device pointer from before?
>>
>> I believe it does work in general. Are you saying that it doesn't work
>> on your board without this patch?
>
> Ah. The problem is that modifying ethprime after it's been used the
> first time has no effect. So, the following work:
>
> pci enum
> setenv ethprime 'RTL8169#0'
> dhcp zImage
>
> or:
>
> pci enum
> setenv ethprime 'RTL8169#1'
> dhcp zImage
>
> but this doesn't:
>
> pci enum
> setenv ethprime 'RTL8169#0'
> dhcp zImage
> # Move Ethernet cable
> setenv ethprime 'RTL8169#1'
> dhcp zImage
>
> I guess that makes sense given how ethprime is supposed to work, but was
> a bit confusing when I wasn't aware.
There is one problematic case in the current code-base, without this
patch, again because there can be multiple Ethernet adapters with the
same name.
eth-uclass.c's eth_get_dev_by_name() allows devices to be looked up
either by name, or via string "ethN" which will find the Nth adapter.
That enables the user to select between even identically-named adapters.
However, eth_current_changed() then over-writes ethact to the adapter
name, which potentially causes a different adapter to be found next
time, which likely causes failures, e.g. if the user only plugged a
cable into one of the two.
> pci enum
> setenv ethact eth1
> dhcp zImage
<<succeeds>
> echo $ethact
eth_rtl8169
> dhcp zImage
<<fails>>
This patches solves that problem too, since the value in the
over-written ethact is unique so everything works.
prev parent reply other threads:[~2016-04-26 17:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-20 23:31 [U-Boot] [RFC PATCH] net: rtl8169: allow multiple devices Stephen Warren
2016-04-25 16:43 ` Stephen Warren
2016-04-25 17:08 ` Joe Hershberger
2016-04-26 16:53 ` Stephen Warren
2016-04-26 17:14 ` Stephen Warren [this message]
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=571FA1DE.3080809@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/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