From owner-svn-src-head@FreeBSD.ORG Tue Jan 5 23:00:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EF82106566C; Tue, 5 Jan 2010 23:00:00 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D85418FC15; Tue, 5 Jan 2010 22:59:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o05Mxx6k039073; Tue, 5 Jan 2010 22:59:59 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o05MxxGB039071; Tue, 5 Jan 2010 22:59:59 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201001052259.o05MxxGB039071@svn.freebsd.org> From: Rui Paulo Date: Tue, 5 Jan 2010 22:59:59 +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: r201620 - head/sys/dev/if_ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2010 23:00:00 -0000 Author: rpaulo Date: Tue Jan 5 22:59:59 2010 New Revision: 201620 URL: http://svn.freebsd.org/changeset/base/201620 Log: Add net80211 media status reporting. PR: 142197 Submitted by: Paul Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Tue Jan 5 22:53:20 2010 (r201619) +++ head/sys/dev/if_ndis/if_ndis.c Tue Jan 5 22:59:59 2010 (r201620) @@ -189,6 +189,7 @@ static int ndis_set_offload (struct ndis static void ndis_getstate_80211 (struct ndis_softc *); static void ndis_setstate_80211 (struct ndis_softc *); static void ndis_auth_and_assoc (struct ndis_softc *, struct ieee80211vap *); +static void ndis_media_status (struct ifnet *, struct ifmediareq *); static int ndis_set_cipher (struct ndis_softc *, int); static int ndis_set_wpa (struct ndis_softc *, void *, int); static int ndis_add_key (struct ieee80211vap *, @@ -993,7 +994,7 @@ ndis_vap_create(struct ieee80211com *ic, vap->iv_newstate = ndis_newstate; /* complete setup */ - ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); + ieee80211_vap_attach(vap, ieee80211_media_change, ndis_media_status); ic->ic_opmode = opmode; /* install key handing routines */ vap->iv_key_set = ndis_add_key; @@ -2237,6 +2238,23 @@ ndis_set_wpa(sc, ie, ielen) } static void +ndis_media_status(struct ifnet *ifp, struct ifmediareq *imr) +{ + struct ieee80211vap *vap = ifp->if_softc; + struct ndis_softc *sc = vap->iv_ic->ic_ifp->if_softc; + uint32_t txrate; + size_t len; + + if (!NDIS_INITIALIZED(sc)) + return; + + len = sizeof(txrate); + if (ndis_get_info(sc, OID_GEN_LINK_SPEED, &txrate, &len) == 0) + vap->iv_bss->ni_txrate = txrate / 5000; + ieee80211_media_status(ifp, imr); +} + +static void ndis_setstate_80211(sc) struct ndis_softc *sc; { @@ -2696,13 +2714,6 @@ ndis_getstate_80211(sc) bs->nwbx_ssid.ns_ssidlen); ni->ni_esslen = bs->nwbx_ssid.ns_ssidlen; - len = sizeof(arg); - rval = ndis_get_info(sc, OID_GEN_LINK_SPEED, &arg, &len); - if (rval) - device_printf(sc->ndis_dev, "get link speed failed: %d\n", - rval); - ni->ni_txrate = arg / 5000; - if (ic->ic_caps & IEEE80211_C_PMGT) { len = sizeof(arg); rval = ndis_get_info(sc, OID_802_11_POWER_MODE, &arg, &len);