--- zzzz-none-000/linux-5.4.213/drivers/net/ifb.c 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/drivers/net/ifb.c 2024-08-14 09:02:07.000000000 +0000 @@ -123,6 +123,31 @@ } +void ifb_update_offload_stats(struct net_device *dev, struct pcpu_sw_netstats *offload_stats) +{ + struct ifb_dev_private *dp; + struct ifb_q_private *txp; + + if (!dev || !offload_stats) { + return; + } + + if (!(dev->priv_flags_ext & IFF_EXT_IFB)) { + return; + } + + dp = netdev_priv(dev); + txp = dp->tx_private; + + u64_stats_update_begin(&txp->rsync); + txp->rx_packets += offload_stats->rx_packets; + txp->rx_bytes += offload_stats->rx_bytes; + txp->tx_packets += offload_stats->tx_packets; + txp->tx_bytes += offload_stats->tx_bytes; + u64_stats_update_end(&txp->rsync); +} +EXPORT_SYMBOL(ifb_update_offload_stats); + static void ifb_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) { @@ -224,6 +249,7 @@ dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST; dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->priv_flags_ext |= IFF_EXT_IFB; /* Mark the device as an IFB device. */ netif_keep_dst(dev); eth_hw_addr_random(dev); dev->needs_free_netdev = true;