All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] 64 bit statistics for VM and 10G drivers
@ 2011-06-09  0:53 Stephen Hemminger
  2011-06-09  0:53 ` [PATCH 1/9] vmxnet3: convert to 64 bit stats interface Stephen Hemminger
                   ` (8 more replies)
  0 siblings, 9 replies; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  0:53 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

All 10G and virtual devices should be using the 64 bit statistics interface
because counters can wrap to fast. The standard monitoring program net-snmp
polls devices every 3 seconds (too fast), but even that can wrap too fast
to be detected.

Net-snmp needs to be updated to use netlink and handle 64 bit values.
It is still using /proc



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 1/9] vmxnet3: convert to 64 bit stats interface
  2011-06-09  0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
@ 2011-06-09  0:53 ` Stephen Hemminger
  2011-06-09  5:17   ` [Pv-drivers] " Scott Goldman
  2011-06-09  0:53 ` [PATCH 2/9] xen: " Stephen Hemminger
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  0:53 UTC (permalink / raw)
  To: David S. Miller, Shreyas Bhatewara; +Cc: netdev, pv-drivers

[-- Attachment #1: vmxnet3-stats64.patch --]
[-- Type: text/plain, Size: 4534 bytes --]

Convert vmxnet3 driver to 64 bit statistics interface.
This driver was already counting packet per queue in a 64 bit value so not
a huge change. Eliminate unused old net_device_stats structure.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/vmxnet3/vmxnet3_drv.c	2011-06-04 22:01:31.932389206 +0900
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c	2011-06-07 19:50:23.189420166 +0900
@@ -2864,7 +2864,7 @@ vmxnet3_probe_device(struct pci_dev *pde
 		.ndo_set_mac_address = vmxnet3_set_mac_addr,
 		.ndo_change_mtu = vmxnet3_change_mtu,
 		.ndo_set_features = vmxnet3_set_features,
-		.ndo_get_stats = vmxnet3_get_stats,
+		.ndo_get_stats64 = vmxnet3_get_stats64,
 		.ndo_tx_timeout = vmxnet3_tx_timeout,
 		.ndo_set_multicast_list = vmxnet3_set_mc,
 		.ndo_vlan_rx_register = vmxnet3_vlan_rx_register,
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c	2011-06-04 21:54:27.110282630 +0900
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c	2011-06-07 20:13:34.492319266 +0900
@@ -113,15 +113,15 @@ vmxnet3_global_stats[] = {
 };
 
 
-struct net_device_stats *
-vmxnet3_get_stats(struct net_device *netdev)
+struct rtnl_link_stats64 *
+vmxnet3_get_stats64(struct net_device *netdev,
+		   struct rtnl_link_stats64 *stats)
 {
 	struct vmxnet3_adapter *adapter;
 	struct vmxnet3_tq_driver_stats *drvTxStats;
 	struct vmxnet3_rq_driver_stats *drvRxStats;
 	struct UPT1_TxStats *devTxStats;
 	struct UPT1_RxStats *devRxStats;
-	struct net_device_stats *net_stats = &netdev->stats;
 	unsigned long flags;
 	int i;
 
@@ -132,36 +132,36 @@ vmxnet3_get_stats(struct net_device *net
 	VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
 	spin_unlock_irqrestore(&adapter->cmd_lock, flags);
 
-	memset(net_stats, 0, sizeof(*net_stats));
 	for (i = 0; i < adapter->num_tx_queues; i++) {
 		devTxStats = &adapter->tqd_start[i].stats;
 		drvTxStats = &adapter->tx_queue[i].stats;
-		net_stats->tx_packets += devTxStats->ucastPktsTxOK +
-					devTxStats->mcastPktsTxOK +
-					devTxStats->bcastPktsTxOK;
-		net_stats->tx_bytes += devTxStats->ucastBytesTxOK +
-				      devTxStats->mcastBytesTxOK +
-				      devTxStats->bcastBytesTxOK;
-		net_stats->tx_errors += devTxStats->pktsTxError;
-		net_stats->tx_dropped += drvTxStats->drop_total;
+		stats->tx_packets += devTxStats->ucastPktsTxOK +
+				     devTxStats->mcastPktsTxOK +
+				     devTxStats->bcastPktsTxOK;
+		stats->tx_bytes += devTxStats->ucastBytesTxOK +
+				   devTxStats->mcastBytesTxOK +
+				   devTxStats->bcastBytesTxOK;
+		stats->tx_errors += devTxStats->pktsTxError;
+		stats->tx_dropped += drvTxStats->drop_total;
 	}
 
 	for (i = 0; i < adapter->num_rx_queues; i++) {
 		devRxStats = &adapter->rqd_start[i].stats;
 		drvRxStats = &adapter->rx_queue[i].stats;
-		net_stats->rx_packets += devRxStats->ucastPktsRxOK +
-					devRxStats->mcastPktsRxOK +
-					devRxStats->bcastPktsRxOK;
-
-		net_stats->rx_bytes += devRxStats->ucastBytesRxOK +
-				      devRxStats->mcastBytesRxOK +
-				      devRxStats->bcastBytesRxOK;
-
-		net_stats->rx_errors += devRxStats->pktsRxError;
-		net_stats->rx_dropped += drvRxStats->drop_total;
-		net_stats->multicast +=  devRxStats->mcastPktsRxOK;
+		stats->rx_packets += devRxStats->ucastPktsRxOK +
+				     devRxStats->mcastPktsRxOK +
+				     devRxStats->bcastPktsRxOK;
+
+		stats->rx_bytes += devRxStats->ucastBytesRxOK +
+				   devRxStats->mcastBytesRxOK +
+				   devRxStats->bcastBytesRxOK;
+
+		stats->rx_errors += devRxStats->pktsRxError;
+		stats->rx_dropped += drvRxStats->drop_total;
+		stats->multicast +=  devRxStats->mcastPktsRxOK;
 	}
-	return net_stats;
+
+	return stats;
 }
 
 static int
--- a/drivers/net/vmxnet3/vmxnet3_int.h	2011-06-04 22:02:03.048543506 +0900
+++ b/drivers/net/vmxnet3/vmxnet3_int.h	2011-06-07 19:54:22.890608779 +0900
@@ -323,7 +323,6 @@ struct vmxnet3_adapter {
 	struct Vmxnet3_TxQueueDesc	*tqd_start;     /* all tx queue desc */
 	struct Vmxnet3_RxQueueDesc	*rqd_start;	/* all rx queue desc */
 	struct net_device		*netdev;
-	struct net_device_stats		net_stats;
 	struct pci_dev			*pdev;
 
 	u8			__iomem *hw_addr0; /* for BAR 0 */
@@ -407,7 +406,9 @@ vmxnet3_create_queues(struct vmxnet3_ada
 		      u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size);
 
 extern void vmxnet3_set_ethtool_ops(struct net_device *netdev);
-extern struct net_device_stats *vmxnet3_get_stats(struct net_device *netdev);
+
+extern struct rtnl_link_stats64 *
+vmxnet3_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats);
 
 extern char vmxnet3_driver_name[];
 #endif



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 2/9] xen: convert to 64 bit stats interface
  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  0:53 ` Stephen Hemminger
  2011-06-09  1:56   ` Ben Hutchings
  2011-06-09  0:53 ` [PATCH 3/9] veth: convert to 64 bit statistics Stephen Hemminger
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 28+ 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] 28+ messages in thread

