Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp197425iol; Thu, 9 Jun 2022 01:52:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrMREkfV00RFQH2LnVPi78tF6p2zsnJHO2JzBwBSTUAp8iw9knLISN4EfRi3kL8alSo3vG X-Received: by 2002:a17:902:e845:b0:163:ebca:a026 with SMTP id t5-20020a170902e84500b00163ebcaa026mr38143458plg.40.1654764746485; Thu, 09 Jun 2022 01:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654764746; cv=none; d=google.com; s=arc-20160816; b=XUbcMT3NC0O75qE2pOaDbVV6CtKNNiymwCvKxwKFAhd9YutLCDTJfm6SSCRIosuORZ HARr5lScGRJnWcBLSSbmQqlMySwWY3vDXKD4LNJe/JjJbBSWKcYdmIPs52Kw7JIkJJNW oUQLC1LoQskAjQu5cByNOT1Vx59VGwgASyYd4PiJfWpqw50NPDIhmXMU1U5mDBPnbeeL aBZ/Wgh74hG427RsYD6zhVgsKGTTTwqJLtPj9jQw8hKS0KM2VF437TWgMz4HMRv34lll R2g2hIJJFsMnnQXfOJrFzpeF0Ywitq+Lt600cdYc3AcKHM3pPaLQMVLMsbrtmSbXuK8u 6Dtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RKAu3Su9OCcQgarsv+yiwODwUHrRRpMfJPL/wOkMh7I=; b=DIu6smFqThzO9ZM+xvOcKCN6LPHPJj8JoIou7+o5sR+nDNS6XwoNnlSqV2NzXt6tdj 5lhU0ISr/Nw2NzwzEL5YL39lAh0PcQXzuAHslE77UBLEu39mDR3Ivm49dLVqypsVtwHt BSELjlh5VzIAfneqLfmw31zcbEBoRtSZXc17g5KcIW/YdRPyKGOPv8G2jKdbEUEInnQj 0A7mWEuWVEdSDDTkJyaMIpttH5/mCcEuDN5JJjkImSOivhWRNbk6cIDOeGj2hWFaiYR9 Vwc3zcujGxtqfih5K3Bu4Dn7apfhr+nFfyd/Ry75YshGY8GESA772tQ5IDO/4WdQt4it DUvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Ut3mWkgX; 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=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p18-20020a62ab12000000b0051c1c914f3fsi14270092pff.290.2022.06.09.01.52.14; Thu, 09 Jun 2022 01:52:26 -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=@amarulasolutions.com header.s=google header.b=Ut3mWkgX; 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=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233019AbiFIHY3 (ORCPT + 99 others); Thu, 9 Jun 2022 03:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232296AbiFIHY2 (ORCPT ); Thu, 9 Jun 2022 03:24:28 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C30C43555CE for ; Thu, 9 Jun 2022 00:24:26 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id h8so2918135iof.11 for ; Thu, 09 Jun 2022 00:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RKAu3Su9OCcQgarsv+yiwODwUHrRRpMfJPL/wOkMh7I=; b=Ut3mWkgX4WnmnIjzD7Y0ontAlJvatWNtNA7i7kkNUfSsgFwOcbJ7WdYWsRFYTpbKKc /0nrI402hf8GfR5EyIbpPypJP3XwyE8nJQKgOwrx8adaHVHSJ3Dz0g9yNPQBAXhJw8m7 z8v5yfzGM12zNlH/uY+/17+h5ZD54ungo7Ayg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RKAu3Su9OCcQgarsv+yiwODwUHrRRpMfJPL/wOkMh7I=; b=LgNcwm3RA1sHInwfHQ8rp8Yyba/4nO59qYDiUeUnL94ornTsEkd+9rSmXyJ/8Jdkyh 4qZ91M6cSN6G06E7YDE1tRJEdIWxTfm3DHl4HySjRwb37EDIeRj2Xp9srCrSRnsXK/hM h/NQHLNDLevmRfBpOXuiLZpcBwIcXOvsUw+qbaJRAYJK8Cl39XHYiNjUl2qe7ENDtWya +jeKY12mt95n0gjmpE0uM9e7W/Zx92EhPOphZ3DVrvnaIUaIQX2b0C0cp7zp+ovQOSpH 0QPYVzvxvOInDrc6s7vw8l/EKQXdnkd95Kvoth+zVipfrWn/asr8S/P8KhpmIqf/UauA UuZg== X-Gm-Message-State: AOAM530KAE0CUFzuI2+eYw5BICLAAw3IWrHFDvm4jCEtD451fWyyY0xM PwWgSHPCKwvyYwKpiJhtFo42REL8OxKUJKh9AcoJrg== X-Received: by 2002:a6b:8f90:0:b0:669:3ad9:9bd with SMTP id r138-20020a6b8f90000000b006693ad909bdmr12248465iod.121.1654759465617; Thu, 09 Jun 2022 00:24:25 -0700 (PDT) MIME-Version: 1.0 References: <20220607094752.1029295-1-dario.binacchi@amarulasolutions.com> <20220607094752.1029295-12-dario.binacchi@amarulasolutions.com> <20220607105225.xw33w32en7fd4vmh@pengutronix.de> <20220609063813.jf5u6iaghoae5dv3@pengutronix.de> In-Reply-To: <20220609063813.jf5u6iaghoae5dv3@pengutronix.de> From: Dario Binacchi Date: Thu, 9 Jun 2022 09:24:14 +0200 Message-ID: Subject: Re: [RFC PATCH 11/13] can: slcan: add ethtool support to reset adapter errors To: Marc Kleine-Budde 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Hi Marc, On Thu, Jun 9, 2022 at 8:38 AM Marc Kleine-Budde wrote: > > On 08.06.2022 18:33:08, Dario Binacchi wrote: > > Hi Marc, > > > > On Tue, Jun 7, 2022 at 12:52 PM Marc Kleine-Budde wrote: > > > > > > On 07.06.2022 11:47:50, Dario Binacchi wrote: > > > > This patch adds a private flag to the slcan driver to switch the > > > > "err-rst-on-open" setting on and off. > > > > > > > > "err-rst-on-open" on - Reset error states on opening command > > > > > > > > "err-rst-on-open" off - Don't reset error states on opening command > > > > (default) > > > > > > > > The setting can only be changed if the interface is down: > > > > > > > > ip link set dev can0 down > > > > ethtool --set-priv-flags can0 err-rst-on-open {off|on} > > > > ip link set dev can0 up > > > > > > > > Signed-off-by: Dario Binacchi > > > > > > I'm a big fan of bringing the device into a well known good state during > > > 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? 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 error states reset is done by 'f ' command, that is not managed by slcan_attach/slcand. 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 == STATE_CONFIG) { mcp2515_init(); return CR; } break; } Thanks and regards, Dario > > regards, > Marc > > -- > 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 | -- Dario Binacchi Embedded Linux Developer dario.binacchi@amarulasolutions.com __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@amarulasolutions.com www.amarulasolutions.com