Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4535899imw; Tue, 12 Jul 2022 09:34:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uTcpZBMpLYkjkZr6lEzVvxRaHKhwmTAopQWu0eJq+EqWazHcgdfpEvaGsnI7b2H2SdjswO X-Received: by 2002:a17:907:a06f:b0:72b:564c:465b with SMTP id ia15-20020a170907a06f00b0072b564c465bmr11124661ejc.344.1657643687750; Tue, 12 Jul 2022 09:34:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657643687; cv=pass; d=google.com; s=arc-20160816; b=vHfRNW/kIYQ5BJUPmEn5by1gJaSedyNjrc0NQH/LphsrHuuYIGCDaZ8hX55neLeRKN fhLhwAS3oHaRKQGVUYfKxTVJP4yO8XAjg6BzW1SaNjcW7Y/gPJ6na/vYojkcM6cfxktm U4lc4yjDGex3Nd5sEy0nmA4rV/Y0D/Fi3+KBIflqikiEuIhaj7LJR53kW8QkgIy13DnA DEud1H+8T+yDk7GZmdHIOSt7oQy5UlpQDdUfiCSYFBqDeulgADGSKlSBgFEBnpNBXTJ+ dkA0iv3gIX3ZVbTKZ1XE1Ieb7wP1zqWDfKfv1C7OJwkofcmogQRdTSM85lga0Qu6YRXk CEWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:user-agent:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature; bh=Akm8k/FTr+MdnylAVaAjtPBkziV7G8pw+So6/jz8vI0=; b=zYoOAmV08yfN2WfA8fEdtAyqpdHqUgbycNvdgtypxJ5StJG7imgdKRly69pB3GT7Iw hcsM0hXuQ/LqaeANRJ0IN7kWGhHr3RQaeoP/AzNIW9a+9ejruF34QaTftnkCCasZcmyb SvjWrT+Z/F0eE0uAc7a8v19sVOgX5tU0gDrw9vxX7kyPdf41J+KEnxzZRrFfjqSdgaLQ i/iXJFW2YEum3ugfruzKaEPWWeUvjZHx8rTXdXu/p/FNodBMSN6BJ2lnc5qEDBSoj52U P4O/F10o1zRkxGIg01ugF2IN3+wD4HBDX034JT1MpQ9Yq90B6CdxmIYi/GFNPiHqLJC1 kKVA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@esdhannover.onmicrosoft.com header.s=selector1-esdhannover-onmicrosoft-com header.b=VTUU6ERb; arc=pass (i=1 spf=pass spfdomain=esd.eu dkim=pass dkdomain=esd.eu dmarc=pass fromdomain=esd.eu); 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pw12-20020a17090720ac00b0072af37c9f69si12352963ejb.423.2022.07.12.09.34.21; Tue, 12 Jul 2022 09:34:47 -0700 (PDT) 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=@esdhannover.onmicrosoft.com header.s=selector1-esdhannover-onmicrosoft-com header.b=VTUU6ERb; arc=pass (i=1 spf=pass spfdomain=esd.eu dkim=pass dkdomain=esd.eu dmarc=pass fromdomain=esd.eu); 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233774AbiGLPiZ (ORCPT + 99 others); Tue, 12 Jul 2022 11:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbiGLPiX (ORCPT ); Tue, 12 Jul 2022 11:38:23 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2109.outbound.protection.outlook.com [40.107.21.109]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E0CCC08FC; Tue, 12 Jul 2022 08:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PJkw7Q4nLBibB54dB7gOBcHQI6a6N1nSWj6t6gYVwmnfSJUbIfV2TBAi2hNRe53J60toBiiLJOqJlgvehkxeexLZD3/9/gmu2FGyryjOh0sXYGr2mSkHz0aPyEx2qfZOz9x/U2LcPbMwOldlsEIQ1Nbq+odZUHb9tDn5YD//QXQbLRA/9K7znygJuPsHWr4XHgAnJBYpGJsTZfGU38ZUgTYPMpMNAeGc/FkZHPVoNl5vXkoYfLbyk/vCODTw6Jil5SvM8sMB5HS9+vEPGV7RAcXbkrOGSkaeRi7HsIK+q3cyUfAzIJzHhKooxnoxiqgGKBVmCmvxBM70a4SwN0vzyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Akm8k/FTr+MdnylAVaAjtPBkziV7G8pw+So6/jz8vI0=; b=kNbxiOPjmUXSxv6UZp/CIFHmAA00HanY1hVmSjsAFZY/RPlYhkHxYYG48/Ko25OAXZOmSdnILIznm5sE9s8U4lgT1jFseDUFz4pezvfx7P6sc+G2jwHf86TJRRUitVTyk5f6W6k+rliZWm83urAsV8gRBw8vXEUM+rPgyfFxlqcO1uxVhEpgYEKAupYU1zRigklnidcvpjXxd4QljjMeOQosBEf9R73kZgCVQ5VWaot2I1c5CLWcLYIYnrUBsMOVZbLtD9ndvTDKbRsdN7EMdHVvfv6xC+xuF9KHRus1ASFXD4Q8Ml51biEd0UiMgha63hCGAS/ngu1e3MVFid/eQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=esd.eu; dmarc=pass action=none header.from=esd.eu; dkim=pass header.d=esd.eu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=esdhannover.onmicrosoft.com; s=selector1-esdhannover-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Akm8k/FTr+MdnylAVaAjtPBkziV7G8pw+So6/jz8vI0=; b=VTUU6ERbIT4QcmUzT7mvn/3cfzj6E9NhIvnyzKja4DfV78wmAnH/JegTxKIHPCVuKoXcC+ZOXfsa8lVkDAKb+GX2H061kj2JIdjPwK7JxCN//g7X+Ac0axUYvgxJVufGc1kXHpzsQg/ZRNE2Si+mzhjig8SNqtAy0Rz/xIxKivI= Received: from GVXPR03MB8426.eurprd03.prod.outlook.com (2603:10a6:150:4::9) by PR3PR03MB6619.eurprd03.prod.outlook.com (2603:10a6:102:7a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Tue, 12 Jul 2022 15:38:19 +0000 Received: from GVXPR03MB8426.eurprd03.prod.outlook.com ([fe80::d57a:7f6b:776b:481a]) by GVXPR03MB8426.eurprd03.prod.outlook.com ([fe80::d57a:7f6b:776b:481a%3]) with mapi id 15.20.5417.026; Tue, 12 Jul 2022 15:38:19 +0000 From: Frank Jungclaus To: "mailhol.vincent@wanadoo.fr" CC: =?iso-8859-15?Q?Stefan_M=E4tje?= , "linux-can@vger.kernel.org" , "mkl@pengutronix.de" , "netdev@vger.kernel.org" , "wg@grandegger.com" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 6/6] can: esd_usb: Improved decoding for ESD_EV_CAN_ERROR_EXT messages Thread-Topic: [PATCH 6/6] can: esd_usb: Improved decoding for ESD_EV_CAN_ERROR_EXT messages Thread-Index: AQHYkvZ+J6KAwatI2U+kMqczZwhhVa15+MmAgADsGYA= Date: Tue, 12 Jul 2022 15:38:18 +0000 Message-ID: References: <20220708181235.4104943-1-frank.jungclaus@esd.eu> <20220708181235.4104943-7-frank.jungclaus@esd.eu> In-Reply-To: Accept-Language: en-001, de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Evolution 3.36.5-0ubuntu1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=esd.eu; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 759a0e80-f91f-49b5-116f-08da641c8bbc x-ms-traffictypediagnostic: PR3PR03MB6619:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uWpk2I9aIozgTqjITgWdjzOwqORfD8ExGNaDU9lWRtH+UXJDaW9Rehm0BtHbAlHFGRhXs66YQHi++abhC77C9LFgSfPwsHfPhBIW7DNTljDABSeFzmNoQbR2qQW7pSm1Hmbcf0kLCL+ynwMY60FHZu9ldZBewE/7nIEKkPB+VddG9/q6WzmacceqGu3mkwk5OMAxYfobS7ZU/mdLTPKPOL+qNppEBZSyadbWYqXdCiNYqAODX8ozt1RUsxPYZa1toVS51LDfe6JoOmeeokQAwc3szFerKVyQNIB6fpAQwVbL2Jkag2r9MwEiqgshcZeQPDowhTWnyesiDhJSQU1unLFyOaYIsl+7/3igQ4C9D4xIdVzcvkl5SsijVim0KO3WgEkyyST/dH1OJ1p/ukPTkrAdca2MI8bAiLDrORp8LFDpDMXP5kFTensv4dP7KEXtJygk0UEdkeNlgv07XoEozeJmLDomHwedrFF1QoOT7WaPbIDh/6OW/VjPtjTPBQiOxZ2rxfnyiQf6cuyvBdQi7n2BQhgUq/IsQaGodGEAmV+VsHY8+TeSFPFueYYhQGOX42csvpFzw8EZgrcE2QZc2HSXClaMhcYn8cQk92bYPKvWkGG9x8olxqjpmSllCB+L0Hp6GHykpyDr/ics594NG4H9yWnakp84KKrx3AcXe5dAf1Lw0NCOKFBCSu/bBlVI86D622PKLGfikSGpvNxlP5fojGlWuh3Xq6OTSiP95U7UKxly0pEFdeJSakg7H1igHVJ0jJILj5Y6x2FD+mpJJPb4UHV12pcyEpZaKfQ47EG8x1yWe9LjVQ9+eZl954u80FImwa/iiNefy2YMqmVFWA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GVXPR03MB8426.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(366004)(396003)(39840400004)(136003)(26005)(41300700001)(186003)(2906002)(122000001)(2616005)(6506007)(86362001)(38100700002)(6512007)(38070700005)(66476007)(316002)(66946007)(8676002)(83380400001)(54906003)(64756008)(6916009)(71200400001)(66446008)(91956017)(4326008)(36756003)(66556008)(6486002)(8936002)(15650500001)(76116006)(966005)(478600001)(5660300002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-15?Q?XlJ9NRoCh/ObgWp87enXzDZpYsKTrNxaojXxqcQnLrwC9/eiKrv0eK2lw?= =?iso-8859-15?Q?I5wqxoQkUl3FkakGE71FXlwpQvmz04v0HNJeY+Ma82GKnpSepTg2K3YtF?= =?iso-8859-15?Q?uL6UMqCr1uBvQY9vPw51iCt6BGybSwutWEpxuYKkdViv59SUyPFn8EuPI?= =?iso-8859-15?Q?xUHJepqwouH6vMCSmgPAstIcMzqRdyD8PrLUJmZnch8lAVwtok2hMgdCq?= =?iso-8859-15?Q?0dgWgLOHqrN2jktBiNqUZpNogaW110bfz2IpORdEvGkMeFELHk6dPTDK1?= =?iso-8859-15?Q?eIEOBHGms3IRxIdJQ1UZMKuFY3J/Dhw7vAFv+Fm04laTn7S0D158zpcpH?= =?iso-8859-15?Q?Zv0a33NTc/Hr2r4Cz5AWBTjA6kHeFP0xdH6ssGyD3d4KSxN9NnteCMGof?= =?iso-8859-15?Q?PWYqkUBFGD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?iso-8859-15?Q?+PrBPdXvZ1PQSDLtrhPVmDymul9yblmpbElTHv+HXBM+LkgBYZbpw1l/4?= =?iso-8859-15?Q?UKarTc6uioGrAZvVFgcUAm7CwkSv5qteiGn06SphrzHATTAJk6bvOJ6E4?= =?iso-8859-15?Q?TXvCUrvibCAHJiL9DyOOfqhmq08esu94QsUrpXsTiNYLRE+IWuBX/agQJ?= =?iso-8859-15?Q?EMlN3tracwVbQHCfo6tzUWWmivnEAs5TlJzG0MjD0IJ3MIjN39A0AOz0x?= =?iso-8859-15?Q?r6O61/pnHPFHUrxHhIYmwJdzx0IWrmzDxE+AvBz9iq0pyoLLD+lgOnOhA?= =?iso-8859-15?Q?Oz3x3YTSFecO7A/M19qyNLJ8ubfKa7yOeAWKepHfatG0QQLhaRfgjYHtr?= =?iso-8859-15?Q?2yBZ3QzOpi51tFB8Dae43fQbvg=3D=3D?= Content-Type: text/plain; charset="iso-8859-15" Content-ID: <35C827E844FA0D4E87E6E299E3514C10@eurprd03.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: esd.eu X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: GVXPR03MB8426.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 759a0e80-f91f-49b5-116f-08da641c8bbc X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2022 15:38:19.1941 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5a9c3a1d-52db-4235-b74c-9fd851db2e6b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 9c1nrFGFZoPPbftLsssL1+MpStwhAX63ZIyz8A9K+yN1bT3CKqVkcihqUQO09UGJY0+Hv+E889CKCWq4O3BAag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR03MB6619 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On Tue, 2022-07-12 at 10:33 +0900, Vincent MAILHOL wrote: > On Sat. 9 Jul. 2022 at 03:14, Frank Jungclaus wr= ote: > > As suggested by Vincent I spend a union plus a struct ev_can_err_ext >=20 > The canonical way to declare that something was suggested by someone > else is to use the Suggested-by tag. >=20 > Also, this particular change was suggested by Marc, not by me ;) > https://lore.kernel.org/linux-can/20220621071152.ggyhrr5sbzvwpkpx@pengutr= onix.de/ Ops, sorry for mixing up your names. So the kudos goes to Marc ;) I'll spend a Suggested-by tag and resend patch 6/6. Best regards, Frank >=20 > > for easier decoding of an ESD_EV_CAN_ERROR_EXT event message (which > > simply is a rx_msg with some dedicated data). >=20 > Suggested-by: Marc Kleine-Budde >=20 > > Signed-off-by: Frank Jungclaus > > --- > > drivers/net/can/usb/esd_usb.c | 20 ++++++++++++++------ > > 1 file changed, 14 insertions(+), 6 deletions(-) > >=20 > > diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_us= b.c > > index 09649a45d6ff..2b149590720c 100644 > > --- a/drivers/net/can/usb/esd_usb.c > > +++ b/drivers/net/can/usb/esd_usb.c > > @@ -126,7 +126,15 @@ struct rx_msg { > > u8 dlc; > > __le32 ts; > > __le32 id; /* upper 3 bits contain flags */ > > - u8 data[8]; > > + union { > > + u8 data[8]; > > + struct { > > + u8 status; /* CAN Controller Status */ > > + u8 ecc; /* Error Capture Register */ > > + u8 rec; /* RX Error Counter */ > > + u8 tec; /* TX Error Counter */ > > + } ev_can_err_ext; /* For ESD_EV_CAN_ERROR_EXT */ > > + }; > > }; > >=20 > > struct tx_msg { > > @@ -134,7 +142,7 @@ struct tx_msg { > > u8 cmd; > > u8 net; > > u8 dlc; > > - u32 hnd; /* opaque handle, not used by device */ > > + u32 hnd; /* opaque handle, not used by device */ > > __le32 id; /* upper 3 bits contain flags */ > > u8 data[8]; > > }; > > @@ -228,11 +236,11 @@ static void esd_usb_rx_event(struct esd_usb_net_p= riv *priv, > > u32 id =3D le32_to_cpu(msg->msg.rx.id) & ESD_IDMASK; > >=20 > > if (id =3D=3D ESD_EV_CAN_ERROR_EXT) { > > - u8 state =3D msg->msg.rx.data[0]; > > - u8 ecc =3D msg->msg.rx.data[1]; > > + u8 state =3D msg->msg.rx.ev_can_err_ext.status; > > + u8 ecc =3D msg->msg.rx.ev_can_err_ext.ecc; > >=20 > > - priv->bec.rxerr =3D msg->msg.rx.data[2]; > > - priv->bec.txerr =3D msg->msg.rx.data[3]; > > + priv->bec.rxerr =3D msg->msg.rx.ev_can_err_ext.rec; > > + priv->bec.txerr =3D msg->msg.rx.ev_can_err_ext.tec; > >=20 > > netdev_dbg(priv->netdev, > > "CAN_ERR_EV_EXT: dlc=3D%#02x state=3D%02x ec= c=3D%02x rec=3D%02x tec=3D%02x\n", >=20 > Yours sincerely, > Vincent Mailhol