RTEMS networking (RTL 8139)

Joel Sherrill joel.sherrill at OARcorp.com
Wed Nov 27 14:15:45 UTC 2002



Imran Ali wrote:
> 
> Hi Joe,
> 
>    I think you missed out to add your MAC address in
> the networkconfig.h file. I don't know if you should do this, but
> I'm sure you defined some other value there.             &nb sp;
> 
> I've gone through the RTEMS networking supplement( though didn't  most
> of it didn't get in to my head). I am trying to use networking demo
> executives. I selected the PC386 target so as to test it on my system
> itself. I built the BSP using the RTEMS snapshot 20021111. My network
> card is RTL8139. I've downloaded the netdemo files.  The I've edited
> the networkconfig.h as below. Also edited the bsp.h file to define the
> BSP_NETWORK_DRIVER as NE2000, didn't define USE_BOOTP. The netdemo
> executive built fine and loaded. Now when I issue a 't' command, which
> sends a tcp packet, I suppose, the application got hanged. Also when
> I gave the 'u' input repeatedly, the executive crashed and shutdown. I
> don't know how to test if my network card driver or any other
> configuration is causing the problem. Hope someone helps me.

You might want to run some of the other network demos just to
get a feel for how good/bad things are.

I don't know about the RTL8139 in particular with the NE2K driver but
do know that NE2K cards are notorious for minor variations that lead
to weird incompatabilities.  The Linux kernel has its own special driver
for the RTL8139 separate from the NE2K which includes this warning:

> 1) The RTL-8139 has a serious problem with motherboards which do
> posted MMIO writes to PCI space.  This driver works around the
> problem by having an MMIO  register write be immediately followed by
> an MMIO register read.

I don't know if that applies to your motherboard or not.  Can anyone
confirm that an RTL8139 has been in this configuration?


