From owner-freebsd-wireless@FreeBSD.ORG Thu Mar 6 07:41:55 2014 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 59C537B0 for ; Thu, 6 Mar 2014 07:41:55 +0000 (UTC) Received: from mail-qc0-x232.google.com (mail-qc0-x232.google.com [IPv6:2607:f8b0:400d:c01::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1772CA60 for ; Thu, 6 Mar 2014 07:41:55 +0000 (UTC) Received: by mail-qc0-f178.google.com with SMTP id i8so2434260qcq.23 for ; Wed, 05 Mar 2014 23:41:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=ldyWLXzqkkzA7UL1/4jF2pgJsdPtct9ZUuGe9dlHFpk=; b=alu8/dCtutz0wAK5XQxH2rCoofgXIhWDEz1CNaREXULZP3gmrGbLIV7YdUBOXiv63E yvsV3qUgtDD6Pb2a+pdqTcE9KWL/MmKpMymEhoO/OnVKKIrjEeAFKNVKj4V2ePWym05Q LYNPH8gJU2Z4lpYwrsEWCW9nDHCnfWBLHNGlrCQHB00kXmx7u4l8myYWqCPZkqVi0LqM DO1gvMJYZjtyam7anNpSsesfkNaCQ539IQPePwgWnt8hxR1enu5sJSOTfyUuY+cIr1Cw 2zNgckETRE492Gkc3M+TbYM3ojCzIk9tkHZiEtsFuW9c4nqYdWAvJHiDdM7baFOgYH5y ppig== MIME-Version: 1.0 X-Received: by 10.140.42.138 with SMTP id c10mr11652447qga.24.1394091714210; Wed, 05 Mar 2014 23:41:54 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.8.137 with HTTP; Wed, 5 Mar 2014 23:41:54 -0800 (PST) In-Reply-To: <53182646.3010004@shurik.kiev.ua> References: <201403040801.s2481uAc088743@svn.freebsd.org> <53182646.3010004@shurik.kiev.ua> Date: Wed, 5 Mar 2014 23:41:54 -0800 X-Google-Sender-Auth: sl0tyreFPJR57j_rIa50E7XiLVQ Message-ID: Subject: Re: Fwd: svn commit: r262729 - head/sys/dev/iwn From: Adrian Chadd To: Alexandr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-wireless@freebsd.org" X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Mar 2014 07:41:55 -0000 Your intel 2230 problems aren't calibration related. My intel 2230 and intel 2200 both work fine everywhere I use them, but I don't have a laptop with it in there all the time. -a On 5 March 2014 23:39, Alexandr wrote: > My 2230 still not working in 11n > > 04.03.2014 10:09, Adrian Chadd =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> If you have a Centrino 100, 2200, 2230, then please update to the >> latest -HEAD. This may fix some calibration issues. >> >> >> -a >> >> >> >> ---------- Forwarded message ---------- >> From: Adrian Chadd >> Date: 4 March 2014 00:01 >> Subject: svn commit: r262729 - head/sys/dev/iwn >> To: src-committers@freebsd.org, svn-src-all@freebsd.org, >> svn-src-head@freebsd.org >> >> >> Author: adrian >> Date: Tue Mar 4 08:01:56 2014 >> New Revision: 262729 >> URL: http://svnweb.freebsd.org/changeset/base/262729 >> >> Log: >> Handle the newer-style bluetooth message format from the (at least) >> Centrino 2230 firmware. >> >> This fixes the general statistics block to be actually valid. >> >> I've verified this by contrasting the output of iwnstats before and >> after the change. The general block is now correct. >> >> Tested: >> >> * Intel 5100 (old format stats message) >> * Intel 2230 (new format stats message) >> >> Modified: >> head/sys/dev/iwn/if_iwn.c >> >> Modified: head/sys/dev/iwn/if_iwn.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/dev/iwn/if_iwn.c Tue Mar 4 06:55:54 2014 (r262728= ) >> +++ head/sys/dev/iwn/if_iwn.c Tue Mar 4 08:01:56 2014 (r262729= ) >> @@ -685,6 +685,13 @@ iwn_attach(device_t dev) >> goto fail; >> } >> >> +#if 0 >> + device_printf(sc->sc_dev, "%s: rx_stats=3D%d, rx_stats_bt=3D%d\n= ", >> + __func__, >> + sizeof(struct iwn_stats), >> + sizeof(struct iwn_stats_bt)); >> +#endif >> + >> if (bootverbose) >> ieee80211_announce(ic); >> DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__); >> @@ -3143,11 +3150,62 @@ iwn5000_rx_calib_results(struct iwn_soft >> >> static void >> iwn_stats_update(struct iwn_softc *sc, struct iwn_calib_state *calib, >> - struct iwn_stats *stats) >> + struct iwn_stats *stats, int len) >> { >> + struct iwn_stats_bt *stats_bt; >> + struct iwn_stats *lstats; >> + >> + /* >> + * First - check whether the length is the bluetooth or normal. >> + * >> + * If it's normal - just copy it and bump out. >> + * Otherwise we have to convert things. >> + */ >> + >> + if (len =3D=3D sizeof(struct iwn_stats) + 4) { >> + memcpy(&sc->last_stat, stats, sizeof(struct iwn_stats)); >> + sc->last_stat_valid =3D 1; >> + return; >> + } >> >> - /* XXX lock assert */ >> - memcpy(&sc->last_stat, stats, sizeof(struct iwn_stats)); >> + /* >> + * If it's not the bluetooth size - log, then just copy. >> + */ >> + if (len !=3D sizeof(struct iwn_stats_bt) + 4) { >> + DPRINTF(sc, IWN_DEBUG_STATS, >> + "%s: size of rx statistics (%d) not an expected size= !\n", >> + __func__, >> + len); >> + memcpy(&sc->last_stat, stats, sizeof(struct iwn_stats)); >> + sc->last_stat_valid =3D 1; >> + return; >> + } >> + >> + /* >> + * Ok. Time to copy. >> + */ >> + stats_bt =3D (struct iwn_stats_bt *) stats; >> + lstats =3D &sc->last_stat; >> + >> + /* flags */ >> + lstats->flags =3D stats_bt->flags; >> + /* rx_bt */ >> + memcpy(&lstats->rx.ofdm, &stats_bt->rx_bt.ofdm, >> + sizeof(struct iwn_rx_phy_stats)); >> + memcpy(&lstats->rx.cck, &stats_bt->rx_bt.cck, >> + sizeof(struct iwn_rx_phy_stats)); >> + memcpy(&lstats->rx.general, &stats_bt->rx_bt.general_bt.common, >> + sizeof(struct iwn_rx_general_stats)); >> + memcpy(&lstats->rx.ht, &stats_bt->rx_bt.ht, >> + sizeof(struct iwn_rx_ht_phy_stats)); >> + /* tx */ >> + memcpy(&lstats->tx, &stats_bt->tx, >> + sizeof(struct iwn_tx_stats)); >> + /* general */ >> + memcpy(&lstats->general, &stats_bt->general, >> + sizeof(struct iwn_general_stats)); >> + >> + /* XXX TODO: Squirrel away the extra bluetooth stats somewhere *= / >> sc->last_stat_valid =3D 1; >> } >> >> @@ -3165,6 +3223,7 @@ iwn_rx_statistics(struct iwn_softc *sc, >> struct ieee80211vap *vap =3D TAILQ_FIRST(&ic->ic_vaps); >> struct iwn_calib_state *calib =3D &sc->calib; >> struct iwn_stats *stats =3D (struct iwn_stats *)(desc + 1); >> + struct iwn_stats *lstats; >> int temp; >> >> DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__); >> @@ -3179,15 +3238,26 @@ iwn_rx_statistics(struct iwn_softc *sc, >> >> bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTRE= AD); >> >> - DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: received statistics, cmd %= d\n", >> - __func__, desc->type); >> + DPRINTF(sc, IWN_DEBUG_CALIBRATE | IWN_DEBUG_STATS, >> + "%s: received statistics, cmd %d, len %d\n", >> + __func__, desc->type, le16toh(desc->len)); >> sc->calib_cnt =3D 0; /* Reset TX power calibration timeout.= */ >> >> - /* Collect/track general statistics for reporting */ >> - iwn_stats_update(sc, calib, stats); >> + /* >> + * Collect/track general statistics for reporting. >> + * >> + * This takes care of ensuring that the bluetooth sized message >> + * will be correctly converted to the legacy sized message. >> + */ >> + iwn_stats_update(sc, calib, stats, le16toh(desc->len)); >> + >> + /* >> + * And now, let's take a reference of it to use! >> + */ >> + lstats =3D &sc->last_stat; >> >> /* Test if temperature has changed. */ >> - if (stats->general.temp !=3D sc->rawtemp) { >> + if (lstats->general.temp !=3D sc->rawtemp) { >> /* Convert "raw" temperature to degC. */ >> sc->rawtemp =3D stats->general.temp; >> temp =3D ops->get_temperature(sc); >> @@ -3202,25 +3272,25 @@ iwn_rx_statistics(struct iwn_softc *sc, >> if (desc->type !=3D IWN_BEACON_STATISTICS) >> return; /* Reply to a statistics request. */ >> >> - sc->noise =3D iwn_get_noise(&stats->rx.general); >> + sc->noise =3D iwn_get_noise(&lstats->rx.general); >> DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: noise %d\n", __func__, sc-= >noise); >> >> /* Test that RSSI and noise are present in stats report. */ >> - if (le32toh(stats->rx.general.flags) !=3D 1) { >> + if (le32toh(lstats->rx.general.flags) !=3D 1) { >> DPRINTF(sc, IWN_DEBUG_ANY, "%s\n", >> "received statistics without RSSI"); >> return; >> } >> >> if (calib->state =3D=3D IWN_CALIB_STATE_ASSOC) >> - iwn_collect_noise(sc, &stats->rx.general); >> + iwn_collect_noise(sc, &lstats->rx.general); >> else if (calib->state =3D=3D IWN_CALIB_STATE_RUN) { >> - iwn_tune_sensitivity(sc, &stats->rx); >> + iwn_tune_sensitivity(sc, &lstats->rx); >> /* >> * XXX TODO: Only run the RX recovery if we're associate= d! >> */ >> - iwn_check_rx_recovery(sc, stats); >> - iwn_save_stats_counters(sc, stats); >> + iwn_check_rx_recovery(sc, lstats); >> + iwn_save_stats_counters(sc, lstats); >> } >> >> DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__); >> _______________________________________________ >> freebsd-wireless@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-wireless >> To unsubscribe, send any mail to "freebsd-wireless-unsubscribe@freebsd.o= rg" > > _______________________________________________ > freebsd-wireless@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-wireless > To unsubscribe, send any mail to "freebsd-wireless-unsubscribe@freebsd.or= g"