--- zzzz-none-000/linux-3.10.107/net/8021q/vlan.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/net/8021q/vlan.c 2021-11-10 11:53:56.000000000 +0000 @@ -18,6 +18,12 @@ * 2 of the License, or (at your option) any later version. */ +/** + * Some part of this file is modified by Ikanos Communications. + * + * Copyright (C) 2013-2014 Ikanos Communications. + */ + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include @@ -265,12 +271,77 @@ vlan_dev_priv(new_dev)->real_dev = real_dev; vlan_dev_priv(new_dev)->dent = NULL; vlan_dev_priv(new_dev)->flags = VLAN_FLAG_REORDER_HDR; +#if defined(CONFIG_FUSIV_KERNEL_POLICY_VLAN) || defined(CONFIG_FUSIV_KERNEL_POLICY_VLAN_MODULE) + vlan_dev_priv(new_dev)->txAction = 1; +#endif + + new_dev->rtnl_link_ops = &vlan_link_ops; + err = register_vlan_dev(new_dev); + if (err < 0) + goto out_free_newdev; + + return 0; + +out_free_newdev: + free_netdev(new_dev); + return err; +} + +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +int avm_register_vlan_device(struct net_device *real_dev, u16 vlan_id, char *name, struct net_device **vlan_dev) +{ + struct net_device *new_dev; + struct net *net = dev_net(real_dev); + int err; + + if(vlan_dev != NULL){ + *vlan_dev = NULL; + } + + if (vlan_id >= VLAN_VID_MASK) + return -ERANGE; + +#if defined(CONFIG_AVMNET_VLAN_MASTER_STAG_8021Q) + err = vlan_check_real_dev(real_dev, htons(ETH_P_8021Q), vlan_id); +#else + err = vlan_check_real_dev(real_dev, htons(ETH_P_8021AD), vlan_id); +#endif + if (err < 0) + return err; + + new_dev = alloc_netdev(sizeof(struct vlan_dev_priv), name, vlan_setup); + + if (new_dev == NULL) + return -ENOBUFS; + + dev_net_set(new_dev, net); + /* need 4 bytes for extra VLAN header info, + * hope the underlying device can handle it. + */ + new_dev->mtu = real_dev->mtu; + new_dev->priv_flags |= (real_dev->priv_flags & IFF_UNICAST_FLT); + new_dev->priv_flags |= IFF_AVM_INTERNAL_VLAN_DEV; + +#if defined(CONFIG_AVMNET_VLAN_MASTER_STAG_8021Q) + vlan_dev_priv(new_dev)->vlan_proto = htons(ETH_P_8021Q); +#else + vlan_dev_priv(new_dev)->vlan_proto = htons(ETH_P_8021AD); +#endif + vlan_dev_priv(new_dev)->vlan_id = vlan_id; + vlan_dev_priv(new_dev)->real_dev = real_dev; + vlan_dev_priv(new_dev)->dent = NULL; + vlan_dev_priv(new_dev)->flags = VLAN_FLAG_REORDER_HDR; new_dev->rtnl_link_ops = &vlan_link_ops; err = register_vlan_dev(new_dev); if (err < 0) goto out_free_newdev; + if(vlan_dev != NULL){ + *vlan_dev = new_dev; + } + return 0; out_free_newdev: @@ -278,6 +349,7 @@ return err; } + static void vlan_sync_address(struct net_device *dev, struct net_device *vlandev) {