Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1080481lqp; Sun, 14 Apr 2024 13:22:19 -0700 (PDT) X-Forwarded-Encrypted: i=4; AJvYcCVzIEWTRTI3R1AzyV1fVypNNZTnA8n1DSzk18quJtPiiurQApNDLWHWQzy3nrKoNlspmXBNuYpiTQ/9QuVdTx+8y/W3tFGDB8aLG/teAA== X-Google-Smtp-Source: AGHT+IHi2Hod+td+oKWiz4AsUOGPv/Z3DNO6CHW6TKwXPeH4YWcxYFn4psHPR5fd2e3VJ1A4DEHG X-Received: by 2002:a05:6512:15a4:b0:518:d64c:73aa with SMTP id bp36-20020a05651215a400b00518d64c73aamr1393464lfb.42.1713126139368; Sun, 14 Apr 2024 13:22:19 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1713126139; cv=pass; d=google.com; s=arc-20160816; b=LFfDP9qVjTZp1LpDFpx7bbLGDf44nFjUo53WM2zEiNlOjBxsTGIvnmIas8DtH2tbZT pbpQxLDS9egmtjaWohcT/yppixjl8XKoBXB0GIBLILaxic/tWSKbCF9iyZ1jeXCc1CXt j+zQCadzJ4XGLl25om3Y6EuM2q5E//QOE2OKL4fUHdkd/Qs+2fILbbza+IzPP6Ogb2iK e4duuinz9Vum/We2DWLf0q8dKDPO6BPoaeNY3xj70vuIYyxmIHA2Qlx89k/BCxrAW0da n5W4NpGTZqMIiTN0QcwtRUCCbgkLzZiNRjlXfrxLJbUj2voLkCSnh4WdfpQ4EDwQO0Dn vv7A== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-signature; bh=FFdZNeDIHKlI++tV+rJTXXExTAzAeIULgTQSTJmSCuU=; fh=HlvYLusmtI0nvdXsXXPbxRGz7tG81EKUQByWrbIrIIk=; b=03WVado+rNIQSxUC1qEv5Y5IIa0caswLQovXADIUpNhFPQgrEfGLNMQF6ojt4yxHwf WE05ZdHrRpopkoA/U6G/wjbGDeMGfs74xln5QTWnQL9B7/AlUQSjl0jD1Vcoubd7DN5X nMkJu5sA2h8KV2T304YUgi3JSJMh84NF0mScpjkriReUjn0YS6xE34NaoBkUO19AH9Is DsLlyhLe2kkIxhbthH0hEwYnnfDXEPJS6gN7JAB8F/IgZO4p8d1EZiSGDf58aKcQNLGN aZzZREYhVO2TLQxf7Z95tW4HeFTKXhszFuPDawLkBvIlUApaDjVxBfJqfRB8SejWXmfS HcoQ==; dara=google.com ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@hartkopp.net header.s=strato-dkim-0002 header.b=ZYVuZhhh; dkim=neutral (no key) header.i=@hartkopp.net header.s=strato-dkim-0003; arc=pass (i=2 spf=pass spfdomain=hartkopp.net dkim=pass dkdomain=hartkopp.net dmarc=pass fromdomain=hartkopp.net); spf=pass (google.com: domain of linux-kernel+bounces-144364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hartkopp.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c12-20020a170906154c00b00a51d7203458si3974711ejd.778.2024.04.14.13.22.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 13:22:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@hartkopp.net header.s=strato-dkim-0002 header.b=ZYVuZhhh; dkim=neutral (no key) header.i=@hartkopp.net header.s=strato-dkim-0003; arc=pass (i=2 spf=pass spfdomain=hartkopp.net dkim=pass dkdomain=hartkopp.net dmarc=pass fromdomain=hartkopp.net); spf=pass (google.com: domain of linux-kernel+bounces-144364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hartkopp.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D02EA1F21185 for ; Sun, 14 Apr 2024 20:22:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D15F513699C; Sun, 14 Apr 2024 20:22:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hartkopp.net header.i=@hartkopp.net header.b="ZYVuZhhh"; dkim=permerror (0-bit key) header.d=hartkopp.net header.i=@hartkopp.net header.b="+nkF2OOL" Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8917B1D688; Sun, 14 Apr 2024 20:22:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=85.215.255.54 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713126124; cv=pass; b=i30Crf8oSrQbu1fHPYyXTgaGgeR/keYvyWTtBBboZ617zCoV3QUUHtI87oSFiYFM00fVT4JLZgNxtfjvj/9DC2jjC3U1PsUlZ/nQNMH6J2ahu5vkl6ZREh+YXiBAOBX+ZrRqZ7BI7lHHpFYZ0KuzfOVrIa+3Hosi4O3qwzQH02Y= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713126124; c=relaxed/simple; bh=vT8KOr3SvikJeMpg2ktjqGTrpiUSVOwI7Ulj4Tcu88w=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=H3zbjxtA/MGrvUSA0NLEden4UD8HV86HD7s8G9kjlLXnDYiyNbumdvsnlwIS/2ULaOSKq0j5s0/Q4o4zMoCfBZz0/r2Eec1yEq4MCSJgmnptux8OQYD8E5wqnDLQzDrn48p/plwdmdYtw/WhvP7lHykwOaqB0/QJfAcWVpsgt1E= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=hartkopp.net; spf=pass smtp.mailfrom=hartkopp.net; dkim=pass (2048-bit key) header.d=hartkopp.net header.i=@hartkopp.net header.b=ZYVuZhhh; dkim=permerror (0-bit key) header.d=hartkopp.net header.i=@hartkopp.net header.b=+nkF2OOL; arc=pass smtp.client-ip=85.215.255.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=hartkopp.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hartkopp.net ARC-Seal: i=1; a=rsa-sha256; t=1713126101; cv=none; d=strato.com; s=strato-dkim-0002; b=nKKe3KUJgcml3yIeSAfS56G8gn/M7whEEmw5a5WE7fzwLxRAf4YgS3U8NaGBzH7EKN SN9kbiTMgjzC3HdfxggzC2C+pa4fZhoalOouQUD3kp8xr6IUKFkF0OIRTn5QwBqcV4Pz 8S8DH7Tu870sSA+WqA15kFbfl7DUOq6JHzQriOqIzRtxWujt4beS0BpV09ip0z2wRjD4 2lNLFsrTTA+rGiGp3ZEVgu0cc5jR91gw8YAViIx4OMUwaD+f1eiehji4TnYMkGUbs5xU HihvqqwdMTAJquFHn2bK4XonjIZADOExmrzz8qT2Mas8F2DGZcQBG9V63UnCDENsXtUg JW2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1713126101; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=FFdZNeDIHKlI++tV+rJTXXExTAzAeIULgTQSTJmSCuU=; b=d+2z78jmUpVbWERrzidNkDGiRCzxitPyZ2tpox3AwqsqC3JvEgUdNG5uCXBcM9wmAu UgHUzNX1yYTKNUm+/tOcB9QZ/7LtSF/W5z7SUFj5GP3eqD/YyCpJslokiqq7on3KUfOj JlX//bb2fygswKgToU5A0T8XcU9lxZwKOHCPaa0wiFT4i9rz1H3dXjcA8Ej0uRgbQwlv axiISXyFHxFHb3rJUTirzl8MdzUSgItAVwS+6OQetwz8/2X5+Alo1VBaZCtH9kwu0dAs vQIigU063HdD99I/JZdXaBnEod5JnJDh89QXyeOLAvv/yK3UjMO5R7rFp8+wjLghDKRK lsuA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1713126101; 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=FFdZNeDIHKlI++tV+rJTXXExTAzAeIULgTQSTJmSCuU=; b=ZYVuZhhhuTXsfiqLhsPEg9wlcG8eThmmC3SBleBWs6PUuvW9kKG088eYLZb0T7bZDv Ak+c4F8bikqsCZa3SUQxA0mHIX1w6+NtSM27rgwtEdQolFnQc48REWOGpwzW7cWr8x/I +gHUrQYOgNgcshVn0/TdM8YkzkTsjKTaw7YdfZ9SmhXpERFqvGLxS8fSlgaihG78ocqt 0z0Z7+lrsvciLpvsV0Kw4uGfTq7a9sB3WSEY+/wl5YEVO8OKtAP86Zc1gVSRIC20zCRt hPTW9mKqxNXClgLUadI/iW2eiNl3z7KoE3ATGPMVT4dvC7MZqmjbw/keLiY6Ht954K/3 Hx8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1713126101; s=strato-dkim-0003; d=hartkopp.net; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=FFdZNeDIHKlI++tV+rJTXXExTAzAeIULgTQSTJmSCuU=; b=+nkF2OOLy0dmy4fcPZ9weFhIxlK4A9ibM3sS5vJCEe69AFulTfGJgtlCP8ET/+uzb2 YOxnle5qTxrA0hgL48Cg== X-RZG-AUTH: ":P2MHfkW8eP4Mre39l357AZT/I7AY/7nT2yrDxb8mjG14FZxedJy6qgO1o3TMaFqTEVR+J8xpzl0=" Received: from [192.168.60.177] by smtp.strato.de (RZmta 50.3.2 DYNA|AUTH) with ESMTPSA id K701d603EKLfKo9 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 14 Apr 2024 22:21:41 +0200 (CEST) Message-ID: <64586257-3cf6-4c10-a30b-200b1ecc5e80@hartkopp.net> Date: Sun, 14 Apr 2024 22:21:33 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/1] Documentation: networking: document ISO 15765-2:2016 To: Vincent Mailhol Cc: Francesco Valla , Marc Kleine-Budde , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Bagas Sanjaya , fabio@redaril.me References: <20240329133458.323041-2-valla.francesco@gmail.com> <20240329133458.323041-3-valla.francesco@gmail.com> <9f5ad308-f2a0-47be-85f3-d152bc98099a@hartkopp.net> Content-Language: en-US From: Oliver Hartkopp In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 14.04.24 06:03, Vincent Mailhol wrote: > > This doesn't remove the fact that I think that this naming convention > is stupid because of the RAS syndrome, but I acknowledge that CAN CC > is now the official denomination and thus, that we should adopt it in > our documentation as well. > ;-) >>> Add a space between ISO and the number. Also, update the year: >>> >>> ISO 15765-2:2024 >>> >> >> Interesting! Didn't know there's already a new version. >> >> Will check this out whether we really support ISO 15765-2:2024 ... >> >> Do you have the standard at hand right now or should we leave this as >> ISO15765-2:2016 until we know? > > I have access to the newer revisions. But I never really invested time > into reading that standard (neither the 2016 nor the 2024 versions). > > Regardless, here is a verbatim extract from the Foreworld section of > ISO 15765-2:2024 > > This fourth edition cancels and replaces the third edition (ISO > 15765-2:2016), which has been technically revised. > > The main changes are as follows: > > - restructured the document to achieve compatibility with OSI > 7-layers model; > > - introduced T_Data abstract service primitive interface to > achieve compatibility with ISO 14229-2; > > - moved all transport layer protocol-related information to Clause 9; > > - clarification and editorial corrections > Yes, I've checked the release notes on the ISO website too. This really looks like editorial stuff that has nothing to do with the data protocol and its segmentation. >>> >>> Here, I would suggest the C99 designated field initialization: >>> >>> struct sockaddr_can addr = { >>> .can_family = AF_CAN; >>> .can_ifindex = if_nametoindex("can0"); >>> .tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG; >>> .tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG; >>> }; > > Typo in my previous message: the designated initializers are not > separated by colon ";" but by comma ",". So it should have been: > > struct sockaddr_can addr = { > .can_family = AF_CAN, > .can_ifindex = if_nametoindex("can0"), > .tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG, > .tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG, > }; > >>> Well, this is just a suggestion, feel free to reject it if you do not like it. >> >> At least I don't like it. >> >> These values are usually interactively given on the command line: >> >> > .can_ifindex = if_nametoindex("can0"); >> > .tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG; >> > .tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG; >> >> So have it in a static field initialization leads to a wrong path IMO. > > There is no such limitation that C99 designated initializers should > only work with variables which have static storage duration. In my > suggested example, nothing is static. > > I see this as the same thing as below example: > > int foo(void); > > int bar() > { > int i = foo(); > } > > int baz() > { > int i; > > i = foo(); > } > > In bar(), the fact that the variable i is initialized at declaration > does not mean that it is static. In both examples, the variable i uses > automatic storage duration. > > Here, my preference goes to bar(), but I recognize that baz() is also > perfectly fine. Replace the int type by the struct sockaddr_can type > and the scalar initialization by designated initializers and you > should see the connection. Oh, sorry. Maybe I expressed myself wrong. IMHO your way to work with an initializer is correct from the C standpoint. But I think this is pretty unusual for a code example when an application programmer starts to work with ISO-TP. You usually get most of these values from the command line an fill the struct _by hand_ - and not with a static initialization. That was my suggestion. > > ** Different topic ** > > While replying on this, I encountered something which made me worry a bit: > > The type of sockaddr_can.can_ifindex is a signed int: > > https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/can.h#L243 > > But if_nametoindex() returns an unsigned int: > > https://man7.org/linux/man-pages/man3/if_nametoindex.3.html > > Shouldn't sockaddr_can.can_ifindex also be declared as an unsigned int? > The if_index derives from struct netdevice.if_index https://elixir.bootlin.com/linux/v6.8.6/source/include/linux/netdevice.h#L2158 which is an int. I don't think this would have an effect in real world to change sockaddr_can.can_ifindex to an unsigned int. I wonder if it is more critical to existing user space code to change it to unsigned int or to leave it as-is ... Best regards, Oliver