diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-04 11:47:58 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-04 11:47:58 -0700 | 
| commit | 6ba74014c1ab0e37af7de6f64b4eccbbae3cb9e7 (patch) | |
| tree | 8f3892fc44f1e403675a6d7e88fda5c70e56ee4c /drivers/net/loopback.c | |
| parent | 5abd9ccced7a726c817dd6b5b96bc933859138d1 (diff) | |
| parent | 3ff1c25927e3af61c6bf0e4ed959504058ae4565 (diff) | |
| download | olio-linux-3.10-6ba74014c1ab0e37af7de6f64b4eccbbae3cb9e7.tar.xz olio-linux-3.10-6ba74014c1ab0e37af7de6f64b4eccbbae3cb9e7.zip  | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1443 commits)
  phy/marvell: add 88ec048 support
  igb: Program MDICNFG register prior to PHY init
  e1000e: correct MAC-PHY interconnect register offset for 82579
  hso: Add new product ID
  can: Add driver for esd CAN-USB/2 device
  l2tp: fix export of header file for userspace
  can-raw: Fix skb_orphan_try handling
  Revert "net: remove zap_completion_queue"
  net: cleanup inclusion
  phy/marvell: add 88e1121 interface mode support
  u32: negative offset fix
  net: Fix a typo from "dev" to "ndev"
  igb: Use irq_synchronize per vector when using MSI-X
  ixgbevf: fix null pointer dereference due to filter being set for VLAN 0
  e1000e: Fix irq_synchronize in MSI-X case
  e1000e: register pm_qos request on hardware activation
  ip_fragment: fix subtracting PPPOE_SES_HLEN from mtu twice
  net: Add getsockopt support for TCP thin-streams
  cxgb4: update driver version
  cxgb4: add new PCI IDs
  ...
Manually fix up conflicts in:
 - drivers/net/e1000e/netdev.c: due to pm_qos registration
   infrastructure changes
 - drivers/net/phy/marvell.c: conflict between adding 88ec048 support
   and cleaning up the IDs
 - drivers/net/wireless/ipw2x00/ipw2100.c: trivial ipw2100_pm_qos_req
   conflict (registration change vs marking it static)
Diffstat (limited to 'drivers/net/loopback.c')
| -rw-r--r-- | drivers/net/loopback.c | 33 | 
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 72b7949c91b..9a099679532 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -58,11 +58,13 @@  #include <linux/tcp.h>  #include <linux/percpu.h>  #include <net/net_namespace.h> +#include <linux/u64_stats_sync.h>  struct pcpu_lstats { -	unsigned long packets; -	unsigned long bytes; -	unsigned long drops; +	u64			packets; +	u64			bytes; +	struct u64_stats_sync	syncp; +	unsigned long		drops;  };  /* @@ -86,31 +88,40 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,  	len = skb->len;  	if (likely(netif_rx(skb) == NET_RX_SUCCESS)) { +		u64_stats_update_begin(&lb_stats->syncp);  		lb_stats->bytes += len;  		lb_stats->packets++; +		u64_stats_update_end(&lb_stats->syncp);  	} else  		lb_stats->drops++;  	return NETDEV_TX_OK;  } -static struct net_device_stats *loopback_get_stats(struct net_device *dev) +static struct rtnl_link_stats64 *loopback_get_stats64(struct net_device *dev, +						      struct rtnl_link_stats64 *stats)  {  	const struct pcpu_lstats __percpu *pcpu_lstats; -	struct net_device_stats *stats = &dev->stats; -	unsigned long bytes = 0; -	unsigned long packets = 0; -	unsigned long drops = 0; +	u64 bytes = 0; +	u64 packets = 0; +	u64 drops = 0;  	int i;  	pcpu_lstats = (void __percpu __force *)dev->ml_priv;  	for_each_possible_cpu(i) {  		const struct pcpu_lstats *lb_stats; +		u64 tbytes, tpackets; +		unsigned int start;  		lb_stats = per_cpu_ptr(pcpu_lstats, i); -		bytes   += lb_stats->bytes; -		packets += lb_stats->packets; +		do { +			start = u64_stats_fetch_begin(&lb_stats->syncp); +			tbytes = lb_stats->bytes; +			tpackets = lb_stats->packets; +		} while (u64_stats_fetch_retry(&lb_stats->syncp, start));  		drops   += lb_stats->drops; +		bytes   += tbytes; +		packets += tpackets;  	}  	stats->rx_packets = packets;  	stats->tx_packets = packets; @@ -158,7 +169,7 @@ static void loopback_dev_free(struct net_device *dev)  static const struct net_device_ops loopback_ops = {  	.ndo_init      = loopback_dev_init,  	.ndo_start_xmit= loopback_xmit, -	.ndo_get_stats = loopback_get_stats, +	.ndo_get_stats64 = loopback_get_stats64,  };  /*  |