--- zzzz-none-000/linux-4.1.38/net/8021q/vlan_dev.c 2017-01-18 18:48:06.000000000 +0000 +++ bcm63-7582-715/linux-4.1.38/net/8021q/vlan_dev.c 2020-11-25 10:06:48.000000000 +0000 @@ -36,6 +36,13 @@ #include #include +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) +#include +extern struct net_device_stats * vlan_dev_collect_stats(struct net_device * dev_p); +extern void vlan_dev_update_stats(struct net_device * dev_p, BlogStats_t *blogStats_p); +extern void vlan_dev_clear_stats(struct net_device * dev_p); +#endif + /* * Create the VLAN header for an arbitrary protocol layer * @@ -339,6 +346,36 @@ return 0; } +#if defined(CONFIG_BCM_KF_VLAN) && (defined(CONFIG_BCM_VLAN) || defined(CONFIG_BCM_VLAN_MODULE)) +int vlan_dev_set_nfmark_to_priority(char *dev_name, int nfmark_to_priority) +{ + struct net_device *dev = dev_get_by_name(&init_net, dev_name); + + if (dev) { + if (dev->priv_flags & IFF_802_1Q_VLAN) { + if (nfmark_to_priority>=-1 && nfmark_to_priority <=29) { + vlan_dev_priv(dev)->nfmark_to_priority = nfmark_to_priority; + dev_put(dev); + return 0; + } + else { + printk("invalid nfmark_to_priority\n"); + } + } + else { + printk(KERN_ERR + "%s: %s is not a vlan device, priv_flags: %hX.\n", + __FUNCTION__, dev->name, dev->priv_flags); + } + } + else { + printk(KERN_ERR "%s: Could not find device: %s\n", __FUNCTION__, dev_name); + } + dev_put(dev); + return -EINVAL; +} +#endif + static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; @@ -774,6 +811,9 @@ .ndo_netpoll_cleanup = vlan_dev_netpoll_cleanup, #endif .ndo_fix_features = vlan_dev_fix_features, +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + .ndo_get_stats = vlan_dev_collect_stats, +#endif .ndo_get_lock_subclass = vlan_dev_get_lock_subclass, .ndo_get_iflink = vlan_dev_get_iflink, }; @@ -800,5 +840,10 @@ dev->destructor = vlan_dev_free; dev->ethtool_ops = &vlan_ethtool_ops; +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + dev->put_stats = vlan_dev_update_stats; + dev->clr_stats = vlan_dev_clear_stats; +#endif eth_zero_addr(dev->broadcast); + }