Received: by 10.213.65.68 with SMTP id h4csp874152imn; Wed, 14 Mar 2018 02:47:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELvfYI1TKmUjet1LaAtEH2GgRaR+NLkOJlrnnXY/4BrsuEaOoCyteP5IrpHEYr634vADGznz X-Received: by 10.98.93.87 with SMTP id r84mr3681383pfb.131.1521020874805; Wed, 14 Mar 2018 02:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521020874; cv=none; d=google.com; s=arc-20160816; b=dxmEDj6PbtpK3VKOyiunq/t7eWzp2jaT9QsnX1ujh+AcDVhIUkqJvwsU0q9wi/yp+a rfcVPEN1HymHOEvADBGjrtZQrw2rJjC0NPHvf45e2cyYpzCr32GE7BKmO/PviPhtf01y rDz0wUfFKf9laRqA/OlfUY9xie2rQ2LT34ojriG0/4hUQkTnBXzDatiNfG0NdujwJVqH lOFBQxsYpjo7opXllX37gDqiabRMt1zcjKe9cMbLVfwdogtbd/CxmgmtVGcRRrYwUu0F D3/QQbIhZzXA/hdUhpJhCdDVisAvEOCy67MRiPJ5cCrsCog0+HH6/JH2qAUGuYJpVEUB 6u9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=Flcxoaqj+1CBbadbrDBniuCR58Y0VmcipthxZxsdzH4=; b=q6f6ynaYeM7+A9lkTAX05PIWX1MUoflMA1OCDpU3chRo2r6L/hMe3ISBoJhAokLe9K YSxqJ14KcGU9Zse7Iz//vZbR86qN52zJkwrENCOCic9ndrrJ6b1fhJocLQPkO132hU2j CM6M4IBGywWmstyTHNeSLVSJ9LOawu+3AkmMmu8OneobNDoU5XTfoWRFql5wW/qN5K4B pMfCvxhskZ6aiI1hs8pSNgGgpjAkXrFegLYSpphg89NAq2fw2IBSg9sq0glLCLt7Z3t9 MplW/CKfyUqCVOBTgSQgMtRbnQkj/jQZ+09gvBhSxvFu8uyh+CMuqAH5kN3b4ZkNJg6d PC4Q== 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 f6-v6si1737587plf.70.2018.03.14.02.47.40; Wed, 14 Mar 2018 02:47:54 -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 S1751626AbeCNJqb (ORCPT + 99 others); Wed, 14 Mar 2018 05:46:31 -0400 Received: from mailproxy03.manitu.net ([217.11.48.67]:45286 "EHLO mailproxy03.manitu.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751417AbeCNJqa (ORCPT ); Wed, 14 Mar 2018 05:46:30 -0400 Received: from [192.168.178.20] (aftr-185-17-207-68.dynamic.mnet-online.de [185.17.207.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wg@grandegger.com) by mailproxy03.manitu.net (Postfix) with ESMTPSA id 59210D4007B; Wed, 14 Mar 2018 10:46:28 +0100 (CET) Subject: Re: rx_packets/bytes stats for error frames To: Marc Kleine-Budde , Jakob Unterwurzacher Cc: Martin Elshuber , Philipp Tomsich , 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> <4c957d42-2b03-9416-75a4-e331f2ded8cf@pengutronix.de> From: Wolfgang Grandegger Message-ID: Date: Wed, 14 Mar 2018 10:46:26 +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: <4c957d42-2b03-9416-75a4-e331f2ded8cf@pengutronix.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 14.03.2018 um 10:36 schrieb Marc Kleine-Budde: > 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 += cf->can_dlc; >>>> + } >>> Please count them, too. >> >> We do count them, as errors! >> >> 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. +1, I think we should count the packets and bytes delivered to the network layer. Wolfgang.