diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/bareudp.c | 11 | ||||
-rw-r--r-- | drivers/net/geneve.c | 11 | ||||
-rw-r--r-- | drivers/net/gtp.c | 8 | ||||
-rw-r--r-- | drivers/net/vxlan.c | 8 |
4 files changed, 8 insertions, 30 deletions
diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index 841910f1db65..ff0bea1554f9 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -54,7 +54,6 @@ struct bareudp_dev { static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb) { struct metadata_dst *tun_dst = NULL; - struct pcpu_sw_netstats *stats; struct bareudp_dev *bareudp; unsigned short family; unsigned int len; @@ -160,13 +159,9 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb) len = skb->len; err = gro_cells_receive(&bareudp->gro_cells, skb); - if (likely(err == NET_RX_SUCCESS)) { - stats = this_cpu_ptr(bareudp->dev->tstats); - u64_stats_update_begin(&stats->syncp); - stats->rx_packets++; - stats->rx_bytes += len; - u64_stats_update_end(&stats->syncp); - } + if (likely(err == NET_RX_SUCCESS)) + dev_sw_netstats_rx_add(bareudp->dev, len); + return 0; drop: /* Consume bad packet */ diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 974a244f45ba..d07008a818df 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -217,7 +217,6 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, { struct genevehdr *gnvh = geneve_hdr(skb); struct metadata_dst *tun_dst = NULL; - struct pcpu_sw_netstats *stats; unsigned int len; int err = 0; void *oiph; @@ -296,13 +295,9 @@ static void geneve_rx(struct geneve_dev *geneve, struct geneve_sock *gs, len = skb->len; err = gro_cells_receive(&geneve->gro_cells, skb); - if (likely(err == NET_RX_SUCCESS)) { - stats = this_cpu_ptr(geneve->dev->tstats); - u64_stats_update_begin(&stats->syncp); - stats->rx_packets++; - stats->rx_bytes += len; - u64_stats_update_end(&stats->syncp); - } + if (likely(err == NET_RX_SUCCESS)) + dev_sw_netstats_rx_add(geneve->dev, len); + return; drop: /* Consume bad packet */ diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index c09fe18c6c52..030a1a5afe05 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -182,8 +182,6 @@ static bool gtp_check_ms(struct sk_buff *skb, struct pdp_ctx *pctx, static int gtp_rx(struct pdp_ctx *pctx, struct sk_buff *skb, unsigned int hdrlen, unsigned int role) { - struct pcpu_sw_netstats *stats; - if (!gtp_check_ms(skb, pctx, hdrlen, role)) { netdev_dbg(pctx->dev, "No PDP ctx for this MS\n"); return 1; @@ -204,11 +202,7 @@ static int gtp_rx(struct pdp_ctx *pctx, struct sk_buff *skb, skb->dev = pctx->dev; - stats = this_cpu_ptr(pctx->dev->tstats); - u64_stats_update_begin(&stats->syncp); - stats->rx_packets++; - stats->rx_bytes += skb->len; - u64_stats_update_end(&stats->syncp); + dev_sw_netstats_rx_add(pctx->dev, skb->len); netif_rx(skb); return 0; diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index be3bf233a809..1a557aeba32b 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1826,7 +1826,6 @@ static bool vxlan_ecn_decapsulate(struct vxlan_sock *vs, void *oiph, /* Callback from net/ipv4/udp.c to receive packets */ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) { - struct pcpu_sw_netstats *stats; struct vxlan_dev *vxlan; struct vxlan_sock *vs; struct vxlanhdr unparsed; @@ -1940,12 +1939,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) goto drop; } - stats = this_cpu_ptr(vxlan->dev->tstats); - u64_stats_update_begin(&stats->syncp); - stats->rx_packets++; - stats->rx_bytes += skb->len; - u64_stats_update_end(&stats->syncp); - + dev_sw_netstats_rx_add(vxlan->dev, skb->len); gro_cells_receive(&vxlan->gro_cells, skb); rcu_read_unlock(); |