Jan Kiszka wrote: > Jan Kiszka wrote: >> [EMAIL PROTECTED] wrote: >>> Jan Kiszka wrote: >>>> Tom Panis wrote: >>>>> Hi, >>>>> >>>>> I'm trying to send raw ethernet packages on Xenomai, I'm also working >>>>> with the trunk version of RTnet. I looked at the example >>>>> \"raw-ethernet.c\" and I'm wondering why the functions like socket_rt, >>>>> send_rt ,.. aren't used. Is it still real-time? I tried to use the >>>> It is, but only when you link against Xenomai's POSIX skin (xeno-config >>>> --posix-ldflags). This step will wrap all POSIX calls like socket, send, >>>> bind to RTDM services, finally invoking RTnet if it is installed >>>> (otherwise you will end up in Linux again). >>>> >>>>> real-time functions like socket_rt,... but then I can't send or receive >>>>> raw ethernet packages anymore: the function send_rt returns -1. >>>> All _rt services are deprecated now (we should mark them...). They were >>>> replaced by RTDM's rt_dev_XXX. But only the name changed here. >>>> >>>> The difference between rt_dev_XXX (or old XXX_rt) services and the true >>>> POSIX calls are the way error codes are returned. For POSIX services you >>>> have to check errno, for the RTDM API you get the error directly via the >>>> return code. Thus, one time -1 only means some error occurred, the other >>>> it means -EPERM (here: RT context required). >>>> >>>>> I attached the program code. Running the program (I use rtlo as >>>>> interface) results in the following output: >>>>> >>>>> Socket created: socket id: 0 >>>>> Got interface: index: 0 >>>>> Sending frames... >>>>> Cannot send: Success >>>>> Length: -1 >>>>> shutting down >>>> How did you compile that program? It doesn't map itself to RT context >>>> unless you compiled it against the POSIX skin (which does so >>>> automatically for main). >>> I didn't compiled it against the POSIX skin. Now I just edited >>> raw-ethertnet.c and kept it in the same directory. I compile it with >>> makefile that's already there. When I do this I can send messages, but I >>> can't receive any. When rt_dev_recv() is called, the program hangs, he >>> keeps waiting for a package to arrive. When I send messages to my computer >>> without this program running dmesg results : >>> [4299353.146000] RTnet: no one cared for packet with layer 3 protocol >>> type 0x1234 >>> [4299354.150000] RTnet: no one cared for packet with layer 3 protocol >>> type 0x1234 >>> .... >>> When my program runs, these messages aren't given anymore, so the packages >>> are taking care of I guess... >>> I added the source. The output of the program is: >>> >>> Socket created: socket id: 1 >>> Got interface: index: 0 >>> Receiving >>> >>> After stopping the program with ctrl+c the following is added: >>> >>> Length: -9 >>> shutting down >> Your test case looks sane on first sight. You ran it against the >> original raw-ethernet example as sender? Over a cable or also via local >> loopback? Does loopback also fail? >> >> I cannot promise when I'll have time to look at this. Meanwhile you >> could try to track a bit down what happens in the core, from the stack >> manager to the af_packet code, by adding printks. >> > > Ok, effect confirmed over loopback here in qemu, and also with the > original raw-packets example of RTnet. Obviously a regression of recent > changes to the packet socket module. Investigating... >
Got it. As usual, a "minor variation": --- stack/packet/af_packet.c (revision 1084) +++ stack/packet/af_packet.c (working copy) @@ -56,7 +56,7 @@ int rt_packet_rcv(struct rtskb *skb, str skb = clone_skb; } else #endif /* CONFIG_RTNET_ETH_P_ALL */ - if (unlikely(!rtskb_acquire(skb, &sock->skb_pool))) { + if (unlikely(rtskb_acquire(skb, &sock->skb_pool) < 0)) { kfree_rtskb(skb); return 0; } (SVN commit #1087) Now your test runs fine here. Thanks for reporting. Jan
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ RTnet-users mailing list RTnet-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rtnet-users