Re: [RTnet-developers] Kernel module for smc91111
Brought to you by:
bet-frogger,
kiszka
|
From: Jan K. <jan...@we...> - 2011-09-16 08:05:29
|
On 2011-09-16 09:33, Hinko Kocevar wrote:
> On 09/16/2011 08:32 AM, Jan Kiszka wrote:
>> On 2011-09-14 12:18, Hinko Kocevar wrote:
>>> Hi all,
>>>
>>> I'm trying to use smc91111 RT driver provided in RTnet package (git
>>> sources) on my ARM PXA253 board. The modules compiles against linux
>>> 2.6.35.9 and Xenomai 2.5.6, but when it is loaded it produces oops.
>>>
>>> What is the state of this module?
>>>
>>> OTOH, I might also try to port the stock kernel driver smc91x we are
>>> currently using to RTnet. It is quite similar to the one in RTnet but
>>> with more features and support for many ARM based boards.
>>
>> The rt_smc91111 is probably not prepared for your hardware. Note that
>> there is both smc91x ans smc911x in upstream while rt_smc9111 was based
>> on the latter (IIRC).
>>
>
> Thank you for response.
>
> I have done some porting of the smc91x driver as found in 2.6.35.9
> vanilla kernel to RTnet. The driver compiles and loads fine, my network
> card is also detected. Once started with "./rtnet start" I get this :
>
> [ 36.417588] I-pipe: Detected illicit call from domain 'Xenomai'
> [ 36.417626] <3> into a service reserved for domain 'Linux' and
> below.
>
>
> Complete dump:
>
> root@xcep:~# sh -x /usr/local/rtnet/sbin/rtnet start
> + prefix=/usr/local/rtnet
> + RTNETCFG=/usr/local/rtnet/etc/rtnet.conf
> + '[' start = -cf ']'
> + '[' -r /usr/local/rtnet/etc/rtnet.conf ']'
> + . /usr/local/rtnet/etc/rtnet.conf
> ++ prefix=/usr/local/rtnet
> ++ exec_prefix=/usr/local/rtnet
> ++ RTNET_MOD=/usr/local/rtnet/modules
> ++ RTIFCONFIG=/usr/local/rtnet/sbin/rtifconfig
> ++ RTCFG=/usr/local/rtnet/sbin/rtcfg
> ++ TDMACFG=/usr/local/rtnet/sbin/tdmacfg
> ++ MODULE_EXT=.ko
> ++ RT_DRIVER=rt_smc91111
> ++ RT_DRIVER_OPTIONS=
> ++ IPADDR=127.0.0.2
> ++ NETMASK=255.255.255.0
> ++ RT_LOOPBACK=yes
> ++ RT_PROTOCOLS=udp packet
> ++ RTCAP=no
> ++ STAGE_2_SRC=
> ++ STAGE_2_DST=
> ++ STAGE_2_CMDS=
> ++ TDMA_MODE=master
> ++ TDMA_SLAVES=127.0.0.1
> ++ TDMA_CYCLE=5000
> ++ TDMA_OFFSET=200
> + '[' start = -v ']'
> + '[' start = -c ']'
> + NETMASK_OPT=
> + '[' '!' 255.255.255.0 = '' ']'
> + NETMASK_OPT=netmask 255.255.255.0
> + init_rtnet
> + insmod /usr/local/rtnet/modules/rtnet.ko
> [ 32.975902]
> [ 32.975935] *** RTnet 0.9.12 - built on Sep 14 2011 15:06:10 ***
> [ 32.975952]
> [ 32.985177] RTnet: initialising real-time networking
> + insmod /usr/local/rtnet/modules/rtipv4.ko
> + insmod /usr/local/rtnet/modules/rt_smc91111.ko
> [ 33.958026] smc91x.c: v1.1-RTnet, sep 13 2011 by Hinko Kocevar
> <hin...@i-...>
> [ 33.976603] RTnet: registered rteth0
> [ 33.980392] rteth0: SMC91C11xFD (build 1316009442) (rev 2) at
> c4b2c300 IRQ 8 DMA 8 [nowait]
> [ 33.988842] rteth0: Ethernet addr: 00:d0:50:31:11:6c
> + insmod /usr/local/rtnet/modules/rtudp.ko
> + insmod /usr/local/rtnet/modules/rtpacket.ko
> + '[' yes = yes ']'
> + insmod /usr/local/rtnet/modules/rt_loopback.ko
> [ 34.457924] initializing loopback...
> [ 34.462746] RTnet: registered rtlo
> + '[' no = yes ']'
> + '[' yes = yes ']'
> + /usr/local/rtnet/sbin/rtifconfig rtlo up 127.0.0.1
> + '[' no = yes ']'
> + insmod /usr/local/rtnet/modules/rtcfg.ko
> [ 35.218000] RTcfg: init real-time configuration distribution protocol
> + insmod /usr/local/rtnet/modules/rtmac.ko
> [ 35.728923] RTmac: init realtime media access control
> + insmod /usr/local/rtnet/modules/tdma.ko
> [ 36.209592] RTmac/TDMA: init time division multiple access control
> mechanism
> + '[' master = master ']'
> + start_master
> + /usr/local/rtnet/sbin/rtcfg rteth0 server
> [ 36.253994] RTcfg: rtcfg_do_main_event() rtdev=1,
> event=RTCFG_CMD_SERVER, state=RTCFG_MAIN_OFF
> [ 36.262661] RTcfg: next main state=RTCFG_MAIN_SERVER_RUNNING
> + STAGE_2_OPT=
> + '[' '!' '' = '' ']'
> + '[' '!' 127.0.0.1 = '' ']'
> + /usr/local/rtnet/sbin/rtifconfig rteth0 up 127.0.0.2 netmask
> 255.255.255.0
> + /usr/local/rtnet/sbin/tdmacfg rteth0 master 5000
> + /usr/local/rtnet/sbin/tdmacfg rteth0 slot 0 0
> [ 36.417588] I-pipe: Detected illicit call from domain 'Xenomai'
> [ 36.417626] <3> into a service reserved for domain 'Linux' and
> below.
> [ 36.432007] Backtrace:
> [ 36.434313] Xenomai: suspending kernel thread c3e51940 ('rtnet-tdma')
> at 0xc0022b6c after exception #0
Many overlapping errors, but this line is likely the root. Check that
code address (0xc0022b6c) to see if something could oops there.
> [ 36.443975] BUG: sleeping function called from invalid context at
> arch/arm/mm/fault.c:312
> [ 36.452177] in_atomic(): 0, irqs_disabled(): 128, pid: 192, name: sh
> [ 36.458539] Backtrace:
> [ 36.461050] [<c0022a88>] (dump_backtrace+0x0/0x118) from [<c0022bd4>]
> (dump_stack+0x18/0x1c)
> [ 36.469510] r7:c3d5fca0 r6:c3d7b960 r5:c3d7b994 r4:c3dc6000
> [ 36.475242] [<c0022bbc>] (dump_stack+0x0/0x1c) from [<c002cb20>]
> (__might_sleep+0xd8/0xfc)
> [ 36.483558] [<c002ca48>] (__might_sleep+0x0/0xfc) from [<c002603c>]
> (do_page_fault+0x124/0x294)
> [ 36.492276] r4:00000000
> [ 36.494865] [<c0025f18>] (do_page_fault+0x0/0x294) from [<c001e320>]
> (do_DataAbort+0x40/0x134)
> [ 36.503520] [<c001e2e0>] (do_DataAbort+0x0/0x134) from [<c001ef84>]
> (ret_from_exception+0x0/0x40)
> [ 36.512412] Exception stack(0xc3dc7fb0 to 0xc3dc7ff8)
> [ 36.517490] 7fa0: 40018350
> 00000000 00000000 000000c0
> [ 36.525709] 7fc0: 40017f68 00000000 000000c0 00000000 000000ce
> ffffffff 4017b000 becc20f4
> [ 36.533917] 7fe0: 40018350 becc20a8 400f54f8 400d090c 60000010 ffffffff
> [ 36.540549] r8:000000ce r7:00000000 r6:000000c0 r5:00000000 r4:ffffffff
> + OFFSET=200
> + echo '$TDMACFG rteth0 slot 0 200;ifconfig vnic0 up $IPADDR $NETMASK_OPT'
> + /usr/local/rtnet/sbin/rtcfg rteth0 add 127.0.0.1 -stage1 -
> [ 36.621182] RTcfg: rtcfg_do_main_event() rtdev=1,
> event=RTCFG_CMD_ADD, state=RTCFG_MAIN_SERVER_RUNNING
> + OFFSET=400
> + ifconfig vnic0 up 127.0.0.2 netmask 255.255.255.0
> + echo -n 'Waiting for all slaves...'
> Waiting for all slaves...+ /usr/local/rtnet/sbin/rtcfg rteth0 wait
> [ 36.681875] RTcfg: rtcfg_do_main_event() rtdev=1,
> event=RTCFG_CMD_WAIT, state=RTCFG_MAIN_SERVER_RUNNING
>
> ^C
> root@xcep:~# ifconfig
> lo Link encap:Local Loopback
> inet addr:127.0.0.1 Mask:255.0.0.0
> UP LOOPBACK RUNNING MTU:16436 Metric:1
> RX packets:20 errors:0 dropped:0 overruns:0 frame:0
> TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:1256 (1.2 KiB) TX bytes:1256 (1.2 KiB)
>
> vnic0 Link encap:Ethernet HWaddr 00:D0:50:31:11:6C
> inet addr:127.0.0.2 Bcast:127.0.0.255 Mask:255.255.255.0
> UP BROADCAST RUNNING MTU:1496 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
>
> Later on these lines start to appear on console:
>
> [ 69.254013] RTcfg: error -105 while sending stage 1 frame
> [ 70.254016] RTcfg: error -105 while sending stage 1 frame
> [ 71.254015] RTcfg: error -105 while sending stage 1 frame
> [ 72.254017] RTcfg: error -105 while sending stage 1 frame
> [ 73.254017] RTcfg: error -105 while sending stage 1 frame
> [ 74.254018] RTcfg: error -105 while sending stage 1 frame
> [ 75.254020] RTcfg: error -105 while sending stage 1 frame
> [ 76.254019] RTcfg: error -105 while sending stage 1 frame
> [ 77.254020] RTcfg: error -105 while sending stage 1 frame
> [ 78.254022] RTcfg: error -105 while sending stage 1 frame
> [ 79.254022] RTcfg: error -105 while sending stage 1 frame
>
>
> I feel I'm quite close to working version, so I'm attaching the driver
> sources too, if you are interested and have some time to look at
> (probably not :).
>
> Note that I used the same file names (rt_smc91111.{c,h}), while the code
> is different, for the sake of simplicity of compiling smc91x driver
> under RTnet. Hopefully of the guidelines of the README.drvporting were
> addressed. I also removed spinlocks where possible since my HW is not
> SMP capable.
If spinlocks included IRQ disabling, you need to keep that. Still, this
approach is not a good idea as you lose critical section marks - and the
spinning part of those locks is a nop on UP anyway.
Jan
|