Re: [RTnet-developers] arcnet driver
Brought to you by:
bet-frogger,
kiszka
|
From: Jan K. <jan...@we...> - 2006-07-14 16:36:48
|
Chris Lightcap wrote:
>=20
> Hi Jan,
>=20
> I made the changes you suggested in your last response. I've exported
> the rtdev_alloc so that I can use that with arcdev_setup in my driver.
> (code shown below)
>=20
> /* Setup a struct device for ARCnet. */
>=20
> static void arcdev_setup(struct rtnet_device *dev)
> {
> dev->type =3D ARPHRD_ARCNET;
> dev->hard_header_len =3D sizeof(struct archdr);
> dev->mtu =3D choose_mtu();
> dev->get_mtu =3D rt_hard_mtu; // RTNET
>=20
> dev->addr_len =3D ARCNET_ALEN;
>=20
> // dev->tx_queue_len =3D 100; // RTNET
> // dev->watchdog_timeo =3D TX_TIMEOUT;
>=20
> dev->broadcast[0] =3D 0x00; // for us, broadcasts are address 0
> =20
> // New-style flags.
>=20
> dev->flags =3D IFF_BROADCAST;
> =20
> // Put in this stuff here, so we don't have to export the symbols t=
o
> // the chipset drivers.
> =20
> dev->open =3D arcnet_open;
> dev->stop =3D arcnet_close;
> dev->hard_start_xmit =3D arcnet_send_packet;
>=20
> // dev->tx_timeout =3D arcnet_timeout;
> // dev->get_stats =3D arcnet_get_stats;
>=20
> dev->hard_header =3D arcnet_header;
> dev->rebuild_header =3D arcnet_rebuild_header;
> }
>=20
> struct rtnet_device *rt_alloc_arcdev(char *name)
> {
> struct rtnet_device *dev;
>=20
> /*** RTnet ***/
> =20
> dev =3D rtdev_alloc(sizeof(struct arcnet_local)); // <-------
> if (!dev)
> return NULL;
>=20
> arcdev_setup(dev);
>=20
> memset(dev->broadcast, 0xFF, ARCNET_ALEN);
> strcpy(dev->name, "rteth%d");
> =20
> rtdev_alloc_name(dev, "rtarc%d");
> rt_rtdev_connect(dev, &RTDEV_manager);
> RTNET_SET_MODULE_OWNER(dev);
> dev->vers =3D RTDEV_VERS_2_0;
>=20
> /*** RTnet ***/
>=20
> if(dev) {
> struct arcnet_local *lp =3D (struct arcnet_local *) dev->priv;
> rtdm_lock_init(&lp->lock); /*** RTnet ***/
> }
>=20
> return dev;
> }
>=20
> We're not planning to run RTmac/TDMA over our RT arcnet so we've decide=
d
> to scratch the rtnet startup script and load the required modules in ou=
r
> own script. Is there anything more that has to be done to load rtnet?
Yes and no. Explanation follows below.
>=20
> mknod /dev/rtnet c 10 240
>=20
> ifconfig lo down
> ifconfig arc0 down
>=20
> insmod /usr/local/rtnet/modules/rtnet.ko
> insmod /usr/local/rtnet/modules/rtipv4.ko
> insmod /usr/local/rtnet/modules/rtpacket.ko
> insmod /usr/local/rtnet/modules/rt_loopback.ko
>=20
> insmod /usr/local/rtnet/modules/rt_arcnet.ko
> insmod /usr/local/rtnet/modules/rt_com20020.ko
> insmod /usr/local/rtnet/modules/rt_com20020-pci.ko
> insmod /usr/local/rtnet/modules/rt_arc-rawmode.ko
>=20
> /usr/local/rtnet/sbin/rtifconfig rtarc0 up 10.1.1.1
> /usr/local/rtnet/sbin/rtifconfig rtlo up 127.0.0.1
>=20
> It seems like everything loaded ok (no error messages) and here's the
> output from dmesg | tail .. is the station address 00 a looming problem=
?
> can I change this in the source file?
That looks arcnet-specific to me, and this is something I cannot comment
on due to lacking experience. I would compare the output with standard
Linux. Of course, understanding how the station addresses are normally
used will be even better. ;)
>=20
> lightcap@borelli:/usr/local/rtnet/sbin$ dmesg | tail
> [4299263.969000] rt-arcnet: COM20020 PCI support
> [4299263.970000] ACPI: PCI Interrupt 0000:04:02.0[A] -> GSI 18 (level,
> low) -> IRQ 21
> [4299263.970000] rtarc0: Contemporary Controls
> [4299264.272000] rtarc0: PCI COM20020: station 00h found at CC70h, IRQ =
21.
> [4299264.280000] rtarc0: Using CKP 64 - data rate 2.5 Mb/s.
> [4299264.280000] RTnet: registered rtarc0
> [4300094.481000] initializing loopback...
> [4300094.481000] RTnet: registered rtlo
> [4300094.511000] rt-arcnet: raw mode (`r') encapsulation support loaded=
=2E
> [4300094.512000] rtarc0: WARNING! Station address 00 is reserved for
> broadcasts!
>=20
> and surprisingly!
>=20
> lightcap@borelli:/usr/local/rtnet/sbin$ sudo ./rtifconfig -a
> rtarc0 Medium: unknown (7)
^^^^^^^
Hah, this still needs fixing! :o>
(see tools/rtifconfig.c)
> IP address: 10.1.1.1 Broadcast address: 10.255.255.255
> UP BROADCAST RUNNING MTU: 508
>=20
> rtlo Medium: Local Loopback
> IP address: 127.0.0.1
> UP LOOPBACK RUNNING MTU: 1500
>=20
> Here is the interesting part! I have a worst case rtt of 0.0 us when I
> ping the local loopback. This can't be right. Even more strange is that=
Let me guess: you run this over RTAI? Then you did not start the system
timer /somehow/. Normally, this is done by rtcfg.ko or tdma.ko. If those
modules aren't loaded, your application has to do this. But as you do
not have any application yet: simply insmod rtcfg.ko. This will start
the timer while rtcfg remains passive otherwise.
> I can ping the arcnet card, which I thought was only possible for TCP/I=
P
> devices. What should I set for the IP address of my arcnet card; should=
> I leave it empty? And the big question is how can I test the performanc=
e
> of the new arcnet driver without implementing it in our robot control
> software? I have Ethereal but I it would be helpful if you had an
> example program.
Well, if it is transparent to the rest of the RTnet stack (and this
seems to be the case), rtping would be a good start. Another performance
tester are the rtt-* examples under examples/xenomai/posix. Teresa
Noviello started a RTAI port recently, but I don't know the current statu=
s.
>=20
> lightcap@borelli:/usr/local/rtnet/sbin$ sudo ./rtping 127.0.0.1
> Real-time PING 127.0.0.1 56(84) bytes of data.
> 64 bytes from 127.0.0.1: icmp_seq=3D1 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D2 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D3 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D4 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D5 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D6 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D7 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D8 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D9 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D10 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D11 time=3D0.0 us
>=20
> --- 127.0.0.1 rtping statistics ---
> 11 packets transmitted, 11 received, 0% packet loss
> worst case rtt =3D 0.0 us
>=20
> lightcap@borelli:/usr/local/rtnet/sbin$ sudo ./rtping 10.1.1.1
> Real-time PING 10.1.1.1 56(84) bytes of data.
> 64 bytes from 127.0.0.1: icmp_seq=3D1 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D2 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D3 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D4 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D5 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D6 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D7 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D8 time=3D0.0 us
> 64 bytes from 127.0.0.1: icmp_seq=3D9 time=3D0.0 us
>=20
> --- 10.1.1.1 rtping statistics ---
> 9 packets transmitted, 9 received, 0% packet loss
> worst case rtt =3D 0.0 us
>=20
>=20
> Thanks again! I'm making great process thanks to your quick responses.
I'm just eagerly awaiting your patches... :)
Jan
|