Revert "bareudp: Fix device stats updates."

This reverts commit 831b755d5b.
This commit is contained in:
Ksawlii 2024-11-24 00:23:41 +01:00
parent 5afa4683a7
commit 2990a48a81

View file

@ -75,7 +75,7 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
if (skb_copy_bits(skb, BAREUDP_BASE_HLEN, &ipversion,
sizeof(ipversion))) {
DEV_STATS_INC(bareudp->dev, rx_dropped);
bareudp->dev->stats.rx_dropped++;
goto drop;
}
ipversion >>= 4;
@ -85,7 +85,7 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
} else if (ipversion == 6 && bareudp->multi_proto_mode) {
proto = htons(ETH_P_IPV6);
} else {
DEV_STATS_INC(bareudp->dev, rx_dropped);
bareudp->dev->stats.rx_dropped++;
goto drop;
}
} else if (bareudp->ethertype == htons(ETH_P_MPLS_UC)) {
@ -99,7 +99,7 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
ipv4_is_multicast(tunnel_hdr->daddr)) {
proto = htons(ETH_P_MPLS_MC);
} else {
DEV_STATS_INC(bareudp->dev, rx_dropped);
bareudp->dev->stats.rx_dropped++;
goto drop;
}
} else {
@ -115,7 +115,7 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
(addr_type & IPV6_ADDR_MULTICAST)) {
proto = htons(ETH_P_MPLS_MC);
} else {
DEV_STATS_INC(bareudp->dev, rx_dropped);
bareudp->dev->stats.rx_dropped++;
goto drop;
}
}
@ -127,12 +127,12 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
proto,
!net_eq(bareudp->net,
dev_net(bareudp->dev)))) {
DEV_STATS_INC(bareudp->dev, rx_dropped);
bareudp->dev->stats.rx_dropped++;
goto drop;
}
tun_dst = udp_tun_rx_dst(skb, family, TUNNEL_KEY, 0, 0);
if (!tun_dst) {
DEV_STATS_INC(bareudp->dev, rx_dropped);
bareudp->dev->stats.rx_dropped++;
goto drop;
}
skb_dst_set(skb, &tun_dst->dst);
@ -157,8 +157,8 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
&((struct ipv6hdr *)oiph)->saddr);
}
if (err > 1) {
DEV_STATS_INC(bareudp->dev, rx_frame_errors);
DEV_STATS_INC(bareudp->dev, rx_errors);
++bareudp->dev->stats.rx_frame_errors;
++bareudp->dev->stats.rx_errors;
goto drop;
}
}
@ -453,11 +453,11 @@ tx_error:
dev_kfree_skb(skb);
if (err == -ELOOP)
DEV_STATS_INC(dev, collisions);
dev->stats.collisions++;
else if (err == -ENETUNREACH)
DEV_STATS_INC(dev, tx_carrier_errors);
dev->stats.tx_carrier_errors++;
DEV_STATS_INC(dev, tx_errors);
dev->stats.tx_errors++;
return NETDEV_TX_OK;
}