* [PATCH 3/9] veth: convert to 64 bit statistics
  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  0:53 ` [PATCH 2/9] xen: " Stephen Hemminger
@ 2011-06-09  0:53 ` Stephen Hemminger
  2011-06-09  2:00   ` 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
                   ` (5 subsequent siblings)
  8 siblings, 2 replies; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  0:53 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: veth-stats64.patch --]
[-- Type: text/plain, Size: 2294 bytes --]

Not much change, device was already keeping per cpu statistics.
Use recent 64 statistics interface.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/veth.c	2011-06-07 20:04:42.221679879 +0900
+++ b/drivers/net/veth.c	2011-06-07 20:10:04.259276778 +0900
@@ -24,12 +24,12 @@
 #define MAX_MTU 65535		/* Max L3 MTU (arbitrary) */
 
 struct veth_net_stats {
-	unsigned long	rx_packets;
-	unsigned long	tx_packets;
-	unsigned long	rx_bytes;
-	unsigned long	tx_bytes;
-	unsigned long	tx_dropped;
-	unsigned long	rx_dropped;
+	u64	rx_packets;
+	u64	tx_packets;
+	u64	rx_bytes;
+	u64	tx_bytes;
+	u64	tx_dropped;
+	u64	rx_dropped;
 };
 
 struct veth_priv {
@@ -159,32 +159,27 @@ rx_drop:
  * general routines
  */
 
-static struct net_device_stats *veth_get_stats(struct net_device *dev)
+static struct rtnl_link_stats64 *veth_get_stats64(struct net_device *dev,
+						  struct rtnl_link_stats64 *tot)
 {
 	struct veth_priv *priv;
 	int cpu;
-	struct veth_net_stats *stats, total = {0};
+	struct veth_net_stats *stats;
 
 	priv = netdev_priv(dev);
 
 	for_each_possible_cpu(cpu) {
 		stats = per_cpu_ptr(priv->stats, cpu);
 
-		total.rx_packets += stats->rx_packets;
-		total.tx_packets += stats->tx_packets;
-		total.rx_bytes   += stats->rx_bytes;
-		total.tx_bytes   += stats->tx_bytes;
-		total.tx_dropped += stats->tx_dropped;
-		total.rx_dropped += stats->rx_dropped;
+		tot->rx_packets += stats->rx_packets;
+		tot->tx_packets += stats->tx_packets;
+		tot->rx_bytes   += stats->rx_bytes;
+		tot->tx_bytes   += stats->tx_bytes;
+		tot->tx_dropped += stats->tx_dropped;
+		tot->rx_dropped += stats->rx_dropped;
 	}
-	dev->stats.rx_packets = total.rx_packets;
-	dev->stats.tx_packets = total.tx_packets;
-	dev->stats.rx_bytes   = total.rx_bytes;
-	dev->stats.tx_bytes   = total.tx_bytes;
-	dev->stats.tx_dropped = total.tx_dropped;
-	dev->stats.rx_dropped = total.rx_dropped;
 
-	return &dev->stats;
+	return tot;
 }
 
 static int veth_open(struct net_device *dev)
@@ -254,7 +249,7 @@ static const struct net_device_ops veth_
 	.ndo_stop            = veth_close,
 	.ndo_start_xmit      = veth_xmit,
 	.ndo_change_mtu      = veth_change_mtu,
-	.ndo_get_stats       = veth_get_stats,
+	.ndo_get_stats64     = veth_get_stats64,
 	.ndo_set_mac_address = eth_mac_addr,
 };
 



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 4/9] ifb: convert to 64 bit stats
  2011-06-09  0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
                   ` (2 preceding siblings ...)
  2011-06-09  0:53 ` [PATCH 3/9] veth: convert to 64 bit statistics Stephen Hemminger
