From owner-svn-src-all@FreeBSD.ORG Sat Oct 25 23:31:20 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1A661065674; Sat, 25 Oct 2008 23:31:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A076D8FC08; Sat, 25 Oct 2008 23:31:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9PNVKnx060339; Sat, 25 Oct 2008 23:31:20 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9PNVK8Z060338; Sat, 25 Oct 2008 23:31:20 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200810252331.m9PNVK8Z060338@svn.freebsd.org> From: Sam Leffler Date: Sat, 25 Oct 2008 23:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184273 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2008 23:31:20 -0000 Author: sam Date: Sat Oct 25 23:31:20 2008 New Revision: 184273 URL: http://svn.freebsd.org/changeset/base/184273 Log: o add support for ifconfig wlanX mode foo o yank useless code for setting fixed rate through media opts: this mechanism didn't scale to HT rates and couldn't handle multiple bands; fixed tx rates are set with the IEEE80211_IOC_TXPARAMS ioctl Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sat Oct 25 23:28:24 2008 (r184272) +++ head/sys/net80211/ieee80211.c Sat Oct 25 23:31:20 2008 (r184273) @@ -1065,8 +1065,7 @@ ieee80211_announce_channels(struct ieee8 } 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: @@ -1099,7 +1098,7 @@ media2mode(const struct ieee80211com *ic */ 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; @@ -1113,51 +1112,12 @@ media2mode(const struct ieee80211com *ic } /* - * 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; } /* @@ -1168,26 +1128,12 @@ ieee80211_media_change(struct ifnet *ifp { 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;