From cf5d98b23ee4275662ec5578e06e0338f7b8ac8c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 26 Oct 2023 09:21:20 +0000 Subject: [PATCH] Revert "xfrm: interface: use DEV_STATS_INC()" This reverts commit 0cb7b894e47b1c8a5c08631a3de4fe082ee17365 which is commit 0cb7b894e47b1c8a5c08631a3de4fe082ee17365 upstream. It breaks the build as it depends on an abi-breaking commit that was previously reverted. If this is needed in the future, it can come back in an abi-safe way. Bug: 161946584 Change-Id: Ib8c4c34c281fdbe75397a9508155b04ab1e63c8d Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_interface_core.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/net/xfrm/xfrm_interface_core.c b/net/xfrm/xfrm_interface_core.c index 82c0c0575074..3dc63810c5f5 100644 --- a/net/xfrm/xfrm_interface_core.c +++ b/net/xfrm/xfrm_interface_core.c @@ -219,8 +219,8 @@ static int xfrmi_rcv_cb(struct sk_buff *skb, int err) skb->dev = dev; if (err) { - DEV_STATS_INC(dev, rx_errors); - DEV_STATS_INC(dev, rx_dropped); + dev->stats.rx_errors++; + dev->stats.rx_dropped++; return 0; } @@ -260,6 +260,7 @@ static int xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) { struct xfrm_if *xi = netdev_priv(dev); + struct net_device_stats *stats = &xi->dev->stats; struct dst_entry *dst = skb_dst(skb); unsigned int length = skb->len; struct net_device *tdev; @@ -285,7 +286,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) tdev = dst->dev; if (tdev == dev) { - DEV_STATS_INC(dev, collisions); + stats->collisions++; net_warn_ratelimited("%s: Local routing loop detected!\n", dev->name); goto tx_err_dst_release; @@ -328,13 +329,13 @@ xmit: tstats->tx_packets++; u64_stats_update_end(&tstats->syncp); } else { - DEV_STATS_INC(dev, tx_errors); - DEV_STATS_INC(dev, tx_aborted_errors); + stats->tx_errors++; + stats->tx_aborted_errors++; } return 0; tx_err_link_failure: - DEV_STATS_INC(dev, tx_carrier_errors); + stats->tx_carrier_errors++; dst_link_failure(skb); tx_err_dst_release: dst_release(dst); @@ -344,6 +345,7 @@ tx_err_dst_release: static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) { struct xfrm_if *xi = netdev_priv(dev); + struct net_device_stats *stats = &xi->dev->stats; struct dst_entry *dst = skb_dst(skb); struct flowi fl; int ret; @@ -360,7 +362,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) dst = ip6_route_output(dev_net(dev), NULL, &fl.u.ip6); if (dst->error) { dst_release(dst); - DEV_STATS_INC(dev, tx_carrier_errors); + stats->tx_carrier_errors++; goto tx_err; } skb_dst_set(skb, dst); @@ -376,7 +378,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) fl.u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; rt = __ip_route_output_key(dev_net(dev), &fl.u.ip4); if (IS_ERR(rt)) { - DEV_STATS_INC(dev, tx_carrier_errors); + stats->tx_carrier_errors++; goto tx_err; } skb_dst_set(skb, &rt->dst); @@ -395,8 +397,8 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; tx_err: - DEV_STATS_INC(dev, tx_errors); - DEV_STATS_INC(dev, tx_dropped); + stats->tx_errors++; + stats->tx_dropped++; kfree_skb(skb); return NETDEV_TX_OK; }