Date: Tue, 5 Jan 2010 22:59:59 +0000 (UTC) From: Rui Paulo <rpaulo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r201620 - head/sys/dev/if_ndis Message-ID: <201001052259.o05MxxGB039071@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <onemda at gmail.com> 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001052259.o05MxxGB039071>