@ 2011-06-09  0:54 ` Stephen Hemminger
  2011-06-09  3:29   ` Eric Dumazet
  2011-06-09  0:54 ` [PATCH 5/9] netxen: convert to 64 bit statistics Stephen Hemminger
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  0:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: ifb-stats64.patch --]
[-- Type: text/plain, Size: 2495 bytes --]

Convert input functional block device to use 64 bit stats.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/ifb.c	2011-06-07 16:58:31.317079332 -0700
+++ b/drivers/net/ifb.c	2011-06-07 17:29:02.958161955 -0700
@@ -42,7 +42,14 @@ struct ifb_private {
 	struct tasklet_struct   ifb_tasklet;
 	int     tasklet_pending;
 	struct sk_buff_head     rq;
+	u64 rx_packets;
+	u64 rx_bytes;
+	u64 rx_dropped;
+
 	struct sk_buff_head     tq;
+	u64 tx_packets;
+	u64 tx_bytes;
+	u64 tx_dropped;
 };
 
 static int numifbs = 2;
@@ -57,7 +64,6 @@ static void ri_tasklet(unsigned long dev
 
 	struct net_device *_dev = (struct net_device *)dev;
 	struct ifb_private *dp = netdev_priv(_dev);
-	struct net_device_stats *stats = &_dev->stats;
 	struct netdev_queue *txq;
 	struct sk_buff *skb;
 
@@ -77,15 +83,16 @@ static void ri_tasklet(unsigned long dev
 
 		skb->tc_verd = 0;
 		skb->tc_verd = SET_TC_NCLS(skb->tc_verd);
-		stats->tx_packets++;
-		stats->tx_bytes +=skb->len;
+
+		dp->tx_packets++;
+		dp->tx_bytes +=skb->len;
 
 		rcu_read_lock();
 		skb->dev = dev_get_by_index_rcu(&init_net, skb->skb_iif);
 		if (!skb->dev) {
 			rcu_read_unlock();
 			dev_kfree_skb(skb);
-			stats->tx_dropped++;
+			dp->tx_dropped++;
 			if (skb_queue_len(&dp->tq) != 0)
 				goto resched;
 			break;
@@ -120,9 +127,26 @@ resched:
 
 }
 
+static struct rtnl_link_stats64 *ifb_stats64(struct net_device *dev,
+					     struct rtnl_link_stats64 *stats)
+{
+	struct ifb_private *dp = netdev_priv(dev);
+
+	stats->rx_packets = dp->rx_packets;
+	stats->rx_bytes = dp->rx_bytes;
+	stats->rx_dropped = dp->rx_dropped;
+	stats->tx_packets = dp->tx_packets;
+	stats->tx_bytes = dp->tx_bytes;
+	stats->tx_dropped = dp->tx_dropped;
+
+	return stats;
+}
+
+
 static const struct net_device_ops ifb_netdev_ops = {
 	.ndo_open	= ifb_open,
 	.ndo_stop	= ifb_close,
+	.ndo_get_stats64 = ifb_stats64,
 	.ndo_start_xmit	= ifb_xmit,
 	.ndo_validate_addr = eth_validate_addr,
 };
@@ -153,15 +177,14 @@ static void ifb_setup(struct net_device
 static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct ifb_private *dp = netdev_priv(dev);
-	struct net_device_stats *stats = &dev->stats;
 	u32 from = G_TC_FROM(skb->tc_verd);
 
-	stats->rx_packets++;
-	stats->rx_bytes+=skb->len;
+	dp->rx_packets++;
+	dp->rx_bytes+=skb->len;
 
 	if (!(from & (AT_INGRESS|AT_EGRESS)) || !skb->skb_iif) {
 		dev_kfree_skb(skb);
-		stats->rx_dropped++;
+		dp->rx_dropped++;
 		return NETDEV_TX_OK;
 	}
 



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 5/9] netxen: convert to 64 bit statistics
  2011-06-09  0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
                   ` (3 preceding siblings ...)
  2011-06-09  0:54 ` [PATCH 4/9] ifb: convert to 64 bit stats Stephen Hemminger
@ 2011-06-09  0:54 ` 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
                   ` (3 subsequent siblings)
  8 siblings, 2 replies; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  0:54 UTC (permalink / raw)
  To: David S. Miller, Amit Kumar Salecha; +Cc: netdev

[-- Attachment #1: netxen-getstats64.patch --]
[-- Type: text/plain, Size: 1752 bytes --]

Change to 64 bit statistics interface, driver was already maintaining 64 bit
value.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/netxen/netxen_nic_main.c	2011-06-07 20:33:48.150337471 +0900
+++ b/drivers/net/netxen/netxen_nic_main.c	2011-06-07 20:57:29.912628921 +0900
@@ -92,7 +92,8 @@ static irqreturn_t netxen_msi_intr(int i
 static irqreturn_t netxen_msix_intr(int irq, void *data);
 
 static void netxen_config_indev_addr(struct net_device *dev, unsigned long);
-static struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);
+static struct rtnl_link_stats64 *netxen_nic_get_stats(struct net_device *dev,
+						      struct rtnl_link_stats64 *stats);
 static int netxen_nic_set_mac(struct net_device *netdev, void *p);
 
 /*  PCI Device ID Table  */
@@ -520,7 +521,7 @@ static const struct net_device_ops netxe
 	.ndo_open	   = netxen_nic_open,
 	.ndo_stop	   = netxen_nic_close,
 	.ndo_start_xmit    = netxen_nic_xmit_frame,
-	.ndo_get_stats	   = netxen_nic_get_stats,
+	.ndo_get_stats64   = netxen_nic_get_stats,
 	.ndo_validate_addr = eth_validate_addr,
 	.ndo_set_multicast_list = netxen_set_multicast_list,
 	.ndo_set_mac_address    = netxen_nic_set_mac,
@@ -2110,10 +2111,10 @@ request_reset:
 	clear_bit(__NX_RESETTING, &adapter->state);
 }
 
-static struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
+static struct rtnl_link_stats64 *netxen_nic_get_stats(struct net_device *netdev,
+						      struct rtnl_link_stats64 *stats)
 {
 	struct netxen_adapter *adapter = netdev_priv(netdev);
-	struct net_device_stats *stats = &netdev->stats;
 
 	stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts;
 	stats->tx_packets = adapter->stats.xmitfinished;



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 6/9] enic: update to support 64 bit stats
  2011-06-09  0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
                   ` (4 preceding siblings ...)
  2011-06-09  0:54 ` [PATCH 5/9] netxen: convert to 64 bit statistics Stephen Hemminger
@ 2011-06-09  0:54 ` 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
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  0:54 UTC (permalink / raw)
  To: David S. Miller, Christian Benvenuti, Vasanthy Kolluri,
	Roopa Prabhu, David Wang
  Cc: netdev

