* [PATCH 2/9] xen: convert to 64 bit stats interface [not found] <20110609005356.160260858@vyatta.com> @ 2011-06-09 0:53 ` Stephen Hemminger 2011-06-09 1:56 ` Ben Hutchings 0 siblings, 1 reply; 4+ messages in thread From: Stephen Hemminger @ 2011-06-09 0:53 UTC (permalink / raw) To: David S. Miller, Jeremy Fitzhardinge; +Cc: netdev, xen-devel [-- Attachment #1: xen-stats64.patch --] [-- Type: text/plain, Size: 2930 bytes --] Convert xen driver to 64 bit statistics interface. This driver was already counting packet per queue in a 64 bit value so not a huge change. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> --- a/drivers/net/xen-netfront.c 2011-06-07 19:34:20.752647705 +0900 +++ b/drivers/net/xen-netfront.c 2011-06-07 20:02:11.028930158 +0900 @@ -122,7 +122,14 @@ struct netfront_info { struct mmu_update rx_mmu[NET_RX_RING_SIZE]; /* Statistics */ - unsigned long rx_gso_checksum_fixup; + u64 rx_packets; + u64 rx_bytes; + u64 rx_errors; + u64 rx_gso_checksum_fixup; + + u64 tx_packets; + u64 tx_bytes; + u64 tx_dropped; }; struct netfront_rx_info { @@ -552,8 +559,8 @@ static int xennet_start_xmit(struct sk_b if (notify) notify_remote_via_irq(np->netdev->irq); - dev->stats.tx_bytes += skb->len; - dev->stats.tx_packets++; + np->tx_bytes += skb->len; + np->tx_packets++; /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */ xennet_tx_buf_gc(dev); @@ -566,7 +573,7 @@ static int xennet_start_xmit(struct sk_b return NETDEV_TX_OK; drop: - dev->stats.tx_dropped++; + np->tx_dropped++; dev_kfree_skb(skb); return NETDEV_TX_OK; } @@ -847,6 +854,7 @@ out: static int handle_incoming_queue(struct net_device *dev, struct sk_buff_head *rxq) { + struct netfront_info *np = netdev_priv(dev); int packets_dropped = 0; struct sk_buff *skb; @@ -867,12 +875,11 @@ static int handle_incoming_queue(struct if (checksum_setup(dev, skb)) { kfree_skb(skb); packets_dropped++; - dev->stats.rx_errors++; continue; } - dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; + np->rx_packets++; + np->rx_bytes += skb->len; /* Pass it up. */ netif_receive_skb(skb); @@ -919,7 +926,7 @@ static int xennet_poll(struct napi_struc err: while ((skb = __skb_dequeue(&tmpq))) __skb_queue_tail(&errq, skb); - dev->stats.rx_errors++; + np->rx_errors++; i = np->rx.rsp_cons; continue; } @@ -1034,6 +1041,22 @@ static int xennet_change_mtu(struct net_ return 0; } +static struct rtnl_link_stats64 *xennet_get_stats64(struct net_device *dev, + struct rtnl_link_stats64 *stats) +{ + struct netfront_info *np = netdev_priv(dev); + + stats->rx_packets = np->rx_packets; + stats->rx_bytes = np->rx_bytes; + stats->rx_errors = np->rx_errors; + + stats->tx_packets = np->tx_packets; + stats->tx_bytes = np->tx_bytes; + stats->tx_bytes = np->tx_dropped; + + return stats; +} + static void xennet_release_tx_bufs(struct netfront_info *np) { struct sk_buff *skb; @@ -1182,6 +1205,7 @@ static const struct net_device_ops xenne .ndo_stop = xennet_close, .ndo_start_xmit = xennet_start_xmit, .ndo_change_mtu = xennet_change_mtu, + .ndo_get_stats64 = xennet_get_stats64, .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, .ndo_fix_features = xennet_fix_features, ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/9] xen: convert to 64 bit stats interface 2011-06-09 0:53 ` [PATCH 2/9] xen: convert to 64 bit stats interface Stephen Hemminger @ 2011-06-09 1:56 ` Ben Hutchings 2011-06-14 21:07 ` Konrad Rzeszutek Wilk 0 siblings, 1 reply; 4+ messages in thread From: Ben Hutchings @ 2011-06-09 1:56 UTC (permalink / raw) To: Stephen Hemminger; +Cc: David S. Miller, Jeremy Fitzhardinge, netdev, xen-devel On Wed, 2011-06-08 at 17:53 -0700, Stephen Hemminger wrote: > Convert xen driver to 64 bit statistics interface. > This driver was already counting packet per queue in a 64 bit value so not > a huge change. [...] I think this driver will need to use u64_stats_sync. Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: [PATCH 2/9] xen: convert to 64 bit stats interface 2011-06-09 1:56 ` Ben Hutchings @ 2011-06-14 21:07 ` Konrad Rzeszutek Wilk 2011-06-15 8:38 ` [Xen-devel] " Ian Campbell 0 siblings, 1 reply; 4+ messages in thread From: Konrad Rzeszutek Wilk @ 2011-06-14 21:07 UTC (permalink / raw) To: Ben Hutchings, Ian Campbell Cc: netdev, Stephen Hemminger, xen-devel, Jeremy Fitzhardinge, David S. Miller On Thu, Jun 09, 2011 at 02:56:45AM +0100, Ben Hutchings wrote: > On Wed, 2011-06-08 at 17:53 -0700, Stephen Hemminger wrote: > > Convert xen driver to 64 bit statistics interface. > > This driver was already counting packet per queue in a 64 bit value so not > > a huge change. > [...] > > I think this driver will need to use u64_stats_sync. Ian? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xen-devel] Re: [PATCH 2/9] xen: convert to 64 bit stats interface 2011-06-14 21:07 ` Konrad Rzeszutek Wilk @ 2011-06-15 8:38 ` Ian Campbell 0 siblings, 0 replies; 4+ messages in thread From: Ian Campbell @ 2011-06-15 8:38 UTC (permalink / raw) To: Konrad Rzeszutek Wilk Cc: Ben Hutchings, Stephen Hemminger, xen-devel@lists.xensource.com, netdev@vger.kernel.org, Jeremy Fitzhardinge, David S. Miller On Tue, 2011-06-14 at 22:07 +0100, Konrad Rzeszutek Wilk wrote: > On Thu, Jun 09, 2011 at 02:56:45AM +0100, Ben Hutchings wrote: > > On Wed, 2011-06-08 at 17:53 -0700, Stephen Hemminger wrote: > > > Convert xen driver to 64 bit statistics interface. > > > This driver was already counting packet per queue in a 64 bit value so not > > > a huge change. > > [...] > > > > I think this driver will need to use u64_stats_sync. > > Ian? I'll defer to Ben on this, but the case for needing u64_stats_sync for 64 bit values seems reasonable to me. Ian. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-15 8:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20110609005356.160260858@vyatta.com>
2011-06-09 0:53 ` [PATCH 2/9] xen: convert to 64 bit stats interface Stephen Hemminger
2011-06-09 1:56 ` Ben Hutchings
2011-06-14 21:07 ` Konrad Rzeszutek Wilk
2011-06-15 8:38 ` [Xen-devel] " Ian Campbell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).