Skip to content

Commit 560b50c

Browse files
Fabian Frederickdavem330
authored andcommitted
ipv4: use dev_sw_netstats_rx_add()
use new helper for netstats settings Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e40b372 commit 560b50c

2 files changed

Lines changed: 2 additions & 15 deletions

File tree

‎net/ipv4/ip_tunnel.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
360360
const struct tnl_ptk_info *tpi, struct metadata_dst *tun_dst,
361361
bool log_ecn_error)
362362
{
363-
struct pcpu_sw_netstats *tstats;
364363
const struct iphdr *iph = ip_hdr(skb);
365364
int err;
366365

@@ -402,12 +401,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
402401
}
403402
}
404403

405-
tstats = this_cpu_ptr(tunnel->dev->tstats);
406-
u64_stats_update_begin(&tstats->syncp);
407-
tstats->rx_packets++;
408-
tstats->rx_bytes += skb->len;
409-
u64_stats_update_end(&tstats->syncp);
410-
404+
dev_sw_netstats_rx_add(tunnel->dev, skb->len);
411405
skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(tunnel->dev)));
412406

413407
if (tunnel->dev->type == ARPHRD_ETHER) {

‎net/ipv4/ip_vti.c‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ static int vti_rcv_cb(struct sk_buff *skb, int err)
9595
{
9696
unsigned short family;
9797
struct net_device *dev;
98-
struct pcpu_sw_netstats *tstats;
9998
struct xfrm_state *x;
10099
const struct xfrm_mode *inner_mode;
101100
struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4;
@@ -138,13 +137,7 @@ static int vti_rcv_cb(struct sk_buff *skb, int err)
138137

139138
skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(skb->dev)));
140139
skb->dev = dev;
141-
142-
tstats = this_cpu_ptr(dev->tstats);
143-
144-
u64_stats_update_begin(&tstats->syncp);
145-
tstats->rx_packets++;
146-
tstats->rx_bytes += skb->len;
147-
u64_stats_update_end(&tstats->syncp);
140+
dev_sw_netstats_rx_add(dev, skb->len);
148141

149142
return 0;
150143
}

0 commit comments

Comments
 (0)