[-- Attachment #1: enic-stats64.patch --]
[-- Type: text/plain, Size: 1503 bytes --]

The device driver already uses 64 bit statistics, it just
doesn't use the 64 bit interface.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/enic/enic_main.c	2011-06-07 16:58:31.317079332 -0700
+++ b/drivers/net/enic/enic_main.c	2011-06-07 17:29:09.670195233 -0700
@@ -801,10 +801,10 @@ static netdev_tx_t enic_hard_start_xmit(
 }
 
 /* dev_base_lock rwlock held, nominally process context */
-static struct net_device_stats *enic_get_stats(struct net_device *netdev)
+static struct rtnl_link_stats64 *enic_get_stats(struct net_device *netdev,
+						struct rtnl_link_stats64 *net_stats)
 {
 	struct enic *enic = netdev_priv(netdev);
-	struct net_device_stats *net_stats = &netdev->stats;
 	struct vnic_stats *stats;
 
 	enic_dev_stats_dump(enic, &stats);
@@ -2117,7 +2117,7 @@ static const struct net_device_ops enic_
 	.ndo_open		= enic_open,
 	.ndo_stop		= enic_stop,
 	.ndo_start_xmit		= enic_hard_start_xmit,
-	.ndo_get_stats		= enic_get_stats,
+	.ndo_get_stats64	= enic_get_stats,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_set_rx_mode	= enic_set_rx_mode,
 	.ndo_set_multicast_list	= enic_set_rx_mode,
@@ -2139,7 +2139,7 @@ static const struct net_device_ops enic_
 	.ndo_open		= enic_open,
 	.ndo_stop		= enic_stop,
 	.ndo_start_xmit		= enic_hard_start_xmit,
-	.ndo_get_stats		= enic_get_stats,
+	.ndo_get_stats64	= enic_get_stats,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_set_mac_address	= enic_set_mac_address,
 	.ndo_set_rx_mode	= enic_set_rx_mode,



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 7/9] myricom: update to 64 bit stats
  2011-06-09  0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
                   ` (5 preceding siblings ...)
  2011-06-09  0:54 ` [PATCH 6/9] enic: update to support 64 bit stats Stephen Hemminger
@ 2011-06-09  0:54 ` 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  0:54 ` [PATCH 9/9] s2io: implement 64 bit stats Stephen Hemminger
  8 siblings, 1 reply; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  0:54 UTC (permalink / raw)
  To: David S. Miller, Andrew Gallatin, Brice Goglin; +Cc: netdev

[-- Attachment #1: myricom-stats.patch --]
[-- Type: text/plain, Size: 2184 bytes --]

Driver was already keeping 64 bit counters, just not using the new interface.

Ps: IMHO drivers should not be duplicating network device
stats into ethtool stats. It is useless duplication.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/myri10ge/myri10ge.c	2011-06-07 16:58:31.333079418 -0700
+++ b/drivers/net/myri10ge/myri10ge.c	2011-06-07 17:29:13.298213223 -0700
@@ -377,7 +377,8 @@ static inline void put_be32(__be32 val,
 	__raw_writel((__force __u32) val, (__force void __iomem *)p);
 }
 
-static struct net_device_stats *myri10ge_get_stats(struct net_device *dev);
+static struct rtnl_link_stats64 *myri10ge_get_stats(struct net_device *dev,
+						    struct rtnl_link_stats64 *stats);
 
 static void set_fw_name(struct myri10ge_priv *mgp, char *name, bool allocated)
 {
@@ -1831,13 +1832,14 @@ myri10ge_get_ethtool_stats(struct net_de
 {
 	struct myri10ge_priv *mgp = netdev_priv(netdev);
 	struct myri10ge_slice_state *ss;
+	struct rtnl_link_stats64 link_stats;
 	int slice;
 	int i;
 
 	/* force stats update */
-	(void)myri10ge_get_stats(netdev);
+	(void)myri10ge_get_stats(netdev, &link_stats);
 	for (i = 0; i < MYRI10GE_NET_STATS_LEN; i++)
-		data[i] = ((unsigned long *)&netdev->stats)[i];
+		data[i] = ((u64 *)&link_stats)[i];
 
 	data[i++] = (unsigned int)mgp->tx_boundary;
 	data[i++] = (unsigned int)mgp->wc_enabled;
@@ -2976,11 +2978,11 @@ drop:
 	return NETDEV_TX_OK;
 }
 
-static struct net_device_stats *myri10ge_get_stats(struct net_device *dev)
+static struct rtnl_link_stats64 *myri10ge_get_stats(struct net_device *dev,
+						    struct rtnl_link_stats64 *stats)
 {
 	struct myri10ge_priv *mgp = netdev_priv(dev);
 	struct myri10ge_slice_netstats *slice_stats;
-	struct net_device_stats *stats = &dev->stats;
 	int i;
 
 	spin_lock(&mgp->stats_lock);
@@ -3790,7 +3792,7 @@ static const struct net_device_ops myri1
 	.ndo_open		= myri10ge_open,
 	.ndo_stop		= myri10ge_close,
 	.ndo_start_xmit		= myri10ge_xmit,
-	.ndo_get_stats		= myri10ge_get_stats,
+	.ndo_get_stats64	= myri10ge_get_stats,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_change_mtu		= myri10ge_change_mtu,
 	.ndo_fix_features	= myri10ge_fix_features,



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 8/9] niu: support 64 bit stats interface
  2011-06-09  0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
                   ` (6 preceding siblings ...)
  2011-06-09  0:54 ` [PATCH 7/9] myricom: update to " Stephen Hemminger
@ 2011-06-09  0:54 ` Stephen Hemminger
  2011-06-09  6:27   ` David Miller
  2011-06-09  0:54 ` [PATCH 9/9] s2io: implement 64 bit stats Stephen Hemminger
  8 siblings, 1 reply; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  0:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: niu-stats.patch --]
[-- Type: text/plain, Size: 2244 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/niu.c	2011-06-07 16:58:31.333079418 -0700
+++ b/drivers/net/niu.c	2011-06-07 17:29:17.234232746 -0700
@@ -6249,9 +6249,10 @@ static void niu_sync_mac_stats(struct ni
 		niu_sync_bmac_stats(np);
 }
 
-static void niu_get_rx_stats(struct niu *np)
+static void niu_get_rx_stats(struct niu *np,
+			     struct rtnl_link_stats64 *stats)
 {
-	unsigned long pkts, dropped, errors, bytes;
+	u64 pkts, dropped, errors, bytes;
 	struct rx_ring_info *rx_rings;
 	int i;
 
@@ -6273,15 +6274,16 @@ static void niu_get_rx_stats(struct niu
 	}
 
 no_rings:
-	np->dev->stats.rx_packets = pkts;
-	np->dev->stats.rx_bytes = bytes;
-	np->dev->stats.rx_dropped = dropped;
-	np->dev->stats.rx_errors = errors;
+	stats->rx_packets = pkts;
+	stats->rx_bytes = bytes;
+	stats->rx_dropped = dropped;
+	stats->rx_errors = errors;
 }
 
-static void niu_get_tx_stats(struct niu *np)
+static void niu_get_tx_stats(struct niu *np,
+			     struct rtnl_link_stats64 *stats)
 {
-	unsigned long pkts, errors, bytes;
+	u64 pkts, errors, bytes;
 	struct tx_ring_info *tx_rings;
 	int i;
 
@@ -6300,20 +6302,22 @@ static void niu_get_tx_stats(struct niu
 	}
 
 no_rings:
-	np->dev->stats.tx_packets = pkts;
-	np->dev->stats.tx_bytes = bytes;
-	np->dev->stats.tx_errors = errors;
+	stats->tx_packets = pkts;
+	stats->tx_bytes = bytes;
+	stats->tx_errors = errors;
 }
 
-static struct net_device_stats *niu_get_stats(struct net_device *dev)
+static struct rtnl_link_stats64 *niu_get_stats(struct net_device *dev,
+					       struct rtnl_link_stats64 *stats)
 {
 	struct niu *np = netdev_priv(dev);
 
 	if (netif_running(dev)) {
-		niu_get_rx_stats(np);
-		niu_get_tx_stats(np);
+		niu_get_rx_stats(np, stats);
+		niu_get_tx_stats(np, stats);
 	}
-	return &dev->stats;
+
+	return stats;
 }
 
 static void niu_load_hash_xmac(struct niu *np, u16 *hash)
@@ -9711,7 +9715,7 @@ static const struct net_device_ops niu_n
 	.ndo_open		= niu_open,
 	.ndo_stop		= niu_close,
 	.ndo_start_xmit		= niu_start_xmit,
-	.ndo_get_stats		= niu_get_stats,
+	.ndo_get_stats64	= niu_get_stats,
 	.ndo_set_multicast_list	= niu_set_rx_mode,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_set_mac_address	= niu_set_mac_addr,



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 9/9] s2io: implement 64 bit stats
  2011-06-09  0:53 [PATCH 0/9] 64 bit statistics for VM and 10G drivers Stephen Hemminger
                   ` (7 preceding siblings ...)
  2011-06-09  0:54 ` [PATCH 8/9] niu: support 64 bit stats interface Stephen Hemminger
@ 2011-06-09  0:54 ` Stephen Hemminger
  2011-06-09  1:52   ` Ben Hutchings
  8 siblings, 1 reply; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  0:54 UTC (permalink / raw)
  To: David S. Miller, Jon Mason; +Cc: netdev

[-- Attachment #1: s2io-stats.patch --]
[-- Type: text/plain, Size: 4085 bytes --]

Convert s2io driver to 64 bit statistics interface.
This driver keeps it private set of counters so change those
to the 64 bit netlink type.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/s2io.c	2011-06-07 17:35:37.372117743 -0700
+++ b/drivers/net/s2io.c	2011-06-07 17:44:14.102680070 -0700
@@ -4897,7 +4897,8 @@ static void s2io_updt_stats(struct s2io_
  *  Return value:
  *  pointer to the updated net_device_stats structure.
  */
-static struct net_device_stats *s2io_get_stats(struct net_device *dev)
+static struct rtnl_link_stats64 *s2io_get_stats(struct net_device *dev,
+						struct rtnl_link_stats64 *net_stats)
 {
 	struct s2io_nic *sp = netdev_priv(dev);
 	struct mac_info *mac_control = &sp->mac_control;
@@ -4916,40 +4917,32 @@ static struct net_device_stats *s2io_get
 	 */
 	delta = ((u64) le32_to_cpu(stats->rmac_vld_frms_oflow) << 32 |
 		le32_to_cpu(stats->rmac_vld_frms)) - sp->stats.rx_packets;
-	sp->stats.rx_packets += delta;
-	dev->stats.rx_packets += delta;
+	sp->stats.tx_packets += delta;
 
 	delta = ((u64) le32_to_cpu(stats->tmac_frms_oflow) << 32 |
 		le32_to_cpu(stats->tmac_frms)) - sp->stats.tx_packets;
 	sp->stats.tx_packets += delta;
-	dev->stats.tx_packets += delta;
 
 	delta = ((u64) le32_to_cpu(stats->rmac_data_octets_oflow) << 32 |
 		le32_to_cpu(stats->rmac_data_octets)) - sp->stats.rx_bytes;
 	sp->stats.rx_bytes += delta;
-	dev->stats.rx_bytes += delta;
 
 	delta = ((u64) le32_to_cpu(stats->tmac_data_octets_oflow) << 32 |
 		le32_to_cpu(stats->tmac_data_octets)) - sp->stats.tx_bytes;
 	sp->stats.tx_bytes += delta;
-	dev->stats.tx_bytes += delta;
 
 	delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_errors;
 	sp->stats.rx_errors += delta;
-	dev->stats.rx_errors += delta;
 
 	delta = ((u64) le32_to_cpu(stats->tmac_any_err_frms_oflow) << 32 |
 		le32_to_cpu(stats->tmac_any_err_frms)) - sp->stats.tx_errors;
 	sp->stats.tx_errors += delta;
-	dev->stats.tx_errors += delta;
 
 	delta = le64_to_cpu(stats->rmac_drop_frms) - sp->stats.rx_dropped;
 	sp->stats.rx_dropped += delta;
-	dev->stats.rx_dropped += delta;
 
 	delta = le64_to_cpu(stats->tmac_drop_frms) - sp->stats.tx_dropped;
 	sp->stats.tx_dropped += delta;
-	dev->stats.tx_dropped += delta;
 
 	/* The adapter MAC interprets pause frames as multicast packets, but
 	 * does not pass them up.  This erroneously increases the multicast
@@ -4961,19 +4954,16 @@ static struct net_device_stats *s2io_get
 	delta -= le64_to_cpu(stats->rmac_pause_ctrl_frms);
 	delta -= sp->stats.multicast;
 	sp->stats.multicast += delta;
-	dev->stats.multicast += delta;
 
 	delta = ((u64) le32_to_cpu(stats->rmac_usized_frms_oflow) << 32 |
 		le32_to_cpu(stats->rmac_usized_frms)) +
 		le64_to_cpu(stats->rmac_long_frms) - sp->stats.rx_length_errors;
 	sp->stats.rx_length_errors += delta;
-	dev->stats.rx_length_errors += delta;
 
 	delta = le64_to_cpu(stats->rmac_fcs_err_frms) - sp->stats.rx_crc_errors;
 	sp->stats.rx_crc_errors += delta;
-	dev->stats.rx_crc_errors += delta;
 
-	return &dev->stats;
+	return &sp->stats;
 }
 
 /**
@@ -7447,7 +7437,7 @@ static int rx_osm_handler(struct ring_in
 		if (err_mask != 0x5) {
 			DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n",
 				  dev->name, err_mask);
-			dev->stats.rx_crc_errors++;
+			sp->stats.rx_crc_errors++;
 			swstats->mem_freed
 				+= skb->truesize;
 			dev_kfree_skb(skb);
@@ -7731,7 +7721,7 @@ static int rts_ds_steer(struct s2io_nic
 static const struct net_device_ops s2io_netdev_ops = {
 	.ndo_open	        = s2io_open,
 	.ndo_stop	        = s2io_close,
-	.ndo_get_stats	        = s2io_get_stats,
+	.ndo_get_stats64        = s2io_get_stats,
 	.ndo_start_xmit    	= s2io_xmit,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_set_multicast_list = s2io_set_multicast,
--- a/drivers/net/s2io.h	2011-06-07 17:38:50.921077503 -0700
+++ b/drivers/net/s2io.h	2011-06-07 17:43:59.478607560 -0700
@@ -871,7 +871,7 @@ struct s2io_nic {
 
 	struct mac_addr def_mac_addr[256];
 
-	struct net_device_stats stats;
+	struct rtnl_link_stats64 stats;
 	int high_dma_flag;
 	int device_enabled_once;
 



^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 9/9] s2io: implement 64 bit stats
  2011-06-09  0:54 ` [PATCH 9/9] s2io: implement 64 bit stats Stephen Hemminger
@ 2011-06-09  1:52   ` Ben Hutchings
  0 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2011-06-09  1:52 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, Jon Mason, netdev

On Wed, 2011-06-08 at 17:54 -0700, Stephen Hemminger wrote:
> plain text document attachment (s2io-stats.patch)
> Convert s2io driver to 64 bit statistics interface.
> This driver keeps it private set of counters so change those
> to the 64 bit netlink type.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> 
> --- a/drivers/net/s2io.c	2011-06-07 17:35:37.372117743 -0700
> +++ b/drivers/net/s2io.c	2011-06-07 17:44:14.102680070 -0700
> @@ -4897,7 +4897,8 @@ static void s2io_updt_stats(struct s2io_
>   *  Return value:
>   *  pointer to the updated net_device_stats structure.
>   */
> -static struct net_device_stats *s2io_get_stats(struct net_device *dev)
> +static struct rtnl_link_stats64 *s2io_get_stats(struct net_device *dev,
> +						struct rtnl_link_stats64 *net_stats)
>  {
>  	struct s2io_nic *sp = netdev_priv(dev);
>  	struct mac_info *mac_control = &sp->mac_control;
> @@ -4916,40 +4917,32 @@ static struct net_device_stats *s2io_get
>  	 */
>  	delta = ((u64) le32_to_cpu(stats->rmac_vld_frms_oflow) << 32 |
>  		le32_to_cpu(stats->rmac_vld_frms)) - sp->stats.rx_packets;
> -	sp->stats.rx_packets += delta;
> -	dev->stats.rx_packets += delta;
> +	sp->stats.tx_packets += delta;

This is now adding to tx_packets, not rx_packets.

>  	delta = ((u64) le32_to_cpu(stats->tmac_frms_oflow) << 32 |
>  		le32_to_cpu(stats->tmac_frms)) - sp->stats.tx_packets;
>  	sp->stats.tx_packets += delta;
> -	dev->stats.tx_packets += delta;
>  
>  	delta = ((u64) le32_to_cpu(stats->rmac_data_octets_oflow) << 32 |
>  		le32_to_cpu(stats->rmac_data_octets)) - sp->stats.rx_bytes;
>  	sp->stats.rx_bytes += delta;
> -	dev->stats.rx_bytes += delta;
[...]

It seems to me that the delta calculations and sp->stats are no longer
necessary.  These can be just:

	net_stats->rx_packets = ((u64) le32_to_cpu(stats->rmac_vld_frms_oflow) << 32 |
				 le32_to_cpu(stats->rmac_vld_frms));
 	net_stats->tx_packets = ((u64) le32_to_cpu(stats->tmac_frms_oflow) << 32 |
				 le32_to_cpu(stats->tmac_frms));
	net_stats->rx_bytes = ((u64) le32_to_cpu(stats->rmac_data_octets_oflow) << 32 |
		 	       le32_to_cpu(stats->rmac_data_octets));
	...

[...]
> @@ -7447,7 +7437,7 @@ static int rx_osm_handler(struct ring_in
>  		if (err_mask != 0x5) {
>  			DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n",
>  				  dev->name, err_mask);
> -			dev->stats.rx_crc_errors++;
> +			sp->stats.rx_crc_errors++;
[...]

This won't be atomic on 32-bit systems.  If this isn't double-counting
CRC errors (I suspect it is) then there needs to be a separate unsigned
long counter that's folded in by s2io_get_stats().

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] 28+ messages in thread

* Re: [PATCH 2/9] xen: convert to 64 bit stats interface
  2011-06-09  0:53 ` [PATCH 2/9] xen: " Stephen Hemminger
@ 2011-06-09  1:56   ` Ben Hutchings
  2011-06-14 21:07     ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 28+ 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] 28+ messages in thread

* Re: [PATCH 3/9] veth: convert to 64 bit statistics
  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-09  6:26   ` David Miller
  1 sibling, 1 reply; 28+ messages in thread
From: Ben Hutchings @ 2011-06-09  2:00 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev

On Wed, 2011-06-08 at 17:53 -0700, Stephen Hemminger wrote:
> Not much change, device was already keeping per cpu statistics.
> Use recent 64 statistics interface.
[...]

It's also going to need to use u64_stats_sync functions.

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] 28+ messages in thread

* Re: [PATCH 3/9] veth: convert to 64 bit statistics
  2011-06-09  2:00   ` Ben Hutchings
@ 2011-06-09  3:22     ` Stephen Hemminger
  2011-06-10 16:34       ` Ben Hutchings
  0 siblings, 1 reply; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  3:22 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: David S. Miller, netdev

On Thu, 09 Jun 2011 03:00:41 +0100
Ben Hutchings <bhutchings@solarflare.com> wrote:

> On Wed, 2011-06-08 at 17:53 -0700, Stephen Hemminger wrote:
> > Not much change, device was already keeping per cpu statistics.
> > Use recent 64 statistics interface.
> [...]
> 
> It's also going to need to use u64_stats_sync functions.
> 
> Ben.
> 

No veth is doing per-cpu update therefore the new code has the same guarantee
as the old code.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 4/9] ifb: convert to 64 bit stats
  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
  0 siblings, 1 reply; 28+ messages in thread
From: Eric Dumazet @ 2011-06-09  3:29 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev

Le mercredi 08 juin 2011 à 17:54 -0700, Stephen Hemminger a écrit :
> pièce jointe document texte brut (ifb-stats64.patch)
> Convert input functional block device to use 64 bit stats.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> 
> --- a/drivers/net/ifb.c	2011-06-07 16:58:31.317079332 -0700
> +++ b/drivers/net/ifb.c	2011-06-07 17:29:02.958161955 -0700
> @@ -42,7 +42,14 @@ struct ifb_private {
>  	struct tasklet_struct   ifb_tasklet;
>  	int     tasklet_pending;
>  	struct sk_buff_head     rq;
> +	u64 rx_packets;
> +	u64 rx_bytes;
> +	u64 rx_dropped;
> +
>  	struct sk_buff_head     tq;
> +	u64 tx_packets;
> +	u64 tx_bytes;
> +	u64 tx_dropped;
>  };
>  

Hi Stephen

This needs special synchronization on 32bit arches, as Ben pointed out
for other drivers.




^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 4/9] ifb: convert to 64 bit stats
  2011-06-09  3:29   ` Eric Dumazet
@ 2011-06-09  3:32     ` Stephen Hemminger
  2011-06-09  3:37       ` Eric Dumazet
  0 siblings, 1 reply; 28+ messages in thread
From: Stephen Hemminger @ 2011-06-09  3:32 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, netdev

On Thu, 09 Jun 2011 05:29:06 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Le mercredi 08 juin 2011 à 17:54 -0700, Stephen Hemminger a écrit :
> > pièce jointe document texte brut (ifb-stats64.patch)
> > Convert input functional block device to use 64 bit stats.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > 
> > 
> > --- a/drivers/net/ifb.c	2011-06-07 16:58:31.317079332 -0700
> > +++ b/drivers/net/ifb.c	2011-06-07 17:29:02.958161955 -0700
> > @@ -42,7 +42,14 @@ struct ifb_private {
> >  	struct tasklet_struct   ifb_tasklet;
> >  	int     tasklet_pending;
> >  	struct sk_buff_head     rq;
> > +	u64 rx_packets;
> > +	u64 rx_bytes;
> > +	u64 rx_dropped;
> > +
> >  	struct sk_buff_head     tq;
> > +	u64 tx_packets;
> > +	u64 tx_bytes;
> > +	u64 tx_dropped;
> >  };
> >  
> 
> Hi Stephen
> 
> This needs special synchronization on 32bit arches, as Ben pointed out
> for other drivers.

IFB is running in single thread context. Therefore just locking would
be enough

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 4/9] ifb: convert to 64 bit stats
  2011-06-09  3:32     ` Stephen Hemminger
@ 2011-06-09  3:37       ` Eric Dumazet
  0 siblings, 0 replies; 28+ messages in thread
From: Eric Dumazet @ 2011-06-09  3:37 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev

Le mercredi 08 juin 2011 à 20:32 -0700, Stephen Hemminger a écrit :

> IFB is running in single thread context. Therefore just locking would
> be enough

Yep, that is provided by include/linux/u64_stats_sync.h for free.

As a bonus, no locking on 64bit arches and a clean interface.




^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: [Pv-drivers] [PATCH 1/9] vmxnet3: convert to 64 bit stats interface
  2011-06-09  0:53 ` [PATCH 1/9] vmxnet3: convert to 64 bit stats interface Stephen Hemminger
@ 2011-06-09  5:17   ` Scott Goldman
  0 siblings, 0 replies; 28+ messages in thread
From: Scott Goldman @ 2011-06-09  5:17 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller, Shreyas Bhatewara; +Cc: pv-drivers, netdev

> Convert vmxnet3 driver to 64 bit statistics interface.
> This driver was already counting packet per queue in a 64 bit value so not
> a huge change. Eliminate unused old net_device_stats structure.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Thanks for taking care of this.

Signed-off-by: Scott J. Goldman <scottjg@vmware.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: [PATCH 5/9] netxen: convert to 64 bit statistics
  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
  1 sibling, 0 replies; 28+ messages in thread
From: Amit Salecha @ 2011-06-09  6:13 UTC (permalink / raw)
  To: Stephen Hemminger, David Miller; +Cc: netdev

> From: Stephen Hemminger [mailto:shemminger@vyatta.com]
> 
> Change to 64 bit statistics interface, driver was already maintaining
> 64 bit
> value.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
Acked-by: Amit Kumar Salecha <amit.salecha@qlogic.com>

Thanks Stephen.



^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 3/9] veth: convert to 64 bit statistics
  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  6:26   ` David Miller
  1 sibling, 0 replies; 28+ messages in thread
From: David Miller @ 2011-06-09  6:26 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 08 Jun 2011 17:53:59 -0700

> Not much change, device was already keeping per cpu statistics.
> Use recent 64 statistics interface.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 8/9] niu: support 64 bit stats interface
  2011-06-09  0:54 ` [PATCH 8/9] niu: support 64 bit stats interface Stephen Hemminger
@ 2011-06-09  6:27   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2011-06-09  6:27 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 08 Jun 2011 17:54:04 -0700

> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 6/9] enic: update to support 64 bit stats
  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
  1 sibling, 0 replies; 28+ messages in thread
