From patchwork Tue Aug 7 02:08:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 10558157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2BD841390 for ; Tue, 7 Aug 2018 02:08:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11AA329926 for ; Tue, 7 Aug 2018 02:08:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 058892993F; Tue, 7 Aug 2018 02:08:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,LOCALPART_IN_SUBJECT,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0920329926 for ; Tue, 7 Aug 2018 02:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7u2lCSWXH8ppRFhGf/jIPxDiQm6QO+gJznXaN0F8MoI=; b=IUeLIAKvCHWfls UPmc3dGLIVyJV/o0fSUM2pdcssmHjNRc+kgweHnqZSh9Se32UpG89OKeCmNF522GFvP5sg2zQfWOj AHwRZPzG8qE4X0LgGajfCehGNTyBtLJ3n+gAGlLqYvuMH9Sd4ltYWXLzrZydmmdoQp1xGFgIW3FwI WozDkc7o4er7tCrmwkg0PUR052+xGCbF/rs1oScN1Wu8y3rozQwT8rAIrxm3xXP+BbuU8hmUUG9QZ 1nCe0JdfbOS/MDqtC1i7zGpRj/l3wAicOzmtiLKRDDCgr4t2f0XDq9s+L4BigA3CEArGAeTVlddN3 k1BgGj5VyMA93s9BzldA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmrQL-0006RW-Ni; Tue, 07 Aug 2018 02:08:37 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmrQA-00062P-RV for ath10k@lists.infradead.org; Tue, 07 Aug 2018 02:08:35 +0000 Received: by mail-pf1-x442.google.com with SMTP id l9-v6so7738265pff.9 for ; Mon, 06 Aug 2018 19:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=E9FDia/zb3YD6XT/u32YD7ht8fnT3m7mUhw7Q/+pLQM=; b=RijY+WwKxcu7qyVQ3Fbywrc6WEuDzWgyxZh7+W/89ghIkD8rp7LXOCN/XnCjNl8AGj myzD/zqyRixHYO+8V69lacAqxsSO8AS+SNlZGFcrpHf8E311l2VmI0Y3IccyDTEHtEZ4 1yp4q2x6mzVNwpqN41ZR3OY6ibbvG54ynstag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=E9FDia/zb3YD6XT/u32YD7ht8fnT3m7mUhw7Q/+pLQM=; b=FTnABSVpbv4QohpZwM9fMfE2rEN1LcDDShmIqvqReeN990Zayxu9yv41hQq+BxDHNC FaMfAwp8YGMWBNdtDTbZa8xE+INehbnAsju3l/vTtL5EidLf7wqXANIh5w8xgqLXYagR o7rjbSsmWq932Z2Nuo1U/B7IyyG5WAuQ/SQY9qPvk/3uSNCfDIAXwIr+Cw57gua9RZZc jzk2Fp6vPGaDMV54wgmUuCooeq6qrtatIVk/5qCemMizyHeT5f/mwO96cA8eOP+xK9me KL0/aephCjiK5LUdMXRDLWeSkFQ9a8GoXFDRmoGfwl5KHd+HQfLfEzzcWJt6JHrZy2hV cbhg== X-Gm-Message-State: AOUpUlE+ibsMgsAxhBIksxGkEum15/8WqqBmuvPtQ7se4mdPOV6xV7UO axhQwRltOS0+gibtWKjMrJPwj+4bY4g= X-Google-Smtp-Source: AAOMgpfMn5aGVNeuOPjO1xPHb1Fl5JTBzHCkM593gC97CsHVMOfcMBOnFyYkfLFK63SJBBoL6Uh2jw== X-Received: by 2002:a62:a649:: with SMTP id t70-v6mr19722539pfe.149.1533607698260; Mon, 06 Aug 2018 19:08:18 -0700 (PDT) Received: from ban.mtv.corp.google.com ([2620:15c:202:1:299d:6b87:5478:d28a]) by smtp.gmail.com with ESMTPSA id v7-v6sm56305pgh.57.2018.08.06.19.08.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Aug 2018 19:08:16 -0700 (PDT) Date: Mon, 6 Aug 2018 19:08:14 -0700 From: Brian Norris To: ath10k@lists.infradead.org Subject: ath10k: antenna bitmask support? Message-ID: <20180807020813.GA185137@ban.mtv.corp.google.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1+48 (1f3a9df87d11) (2018-07-22) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180806_190827_583730_78C06FEE X-CRM114-Status: GOOD ( 12.86 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all, I'm looking at ancient changes like this: commit 5572a95b4b5768187652a346356e39e7542ca6e0 Author: Ben Greear Date: Mon Nov 24 16:22:10 2014 +0200 ath10k: apply chainmask settings to vdev on creation since I see that some firmwares seem to crash a lot if you apply certain chainmask settings (e.g., 0x2). Is it really expected that you can set gaps in the chainmask or not? I ask because I've been trying to use this for doing some antenna configuration verification (e.g., disable all but one antenna and see what happens), and this works as expected on APs I have running IPQ8064 (QCA988X?), but it crashes the firmware on IPQ4019. I similarly wonder about this opinionated statement in ath10k_check_chain_mask(): /* It is not clear that allowing gaps in chainmask * is helpful. Probably it will not do what user * is hoping for, so warn in that case. */ It seems like we should reject unexpected values (-EINVAL) if they're really not supported. But then, I've found differences depending on the chipset it would seem, so I guess I'd have to figure out which chipsets (or firmwares?) support which features... On a related note, if we *do* support "gaps" in these bitmasks, wouldn't that mean we're handling 0x6, 0xa, etc., incorrectly in get_nss_from_chainmask()? My prototype patch (untested so far) would be: diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 836e0a47b94a..3b557d3dc036 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -19,6 +19,7 @@ #include "mac.h" #include +#include #include #include @@ -4905,13 +4906,7 @@ static int ath10k_config(struct ieee80211_hw *hw, u32 changed) static u32 get_nss_from_chainmask(u16 chain_mask) { - if ((chain_mask & 0xf) == 0xf) - return 4; - else if ((chain_mask & 0x7) == 0x7) - return 3; - else if ((chain_mask & 0x3) == 0x3) - return 2; - return 1; + return max_t(u32, hweight16(chain_mask & 0xf), 1); } static int ath10k_mac_set_txbf_conf(struct ath10k_vif *arvif)