--- zzzz-none-000/linux-4.9.276/net/ipv4/ip_gre.c 2021-07-20 14:21:16.000000000 +0000 +++ falcon-5530-750/linux-4.9.276/net/ipv4/ip_gre.c 2023-04-05 08:19:02.000000000 +0000 @@ -1185,6 +1185,20 @@ .size = sizeof(struct ip_tunnel_net), }; +#if IS_ENABLED(CONFIG_PPA) +extern uint32_t (*ppa_is_ipv4_gretap_fn)(struct net_device *dev); + +static u32 ppa_is_ipv4_gretap(struct net_device *dev) +{ + /* NOTE: + * To include acelerated counters in gre_tap net_device stats, + * gre_tap netdev_ops pointer (i.e., @gre_tap_netdev_ops) can be modified with a new one. + * This is specifically to overload @ndo_get_stats64, but @ndo_init remains unchanged. + */ + return (dev && dev->netdev_ops && (dev->netdev_ops->ndo_init == gre_tap_netdev_ops.ndo_init)); +} +#endif + static int __init ipgre_init(void) { int err; @@ -1213,6 +1227,10 @@ if (err < 0) goto tap_ops_failed; +#if IS_ENABLED(CONFIG_PPA) + ppa_is_ipv4_gretap_fn = ppa_is_ipv4_gretap; +#endif + return 0; tap_ops_failed: @@ -1228,6 +1246,9 @@ static void __exit ipgre_fini(void) { +#if IS_ENABLED(CONFIG_PPA) + ppa_is_ipv4_gretap_fn = NULL; +#endif rtnl_link_unregister(&ipgre_tap_ops); rtnl_link_unregister(&ipgre_link_ops); gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO);