* cansend app will block while it is sending RTR frames
@ 2013-08-28 9:34 xuewentian
2013-08-28 12:31 ` Marc Kleine-Budde
0 siblings, 1 reply; 4+ messages in thread
From: xuewentian @ 2013-08-28 9:34 UTC (permalink / raw)
To: linux-can
Hi all,
I want to test sending a lot of RTR frames, because select/poll is no
effect on the flow control, I add the usleep in the cansend app.
The code segment is :
while (infinite || loopcount--) {
ret = write(s, &frame, sizeof(frame));
if (ret == -1) {
perror("write");
printf("Please specify a more long delay time!\n");
break;
}
usleep(delay);//flow control
}
Here the "delay" is about 200us, and I used "cansend can0 -r -e -l 500 -
i 0x1234567 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88" command to send 500
RTR frames.but candump on
the another board could only received the 336 frames,and candump app
hasn't print the received RTR frames,and only count the received frmaes.
and I debugged the send process in the kernel, and I found that it sleep
on the copy_from_user in the memcpy_fromiovec of the raw_sendmsg
err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); // in
the raw_sendmsg function of the net/can/raw.c file.
if (err < 0)
goto free_skb;
What about happens with the write of the cansend app? and I used the
same way to send the 5000000 data frames, it didn't blocked.
Thanks a lot.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cansend app will block while it is sending RTR frames
2013-08-28 9:34 cansend app will block while it is sending RTR frames xuewentian
@ 2013-08-28 12:31 ` Marc Kleine-Budde
2013-08-28 14:21 ` xuewentian
[not found] ` <201308301520148531275@embedinfo.com>
0 siblings, 2 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2013-08-28 12:31 UTC (permalink / raw)
To: xuewentian; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1673 bytes --]
On 08/28/2013 11:34 AM, xuewentian wrote:
> Hi all,
>
> I want to test sending a lot of RTR frames, because select/poll is no
> effect on the flow control, I add the usleep in the cansend app.
>
> The code segment is :
>
>
> while (infinite || loopcount--) {
>
> ret = write(s, &frame, sizeof(frame));
> if (ret == -1) {
> perror("write");
> printf("Please specify a more long delay time!\n");
> break;
> }
> usleep(delay);//flow control
> }
>
> Here the "delay" is about 200us, and I used "cansend can0 -r -e -l 500 -
> i 0x1234567 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88" command to send 500
> RTR frames.but candump on
> the another board could only received the 336 frames,and candump app
> hasn't print the received RTR frames,and only count the received frmaes.
> and I debugged the send process in the kernel, and I found that it sleep
> on the copy_from_user in the memcpy_fromiovec of the raw_sendmsg
>
> err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); // in
> the raw_sendmsg function of the net/can/raw.c file.
> if (err < 0)
> goto free_skb;
How have you measured that the kernel sleeps in that function? How long
does it sleep?
> What about happens with the write of the cansend app? and I used the
> same way to send the 5000000 data frames, it didn't blocked.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cansend app will block while it is sending RTR frames
2013-08-28 12:31 ` Marc Kleine-Budde
@ 2013-08-28 14:21 ` xuewentian
[not found] ` <201308301520148531275@embedinfo.com>
1 sibling, 0 replies; 4+ messages in thread
From: xuewentian @ 2013-08-28 14:21 UTC (permalink / raw)
To: linux-can
Marc Kleine-Budde <mkl <at> pengutronix.de> writes:
>
> On 08/28/2013 11:34 AM, xuewentian wrote:
> > Hi all,
> >
> > I want to test sending a lot of RTR frames, because select/poll is no
> > effect on the flow control, I add the usleep in the cansend app.
> >
> > The code segment is :
> >
> >
> > while (infinite || loopcount--) {
> >
> > ret = write(s, &frame, sizeof(frame));
> > if (ret == -1) {
> > perror("write");
> > printf("Please specify a more long delay time!\n");
> > break;
> > }
> > usleep(delay);//flow control
> > }
> >
> > Here the "delay" is about 200us, and I used "cansend can0 -r -e -l 500
-
> > i 0x1234567 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88" command to send
500
> > RTR frames.but candump on
> > the another board could only received the 336 frames,and candump app
> > hasn't print the received RTR frames,and only count the received frmaes.
> > and I debugged the send process in the kernel, and I found that it
sleep
> > on the copy_from_user in the memcpy_fromiovec of the raw_sendmsg
> >
> > err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); // in
> > the raw_sendmsg function of the net/can/raw.c file.
> > if (err < 0)
> > goto free_skb;
>
> How have you measured that the kernel sleeps in that function? How long
> does it sleep?
**************
my reply:
I found the cansend app will always sleep after sending 336 RTR frames by
using "cansend can0 -r -e -l 500 -i 0x1234567 0x11 0x22 0x33 0x44 0x55 0x66
0x77 0x88". I must press ctrl+c to cancel it,after cancelling
it,and I ran "cansend can0 -r -e -i 0x1234567 0x11 0x22 0x33 0x44 0x55 0x66
0x77 0x88" for send another RTR frame, it could be sent successfully.
and I tested "cansend can0 -r -e -l 500 -i 0x1234567 0x11 0x22 0x33 0x44
0x55 0x66 0x77 0x88 &" to run background, and it still sent 336 RTR frames,
and the process was pending, and I could still send RTR
frames on the serial terminal.
And I used command "cansend can0 -e -l 5000000 -i 0x1234567 0x11 0x22 0x33
0x44 0x55 0x66 0x77 0x88" to send 50000000 data frames,the cansend app could
return to serial terminal. It didn't block.
The problem seemed to has no relationship with can driver because it still
could send RTR frames after the problem occurred. I didn't know why it was
always sleeping on the copy_from_user function.
any suggestion for me?
Thanks a lot for your reply.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cansend app will block while it is sending RTR frames
[not found] ` <201308301520148531275@embedinfo.com>
@ 2013-08-30 7:27 ` Marc Kleine-Budde
0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2013-08-30 7:27 UTC (permalink / raw)
To: xuewt; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 532 bytes --]
On 08/30/2013 09:20 AM, xuewt wrote:
> I found that I didn't free the skb buffer for RTR frame. It was resolved.
Please don't top post. Oh, you're writing a new driver. What hardware
are you supporting? If you post it here, we'll review it.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-30 7:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-28 9:34 cansend app will block while it is sending RTR frames xuewentian
2013-08-28 12:31 ` Marc Kleine-Budde
2013-08-28 14:21 ` xuewentian
[not found] ` <201308301520148531275@embedinfo.com>
2013-08-30 7:27 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).