From: Stephen Hemminger <shemminger@vyatta•com>
To: "David S. Miller" <davem@davemloft•net>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix•com>
Cc: netdev@vger•kernel.org, xen-devel@lists•xensource.com
Subject: [PATCH 2/9] xen: convert to 64 bit stats interface
Date: Wed, 08 Jun 2011 17:53:58 -0700 [thread overview]
Message-ID: <20110609005417.385577995@vyatta.com> (raw)
In-Reply-To: 20110609005356.160260858@vyatta.com
[-- 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,
next prev parent reply other threads:[~2011-06-09 0:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-09 0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
2011-06-09 0:53 ` [PATCH 1/9] vmxnet3: convert to 64 bit stats interface Stephen Hemminger
2011-06-09 5:17 ` [Pv-drivers] " Scott Goldman
2011-06-09 0:53 ` Stephen Hemminger [this message]
2011-06-09 1:56 ` [PATCH 2/9] xen: " Ben Hutchings
2011-06-14 21:07 ` Konrad Rzeszutek Wilk
2011-06-15 8:38 ` [Xen-devel] " Ian Campbell
2011-06-09 0:53 ` [PATCH 3/9] veth: convert to 64 bit statistics Stephen Hemminger
2011-06-09 2:00 ` Ben Hutchings
2011-06-09 3:22 ` Stephen Hemminger
2011-06-10 16:34 ` Ben Hutchings
2011-06-09 6:26 ` David Miller
2011-06-09 0:54 ` [PATCH 4/9] ifb: convert to 64 bit stats Stephen Hemminger
2011-06-09 3:29 ` Eric Dumazet
2011-06-09 3:32 ` Stephen Hemminger
2011-06-09 3:37 ` Eric Dumazet
2011-06-09 0:54 ` [PATCH 5/9] netxen: convert to 64 bit statistics Stephen Hemminger
2011-06-09 6:13 ` Amit Salecha
2011-06-09 6:27 ` David Miller
2011-06-09 0:54 ` [PATCH 6/9] enic: update to support 64 bit stats Stephen Hemminger
2011-06-09 6:27 ` David Miller
2011-06-09 17:43 ` roprabhu
2011-06-09 0:54 ` [PATCH 7/9] myricom: update to " Stephen Hemminger
2011-06-09 6:27 ` David Miller
2011-06-09 0:54 ` [PATCH 8/9] niu: support 64 bit stats interface Stephen Hemminger
2011-06-09 6:27 ` David Miller
2011-06-09 0:54 ` [PATCH 9/9] s2io: implement 64 bit stats Stephen Hemminger
2011-06-09 1:52 ` Ben Hutchings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110609005417.385577995@vyatta.com \
--to=shemminger@vyatta$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=jeremy.fitzhardinge@citrix$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=xen-devel@lists$(echo .)xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox