automatic NIC driver selection.
Till Straumann
strauman at slac.stanford.edu
Wed Feb 1 04:42:52 UTC 2006
I've done that, too, but I found it less flexible
(e.g., the mvme5500 and mvme6100 have two interfaces. I want
RTEMS to use the first one with an active link, not
just the first successfully probed card).
Also, you'd have to replicate the address parameters
on all those structures if BOOTP is not used.
Furthermore, with my BSPs, I use yet another hack
to cook up part of the network configuration
from NVRAM and/or a commandline that is passed in
by a bootloader.
This code would then have to know which driver was selected.
Here's what my hacks do in summary:
1) several parameters (e.g., boot file, IP address, ...)
are extracted from NVRAM and command line and filled
into the network config. Interface parameters (IP address)
go into the first non-loopback interface structure.
2) network is started
3) the aforementioned 'wrapper-attach-hack' routine selects
a driver (based on PCI ids, probing, link status etc.)
4) call driver's attach method
5) special 'bootp_hook_hack' method in the network configuration
does last tweaks before and after an (optional)
BOOTP request. What exactly is done and if a BOOTP
lookup is performed at all depends on the NVRAM
and commandline parameter settings.
YMMV
-- Till
Eric Norum wrote:
> I think that some of the pc386 drivers are already set up for automatic
> selection. Have you tried simply chaining together several driver
> configuration structures before calling rtems_bsdnet_initialize_network()?
>
> For example, here's a section of the RTEMS/EPICS network configuration
> file. At the time I wrote it there were very few pc386 drivers
> available. Perhaps some of the newer drivers also support probing.
> (Aside: We really ought to make sure that more/all drivers are capable
> of probing for hardware presence.)
>
>
> extern void rtems_bsdnet_loopattach();
> static struct rtems_bsdnet_ifconfig loopback_config = {
> "lo0", /* name */
> (int (*)(struct rtems_bsdnet_ifconfig *, int))
> rtems_bsdnet_loopattach, /* attach function */
> NULL, /* link to next interface */
> "127.0.0.1", /* IP address */
> "255.0.0.0", /* IP net mask */
> };
>
> /*
> * The following conditionals select the network interface card.
> *
> * On RTEMS-pc386 targets all network drivers which support run-time
> * probing are linked.
> * On other targets the network interface specified by the board-support
> * package is used.
> * To use a different NIC for a particular application, copy this file
> to the
> * application directory and make the appropriate changes.
> */
> #if defined(__i386__)
> extern int rtems_fxp_attach (struct rtems_bsdnet_ifconfig *, int);
> static struct rtems_bsdnet_ifconfig fxp_driver_config = {
> "fxp1", /* name */
> rtems_fxp_attach, /* attach function */
> &loopback_config, /* link to next interface */
> };
> extern int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *,
> int);
> static struct rtems_bsdnet_ifconfig e3c509_driver_config = {
> "ep0", /* name */
> rtems_3c509_driver_attach, /* attach function */
> &fxp_driver_config, /* link to next interface */
> };
> #define FIRST_DRIVER_CONFIG &e3c509_driver_config
> #else
>
>
> On Jan 30, 2006, at 8:58 PM, Till Straumann wrote:
>
>> Karel Gardas wrote:
>>
>>> Hello,
>>> has anybody here already hacked RTEMS to support some kind of
>>> automatic NIC driver selection? The purpose is to compile once net-
>>> enabled binaries and runs on two (or more) machines (pc386 BSP) with
>>> different NIC.
>>> Thanks,
>>> Karel
>>> --
>>> Karel Gardas kgardas at objectsecurity.com
>>> ObjectSecurity Ltd. http://www.objectsecurity.com
>>
>>
>> Yes.
>>
>> Hacked is the appropriate word.
>>
>> I write a wrapper 'attach' method which does the driver selection
>> (the MVME6100 BSP I recently wrote also does link detection
>> there), modifies the 'ifcfg->attach' and 'ifcfg->name' fields and
>> vectors to the real 'attach'.
>>
>>
>> Till
>>
>
More information about the users
mailing list