mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
Revert "veth: Use tstats per-CPU traffic counters"
This reverts commit 7ca7b6649b which is
commit 6f2684bf2b4460c84d0d34612a939f78b96b03fc upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: I77d059ea30dda952a3e58f85289a69afbca037f4
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -342,7 +342,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
skb_tx_timestamp(skb);
|
skb_tx_timestamp(skb);
|
||||||
if (likely(veth_forward_skb(rcv, skb, rq, use_napi) == NET_RX_SUCCESS)) {
|
if (likely(veth_forward_skb(rcv, skb, rq, use_napi) == NET_RX_SUCCESS)) {
|
||||||
if (!use_napi)
|
if (!use_napi)
|
||||||
dev_sw_netstats_tx_add(dev, 1, length);
|
dev_lstats_add(dev, length);
|
||||||
} else {
|
} else {
|
||||||
drop:
|
drop:
|
||||||
atomic64_inc(&priv->dropped);
|
atomic64_inc(&priv->dropped);
|
||||||
@@ -357,6 +357,14 @@ drop:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static u64 veth_stats_tx(struct net_device *dev, u64 *packets, u64 *bytes)
|
||||||
|
{
|
||||||
|
struct veth_priv *priv = netdev_priv(dev);
|
||||||
|
|
||||||
|
dev_lstats_read(dev, packets, bytes);
|
||||||
|
return atomic64_read(&priv->dropped);
|
||||||
|
}
|
||||||
|
|
||||||
static void veth_stats_rx(struct veth_stats *result, struct net_device *dev)
|
static void veth_stats_rx(struct veth_stats *result, struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct veth_priv *priv = netdev_priv(dev);
|
struct veth_priv *priv = netdev_priv(dev);
|
||||||
@@ -394,24 +402,24 @@ static void veth_get_stats64(struct net_device *dev,
|
|||||||
struct veth_priv *priv = netdev_priv(dev);
|
struct veth_priv *priv = netdev_priv(dev);
|
||||||
struct net_device *peer;
|
struct net_device *peer;
|
||||||
struct veth_stats rx;
|
struct veth_stats rx;
|
||||||
|
u64 packets, bytes;
|
||||||
|
|
||||||
tot->tx_dropped = atomic64_read(&priv->dropped);
|
tot->tx_dropped = veth_stats_tx(dev, &packets, &bytes);
|
||||||
dev_fetch_sw_netstats(tot, dev->tstats);
|
tot->tx_bytes = bytes;
|
||||||
|
tot->tx_packets = packets;
|
||||||
|
|
||||||
veth_stats_rx(&rx, dev);
|
veth_stats_rx(&rx, dev);
|
||||||
tot->tx_dropped += rx.xdp_tx_err;
|
tot->tx_dropped += rx.xdp_tx_err;
|
||||||
tot->rx_dropped = rx.rx_drops + rx.peer_tq_xdp_xmit_err;
|
tot->rx_dropped = rx.rx_drops + rx.peer_tq_xdp_xmit_err;
|
||||||
tot->rx_bytes += rx.xdp_bytes;
|
tot->rx_bytes = rx.xdp_bytes;
|
||||||
tot->rx_packets += rx.xdp_packets;
|
tot->rx_packets = rx.xdp_packets;
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
peer = rcu_dereference(priv->peer);
|
peer = rcu_dereference(priv->peer);
|
||||||
if (peer) {
|
if (peer) {
|
||||||
struct rtnl_link_stats64 tot_peer = {};
|
veth_stats_tx(peer, &packets, &bytes);
|
||||||
|
tot->rx_bytes += bytes;
|
||||||
dev_fetch_sw_netstats(&tot_peer, peer->tstats);
|
tot->rx_packets += packets;
|
||||||
tot->rx_bytes += tot_peer.tx_bytes;
|
|
||||||
tot->rx_packets += tot_peer.tx_packets;
|
|
||||||
|
|
||||||
veth_stats_rx(&rx, peer);
|
veth_stats_rx(&rx, peer);
|
||||||
tot->tx_dropped += rx.peer_tq_xdp_xmit_err;
|
tot->tx_dropped += rx.peer_tq_xdp_xmit_err;
|
||||||
@@ -1604,7 +1612,7 @@ static void veth_setup(struct net_device *dev)
|
|||||||
NETIF_F_HW_VLAN_STAG_RX);
|
NETIF_F_HW_VLAN_STAG_RX);
|
||||||
dev->needs_free_netdev = true;
|
dev->needs_free_netdev = true;
|
||||||
dev->priv_destructor = veth_dev_free;
|
dev->priv_destructor = veth_dev_free;
|
||||||
dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
|
dev->pcpu_stat_type = NETDEV_PCPU_STAT_LSTATS;
|
||||||
dev->max_mtu = ETH_MAX_MTU;
|
dev->max_mtu = ETH_MAX_MTU;
|
||||||
|
|
||||||
dev->hw_features = VETH_FEATURES;
|
dev->hw_features = VETH_FEATURES;
|
||||||
|
|||||||
Reference in New Issue
Block a user