--- zzzz-none-000/linux-4.9.279/net/8021q/vlan.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/net/8021q/vlan.c 2023-02-08 11:43:43.000000000 +0000 @@ -37,6 +37,9 @@ #include #include +#ifdef CONFIG_TI_PACKET_PROCESSOR +#include +#endif /* CONFIG_TI_PACKET_PROCESSOR */ #include "vlan.h" #include "vlanproc.h" @@ -87,7 +90,9 @@ vlan_info = rtnl_dereference(real_dev->vlan_info); BUG_ON(!vlan_info); - +#ifdef CONFIG_TI_PACKET_PROCESSOR + ti_hil_pp_event(TI_VLAN_DEV_DELETED, (void *)dev); +#endif /* CONFIG_TI_PACKET_PROCESSOR */ grp = &vlan_info->grp; grp->nr_vlan_devs--; @@ -185,6 +190,12 @@ vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, dev); grp->nr_vlan_devs++; +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* Packet processor info needs to be copied from the base interface to the + * new VLAN interface in order to support acceleration on VLAN interface */ + ti_hil_clone_netdev_pp_info(dev, real_dev); + ti_hil_pp_event(TI_VLAN_DEV_CREATED, (void *)dev); +#endif return 0; out_unregister_netdev: @@ -268,7 +279,6 @@ err = register_vlan_dev(new_dev); if (err < 0) goto out_free_newdev; - return 0; out_free_newdev: @@ -277,6 +287,70 @@ return err; } +/*------------------------------------------------------------------------------------------*\ +AVM/TKL: AVMNET VLAN extension +\*------------------------------------------------------------------------------------------*/ +int avm_register_vlan_device(struct net_device *real_dev, uint16_t vlan_id, const 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, + NET_NAME_UNKNOWN, 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: + free_netdev(new_dev); + return err; +} + static void vlan_sync_address(struct net_device *dev, struct net_device *vlandev) {