--- zzzz-none-000/linux-5.15.111/net/8021q/vlan.c 2023-05-11 14:00:40.000000000 +0000 +++ puma7-atom-6670-761/linux-5.15.111/net/8021q/vlan.c 2024-02-07 10:23:29.000000000 +0000 @@ -33,6 +33,9 @@ #include #include +#ifdef CONFIG_TI_PACKET_PROCESSOR +#include +#endif /* CONFIG_TI_PACKET_PROCESSOR */ #include "vlan.h" #include "vlanproc.h" @@ -98,7 +101,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--; @@ -193,6 +198,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: @@ -277,7 +288,6 @@ err = register_vlan_dev(new_dev, NULL); if (err < 0) goto out_free_newdev; - return 0; out_free_newdev: @@ -285,6 +295,69 @@ 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, NULL); +#else + err = vlan_check_real_dev(real_dev, htons(ETH_P_8021AD), vlan_id, NULL); +#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); + +#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, NULL); + 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) {