From patchwork Fri Jan 9 23:01:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 17652 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org 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 41EC44760F for ; Sat, 10 Jan 2009 10:19:19 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757764AbZAIXTH (ORCPT ); Fri, 9 Jan 2009 18:19:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754677AbZAIXTE (ORCPT ); Fri, 9 Jan 2009 18:19:04 -0500 Received: from suva.vyatta.com ([76.74.103.44]:42273 "EHLO suva.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754733AbZAIXSJ (ORCPT ); Fri, 9 Jan 2009 18:18:09 -0500 Received: from suva.vyatta.com (suva [127.0.0.1]) by suva.vyatta.com (8.13.7/8.13.7) with ESMTP id n09NI1hR017291; Fri, 9 Jan 2009 15:18:01 -0800 Received: (from shemminger@localhost) by suva.vyatta.com (8.13.7/8.13.7/Submit) id n09NI1rO017290; Fri, 9 Jan 2009 15:18:01 -0800 Message-Id: <20090109230139.553525868@linux-foundation.org> User-Agent: quilt/0.47-1 Date: Fri, 09 Jan 2009 15:01:35 -0800 From: Stephen Hemminger To: David Miller , t.sailer@alumni.ethz.ch Cc: netdev@vger.kernel.org, linux-hams@vger.kernel.org Subject: [patch 38/45] hdlcdrv: convert to internal net_device_stats References: <20090109230057.575650817@linux-foundation.org> Content-Disposition: inline; filename=hdlcdrv-stats.patch Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Stephen Hemminger Acked-by: Thomas Sailer --- drivers/net/hamradio/hdlcdrv.c | 27 +++++++-------------------- include/linux/hdlcdrv.h | 1 - 2 files changed, 7 insertions(+), 21 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 --- a/drivers/net/hamradio/hdlcdrv.c 2009-01-09 10:16:50.000000000 -0800 +++ b/drivers/net/hamradio/hdlcdrv.c 2009-01-09 12:52:18.000000000 -0800 @@ -154,7 +154,7 @@ static void hdlc_rx_flag(struct net_devi pkt_len = s->hdlcrx.len - 2 + 1; /* KISS kludge */ if (!(skb = dev_alloc_skb(pkt_len))) { printk("%s: memory squeeze, dropping packet\n", dev->name); - s->stats.rx_dropped++; + dev->stats.rx_dropped++; return; } cp = skb_put(skb, pkt_len); @@ -162,7 +162,7 @@ static void hdlc_rx_flag(struct net_devi memcpy(cp, s->hdlcrx.buffer, pkt_len - 1); skb->protocol = ax25_type_trans(skb, dev); netif_rx(skb); - s->stats.rx_packets++; + dev->stats.rx_packets++; } void hdlcdrv_receiver(struct net_device *dev, struct hdlcdrv_state *s) @@ -326,7 +326,7 @@ void hdlcdrv_transmitter(struct net_devi s->hdlctx.len = pkt_len+2; /* the appended CRC */ s->hdlctx.tx_state = 2; s->hdlctx.bitstream = 0; - s->stats.tx_packets++; + dev->stats.tx_packets++; break; case 2: if (!s->hdlctx.len) { @@ -427,19 +427,6 @@ static int hdlcdrv_set_mac_address(struc } /* --------------------------------------------------------------------- */ - -static struct net_device_stats *hdlcdrv_get_stats(struct net_device *dev) -{ - struct hdlcdrv_state *sm = netdev_priv(dev); - - /* - * Get the current statistics. This may be called with the - * card open or closed. - */ - return &sm->stats; -} - -/* --------------------------------------------------------------------- */ /* * Open/initialize the board. This is called (in the current kernel) * sometime after booting when the 'ifconfig' program is run. @@ -568,10 +555,10 @@ static int hdlcdrv_ioctl(struct net_devi bi.data.cs.ptt = hdlcdrv_ptt(s); bi.data.cs.dcd = s->hdlcrx.dcd; bi.data.cs.ptt_keyed = s->ptt_keyed; - bi.data.cs.tx_packets = s->stats.tx_packets; - bi.data.cs.tx_errors = s->stats.tx_errors; - bi.data.cs.rx_packets = s->stats.rx_packets; - bi.data.cs.rx_errors = s->stats.rx_errors; + bi.data.cs.tx_packets = dev->stats.tx_packets; + bi.data.cs.tx_errors = dev->stats.tx_errors; + bi.data.cs.rx_packets = dev->stats.rx_packets; + bi.data.cs.rx_errors = dev->stats.rx_errors; break; case HDLCDRVCTL_OLDGETSTAT: --- a/include/linux/hdlcdrv.h 2009-01-09 10:16:50.000000000 -0800 +++ b/include/linux/hdlcdrv.h 2009-01-09 12:52:18.000000000 -0800 @@ -241,7 +241,6 @@ struct hdlcdrv_state { struct hdlcdrv_bitbuffer bitbuf_hdlc; #endif /* HDLCDRV_DEBUG */ - struct net_device_stats stats; int ptt_keyed; /* queued skb for transmission */