From owner-p4-projects@FreeBSD.ORG Sat Mar 15 22:48:13 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1F8671065671; Sat, 15 Mar 2008 22:48:13 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D050E106566C for ; Sat, 15 Mar 2008 22:48:12 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D336B8FC19 for ; Sat, 15 Mar 2008 22:48:12 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m2FMmC9M085984 for ; Sat, 15 Mar 2008 22:48:12 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m2FMmCMc085982 for perforce@freebsd.org; Sat, 15 Mar 2008 22:48:12 GMT (envelope-from sam@freebsd.org) Date: Sat, 15 Mar 2008 22:48:12 GMT Message-Id: <200803152248.m2FMmCMc085982@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 137807 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Mar 2008 22:48:13 -0000 http://perforce.freebsd.org/chv.cgi?CH=137807 Change 137807 by sam@sam_ebb on 2008/03/15 22:47:59 fill in missing bits to merge vap's multicast lists into a single list for the parent device and call the update method to notify the driver it should push the result; note this is prone with terrible hackery to workaround bogosity in the ifnet code and we still pay a terrible price as we must rebuild the parent's mcast list from scratch each time as we have no context to know how to optimize work Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211_ioctl.c#43 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211_ioctl.c#43 (text+ko) ==== @@ -3143,12 +3143,44 @@ return error; } +/* + * Rebuild the parent's multicast address list after an add/del + * of a multicast address for a vap. We have no way to tell + * what happened above to optimize the work so we purge the entire + * list and rebuild from scratch. This is way expensive. + * Note also the half-baked workaround for if_addmulti calling + * back to the parent device; there's no way to insert mcast + * entries quietly and/or cheaply. + */ +static void +ieee80211_ioctl_updatemulti(struct ieee80211com *ic) +{ + struct ifnet *parent = ic->ic_ifp; + struct ieee80211vap *vap; + void *ioctl; + + IEEE80211_LOCK(ic); + if_purgemaddrs(parent); + ioctl = parent->if_ioctl; /* XXX WAR if_allmulti */ + parent->if_ioctl = NULL; + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { + struct ifnet *ifp = vap->iv_ifp; + struct ifmultiaddr *ifma; + + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) + (void) if_addmulti(parent, ifma->ifma_addr, NULL); + } + parent->if_ioctl = ioctl; + IEEE80211_UNLOCK(ic); + + ic->ic_update_mcast(ic->ic_ifp); +} + int ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct ieee80211vap *vap; struct ieee80211com *ic; - struct ifnet *parent; int error = 0; struct ifreq *ifr; struct ifaddr *ifa; /* XXX */ @@ -3193,12 +3225,7 @@ break; case SIOCADDMULTI: case SIOCDELMULTI: - /* XXX merge vap lists into parent */ - parent = vap->iv_ic->ic_ifp; - if (parent->if_drv_flags & IFF_DRV_RUNNING) { - /* XXX propagate multicast address to device */ - error = parent->if_ioctl(parent, cmd, data); - } + ieee80211_ioctl_updatemulti(vap->iv_ic); break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: