Skip to content

Commit ba1cb99

Browse files
committed
Merge branch 'vxlan-stats'
Guillaume Nault says: ==================== vxlan: Fix vxlan counters. Like most virtual devices, vxlan needs special care when updating its netdevice counters. This is done in patch 1. Patch 2 just adds a missing VNI counter update (found while working on patch 1). ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents b867247 + b22ea4e commit ba1cb99

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

drivers/net/vxlan/vxlan_core.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,8 +1766,8 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
17661766
skb_reset_network_header(skb);
17671767

17681768
if (!vxlan_ecn_decapsulate(vs, oiph, skb)) {
1769-
++vxlan->dev->stats.rx_frame_errors;
1770-
++vxlan->dev->stats.rx_errors;
1769+
DEV_STATS_INC(vxlan->dev, rx_frame_errors);
1770+
DEV_STATS_INC(vxlan->dev, rx_errors);
17711771
vxlan_vnifilter_count(vxlan, vni, vninode,
17721772
VXLAN_VNI_STATS_RX_ERRORS, 0);
17731773
goto drop;
@@ -1837,7 +1837,9 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
18371837
goto out;
18381838

18391839
if (!pskb_may_pull(skb, arp_hdr_len(dev))) {
1840-
dev->stats.tx_dropped++;
1840+
dev_core_stats_tx_dropped_inc(dev);
1841+
vxlan_vnifilter_count(vxlan, vni, NULL,
1842+
VXLAN_VNI_STATS_TX_DROPS, 0);
18411843
goto out;
18421844
}
18431845
parp = arp_hdr(skb);
@@ -1893,7 +1895,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
18931895
reply->pkt_type = PACKET_HOST;
18941896

18951897
if (netif_rx(reply) == NET_RX_DROP) {
1896-
dev->stats.rx_dropped++;
1898+
dev_core_stats_rx_dropped_inc(dev);
18971899
vxlan_vnifilter_count(vxlan, vni, NULL,
18981900
VXLAN_VNI_STATS_RX_DROPS, 0);
18991901
}
@@ -2052,7 +2054,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
20522054
goto out;
20532055

20542056
if (netif_rx(reply) == NET_RX_DROP) {
2055-
dev->stats.rx_dropped++;
2057+
dev_core_stats_rx_dropped_inc(dev);
20562058
vxlan_vnifilter_count(vxlan, vni, NULL,
20572059
VXLAN_VNI_STATS_RX_DROPS, 0);
20582060
}
@@ -2263,7 +2265,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
22632265
len);
22642266
} else {
22652267
drop:
2266-
dev->stats.rx_dropped++;
2268+
dev_core_stats_rx_dropped_inc(dev);
22672269
vxlan_vnifilter_count(dst_vxlan, vni, NULL,
22682270
VXLAN_VNI_STATS_RX_DROPS, 0);
22692271
}
@@ -2295,7 +2297,7 @@ static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
22952297
addr_family, dst_port,
22962298
vxlan->cfg.flags);
22972299
if (!dst_vxlan) {
2298-
dev->stats.tx_errors++;
2300+
DEV_STATS_INC(dev, tx_errors);
22992301
vxlan_vnifilter_count(vxlan, vni, NULL,
23002302
VXLAN_VNI_STATS_TX_ERRORS, 0);
23012303
kfree_skb(skb);
@@ -2559,19 +2561,19 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
25592561
return;
25602562

25612563
drop:
2562-
dev->stats.tx_dropped++;
2564+
dev_core_stats_tx_dropped_inc(dev);
25632565
vxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX_DROPS, 0);
25642566
dev_kfree_skb(skb);
25652567
return;
25662568

25672569
tx_error:
25682570
rcu_read_unlock();
25692571
if (err == -ELOOP)
2570-
dev->stats.collisions++;
2572+
DEV_STATS_INC(dev, collisions);
25712573
else if (err == -ENETUNREACH)
2572-
dev->stats.tx_carrier_errors++;
2574+
DEV_STATS_INC(dev, tx_carrier_errors);
25732575
dst_release(ndst);
2574-
dev->stats.tx_errors++;
2576+
DEV_STATS_INC(dev, tx_errors);
25752577
vxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX_ERRORS, 0);
25762578
kfree_skb(skb);
25772579
}
@@ -2604,7 +2606,7 @@ static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,
26042606
return;
26052607

26062608
drop:
2607-
dev->stats.tx_dropped++;
2609+
dev_core_stats_tx_dropped_inc(dev);
26082610
vxlan_vnifilter_count(netdev_priv(dev), vni, NULL,
26092611
VXLAN_VNI_STATS_TX_DROPS, 0);
26102612
dev_kfree_skb(skb);
@@ -2642,7 +2644,7 @@ static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,
26422644
return NETDEV_TX_OK;
26432645

26442646
drop:
2645-
dev->stats.tx_dropped++;
2647+
dev_core_stats_tx_dropped_inc(dev);
26462648
vxlan_vnifilter_count(netdev_priv(dev), vni, NULL,
26472649
VXLAN_VNI_STATS_TX_DROPS, 0);
26482650
dev_kfree_skb(skb);
@@ -2739,7 +2741,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
27392741
!is_multicast_ether_addr(eth->h_dest))
27402742
vxlan_fdb_miss(vxlan, eth->h_dest);
27412743

2742-
dev->stats.tx_dropped++;
2744+
dev_core_stats_tx_dropped_inc(dev);
27432745
vxlan_vnifilter_count(vxlan, vni, NULL,
27442746
VXLAN_VNI_STATS_TX_DROPS, 0);
27452747
kfree_skb(skb);

0 commit comments

Comments
 (0)