| 824 | extern void (*vlan_link_state_p)(struct ifnet *); |
| 825 | |
| 826 | static int |
| 827 | vlan_modevent(module_t mod, int type, void *data) |
| 828 | { |
| 829 | |
| 830 | switch (type) { |
| 831 | case MOD_LOAD: |
| 832 | ifdetach_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, |
| 833 | vlan_ifdetach, NULL, EVENTHANDLER_PRI_ANY); |
| 834 | if (ifdetach_tag == NULL) |
| 835 | return (ENOMEM); |
| 836 | iflladdr_tag = EVENTHANDLER_REGISTER(iflladdr_event, |
| 837 | vlan_iflladdr, NULL, EVENTHANDLER_PRI_ANY); |
| 838 | if (iflladdr_tag == NULL) |
| 839 | return (ENOMEM); |
| 840 | VLAN_LOCKING_INIT(); |
| 841 | vlan_input_p = vlan_input; |
| 842 | vlan_link_state_p = vlan_link_state; |
| 843 | vlan_trunk_cap_p = vlan_trunk_capabilities; |
| 844 | vlan_trunkdev_p = vlan_trunkdev; |
| 845 | vlan_cookie_p = vlan_cookie; |
| 846 | vlan_setcookie_p = vlan_setcookie; |
| 847 | vlan_tag_p = vlan_tag; |
| 848 | vlan_pcp_p = vlan_pcp; |
| 849 | vlan_devat_p = vlan_devat; |
| 850 | #ifndef VIMAGE |
| 851 | vlan_cloner = if_clone_advanced(vlanname, 0, vlan_clone_match, |
| 852 | vlan_clone_create, vlan_clone_destroy); |
| 853 | #endif |
| 854 | if (bootverbose) |
| 855 | printf("vlan: initialized, using " |
| 856 | #ifdef VLAN_ARRAY |
| 857 | "full-size arrays" |
| 858 | #else |
| 859 | "hash tables with chaining" |
| 860 | #endif |
| 861 | |
| 862 | "\n"); |
| 863 | break; |
| 864 | case MOD_UNLOAD: |
| 865 | #ifndef VIMAGE |
| 866 | if_clone_detach(vlan_cloner); |
| 867 | #endif |
| 868 | EVENTHANDLER_DEREGISTER(ifnet_departure_event, ifdetach_tag); |
| 869 | EVENTHANDLER_DEREGISTER(iflladdr_event, iflladdr_tag); |
| 870 | vlan_input_p = NULL; |
| 871 | vlan_link_state_p = NULL; |
| 872 | vlan_trunk_cap_p = NULL; |
| 873 | vlan_trunkdev_p = NULL; |
| 874 | vlan_tag_p = NULL; |
| 875 | vlan_cookie_p = NULL; |
| 876 | vlan_setcookie_p = NULL; |
| 877 | vlan_devat_p = NULL; |
| 878 | VLAN_LOCKING_DESTROY(); |
| 879 | if (bootverbose) |
| 880 | printf("vlan: unloaded\n"); |
| 881 | break; |
| 882 | default: |
| 883 | return (EOPNOTSUPP); |
nothing calls this directly
no test coverage detected