From patchwork Tue Sep 1 15:29:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Grandegger X-Patchwork-Id: 32753 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 0A06FB7B7D for ; Wed, 2 Sep 2009 01:29:58 +1000 (EST) Received: by ozlabs.org (Postfix) id F2D76DDD0B; Wed, 2 Sep 2009 01:29:57 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 8161CDDD04 for ; Wed, 2 Sep 2009 01:29:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754346AbZIAP3n (ORCPT ); Tue, 1 Sep 2009 11:29:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753888AbZIAP3n (ORCPT ); Tue, 1 Sep 2009 11:29:43 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:38660 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753860AbZIAP3m (ORCPT ); Tue, 1 Sep 2009 11:29:42 -0400 Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149]) by mail-out.m-online.net (Postfix) with ESMTP id 95A011C153E2; Tue, 1 Sep 2009 17:29:44 +0200 (CEST) X-Auth-Info: tP7nkN4oS9eOCbbBfy6en4PCOn52j4aGv9zxi2VCbfk= Received: from lancy.denx.de (p4FF06838.dip.t-dialin.net [79.240.104.56]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mnet-online.de (Postfix) with ESMTP id 25D84901DD; Tue, 1 Sep 2009 17:29:44 +0200 (CEST) Message-ID: <4A9D3DE5.40309@grandegger.com> Date: Tue, 01 Sep 2009 17:29:41 +0200 From: Wolfgang Grandegger User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Linux Netdev List CC: SocketCAN Core Mailing List Subject: [PATCH net-next] can: sja1000: fix network statistics update X-Enigmail-Version: 0.96.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The member "tx_bytes" of "struct net_device_stats" should be incremented when the interrupt is done and an "arbitration lost error" is a TX error and the statistics should be updated accordingly. Signed-off-by: Wolfgang Grandegger --- drivers/net/can/sja1000/sja1000.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net-next-2.6/drivers/net/can/sja1000/sja1000.c =================================================================== --- net-next-2.6.orig/drivers/net/can/sja1000/sja1000.c +++ net-next-2.6/drivers/net/can/sja1000/sja1000.c @@ -242,7 +242,6 @@ static netdev_tx_t sja1000_start_xmit(st struct net_device *dev) { struct sja1000_priv *priv = netdev_priv(dev); - struct net_device_stats *stats = &dev->stats; struct can_frame *cf = (struct can_frame *)skb->data; uint8_t fi; uint8_t dlc; @@ -276,7 +275,6 @@ static netdev_tx_t sja1000_start_xmit(st for (i = 0; i < dlc; i++) priv->write_reg(priv, dreg++, cf->data[i]); - stats->tx_bytes += dlc; dev->trans_start = jiffies; can_put_echo_skb(skb, dev, 0); @@ -428,7 +426,7 @@ static int sja1000_err(struct net_device dev_dbg(dev->dev.parent, "arbitration lost interrupt\n"); alc = priv->read_reg(priv, REG_ALC); priv->can.can_stats.arbitration_lost++; - stats->rx_errors++; + stats->tx_errors++; cf->can_id |= CAN_ERR_LOSTARB; cf->data[0] = alc & 0x1f; } @@ -486,6 +484,7 @@ irqreturn_t sja1000_interrupt(int irq, v if (isrc & IRQ_TI) { /* transmission complete interrupt */ + stats->tx_bytes += priv->read_reg(priv, REG_FI) & 0xf; stats->tx_packets++; can_get_echo_skb(dev, 0); netif_wake_queue(dev);