linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Daniel Squires <dan@engineeredarts.co.uk>,
	linux-can@vger.kernel.org,
	Oliver Hartkopp <socketcan@hartkopp.net>
Subject: Re: socket can receive order
Date: Tue, 8 Sep 2015 13:13:01 +0200	[thread overview]
Message-ID: <55EEC2BD.6010302@pengutronix.de> (raw)
In-Reply-To: <55EEBB4E.6080104@engineeredarts.co.uk>

[-- Attachment #1: Type: text/plain, Size: 2328 bytes --]

On 09/08/2015 12:41 PM, Daniel Squires wrote:
> On my laptop and Desktop PC I have not seen it happen.

> Both the application PC (NUC) and the Laptop are running Ubuntu kernel 
> 3.19.0-26-generic
> 
> The NUC has the kernel rebuilt without xhci due to problems it causes 
> with another USB peripheral.
> 
> I am not entirely sure what you mean by which can core I am using but if 
> it helps i am opening the socket as follows :

I mean what kind of CAN adapter...

> 
>      sock = socket(PF_CAN,SOCK_RAW,CAN_RAW);
> 
> in a small standalone test application which I wrote after having 
> difficulty with our main application.
> 
> I am using custom hardware/firmware and am using the kernel module found 
> here : https://github.com/fabiobaltieri/open-usb-can
> though it has a small change to stop the net queue at the top of 
> open_usb_can_start_xmit as otherwise its prone to loosing TX packets 
> when loaded.

Yes, this looks racy - You should ask then to mainline working the driver.

> I can see the packets coming in the correct order in wireshark and it is 
> not immediately obvious to me how the kernel module could mix up the 
> order, so it seems that it must be something that happens at the socket 
> level?

The kernel module "produces" the CAN frames, so if you see them in the
correct order in wireshark, they have left the module in the right order.

> candump can3 -tz
> <snip>
>   (003.088648)  can3  043   [8]  F7 2D 00 00 00 00 00 00
>   (003.089149)  can3  045   [8]  F9 2D 00 00 00 00 00 00
>   (003.088897)  can3  044   [8]  F8 2D 00 00 00 00 00 00

The timestamps are in the correct order. Maybe Oliver can help here,
he's an expert when it comes to strange reordering :)

> On the top level I am using CANFestival for CANOpen implementation, so 
> it has occurred to me I could implement a CANFestival "driver" using 
> libusb and completely bypass the kernel module and socket can layers, 
> but I hope not to have to do this.

Na, you don't want to do this.

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: 455 bytes --]

  reply	other threads:[~2015-09-08 11:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08  9:42 socket can receive order Daniel Squires
2015-09-08 10:01 ` Marc Kleine-Budde
2015-09-08 10:41   ` Daniel Squires
2015-09-08 11:13     ` Marc Kleine-Budde [this message]
2015-09-08 11:17       ` Daniel Squires
2015-09-08 11:20         ` Marc Kleine-Budde
2015-09-08 11:37           ` Daniel Squires
2015-09-08 16:56         ` Oliver Hartkopp
2015-09-09  2:30           ` Austin Schuh
2015-09-09  3:10             ` Brian Silverman
2015-09-09 16:23               ` Oliver Hartkopp
2015-09-09 12:05             ` Daniel Squires
2015-09-09 16:14             ` Daniel Squires
2015-09-09 16:31               ` Oliver Hartkopp
2015-09-17 19:18               ` Oliver Hartkopp
2015-09-08 11:46       ` Wolfgang Grandegger
2015-09-08 11:49         ` Daniel Squires
2015-09-08 11:56         ` Marc Kleine-Budde
2015-09-10  2:29         ` Tom Evans
2015-09-10  8:08           ` Daniel Squires

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=55EEC2BD.6010302@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=dan@engineeredarts.co.uk \
    --cc=linux-can@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    /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).