--- zzzz-none-000/linux-4.4.271/net/8021q/vlan_core.c 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/net/8021q/vlan_core.c 2023-04-19 10:22:30.000000000 +0000 @@ -5,6 +5,14 @@ #include #include "vlan.h" +#if defined(CONFIG_LTQ_ETH_OAM) || defined(CONFIG_LTQ_ETH_OAM_MODULE) +/* Support for ethernet OAM with VLAN */ +#include + +struct net_device * (*fp_ltq_eth_oam_dev)(void)=NULL; +EXPORT_SYMBOL(fp_ltq_eth_oam_dev); +#endif + bool vlan_do_receive(struct sk_buff **skbp) { struct sk_buff *skb = *skbp; @@ -61,9 +69,34 @@ rx_stats->rx_multicast++; u64_stats_update_end(&rx_stats->syncp); +#if IS_ENABLED(CONFIG_LTQ_ETH_OAM) + if (skb->protocol == ETH_P_CFM && fp_ltq_eth_oam_dev != NULL) + skb->dev = fp_ltq_eth_oam_dev(); +#endif + return true; } +/* Update the VLAN device with statistics from network offload engines */ +void __vlan_dev_update_accel_stats(struct net_device *dev, + struct rtnl_link_stats64 *nlstats) +{ + struct vlan_pcpu_stats *stats; + + if (!is_vlan_dev(dev)) + return; + + stats = this_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats); + + u64_stats_update_begin(&stats->syncp); + stats->rx_packets += nlstats->rx_packets; + stats->rx_bytes += nlstats->rx_bytes; + stats->tx_packets += nlstats->tx_packets; + stats->tx_bytes += nlstats->tx_bytes; + u64_stats_update_end(&stats->syncp); +} +EXPORT_SYMBOL(__vlan_dev_update_accel_stats); + /* Must be invoked with rcu_read_lock. */ struct net_device *__vlan_find_dev_deep_rcu(struct net_device *dev, __be16 vlan_proto, u16 vlan_id) @@ -102,6 +135,12 @@ } EXPORT_SYMBOL(vlan_dev_real_dev); +struct net_device *vlan_dev_next_dev(const struct net_device *dev) +{ + return vlan_dev_priv(dev)->real_dev; +} +EXPORT_SYMBOL(vlan_dev_next_dev); + u16 vlan_dev_vlan_id(const struct net_device *dev) { return vlan_dev_priv(dev)->vlan_id;