From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4F6CC4321E for ; Wed, 30 Nov 2022 21:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229569AbiK3VCb (ORCPT ); Wed, 30 Nov 2022 16:02:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbiK3VC2 (ORCPT ); Wed, 30 Nov 2022 16:02:28 -0500 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E87383EA1; Wed, 30 Nov 2022 13:02:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1669842144; s=strato-dkim-0002; d=hartkopp.net; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=rQjv0ilcgXlZxoUpB0HbLsfebMKlAgyw+Xw7AfTs1CU=; b=F+Xg1D4iYJLeyPuMtepW/NlzFi19PGjYOLvAuV5v5ibvfQFWiBvN5XFCApAbyJiP0f E2SMHt7yMtpalJrRvU9TeQCiBiDxpbC34zPl9vnnLs55IPg3PyCXhO0yw6zwGDPPUFiY PrSMMILsKv50mQsexLEt2jVnRSXebJdYkVGE+YQalEhi8eog5yEFlAG/fFmKMdJwphaI 0ruPTifQ745nS2iT/ZMoE8KAAxAWKDtwBsfsEzphahNKuA7v2KBlyhh4kvAj+gZQIjLm bZz4+GHc5maLyci83b9C+oIaH+IwlGnc5Wd8kcbfRsEuGCVQ7+1H24XrKlb0K3vHlAci GsbA== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P2MHfkW8eP4Mre39l357AZT/I7AY/7nT2yrDxb8mjG14FZxedJy6qgO1qCHSa1GLptZHusx3hdIrpKytISr6hZqJAw==" X-RZG-CLASS-ID: mo00 Received: from [IPV6:2a00:6020:1cfd:d104::923] by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id Dde783yAUL2NYBv (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 30 Nov 2022 22:02:23 +0100 (CET) Message-ID: Date: Wed, 30 Nov 2022 22:02:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [RFC][PATCH 0/2] LIN support for Linux Content-Language: en-US To: Christoph Fritz Cc: Pavel Pisa , Richard Weinberger , Andreas Lauser , Wolfgang Grandegger , Marc Kleine-Budde , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221127190244.888414-1-christoph.fritz@hexdev.de> <58a773bd-0db4-bade-f8a2-46e850df9b0b@hartkopp.net> From: Oliver Hartkopp In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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