linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: xuewentian <xuewt@embedinfo.com>
Cc: linux-can@vger.kernel.org
Subject: Re: cansend app will block while it is sending RTR frames
Date: Wed, 28 Aug 2013 14:31:21 +0200	[thread overview]
Message-ID: <521DED99.6010606@pengutronix.de> (raw)
In-Reply-To: <loom.20130828T111851-325@post.gmane.org>

[-- 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 --]

  reply	other threads:[~2013-08-28 12:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28  9:34 cansend app will block while it is sending RTR frames xuewentian
2013-08-28 12:31 ` Marc Kleine-Budde [this message]
2013-08-28 14:21   ` xuewentian
     [not found]   ` <201308301520148531275@embedinfo.com>
2013-08-30  7:27     ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=521DED99.6010606@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=xuewt@embedinfo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).