From: David Miller @ 2011-06-09  6:27 UTC (permalink / raw)
  To: shemminger; +Cc: benve, vkolluri, roprabhu, dwang2, netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 08 Jun 2011 17:54:02 -0700

> The device driver already uses 64 bit statistics, it just
> doesn't use the 64 bit interface.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 7/9] myricom: update to 64 bit stats
  2011-06-09  0:54 ` [PATCH 7/9] myricom: update to " Stephen Hemminger
@ 2011-06-09  6:27   ` David Miller
  0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2011-06-09  6:27 UTC (permalink / raw)
  To: shemminger; +Cc: gallatin, brice, netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 08 Jun 2011 17:54:03 -0700

> Driver was already keeping 64 bit counters, just not using the new interface.
> 
> Ps: IMHO drivers should not be duplicating network device
> stats into ethtool stats. It is useless duplication.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 5/9] netxen: convert to 64 bit statistics
  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
  1 sibling, 0 replies; 28+ messages in thread
From: David Miller @ 2011-06-09  6:27 UTC (permalink / raw)
  To: shemminger; +Cc: amit.salecha, netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 08 Jun 2011 17:54:01 -0700

> Change to 64 bit statistics interface, driver was already maintaining 64 bit
> value.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 6/9] enic: update to support 64 bit stats
  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
  1 sibling, 0 replies; 28+ messages in thread
