From: Marc Kleine-Budde <mkl@pengutronix.de>
To: "Max S." <max@schneidersoft.net>
Cc: wg <wg@grandegger.com>, linux-can@vger.kernel.org
Subject: Re: Usb to can driver
Date: Wed, 26 Jun 2013 20:58:26 +0200 [thread overview]
Message-ID: <51CB39D2.60501@pengutronix.de> (raw)
In-Reply-To: <1372272912.3805.27.camel@blackbox>
[-- Attachment #1: Type: text/plain, Size: 2234 bytes --]
On 06/26/2013 08:55 PM, Max S. wrote:
>>> My firmware implements LOOPBACK by default. That is all frames sent by
>>> the can hardware are also returned over usb. I use this effect to call
>>> can_get_echo_skb() during bulk in. To support LOOPBACK mode as per
>>> socketcan; should i also call netif_rx() durring bulk in if
>>> CAN_CTRLMODE_LOOPBACK is
>>> set?
>>
>> Message echo (normally via echo_skbs) and loopback (via
>> CAN_CTRLMODE_LOOPBACK)
>> are somehow different things. The first is a local loopback of sent
>> frames,
>> which is described here:
>>
>> http://lxr.linux.no/#linux+v3.9.7/Documentation/networking/can.txt#L178
>
> I was confused because i was not sure if 'sent frame' meant either a)
> 'frame that has left Linux', or b) 'frame that actually made it onto the
> CAN bus'. Appears I can choose either :P
b) is preferred
> For usb_8dev and ems_usb, echo via put_echo_skb happens in the USB write
> callback. (a)
>
> For esd_usb2 a frame is only recognized as sent when the device reports
> it as sent. (b)
>
> I also noticed esd_usb2 does: dev->nets[msg->msg.txdone.net]
> Is that safe? msg->msg.txdone.net is never check if its in range...
Can you send a patch? :)
>> Does the hardware communicate a TX done event as well?
> Yes, The controller produces a TX event which happens after successful
> frame transmission. I place successfully TXed frames in the USB IN fifo
> with their corresponding echo_ids.
This means you implement b).
>> CAN_CTRLMODE_LOOPBACK is a real hardware loopback. Normally the message
>> does not even go out to the bus mainly useful for testing. For the software the
>> loopback message should be handled like any other incoming message.
>
> Ah. so CAN_CTRLMODE_LOOPBACK could be used to test data path from
> application->Linux->driver->can_hardware and back. without the need of
> an actual physical CAN bus.
Yes, this is a usecase.
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 --]
next prev parent reply other threads:[~2013-06-26 18:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 23:59 Usb to can driver Max S.
2013-06-26 7:10 ` wg
2013-06-26 18:55 ` Max S.
2013-06-26 18:58 ` Marc Kleine-Budde [this message]
[not found] ` <1372810462.15632.2.camel@blackbox>
2013-07-03 7:55 ` Marc Kleine-Budde
-- strict thread matches above, loose matches on Subject: below --
2013-04-23 17:15 Max S.
2013-04-23 21:47 ` Marc Kleine-Budde
2013-04-24 15:48 ` Max S.
2013-04-24 16:07 ` Marc Kleine-Budde
2013-04-24 17:40 ` Oliver Hartkopp
2013-04-24 21:24 ` Marc Kleine-Budde
2013-04-25 23:35 ` Max S.
2013-04-26 5:25 ` Oliver Hartkopp
2013-04-26 8:55 ` Kurt Van Dijck
2013-04-26 8:26 ` Marc Kleine-Budde
2013-04-24 21:33 ` Max S.
2013-05-02 11:07 ` Marc Kleine-Budde
2013-05-02 11:09 ` Marc Kleine-Budde
2013-05-02 11:30 ` Wolfgang Grandegger
2013-05-02 11:32 ` Marc Kleine-Budde
2013-05-16 11:40 ` Marc Kleine-Budde
2013-06-04 13:18 ` Max S.
2013-06-04 14:40 ` Wolfgang Grandegger
2013-06-04 14:41 ` Marc Kleine-Budde
2013-04-24 6:38 ` Sven Geggus
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=51CB39D2.60501@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=max@schneidersoft.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).