From dcf24f77e4b4acac0f82f0b435541360a5a515ab Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Fri, 19 Feb 2016 22:47:12 +0200 Subject: [PATCH] staging: octeon: drop atomic usage from rx counters We have only one NAPI poll running at a time, so virtual port rx counters can be updated normally. Update of rx_dropped can still race with the gathering of statistics, but full accuracy is not required there. Signed-off-by: Aaro Koskinen Acked-by: David Daney Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-rx.c | 23 +++-------------------- drivers/staging/octeon/ethernet.c | 13 +------------ 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index 6aed3cf6c0b4..ed553040cfb9 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c @@ -26,8 +26,6 @@ #include #endif /* CONFIG_XFRM */ -#include - #include #include "ethernet-defines.h" @@ -364,17 +362,8 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) /* Increment RX stats for virtual ports */ if (port >= CVMX_PIP_NUM_INPUT_PORTS) { -#ifdef CONFIG_64BIT - atomic64_add(1, - (atomic64_t *)&priv->stats.rx_packets); - atomic64_add(skb->len, - (atomic64_t *)&priv->stats.rx_bytes); -#else - atomic_add(1, - (atomic_t *)&priv->stats.rx_packets); - atomic_add(skb->len, - (atomic_t *)&priv->stats.rx_bytes); -#endif + priv->stats.rx_packets++; + priv->stats.rx_bytes += skb->len; } netif_receive_skb(skb); } else { @@ -383,13 +372,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) printk_ratelimited("%s: Device not up, packet dropped\n", dev->name); */ -#ifdef CONFIG_64BIT - atomic64_add(1, - (atomic64_t *)&priv->stats.rx_dropped); -#else - atomic_add(1, - (atomic_t *)&priv->stats.rx_dropped); -#endif + priv->stats.rx_dropped++; dev_kfree_skb_irq(skb); } } else { diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 8d239e23e5c7..9fa552f64a03 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -226,18 +226,7 @@ static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev) priv->stats.multicast += rx_status.multicast_packets; priv->stats.rx_crc_errors += rx_status.inb_errors; priv->stats.rx_frame_errors += rx_status.fcs_align_err_packets; - - /* - * The drop counter must be incremented atomically - * since the RX tasklet also increments it. - */ -#ifdef CONFIG_64BIT - atomic64_add(rx_status.dropped_packets, - (atomic64_t *)&priv->stats.rx_dropped); -#else - atomic_add(rx_status.dropped_packets, - (atomic_t *)&priv->stats.rx_dropped); -#endif + priv->stats.rx_dropped += rx_status.dropped_packets; } return &priv->stats; -- 2.39.2