automatic NIC driver selection.

Eric Norum norume at aps.anl.gov
Tue Jan 31 13:03:03 UTC 2006


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
>

-- 
Eric Norum <norume at aps.anl.gov>
Advanced Photon Source
Argonne National Laboratory
(630) 252-4793






More information about the users mailing list