Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2964233rwb; Wed, 30 Nov 2022 13:23:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf6IMLUb+gzdFpuTNKM9xcI2ktGnaLTCUMi6qimplNVqCDim/l7YsgUHYoKJ3KAxTmi2APKu X-Received: by 2002:a17:903:481:b0:189:809e:3956 with SMTP id jj1-20020a170903048100b00189809e3956mr20267606plb.121.1669843388294; Wed, 30 Nov 2022 13:23:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669843388; cv=none; d=google.com; s=arc-20160816; b=l5LZCaoJxNl+rZDdpNZIeVQEkbuNSPgfKf/AwgP8uxJ0y4VFECFZJA+WL4At/zhRrw +rkru9g5qd6xZtOiTenO2Ym4NjofAgPY2vA7rc4x/0sT+3k5bEn05xNA7B9ajXscmmKh ol+1HAVLycjZeXwvYChDtlM7cu5PvVov7C1D40+GaUV1YkI+wqXHx6T3Zq2q7URZc7z/ 35FhHbd/rKgDdJBjyeZI3AgjuzmDQtOHe7/mG/mhj+gDUvyiHGWqIe0l4bwnTdCMXZca 3eimnz5ocnMPZ3DtQ3Q9PUEqasIzxAud54FDOdNlSCD8BV+9Giq0LBBZ1TP03aYGbnia pXzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=rQjv0ilcgXlZxoUpB0HbLsfebMKlAgyw+Xw7AfTs1CU=; b=dPWhxTYLZz2v2ZafYulfJTUvSj1zD3BpwdZo08kl8N0LONEpcF+5XsJ00XW4qRhULm Xm35TctygC0b9zadYtqr3BeAESFRgFCfzG9WvnBQB+PN12dNFnljVLGEzt3qRel2Yhq1 7+6yRF+5ff67fb/vFf3tKZWhL6SZ9iIxuagtKzIhS6kpUyd4dL9gGTMJujb3UhqswwaP 9tlE1rMW/1tIr2cUqe0tlerLTjV7al+Hjipeh+lZJ6Nka0Ts03tz6X1b4xbKh7GPbZdO WNCbjasmjktFImUYwn1qtl+lCHOblxDgSbUu1cCHqG0QvT5vccmyG02yaXF2IolAb19T 0Bjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hartkopp.net header.s=strato-dkim-0002 header.b=F+Xg1D4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hartkopp.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m24-20020aa79018000000b00571fe971a74si2418590pfo.41.2022.11.30.13.22.55; Wed, 30 Nov 2022 13:23:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@hartkopp.net header.s=strato-dkim-0002 header.b=F+Xg1D4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hartkopp.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229772AbiK3VCa (ORCPT + 83 others); Wed, 30 Nov 2022 16:02:30 -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 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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