[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ed685ce0-16e2-3f7c-173a-ac14f32d9ca6@hartkopp.net>
Date: Wed, 30 Nov 2022 22:02:23 +0100
From: Oliver Hartkopp <socketcan@...tkopp.net>
To: Christoph Fritz <christoph.fritz@...dev.de>
Cc: Pavel Pisa <pisa@....felk.cvut.cz>,
Richard Weinberger <richard@....at>,
Andreas Lauser <andreas.lauser@...tion.io>,
Wolfgang Grandegger <wg@...ndegger.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Jonathan Corbet <corbet@....net>, linux-can@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH 0/2] LIN support for Linux
Hi Christoph, all,
On 28.11.22 11:16, Christoph Fritz wrote:
>> IIRC the implementation of the master/slave timings was the biggest
>
> Currently sllin only supports master mode, I guess because of the tight
> timing constraints.
I think this has to be corrected.
In the master mode the SocketCAN Broadcast Manager (BCM) is configured
to periodically send LIN headers
(according to LIN schedule table).
https://www.kernel.org/doc/html/latest/networking/can.html#broadcast-manager-protocol-sockets-sock-dgram
This is a very easy approach to precisely send the the LIN frames from
kernel space and also atomically change the content of (all) the
configured LIN frames while the schedule table is continuously processed.
Sending LIN frames directly from *userspace* (and handling timers there)
was *never* intended for real LIN communication - although the examples
(with cangen) in the document look like this.
Same applies to the slave mode:
If you check out
https://raw.githubusercontent.com/wiki/lin-bus/linux-lin/sllin-doc.pdf
on page 11 you are able to enable the slave mode with
insmod ./sllin.ko master=0
The 'trick' about this mode is that the RTR-functionality of the BCM is
able process the incoming CAN/LIN identifier and *instantly* send back
some pre-defined data for that specific LIN-ID, so that the SLLIN driver
sends/answers the 'data' section of the received LIN-ID within the
required timing constrains for LIN slaves.
Not sure if the info about this concept got lost somehow, but the
CAN_BCM is the key for handling the LIN protocol and offload the LIN
scheduling (master/slave) to the kernel for the comparably dumb tty
interfaces.
Best regards,
Oliver
Powered by blists - more mailing lists