From owner-p4-projects@FreeBSD.ORG Thu Oct 23 19:25:01 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 62705106569A; Thu, 23 Oct 2008 19:25:01 +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 262BB1065685 for ; Thu, 23 Oct 2008 19:25:01 +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 147968FC2A for ; Thu, 23 Oct 2008 19:25:01 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m9NJP0Xc086790 for ; Thu, 23 Oct 2008 19:25:00 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m9NJP0Qo086788 for perforce@freebsd.org; Thu, 23 Oct 2008 19:25:00 GMT (envelope-from sam@freebsd.org) Date: Thu, 23 Oct 2008 19:25:00 GMT Message-Id: <200810231925.m9NJP0Qo086788@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 151821 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: Thu, 23 Oct 2008 19:25:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=151821 Change 151821 by sam@sam_ebb on 2008/10/23 19:24:37 o fill in incomplete media change handling so ifconfig mode 11b (for example) works o remove media change handling of the underyling device; it only tried to handle fixed rates but did it wrong and has been replaced by the per-band tx parameters mechanism As a side-effect ic_curmode is now dead code; just need to update driver use so it can finally be purged. Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211.c#52 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211.c#52 (text+ko) ==== @@ -1063,8 +1063,7 @@ } static int -media2mode(const struct ieee80211com *ic, - const struct ifmedia_entry *ime, enum ieee80211_phymode *mode) +media2mode(const struct ifmedia_entry *ime, uint32_t flags, uint16_t *mode) { switch (IFM_MODE(ime->ifm_media)) { case IFM_IEEE80211_11A: @@ -1097,7 +1096,7 @@ */ if (ime->ifm_media & IFM_IEEE80211_TURBO) { if (*mode == IEEE80211_MODE_11A) { - if (ic->ic_flags & IEEE80211_F_TURBOP) + if (flags & IEEE80211_F_TURBOP) *mode = IEEE80211_MODE_TURBO_A; else *mode = IEEE80211_MODE_STURBO_A; @@ -1111,51 +1110,12 @@ } /* - * Handle a media change request on the underlying - * interface; we accept mode changes only. + * Handle a media change request on the underlying interface. */ int ieee80211com_media_change(struct ifnet *ifp) { - struct ieee80211com *ic = ifp->if_l2com; - struct ifmedia_entry *ime = ic->ic_media.ifm_cur; - enum ieee80211_phymode newphymode; - int error = 0; - - /* - * First, identify the phy mode. - */ - if (!media2mode(ic, ime, &newphymode)) - return EINVAL; - /* NB: mode must be supported, no need to check */ - - /* - * Handle phy mode change. - */ - IEEE80211_LOCK(ic); - if (ic->ic_curmode != newphymode) { /* change phy mode */ - struct ieee80211vap *vap; - - (void) ieee80211_setmode(ic, newphymode); - /* - * Propagate new state to each vap. - */ - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - } - } - IEEE80211_UNLOCK(ic); - return error; -} - -static int -findrate(const struct ieee80211com *ic, enum ieee80211_phymode m, int r) -{ - int i, nrates; - - for (i = 0, nrates = ic->ic_sup_rates[m].rs_nrates; i < nrates; i++) - if ((ic->ic_sup_rates[m].rs_rates[i] & IEEE80211_RATE_VAL) == r) - return i; - return -1; + return EINVAL; } /* @@ -1166,26 +1126,12 @@ { struct ieee80211vap *vap = ifp->if_softc; struct ifmedia_entry *ime = vap->iv_media.ifm_cur; - struct ieee80211com *ic = vap->iv_ic; - int newrate; + uint16_t newmode; - /* XXX this won't work unless ic_curmode is != IEEE80211_MODE_AUTO */ - if (ic->ic_curmode == IEEE80211_MODE_AUTO) + if (!media2mode(ime, vap->iv_flags, &newmode)) return EINVAL; - if (IFM_SUBTYPE(ime->ifm_media) != IFM_AUTO) { - /* - * NB: this can only be used to specify a legacy rate. - */ - newrate = ieee80211_media2rate(ime->ifm_media); - if (newrate == 0) - return EINVAL; - if (findrate(ic, ic->ic_curmode, newrate) == -1) - return EINVAL; - } else { - newrate = IEEE80211_FIXED_RATE_NONE; - } - if (newrate != vap->iv_txparms[ic->ic_curmode].ucastrate) { - vap->iv_txparms[ic->ic_curmode].ucastrate = newrate; + if (vap->iv_des_mode != newmode) { + vap->iv_des_mode = newmode; return ENETRESET; } return 0;