> thanks
> 
> Imran
> 
> /*
>  * Network configuration
>  *
>  ***************************************** *******************
>  * EDIT THIS FILE TO REFLECT YOUR NETWORK CONFIGURATION     *
>  * BEFORE RUNNING ANY RTEMS PROGRAMS WHICH USE THE NETWORK! *
>  ************************************************************
>  *
>  *  $Id: networkconfig.h,v 1.6.4.1 2000/05/09 21:38:58 joel Exp $
>  */
> 
> #ifndef _RTEMS_NETWORKCONFIG_H_
> #define _RTEMS_NETWORKCONFIG_H_
> 
> /*
>  *  The following will normally be set by the BSP if it supports
>  *  a single network device driver.  In the event, it supports
>  *  multiple network device drivers, then the user's default
>  *  network device driver will have to be selected by a BSP
>  *  specific mechanism.
>  */
> 
> #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
> #warning "RTEMS_BSP_NETWORK_DRIVER_NAME is not defined"
> #define RTEMS_BSP_NETWORK_DRIVER_NAME "no_network1"
> #endif
> 
> #ifndef RTEMS_BSP_NETWORK_DRIVER_ATTACH
> #warning "RTEMS_BSP_NETWORK_DRIVER_ATTACH is not defined"
> #define RTEMS_BSP_NETWORK_DRIVER_ATTACH 0
> 
> /* #define RTEMS_USE_BOOTP */
> 
> #include <bsp.h>
> 
> /*
>  * Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the
>  * Ethernet address here.  If RTEMS_SET_ETHERNET_ADDRESS is not
>  * defined the driver will choose an address.
>  */
> 
> #define RTEMS_SET_ETHERNET_ADDRESS
> #if (defined (RTEMS_SET_ETHERNET_ADDRESS))
> /* static char ethernet_address[6] = { 0x08, 0x00, 0x3e, 0x12, 0x28,
> 0xb1 }; */
> 
> 
> 
> static char ethernet_address[6] = { 0x00, 0xE0, 0x18, 0x37, 0x3D, 0x65
> };
> 
> #endif
> extern void rtems_bsdnet_do_dhcp();
> #ifdef RTEMS_USE_LOOPBACK
> /*
>  * Loopback interface
>  */
> extern void rtems_bsdnet_loopattach();
> 
> static struct rtems_bsdnet_ifconfig loopback_config = {
>  "lo0",    /* name */
>  rtems_bsdnet_loopattach, /* attach function */
> 
>  NULL,    /* link to next interface */
> 
>  "127.0.0.1",   /* IP address */
>  "255.0.0.0",   /* IP net mask */
> };
> #endif
> 
> /*
>  * Default network interface
>  */
> static struct rtems_bsdnet_ifconfig netdriver_config = {
>  RTEMS_BSP_NETWORK_DRIVER_NAME,  /* name */
>  RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */
> 
> #ifdef RTEMS_USE_LOOPBACK
>  &loopback_config,  /* link to next interface */
> #else
>  NULL,    /* No more interfaces */
> #endif
> 
> #if (defined (RTEMS_USE_BOOTP))
>  NULL,    /* BOOTP supplies IP address */
>  NULL,    /* BOOTP supplies IP net mask */
> #else
>  "10.0.0.138",  /* IP address */
>  "255.0.0.0",  /* IP net mask */
> #endif /* !RTEMS_USE_BOOTP */
> 
> #if (defined (RTEMS_SET_ETHERNET_ADDRESS))
>  ethernet_address,   & nbsp;           /* Ethernet hardware address */
> #else
>  NULL,        & nbsp;           &nbs p;      /* Driver supplies
> hardware address */
> #endif
>  0    /* Use default driver parameters */
> };
> 
> /*
>  * Network configuration
>  */
> struct rtems_bsdnet_config rtems_bsdnet_config = {
>  &netdriver_config,
> 
> #if (defined (RTEMS_USE_BOOTP))
>  rtems_bsdnet_do_dhcp,
> #else
>  NULL,#endif
> 
>  0,   /* Default network task priority */
>  0,   /* Default mbuf capacity */
>  0,   /* Default mbuf cluster capacity */
> 
> #if (!defined (RTEMS_USE_BOOTP))
>  "IMRAN",  /* Host name */
>  "msdomain",  /* Domain name */
>  "10.0.0.9", /* Gateway */
>  "10.0.0.9", /* Log host */
>  {"10.0.0.9" }, /* Name server(s) */
>  {"10.0.0.9" }, /* NTP server(s) */
> 
>  /*
>   *  A real example -- DO NOT USE THIS YOURSELF!!!
>   */
> 
> #if 0
>  "dy4",   /* Host name */
>  "NOT_oarcorp.com", /* Domain name */
>  "192.168.1.2",    /* Gateway */
>  "192.168.1.2",   /* Log host */
>  {"192.168.1.2" }, /* Name server(s) */
>  {"192.168.1.2" }, /* NTP server(s) */
> #endif
> #endif /* !RTEMS_USE_BOOTP */
> 
> };
> 
> /*
>  * For TFTP test application
>  */
> #if (!defined (RTEMS_USE_BOOTP))
> #define RTEMS_TFTP_TEST_HOST_NAME "IMRAN"
> #define RTEMS_TFTP_TEST_FILE_NAME "tftptest"
> #endif
> 
> #endif /* _RTEMS_NETWORKCONFIG_H_ */
> 
> 
> 
> 
> 
> 
> 
> >Thank you for your response. Setting the file
> >descriptors did fix the problem, but partially. Right
> >now I'm trying to fiqure out why I can't ping the
> >target system. I thought this is prebuilt to the
> >network demo program.
> >
> > I know I can't change the hardware address. I just
> >wanted to know that whether the address displayed by
> >the  netdemo program is my hw address. If so, it's
> >something diffrerent than that shown by ifconfig. What
> >does that mean? Is RTEMS identifying my NIC correctly?
> >with regards
> >Joe
> > --- Ian Caddy <ianc at microsol.iinet.net.au> wrote: >
> >Hi Joe,
> >>
> >> When you build your application you must tell RTEMS
> >> how many resources
> >> you require.
> >>
> >> In the example that you showed, you are running out
> >> of file handles.
> >> This can be increased by:
> >>
> >>
> >> #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS  20
> >>
> >> 20 is just a number that I put in there, but you
> >> have to decide how big
> >> you want it.  There are a bunch of other ones that
> >> you will require as well.
> >>
> >> The C_UserGuide has information on these defines
> >> which need to be placed
> >> in your application before the confdefs.h include
> >> file.  This is
> >> normally contained in your init task file.
> >>
> >> As to your mac address, the card may have a
> >> hardcoded mac address and
> >> won't let you change it if that is what you were
> >> trying to do.  In this
> >> case, when you read it back it will be the card's
> >> mac address and not
> >> one you tried to put in.
> >>
> >> I hope this helps,
> >>
> >> Ian Caddy
> >>
> >>
> >> Joe Samuel wrote:
> >> > Hi Sachin,
> >> >      thank you for your response. But I could know
> >> > that RTL 8139 is NE2000 compatible. When I changed
> >> the
> >> > bsp.h(#define RTEMS_BSP_NETWORK_DRIVER_NAME
> >> > BSP_NE2000_NETWORK_DRIVER_NAME), the
> >> initialization
> >> > didn't hang, but I got the following messages:
> >> >
> >> > Network device 'ne1' <00:D0:09:57:86:23>
> >> initialized
> >> > on port 0xC000, irq 5
> >> > Can't bring ne1 up: Too many open files on system
> >> > Can't set default roots: No such process
> >> > No routes!
> >> > Create socket
> >> > RTEMS: Can't create socket
> >> >
> >> >     These messages give me some hope that there is
> >> a
> >> > workaround using the RTL network card itself.
> >> > I'm posting this to the RTEMS group also. Can
> >> anyone
> >> > suggest a solution?
> >> >
> >> > BTw, is the address in the first messge supposed
> >> to be
> >> > my mac address?, but ifconfig return a different
> >> > address- 00:E0:18:37:3E:86 .
> >> >
> >> > regards,
> >> > Joe
> >> >
> >> >
> >> >
> >> >  --- Sachin K <sachin at dexceldesigns.com> wrote: >
> >> > ----- Original Message -----
> >> >
> >> >>From: "Joe Samuel" <sjoe2 at yahoo.com>
> >> >>To: "Sachin K" <sachin at dexceldesigns.com>
> >> >>Sent: Monday, November 25, 2002 5:29 PM
> >> >>Subject: Re: RTEMS networking (RTL 8139)
> >> >>
> >> >>
> >> >>
> >> >>>Hi Sachin,
> >> >>>  thank you for your quick response. I'm using
> >> RTL
> >> >>>8139 NIC.
> >> >>
> >> >>( same card which i was using. ;) )
> >> >>
> >> >>
> >> >>>I think I should look for another NIC right?
> >> >>
> >> >>yes.
> >> >>try for winbond NIC.
> >> >>
> >> >>>
> >> >>>Joe
> >> >>> --- Sachin K <sachin at dexceldesigns.com> wrote:
> >
> >> >>>----- Original Message -----
> >> >>>
> >> >>>>From: "Joe Samuel" <sjoe2 at yahoo.com>
> >> >>>>To: "Sachin K" <sachin at dexceldesigns.com>
> >> >>>>Sent: Monday, November 25, 2002 12:00 PM
> >> >>>>Subject: RTEMS networking (RTL 8139)
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>>>Hi Sachin,
> >> >>>>
> >> >>>>Hi Samuel,
> >> >>>>
> >> >>>>
> >> >>>>>    I'm an undergradute experimenting with
> >> >>>>
> >> >>RTEMS
> >> >>
> >> >>>>as
> >> >>>>
> >> >>>>>part of my research project. I also faced the
> >> >>>>
> >> >>same
> >> >>
> >> >>>>>problem described by you here:
> >> >>>>>
> >> >>>>
> >> >
> >>
> >http://www.oarcorp.com/rtems/maillistArchives/rtems-users/2002/july/msg
> 00053
> >> >
> >> >>>>.html
> >> >>>>
> >> >>>>>  Could you please let me know if you've found
> >> >>>>
> >> >>any
> >> >>
> >> >>>>>work arounds?
> >> >>>>
> >> >>>>first check which type of ethernet card you
> >> >>>
> >> >>have,
> >> >>
> >> >>>>because RTEMS currently
> >> >>>>supports only NE2000, dec compatible ethernet
> >> >>>>devices.
> >> >>>>
> >> >>>>if you have the network card which is compatible
> >> >>>>with the above mentioned
> >> >>>>chipset, modify the attached network config file
> >> >>>>according to your network
> >> >>>>setings and use it in your application.
> >> >>>>
> >> >>>>
> >> >>>>>thank you in advance.
> >> >>>>>Joe
> >> >>>>>
> >> >>>>
> >> >>>>Sachin.K
> >> >>>>
> >> >>>
> >> >>>>ATTACHMENT part 2 application/octet-stream
> >> >>>
> >> >>>name=networkconfig.h
> >> >>>
> >> >>>>
> >> >
> >>
> >--------------------------------------------------------------
> >> >
> >> >>>>Dexcel Electronics Designs (P) Ltd., Bangalore,
> >> >>>>India
> >> >>>>
> >> >>>
> >>
> >>>>__________________________________________________
> >> >>>Do You Yahoo!?
> >> >>>Everything you'll ever need on one web page
> >> >>>from News and Sport to Email and Music Charts
> >> >>>http://uk.my.yahoo.com
> >> >>
> >> >>
> >> >>
> >> >
> >>
> >--------------------------------------------------------------
> >> >
> >> >>Dexcel Electronics Designs (P) Ltd., Bangalore,
> >> >>India
> >> >>
> >> >>
> >> >
> >> >
> >> > __________________________________________________
> >> > Do You Yahoo!?
> >> > Everything you'll ever need on one web page
> >> > from News and Sport to Email and Music Charts
> >> > http://uk.my.yahoo.com
> >> >
> >>
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Everything you'll ever need on one web page
> >from News and Sport to Email and Music Charts
> >http://uk.my.yahoo.com
> >
> 
> _______________________________________________________________
> http://www.homenetmail.com Free e-Mail Service
> Visit www.schoolnetindia.com for Networked Learning

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list