From: roprabhu @ 2011-06-09 17:43 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller, Christian Benvenuti,
	Vasanthy Kolluri, David Wang
  Cc: netdev

On 6/8/11 5:54 PM, "Stephen Hemminger" <shemminger@vyatta.com> wrote:

> The device driver already uses 64 bit statistics, it just
> doesn't use the 64 bit interface.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> --- a/drivers/net/enic/enic_main.c 2011-06-07 16:58:31.317079332 -0700
> +++ b/drivers/net/enic/enic_main.c 2011-06-07 17:29:09.670195233 -0700
> @@ -801,10 +801,10 @@ static netdev_tx_t enic_hard_start_xmit(
>  }
>  
>  /* dev_base_lock rwlock held, nominally process context */
> -static struct net_device_stats *enic_get_stats(struct net_device *netdev)
> +static struct rtnl_link_stats64 *enic_get_stats(struct net_device *netdev,
> +      struct rtnl_link_stats64 *net_stats)
>  {
> struct enic *enic = netdev_priv(netdev);
> - struct net_device_stats *net_stats = &netdev->stats;
> struct vnic_stats *stats;
>  
> enic_dev_stats_dump(enic, &stats);
> @@ -2117,7 +2117,7 @@ static const struct net_device_ops enic_
> .ndo_open  = enic_open,
> .ndo_stop  = enic_stop,
> .ndo_start_xmit  = enic_hard_start_xmit,
> - .ndo_get_stats  = enic_get_stats,
> + .ndo_get_stats64 = enic_get_stats,
> .ndo_validate_addr = eth_validate_addr,
> .ndo_set_rx_mode = enic_set_rx_mode,
> .ndo_set_multicast_list = enic_set_rx_mode,
> @@ -2139,7 +2139,7 @@ static const struct net_device_ops enic_
> .ndo_open  = enic_open,
> .ndo_stop  = enic_stop,
> .ndo_start_xmit  = enic_hard_start_xmit,
> - .ndo_get_stats  = enic_get_stats,
> + .ndo_get_stats64 = enic_get_stats,
> .ndo_validate_addr = eth_validate_addr,
> .ndo_set_mac_address = enic_set_mac_address,
> .ndo_set_rx_mode = enic_set_rx_mode,
> 

ACK..
Thanks Stephen. 


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 3/9] veth: convert to 64 bit statistics
  2011-06-09  3:22     ` Stephen Hemminger
@ 2011-06-10 16:34       ` Ben Hutchings
  0 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2011-06-10 16:34 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev

On Wed, 2011-06-08 at 20:22 -0700, Stephen Hemminger wrote:
> On Thu, 09 Jun 2011 03:00:41 +0100
> Ben Hutchings <bhutchings@solarflare.com> wrote:
> 
> > On Wed, 2011-06-08 at 17:53 -0700, Stephen Hemminger wrote:
> > > Not much change, device was already keeping per cpu statistics.
> > > Use recent 64 statistics interface.
> > [...]
> > 
> > It's also going to need to use u64_stats_sync functions.
> > 
> > Ben.
> > 
> 
> No veth is doing per-cpu update therefore the new code has the same guarantee
> as the old code.

Per-cpu statistics avoid the problem of races between writers without
using expensive atomic operations.  They don't solve the problem of
races between writer and reader (on 32-bit systems).

For example, if veth_get_stats() races with a receive or transmit that
increments a value from 0x00000001ffffffff to 0x0000000200000000, it may
see the value as 0x00000002ffffffff.

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] 28+ 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; 28+ 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] 28+ 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; 28+ 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, netdev,
	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] 28+ messages in thread

end of thread, other threads:[~2011-06-15  8:38 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/9] xen: " 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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.