All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: ath10k@lists.infradead.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: ath10k: antenna bitmask support?
Date: Mon, 6 Aug 2018 19:08:14 -0700	[thread overview]
Message-ID: <20180807020813.GA185137@ban.mtv.corp.google.com> (raw)

Hi all,

I'm looking at ancient changes like this:

commit 5572a95b4b5768187652a346356e39e7542ca6e0
Author: Ben Greear <greearb@candelatech.com>
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 <net/mac80211.h>
+#include <linux/bitops.h>
 #include <linux/etherdevice.h>
 #include <linux/acpi.h>
 
@@ -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)

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

             reply	other threads:[~2018-08-07  2:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07  2:08 Brian Norris [this message]
2018-08-07  4:11 ` ath10k: antenna bitmask support? Sebastian Gottschall
2018-08-07  5:01   ` Brian Norris
2018-08-07  7:22     ` Sebastian Gottschall
2018-08-07 18:01       ` Brian Norris
2018-08-07 13:19 ` Ben Greear
2018-08-07 17:52   ` Brian Norris
2018-08-07 18:18     ` Ben Greear

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180807020813.GA185137@ban.mtv.corp.google.com \
    --to=briannorris@chromium.org \
    --cc=ath10k@lists.infradead.org \
    --cc=greearb@candelatech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.