Received: by 10.213.65.68 with SMTP id h4csp870994imn; Wed, 14 Mar 2018 02:39:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELsciVQk6DLNzRCzCgfFMXhv/3JpfP9196qRtEEQWsYCQuY1LDW4KVW4dPfNVtxJkK0uC8L5 X-Received: by 2002:a17:902:82c2:: with SMTP id u2-v6mr3365469plz.401.1521020371946; Wed, 14 Mar 2018 02:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521020371; cv=none; d=google.com; s=arc-20160816; b=GX5/gQkkit/ywBBevOCK2PSDqgnH2GNKhA3XGDwrnpWXD+ApV+vEbQXLAqBCRod3NX C60dNS9U5z9jhACIsJ0Mbo1+LpRy0f85HQJv78+bCH3VUkRP5IyKsOhNVLT4eD/rFVK/ hk7W6X+BvKmwyoqNS6/VnESF1TPSgbfg8iDhDCzLU4idjgUsAD5MHFWavym6ijUMIIZt LRWowSfnpHQ65y28tPs+QreGtgriwW6k2Tdlumd3Hq8hIWikPAt4zkgg5ImmZWLXaKbv INEby5PaYAf9Lrqnu8w9UESPWRYjZFqpsJ6XL7ZH25SN1P6+K2+L6Q+Gchon8jgeyphB FibQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=L75wFlyWGfX3/BX23Xt84w0ybeqa9N799pVlJG8kxUI=; b=F74TBYQ+j+x+4VdzLKY6NeO8LM8nQhFAXietwI/BF7epjJ6yiZIyUlGaEOH4xxJI7K ntqi1RVfT7rguLxlpzxYjau/0WzEof/GAHGOb0uckQqYTXkBXrSdXdH9sNQ2LhvwXP/O C2QcUc1DRHwSzkxQVV1gNZgaio64m3ZmDXytzYHI+/iIktdXTa4t9WCoD20UBbrAnDI0 +QgGEA2+KGnTTZ4lB1RCvc6wEJYIVU0Bwk++nc1hvF2s1iiftgLJnhccVDjIXVK8Fn8q WbLkz8T/16GmgPkckQ3nZVYvHAiLJQtT5Ekh40IuEbHHN+LHe7i5Vn8SGLWS+aX3yTfb E3JA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l59-v6si1665261plb.77.2018.03.14.02.39.17; Wed, 14 Mar 2018 02:39:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751497AbeCNJhK (ORCPT + 99 others); Wed, 14 Mar 2018 05:37:10 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:43659 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751AbeCNJhI (ORCPT ); Wed, 14 Mar 2018 05:37:08 -0400 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ew2qD-0007Cl-WF; Wed, 14 Mar 2018 10:37:02 +0100 Received: from [IPv6:2001:470:7eea:1122:b5ce:4785:94ee:c957] (unknown [IPv6:2001:470:7eea:1122:b5ce:4785:94ee:c957]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (Client CN "mkl@blackshift.org", Issuer "StartCom Class 1 Client CA" (not verified)) (Authenticated sender: mkl@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id C10442F00B3; Wed, 14 Mar 2018 09:37:00 +0000 (UTC) Subject: rx_packets/bytes stats for error frames (was: Re: [PATCH v2 1/1] can: ucan: add driver for Theobroma Systems UCAN devices) To: Jakob Unterwurzacher Cc: Martin Elshuber , Philipp Tomsich , Wolfgang Grandegger , linux-can@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180313173520.21257-1-jakob.unterwurzacher@theobroma-systems.com> <20180313173520.21257-2-jakob.unterwurzacher@theobroma-systems.com> <6c1b7482-2cde-40e3-eff4-e4b94794a63e@theobroma-systems.com> From: Marc Kleine-Budde Message-ID: <4c957d42-2b03-9416-75a4-e331f2ded8cf@pengutronix.de> Date: Wed, 14 Mar 2018 10:36:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <6c1b7482-2cde-40e3-eff4-e4b94794a63e@theobroma-systems.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="u6zmgLP6d4ZUuIx0g08s7VOP0FWxzbdON" 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --u6zmgLP6d4ZUuIx0g08s7VOP0FWxzbdON Content-Type: multipart/mixed; boundary="VunDYGtMXAdOGPEKAROIkeauQDhjaA1oK"; protected-headers="v1" From: Marc Kleine-Budde To: Jakob Unterwurzacher Cc: Martin Elshuber , Philipp Tomsich , Wolfgang Grandegger , linux-can@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <4c957d42-2b03-9416-75a4-e331f2ded8cf@pengutronix.de> Subject: rx_packets/bytes stats for error frames (was: Re: [PATCH v2 1/1] can: ucan: add driver for Theobroma Systems UCAN devices) References: <20180313173520.21257-1-jakob.unterwurzacher@theobroma-systems.com> <20180313173520.21257-2-jakob.unterwurzacher@theobroma-systems.com> <6c1b7482-2cde-40e3-eff4-e4b94794a63e@theobroma-systems.com> In-Reply-To: <6c1b7482-2cde-40e3-eff4-e4b94794a63e@theobroma-systems.com> --VunDYGtMXAdOGPEKAROIkeauQDhjaA1oK Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable On 03/14/2018 10:09 AM, Jakob Unterwurzacher wrote: > On 14.03.18 08:51, Marc Kleine-Budde wrote: >>> + memcpy(cf->data, m->msg.can_msg.data, cf->can_dlc); >>> + >>> + /* don't count error frames as real packets */ >>> + if (!(canid & CAN_ERR_FLAG)) { >>> + stats->rx_packets++; >>> + stats->rx_bytes +=3D cf->can_dlc; >>> + } >> Please count them, too. >=20 > We do count them, as errors! >=20 > This is what happens when you transmit a single CAN frame with nothing = > connected: "TX errors" shoots up but "RX packets" stays zero. This is handled not consistent in the existing CAN drivers. In flexcan all and c_can (all but rx overflow) are counted as rx_packets and rx_bytes. (I haven't looked at the other drivers.) I tend to count the error frames as ordinary frames. Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | --VunDYGtMXAdOGPEKAROIkeauQDhjaA1oK-- --u6zmgLP6d4ZUuIx0g08s7VOP0FWxzbdON Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEENrCndlB/VnAEWuH5k9IU1zQoZfEFAlqo7TkACgkQk9IU1zQo ZfGsqwf/WkJISU3LQLqNxOs/QOsZpSFlBSKOgi6409dak6xVntye+4Z2J0caQPOW DEoty0MU5FecUI2uYANaU+xIHncbU8VkopQ9XyQl4pDSDMFt9Vgn/vI3opIviFJV G+CgygcN9iaX+VZmDuhJQFvjba+8a+PXxv4BvvYKBWdZQ88j34JWmBjrnIMWz8Zx K4IYRQ4g4Zf0Xonzm4QvVKm6V82vkacMWBl2Lauy1KGFny1xavjUv8yBP3Sl/WpW g6+4QBxosHEtZMAIdsLAbY+VpuKbn3WpawGoyTCYN443sinGIk3xcDSWAdIDsPE6 Go2MYF9bs880lkscCAJaPogvJVIkLw== =ouAB -----END PGP SIGNATURE----- --u6zmgLP6d4ZUuIx0g08s7VOP0FWxzbdON--