--- src/sys/net/vlan/if_vlan.c 2008/06/24 11:40:56 1.36 +++ src/sys/net/vlan/if_vlan.c 2008/07/27 10:06:57 1.37 @@ -134,11 +134,7 @@ static void vlan_ifdetach(void *, struct static void vlan_init(void *); static void vlan_start(struct ifnet *); static int vlan_ioctl(struct ifnet *, u_long, caddr_t, struct ucred *); - -static int vlan_input(struct mbuf *m, struct mbuf_chain *); -#ifdef ETHER_INPUT2 static void vlan_input2(struct mbuf *); -#endif static void vlan_clrmulti(struct ifvlan *, struct ifnet *); static int vlan_setmulti(struct ifvlan *, struct ifnet *); @@ -254,12 +250,7 @@ vlan_modevent(module_t mod, int type, vo switch (type) { case MOD_LOAD: LIST_INIT(&ifv_list); - vlan_input_p = vlan_input; -#ifdef ETHER_INPUT2 vlan_input2_p = vlan_input2; -#else - vlan_input2_p = NULL; -#endif vlan_ifdetach_cookie = EVENTHANDLER_REGISTER(ifnet_detach_event, vlan_ifdetach, NULL, @@ -269,7 +260,6 @@ vlan_modevent(module_t mod, int type, vo case MOD_UNLOAD: if_clone_detach(&vlan_cloner); - vlan_input_p = NULL; vlan_input2_p = NULL; EVENTHANDLER_DEREGISTER(ifnet_detach_event, vlan_ifdetach_cookie); @@ -453,66 +443,6 @@ vlan_start(struct ifnet *ifp) } } -static int -vlan_input(struct mbuf *m, struct mbuf_chain *chain) -{ - struct ifvlan *ifv = NULL; - struct ifnet *rcvif; - struct vlan_trunk *vlantrunks; - struct vlan_entry *entry; - - rcvif = m->m_pkthdr.rcvif; - ASSERT_SERIALIZED(rcvif->if_serializer); - KKASSERT(m->m_flags & M_VLANTAG); - - vlantrunks = rcvif->if_vlantrunks; - if (vlantrunks == NULL) { - rcvif->if_noproto++; - m_freem(m); - return -1; - } - - crit_enter(); - LIST_FOREACH(entry, &vlantrunks[mycpuid].vlan_list, ifv_link) { - if (entry->ifv->ifv_tag == - EVL_VLANOFTAG(m->m_pkthdr.ether_vlantag)) { - ifv = entry->ifv; - break; - } - } - crit_exit(); - - /* - * Packet is discarded if: - * - no corresponding vlan(4) interface - * - vlan(4) interface has not been completely set up yet, - * or is being destroyed (ifv->ifv_p != rcvif) - * - vlan(4) interface is not brought up - */ - if (ifv == NULL || ifv->ifv_p != rcvif || - (ifv->ifv_if.if_flags & IFF_UP) == 0) { - rcvif->if_noproto++; - m_freem(m); - return -1; /* so ether_input can take note */ - } - - /* - * Clear M_VLANTAG, before the packet is handed to - * vlan(4) interface - */ - m->m_flags &= ~M_VLANTAG; - - ifv->ifv_if.if_ipackets++; - lwkt_serialize_exit(rcvif->if_serializer); - lwkt_serialize_enter(ifv->ifv_if.if_serializer); - ether_input_chain(&ifv->ifv_if, m, chain); - lwkt_serialize_exit(ifv->ifv_if.if_serializer); - lwkt_serialize_enter(rcvif->if_serializer); - return 0; -} - -#ifdef ETHER_INPUT2 - static void vlan_input2(struct mbuf *m) { @@ -583,8 +513,6 @@ vlan_input2(struct mbuf *m) ether_input_oncpu(ifp, m); } -#endif /* ETHER_INPUT2 */ - static void vlan_link_dispatch(struct netmsg *nmsg) { @@ -783,16 +711,13 @@ vlan_unlink(struct ifvlan *ifv, struct i crit_enter(); if (LIST_EMPTY(&vlantrunks[mycpuid].vlan_list)) { -#ifdef notyet ifp_p->if_vlantrunks = NULL; + + /* + * Make that all protocol threads see if_vlantrunks change. + */ netmsg_service_sync(); kfree(vlantrunks, M_VLAN); -#else - lwkt_serialize_enter(ifp_p->if_serializer); - kfree(ifp_p->if_vlantrunks, M_VLAN); - ifp_p->if_vlantrunks = NULL; - lwkt_serialize_exit(ifp_p->if_serializer); -#endif } crit_exit(); }