Skip to content

Commit

Permalink
ipv4: use dev_sw_netstats_rx_add()
Browse files Browse the repository at this point in the history
use new helper for netstats settings

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Fabian Frederick authored and David S. Miller committed Oct 6, 2020
1 parent e40b372 commit 560b50c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
8 changes: 1 addition & 7 deletions net/ipv4/ip_tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
const struct tnl_ptk_info *tpi, struct metadata_dst *tun_dst,
bool log_ecn_error)
{
struct pcpu_sw_netstats *tstats;
const struct iphdr *iph = ip_hdr(skb);
int err;

Expand Down Expand Up @@ -402,12 +401,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
}
}

tstats = this_cpu_ptr(tunnel->dev->tstats);
u64_stats_update_begin(&tstats->syncp);
tstats->rx_packets++;
tstats->rx_bytes += skb->len;
u64_stats_update_end(&tstats->syncp);

dev_sw_netstats_rx_add(tunnel->dev, skb->len);
skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(tunnel->dev)));

if (tunnel->dev->type == ARPHRD_ETHER) {
Expand Down
9 changes: 1 addition & 8 deletions net/ipv4/ip_vti.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ static int vti_rcv_cb(struct sk_buff *skb, int err)
{
unsigned short family;
struct net_device *dev;
struct pcpu_sw_netstats *tstats;
struct xfrm_state *x;
const struct xfrm_mode *inner_mode;
struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4;
Expand Down Expand Up @@ -138,13 +137,7 @@ static int vti_rcv_cb(struct sk_buff *skb, int err)

skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(skb->dev)));
skb->dev = dev;

tstats = this_cpu_ptr(dev->tstats);

u64_stats_update_begin(&tstats->syncp);
tstats->rx_packets++;
tstats->rx_bytes += skb->len;
u64_stats_update_end(&tstats->syncp);
dev_sw_netstats_rx_add(dev, skb->len);

return 0;
}
Expand Down

0 comments on commit 560b50c

Please sign in to comment.