From owner-svn-src-head@FreeBSD.ORG Wed Nov 13 07:09:01 2013 Return-Path: Delivered-To: svn-src-head@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 9550B1B2; Wed, 13 Nov 2013 07:09:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6B451291A; Wed, 13 Nov 2013 07:09:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAD79134009352; Wed, 13 Nov 2013 07:09:01 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAD791np009351; Wed, 13 Nov 2013 07:09:01 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201311130709.rAD791np009351@svn.freebsd.org> From: Adrian Chadd Date: Wed, 13 Nov 2013 07:09:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258085 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.16 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: Wed, 13 Nov 2013 07:09:01 -0000 Author: adrian Date: Wed Nov 13 07:09:00 2013 New Revision: 258085 URL: http://svnweb.freebsd.org/changeset/base/258085 Log: Correctly initialise the 2-chain antenna mask in the link quality table. The previous code simply hard-coded IWN_ANT_AB which is only correct for some of the NICs. Now, if the NIC is a 1-stream TX, you need to set IWN_ANT_AB and _not_ just a single antenna. The Intel 5100 firmware panics the moment the link quality table is updated. So! * no secondary antenna? Set it to IWN_ANT_AB; * two-stream device? Transmit on the full transmit antenna configuration. Tested: * Intel 5100, STA * Intel 2200 (eadler) Obtained from: Linux iwlwifi Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Wed Nov 13 05:25:49 2013 (r258084) +++ head/sys/dev/iwn/if_iwn.c Wed Nov 13 07:09:00 2013 (r258085) @@ -4788,11 +4788,49 @@ iwn_set_link_quality(struct iwn_softc *s memset(&linkq, 0, sizeof linkq); linkq.id = wn->id; linkq.antmsk_1stream = txant; - linkq.antmsk_2stream = IWN_ANT_AB; + + /* + * The '2 stream' setup is a bit .. odd. + * + * For NICs that support only 1 antenna, default to IWN_ANT_AB or + * the firmware panics (eg Intel 5100.) + * + * For NICs that support two antennas, we use ANT_AB. + * + * For NICs that support three antennas, we use the two that + * wasn't the default one. + * + * XXX TODO: if bluetooth (full concurrent) is enabled, restrict + * this to only one antenna. + */ + + /* So - if there's no secondary antenna, assume IWN_ANT_AB */ + + /* Default - transmit on the other antennas */ + linkq.antmsk_2stream = (sc->txchainmask & ~IWN_LSB(sc->txchainmask)); + + /* Now, if it's zero, set it to IWN_ANT_AB, so to not panic firmware */ + if (linkq.antmsk_2stream == 0) + linkq.antmsk_2stream = IWN_ANT_AB; + + /* + * If the NIC is a two-stream TX NIC, configure the TX mask to + * the default chainmask + */ + else if (sc->ntxchains == 2) + linkq.antmsk_2stream = sc->txchainmask; + linkq.ampdu_max = 32; /* XXX negotiated? */ linkq.ampdu_threshold = 3; linkq.ampdu_limit = htole16(4000); /* 4ms */ + DPRINTF(sc, IWN_DEBUG_XMIT, + "%s: 1stream antenna=0x%02x, 2stream antenna=0x%02x, ntxstreams=%d\n", + __func__, + linkq.antmsk_1stream, + linkq.antmsk_2stream, + sc->ntxchains); + /* * Are we using 11n rates? Ensure the channel is * 11n _and_ we have some 11n rates, or don't