Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp198264iol; Thu, 9 Jun 2022 01:53:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoc3ir+VvHViNiHjX2hm+oRO6/ejHF1XHkAfm6E94/QgiPzQ0Kjv4zu0l8q1U03nFDG0AG X-Received: by 2002:a05:6a00:1788:b0:51b:f462:b16 with SMTP id s8-20020a056a00178800b0051bf4620b16mr27226973pfg.42.1654764837531; Thu, 09 Jun 2022 01:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654764837; cv=none; d=google.com; s=arc-20160816; b=Eh4Q4aO2Jr7rbg/rF7SETa3CVJfSf//DvxpWLGpZaz/TSA0w7guzEQwcqsrAloFNHB cCyfDNReVJRYYLRJT5Ad4mUZdTQe30TQ+uSnWXBptgvrpfhFfmBJvwD1NheocZsLIqdA wDna7kt+QCUtz/e/hVMJIGnT9QAT2LVmYgvC0ZuRcG2DOy/v7SmZ0fg53bBQV9+Zgxlf kPIckQ+NVuDzta5aT9FfPZklDn8c9oRv5sYlgMhRUE0iDo+WIJyw6oKc5MywctplQNvS RoD5kY182Q8IXQka6lbS1ZpjhoMteC68ORuKUiFQkSzwyWlfDDBjkXDlIc8FFev6ziTy P/tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Anuw0JVcrDiSZTbR+KxJk9JmSyDFK5FdZekwlenT0lY=; b=P4UIwWTkC2RIZp4gYTw9sw08a2w6wn1kJEkPo/WtqfayJnyacZeTRIcq4L3gSQNwmi OBZZR4jwvHhoJItHwIEzmIkZJjjxL7zgzXnfe5Ojf0Nv9ywWIlG6JIeIoNFNFqVPW9bi iuzhNsUe3dy57cB9Ac/pfWbPJbPh/RD5njxBlg6EcN7TvLwdTjTSG+RxPMiePMgztpIl IADBmqA2Eq5veZw2noKYHeKm4+AfufXum41UNsQJ1Q1WzKtPEyKqDrLxN/jjIbJUv/bw 1hamzmzup+nJQDc+rMALNw9Yu/MeONNa1cuTvp69XzHG8pRMs/e0yRYGDlTohBlWCMIl Sfmw== ARC-Authentication-Results: i=1; mx.google.com; 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 h188-20020a636cc5000000b003fdbe9d3498si16734738pgc.877.2022.06.09.01.53.45; Thu, 09 Jun 2022 01:53:57 -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; 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 S240429AbiFIIBc (ORCPT + 99 others); Thu, 9 Jun 2022 04:01:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238498AbiFIIB2 (ORCPT ); Thu, 9 Jun 2022 04:01:28 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F6960C6 for ; Thu, 9 Jun 2022 01:01:27 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nzD6R-0003tg-Ij; Thu, 09 Jun 2022 10:01:15 +0200 Received: from pengutronix.de (unknown [IPv6:2a01:4f8:1c1c:29e9:22:41ff:fe00:1400]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id D75DC8FD4B; Thu, 9 Jun 2022 08:01:12 +0000 (UTC) Date: Thu, 9 Jun 2022 10:01:12 +0200 From: Marc Kleine-Budde To: Dario Binacchi Cc: linux-kernel@vger.kernel.org, Amarula patchwork , michael@amarulasolutions.com, "David S. Miller" , Eric Dumazet , Greg Kroah-Hartman , Jakub Kicinski , Jiri Slaby , Paolo Abeni , Sebastian Andrzej Siewior , Vincent Mailhol , Wolfgang Grandegger , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [RFC PATCH 11/13] can: slcan: add ethtool support to reset adapter errors Message-ID: <20220609080112.24bw2764ov767pqc@pengutronix.de> References: <20220607094752.1029295-1-dario.binacchi@amarulasolutions.com> <20220607094752.1029295-12-dario.binacchi@amarulasolutions.com> <20220607105225.xw33w32en7fd4vmh@pengutronix.de> <20220609063813.jf5u6iaghoae5dv3@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="nrsx7nlshjl4uzjt" Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 --nrsx7nlshjl4uzjt Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 09.06.2022 09:24:14, Dario Binacchi wrote: > > > > I'm a big fan of bringing the device into a well known good state d= uring > > > > ifup. What would be the reasons/use cases to not reset the device? > > > > > > Because by default either slcand and slcan_attach don't reset the > > > error states, but you must use the `-f' option to do so. So, I > > > followed this use case. > > > > Is this a CAN bus error state, like Bus Off or some controller (i.e. non > > CAN related) error? >=20 > The help option of slcan_attach and slcand prints " -f (read status > flags with 'F\\r' to reset error states)\n" I looked at the sources of > the adapter I am using (USBtin, which uses the mcp2515 controller). > The 'F' command reads the EFLG register (0x2d) without resetting the > RX0OVR and RX1OVR overrun bits. The Lawicel doc [1] says 'F' is to read the status flags not to clear it. However commit 7ef581fec029 ("slcan_attach: added '-f' commandline option to read status flags") [2] suggests that there are some adapters that the reading of the status flag clears the errors. IMHO the 'F' command should be send unconditionally during open. [1] http://www.can232.com/docs/can232_v3.pdf [2] https://github.com/linux-can/can-utils/commit/7ef581fec0298a228baa71372= ea5667874fb4a56 > The error states reset is done by 'f ' command, that is not > managed by slcan_attach/slcand. Is the 'f' command is non-standard? > switch (subcmd) { > case 0x0: // Disable status reporting > mcp2515_write_register(MCP2515_REG_CANINTE, 0x00); > return CR; > case 0x1: // Enable status reporting > mcp2515_write_register(MCP2515_REG_CANINTE, 0x20); // > ERRIE interrupt to INT pin > return CR; > case 0x2: // Clear overrun errors > mcp2515_write_register(MCP2515_REG_EFLG, 0x00); > return CR; > case 0x3: // Reinit/reset MCP2515 to clear all errors > if (state =3D=3D STATE_CONFIG) { > mcp2515_init(); > return CR; > } > break; > } Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --nrsx7nlshjl4uzjt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEBsvAIBsPu6mG7thcrX5LkNig010FAmKhqMUACgkQrX5LkNig 0114qAgArPEP1RPi8hQW1i+C4+/kWVLSk8Mlftr4ru7u4Nsp1miAiuP/E1pPIgyX Wc5FiojY7XT2Rpc1543Ufz+7o67be2hvHApDPQTT30qPWWTD0hIHlEt3FU/5CPig aseQYSnvpANP28Rp0ILvdf8odnDT6C/k0yEDKbbHnkZOARsV1fiLfkxTmfDac9i1 /2A6kmPAk48Y1pYGI9rPihYSfPxyPVGwSbQIEPQY35RHvLvgg74qS/2OJ5tieexF 8fE2io8j9+dMG62UHnPm9HQ5ATTeM0X+9zjsKGE2SPkGU/ayJ1MxMjaFR3TT4yOB 7X0G3ieyCwr5sunnmCkNld23UPxAhw== =+BBy -----END PGP SIGNATURE----- --nrsx7nlshjl4uzjt--