linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ahmed S. Darwish" <darwish.07@gmail.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
	Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
	Andri Yngvason <andri.yngvason@marel.com>,
	Linux-CAN <linux-can@vger.kernel.org>
Subject: Methods for testing CAN drivers tx/rx paths
Date: Sat, 14 Mar 2015 20:15:20 +0200	[thread overview]
Message-ID: <20150314181520.GA19643@vivalin-002> (raw)

Hi Marc, everyone,

Do you have any comments on how to heavily test a CAN driver tx/rx
code paths?

Below is the approach I use, which was succesful in triggering many
issues in the kvaser_usb driver. I wonder though if you guys have
any different tricks you use for your own daily CAN driver
development tx/rx testing?


Testing method:
---------------

On tx:

	$ cangen -g1 -I111 -Di -L4 can0 &
	$ cangen -g1 -I222 -Di -L4 can0 &
	$ cangen -g1 -I333 -Di -L4 can0 &
	$ cangen -g1 -I444 -Di -L4 can0 &

On the other end of the CAN bus, to test rx:

	$ cangen -g0 -I555 -Di -L4 can0 &
	$ cangen -g1 -I666 -Di -L4 can0 &
	$ cangen -g1 -I777 -Di -L4 can0 &

Echo is enabled in the driver. Now doing a basic

	$ candump -d -e can0,0:0,#FFFFFFFF > output.txt

produces too many dropped packets after around 10 minutes of use. [1]

Using in-kernel CAN ID filtering solves the issue nicely:

	for i in {1..7}; do
	    candump -e -d can0,$i$i$i:7FF > output-$i$i$i.txt &
	done

Then the machine is left for a day or two. Afterwards, using simple
Python scripts, I analyze each output-XXX.txt file to ensure that
no packets got dropped for each `cangen' path above, and that the
sequential order of data generated by `cangen -Di' is still
maintained.


Thanks a lot,
Darwish


[1] As reported by SO_RCVQ_OFL, skb-attached, ancilliary messages.
    Thanks Oliver, candump `-d' was a life-saving feature!
    http://article.gmane.org/gmane.network.socketcan.user/179

             reply	other threads:[~2015-03-14 18:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-14 18:15 Ahmed S. Darwish [this message]
2015-03-16  8:37 ` Methods for testing CAN drivers tx/rx paths Oliver Hartkopp
2015-03-17 14:38   ` Ahmed S. Darwish

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=20150314181520.GA19643@vivalin-002 \
    --to=darwish.07@gmail.com \
    --cc=andri.yngvason@marel.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=socketcan@hartkopp.net \
    --cc=wg@grandegger.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).