From: Wolfgang Grandegger <wg@grandegger.com>
To: "Ira W. Snyder" <iws@ovro.caltech.edu>
Cc: linux-can@vger.kernel.org
Subject: Re: Questions about janz-ican3 and CAN_RAW_RECV_OWN_MSGS
Date: Wed, 04 Jul 2012 11:18:38 +0200 [thread overview]
Message-ID: <4FF40A6E.1040709@grandegger.com> (raw)
In-Reply-To: <20120703232328.GD6616@ovro.caltech.edu>
Hi Ira,
On 07/04/2012 01:23 AM, Ira W. Snyder wrote:
> Hello everyone,
>
> I'm finally implementing SocketCAN support in our internal codebase, and
> have run across some issues. We previously used a character driver provided
> by the vendor.
>
> I myself implemented the driver for the Janz ICAN3 card. It has been in
> mainline Linux since 2.6.35.
>
> The hardware is an SJA1000 chip plus a microcontroller and some RAM. All
> messages go through the microcontroller firmware.
>
> This firmware has the following features:
> - it does have hardware-supported local loopback
> - it does NOT have any sort of "tx-complete" notification or interrupt
> - it does NOT have any indication that a frame went through the
> hardware-supported local loopback
>
> To work around the lack of "tx-complete" interrupts, I used the hardware
> local loopback feature. Every frame has hardware loopback set, which causes
> the ican3_napi() routine to be called for each frame sent. This works fine,
> except that sockets created with the default options (loopback on,
> can_raw_recv_own_msgs off) do receive their own messages. This seems wrong.
>
> QUESTION 1:
> The functions can_(get|put)_echo_skb() are not used at all. Is this wrong?
Not necessarily. IIRC, the early versions of the Flexcan driver used the
hardware loopback as well but switched to classical echo-skb handling
because of the problem with recv-own-msgs.
> QUESTION 2:
> The socketcan test tst-rcv-own-msgs says:
> Starting PF_CAN frame flow test.
> checking socket default settings ... failure!
>
> If I understand the code correctly, this means that the sending socket
> received an echo frame when it should not have received one.
>
> This matches what I expect the code to do.
>
> How can I fix this?
>
> OBSERVATION 1:
> The following patch drops the relevant calls to netif_stop_queue() and
> netif_wake_queue(), as well as the hardware-supported local loopback.
>
> The tst-rcv-own-msgs test passes.
>
> Is dropping these API calls a reasonable thing to do?
Well, that controller will not allow to support all features and options
and we need to make a choice:
recv-own-msgs support versus proper tx-done handling (correct timing)
As the recv-own-msgs is not used frequently, it would not be really
dramatic if the feature is not available. Just my 0.02 cent.
Wolfgang.
next prev parent reply other threads:[~2012-07-04 9:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-03 23:23 Questions about janz-ican3 and CAN_RAW_RECV_OWN_MSGS Ira W. Snyder
2012-07-04 9:18 ` Wolfgang Grandegger [this message]
2012-07-04 12:07 ` Kurt Van Dijck
2012-07-04 16:23 ` Oliver Hartkopp
2012-07-04 19:07 ` Ira W. Snyder
2012-07-05 9:48 ` Oliver Hartkopp
2012-07-10 10:20 ` Marc Kleine-Budde
2012-07-10 19:01 ` Oliver Hartkopp
2012-07-04 16:34 ` Ira W. Snyder
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=4FF40A6E.1040709@grandegger.com \
--to=wg@grandegger.com \
--cc=iws@ovro.caltech.edu \
--cc=linux-can@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.