From patchwork Fri Jan 9 23:01:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 17654 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 68733DE68D for ; Sat, 10 Jan 2009 10:19:20 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757840AbZAIXTM (ORCPT ); Fri, 9 Jan 2009 18:19:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757798AbZAIXTJ (ORCPT ); Fri, 9 Jan 2009 18:19:09 -0500 Received: from suva.vyatta.com ([76.74.103.44]:42256 "EHLO suva.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754597AbZAIXSG (ORCPT ); Fri, 9 Jan 2009 18:18:06 -0500 Received: from suva.vyatta.com (suva [127.0.0.1]) by suva.vyatta.com (8.13.7/8.13.7) with ESMTP id n09NHxUq017207; Fri, 9 Jan 2009 15:17:59 -0800 Received: (from shemminger@localhost) by suva.vyatta.com (8.13.7/8.13.7/Submit) id n09NHww5017204; Fri, 9 Jan 2009 15:17:58 -0800 Message-Id: <20090109230139.075685318@linux-foundation.org> User-Agent: quilt/0.47-1 Date: Fri, 09 Jan 2009 15:01:29 -0800 From: Stephen Hemminger To: David Miller , t.sailer@alumni.ethz.ch Cc: netdev@vger.kernel.org, linux-hams@vger.kernel.org Subject: [patch 32/45] baycom: convert to internal net_device_stats References: <20090109230057.575650817@linux-foundation.org> Content-Disposition: inline; filename=baycom-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 --- 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/baycom_epp.c 2009-01-09 10:16:50.000000000 -0800 +++ b/drivers/net/hamradio/baycom_epp.c 2009-01-09 10:22:45.000000000 -0800 @@ -203,7 +203,6 @@ struct baycom_state { unsigned char buf[TXBUFFER_SIZE]; } hdlctx; - struct net_device_stats stats; unsigned int ptt_keyed; struct sk_buff *skb; /* next transmit packet */ @@ -423,7 +422,7 @@ static void encode_hdlc(struct baycom_st bc->hdlctx.bufptr = bc->hdlctx.buf; bc->hdlctx.bufcnt = wp - bc->hdlctx.buf; dev_kfree_skb(skb); - bc->stats.tx_packets++; + bc->dev->stats.tx_packets++; } /* ---------------------------------------------------------------------- */ @@ -547,7 +546,7 @@ static void do_rxpacket(struct net_devic pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */ if (!(skb = dev_alloc_skb(pktlen))) { printk("%s: memory squeeze, dropping packet\n", dev->name); - bc->stats.rx_dropped++; + dev->stats.rx_dropped++; return; } cp = skb_put(skb, pktlen); @@ -555,7 +554,7 @@ static void do_rxpacket(struct net_devic memcpy(cp, bc->hdlcrx.buf, pktlen - 1); skb->protocol = ax25_type_trans(skb, dev); netif_rx(skb); - bc->stats.rx_packets++; + dev->stats.rx_packets++; } static int receive(struct net_device *dev, int cnt) @@ -802,19 +801,6 @@ static int baycom_set_mac_address(struct /* --------------------------------------------------------------------- */ -static struct net_device_stats *baycom_get_stats(struct net_device *dev) -{ - struct baycom_state *bc = netdev_priv(dev); - - /* - * Get the current statistics. This may be called with the - * card open or closed. - */ - return &bc->stats; -} - -/* --------------------------------------------------------------------- */ - static void epp_wakeup(void *handle) { struct net_device *dev = (struct net_device *)handle; @@ -1065,10 +1051,10 @@ static int baycom_ioctl(struct net_devic hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT); hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT); hi.data.cs.ptt_keyed = bc->ptt_keyed; - hi.data.cs.tx_packets = bc->stats.tx_packets; - hi.data.cs.tx_errors = bc->stats.tx_errors; - hi.data.cs.rx_packets = bc->stats.rx_packets; - hi.data.cs.rx_errors = bc->stats.rx_errors; + hi.data.cs.tx_packets = dev->stats.tx_packets; + hi.data.cs.tx_errors = dev->stats.tx_errors; + hi.data.cs.rx_packets = dev->stats.rx_packets; + hi.data.cs.rx_errors = dev->stats.rx_errors; break; case HDLCDRVCTL_OLDGETSTAT: @@ -1147,7 +1133,6 @@ static void baycom_probe(struct net_devi dev->stop = epp_close; dev->do_ioctl = baycom_ioctl; dev->hard_start_xmit = baycom_send_packet; - dev->get_stats = baycom_get_stats; /* Fill in the fields of the device structure */ bc->skb = NULL;