All of lore.kernel.org
 help / color / mirror / Atom feed
* Change the number of active antennas (RF-chains)
@ 2014-09-11  7:37 Okhwan Lee
  2014-09-11 14:21 ` Ben Greear
  0 siblings, 1 reply; 4+ messages in thread
From: Okhwan Lee @ 2014-09-11  7:37 UTC (permalink / raw)
  To: ath10k

Hi,

I have been trying to configure the number of active antennas (not
spatial stream) by using ath10k/QCA9880.

When I use ath9k, we can easily change the number of active antenna by
using REG_WRITE(ah, AR_PHY_RX_CHAINMASK, ah->rxchainmask) function
used in ar9003_hw_set_chain_masks.

However, in ath10k, we failed to handle the values (e.g, rx/tx chain
mask of QCA9880) by using ath10k_wmi_pdev_set_param(ar,
ar->wmi.pdev_param->rx_chain_mask, rx_ant) funcion in used in
__ath10k_set_antenna.

I use debugfs module to configure the parameters and you can find our
code (for both ath9k and ath10k) at the end of this e-mail.
aWe measured  the power consumption of NIC to confirm whether the
codes can change the number of active RF-chains or not.
As you might know, the power consumption is highly depends on the
number of active RF-chains.
In ath9k, the power consumption decreases as the number of active
rf-chains (rx_chainmask, antennas) is decrease.
However, in ath10, we failed to configure the number of active
RF-chains, and the power consumption does not change at all.

If you have any idea on this issue, please let me know.

Thank you.

Okhwan

/********************ath10k/debug.c (this is not work)*********************/

static ssize_t ath10k_read_rx_chainmask(struct file *file,
                                        char __user *user_buf,
                                             size_t count, loff_t *ppos)
{
//      printk(KERN_DEBUG "%s",__FUNCTION__);
        ath10k_dbg(ATH10K_DBG_MAC, "%s -> ",__FUNCTION__);
        struct ath10k *ar = file->private_data;
        char buf[32];
        unsigned int len;

        len = sprintf(buf, "0x%08x\n", ar->cfg_rx_chainmask);
        return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}

static ssize_t ath10k_write_rx_chainmask(struct file *file, const char
__user *user_buf,
                             size_t count, loff_t *ppos)
{
        ath10k_dbg(ATH10K_DBG_MAC, "%s -> ",__FUNCTION__);
        struct ath10k *ar = file->private_data;
        unsigned long mask;
        int ret;

        ret = kstrtoul_from_user(user_buf, count, 0, &mask);
        ath10k_dbg(ATH10K_DBG_MAC, "%s -> mask: 0x%x\n",__FUNCTION__,
(unsigned int)mask);
        if (mask > 0x7){
                ath10k_dbg(ATH10K_DBG_MAC, "%s -> mask: %lu should be
< 7\n",__FUNCTION__, mask);
                return -E2BIG;
        }

        if ((ar->state != ATH10K_STATE_ON) &&
            (ar->state != ATH10K_STATE_RESTARTED)){
                ath10k_dbg(ATH10K_DBG_MAC, "%s -> failed pass state
check stat: %d\n",__FUNCTION__, ar->state);
                ret = 1;
                goto out;
        }

        ath10k_dbg(ATH10K_DBG_MAC, "%s -> start lock\n",__FUNCTION__);
        mutex_lock(&ar->conf_mutex);
        ath10k_dbg(ATH10K_DBG_MAC, "%s -> locked\n",__FUNCTION__);

        ar->cfg_rx_chainmask = mask;

        ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rx_chain_mask,
                                        (u32)mask);
        if (ret) {
                ath10k_warn("failed to set rx-chainmask: %d, req 0x%x\n",
                            ret, (unsigned int)mask);
                goto out;
        }
        ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->tx_chain_mask,
                                        (u32)mask);



        ret = count;
out:
        mutex_unlock(&ar->conf_mutex);

        return ret;
}

static const struct file_operations fops_rx_chainmask = {
        .read = ath10k_read_rx_chainmask,
        .write = ath10k_write_rx_chainmask,
        .open = simple_open,
        .owner = THIS_MODULE,
        .llseek = default_llseek,
};

/*****************************************/


/********************ath9k/debug.c (this is work)*********************/


static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
           size_t count, loff_t *ppos)
{
  printk(KERN_DEBUG “%s”,__FUNCTION__);
  struct ath_softc *sc = file->private_data;
  struct ath_hw *ah = sc->sc_ah;
  char buf[32];
  unsigned int len;


  len = sprintf(buf, “0x%08x\n”, ah->rxchainmask);
  return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}


static ssize_t write_file_rx_chainmask(struct file *file, const char
__user *user_buf,
           size_t count, loff_t *ppos)
{
  printk(KERN_DEBUG “%s”,__FUNCTION__);
  struct ath_softc *sc = file->private_data;
  struct ath_hw *ah = sc->sc_ah;
  unsigned long mask;
  char buf[32];
  ssize_t len;


  len = min(count, sizeof(buf) - 1);
  if (copy_from_user(buf, user_buf, len))
    return -EFAULT;


  buf[len] = ‘\0’;
  if (strict_strtoul(buf, 0, &mask))
    return -EINVAL;


  ah->rxchainmask = mask;
  ah->caps.rx_chainmask = mask;
  ah->eep_ops->fill_eeprom(ah);
  REG_WRITE(ah, AR_PHY_RX_CHAINMASK, ah->rxchainmask);
  REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, ah->rxchainmask);


  return count;
}


/*****************************************/

Sincerely yours,

Okhwan Lee , Ph.D. student
Multimedia & Wireless Networking Lab. (MWNL),
School of Electrical Engineering,
Seoul National University (SNU)

Tel: +82-2-880-1755
Cell: +82-10-4632-1980
URL: http://mwnl.snu.ac.kr/~ohlee

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Change the number of active antennas (RF-chains)
  2014-09-11  7:37 Change the number of active antennas (RF-chains) Okhwan Lee
@ 2014-09-11 14:21 ` Ben Greear
  2014-09-12  3:48   ` Okhwan Lee
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Greear @ 2014-09-11 14:21 UTC (permalink / raw)
  To: Okhwan Lee, ath10k

On 09/11/2014 12:37 AM, Okhwan Lee wrote:
> Hi,
>
> I have been trying to configure the number of active antennas (not
> spatial stream) by using ath10k/QCA9880.
>
> When I use ath9k, we can easily change the number of active antenna by
> using REG_WRITE(ah, AR_PHY_RX_CHAINMASK, ah->rxchainmask) function
> used in ar9003_hw_set_chain_masks.
>
> However, in ath10k, we failed to handle the values (e.g, rx/tx chain
> mask of QCA9880) by using ath10k_wmi_pdev_set_param(ar,
> ar->wmi.pdev_param->rx_chain_mask, rx_ant) funcion in used in
> __ath10k_set_antenna.

Newer kernels should have this support, and it seemed to work in my
testing.  I did not test power consumption.

What kernel version are you using?

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Change the number of active antennas (RF-chains)
  2014-09-11 14:21 ` Ben Greear
@ 2014-09-12  3:48   ` Okhwan Lee
  2014-09-12 16:23     ` Ben Greear
  0 siblings, 1 reply; 4+ messages in thread
From: Okhwan Lee @ 2014-09-12  3:48 UTC (permalink / raw)
  To: Ben Greear; +Cc: ath10k

Hi,  

Thank you for your answer.  
I use 3.16.1 kernel version,  3.16.1 backport version and 10.1.467.2-1 firmware version.  
I am curious to know your testing.  

This is my test bash-script.

########### test.sh ###########

#!/usr/bin/sudo /bin/bash
rmmod ath10k_pci ath10k_core ath mac80211 cfg80211
modprobe ath10k_pci  
ifconfig wlan0 2>/dev/null 1>/dev/null
while [ $? -ne 0 ]  
do
ifconfig wlan0 2>/dev/null 1>/dev/null
done
echo 0x12 > /sys/module/ath10k_core/parameters/debug_mask
iw dev wlan0 interface add mon0 type monitor
iw mon0 set freq 5180 80 5210
ifconfig mon0 up



######################

then … type the following command in shell prompt  

echo 0x1 > /sys/kernel/debug/ieee80211/phy*/ath10k/rx_chainmask
echo 0x7 > /sys/kernel/debug/ieee80211/phy*/ath10k/rx_chainmask

.
.
.

I also test it by using hostapd.

Thank you.  

--
Okhwan Lee,
Multimedia & Wireless Networking Lab. (MWNL),
Seoul National University (SNU).

Tel: +82-2-880-1755
Cell: +82-10-4632-1980
URL: http://mwnl.snu.ac.kr/~ohlee


On 2014년 9월 11일 Thursday at 오후 11:21, Ben Greear wrote:

> On 09/11/2014 12:37 AM, Okhwan Lee wrote:
> > Hi,
> >  
> > I have been trying to configure the number of active antennas (not
> > spatial stream) by using ath10k/QCA9880.
> >  
> > When I use ath9k, we can easily change the number of active antenna by
> > using REG_WRITE(ah, AR_PHY_RX_CHAINMASK, ah->rxchainmask) function
> > used in ar9003_hw_set_chain_masks.
> >  
> > However, in ath10k, we failed to handle the values (e.g, rx/tx chain
> > mask of QCA9880) by using ath10k_wmi_pdev_set_param(ar,
> > ar->wmi.pdev_param->rx_chain_mask, rx_ant) funcion in used in
> > __ath10k_set_antenna.
>  
>  
>  
> Newer kernels should have this support, and it seemed to work in my
> testing. I did not test power consumption.
>  
> What kernel version are you using?
>  
> Thanks,
> Ben
>  
> --  
> Ben Greear <greearb@candelatech.com (mailto:greearb@candelatech.com)>
> Candela Technologies Inc http://www.candelatech.com



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Change the number of active antennas (RF-chains)
  2014-09-12  3:48   ` Okhwan Lee
@ 2014-09-12 16:23     ` Ben Greear
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Greear @ 2014-09-12 16:23 UTC (permalink / raw)
  To: Okhwan Lee; +Cc: ath10k

On 09/11/2014 08:48 PM, Okhwan Lee wrote:
> Hi,  
> 
> Thank you for your answer.  
> I use 3.16.1 kernel version,  3.16.1 backport version and 10.1.467.2-1 firmware version.  
> I am curious to know your testing.  
> 
> This is my test bash-script.
> 
> ########### test.sh ###########
> 
> #!/usr/bin/sudo /bin/bash
> rmmod ath10k_pci ath10k_core ath mac80211 cfg80211
> modprobe ath10k_pci  
> ifconfig wlan0 2>/dev/null 1>/dev/null
> while [ $? -ne 0 ]  
> do
> ifconfig wlan0 2>/dev/null 1>/dev/null
> done

What are the commands above supposed to be doing?

> echo 0x12 > /sys/module/ath10k_core/parameters/debug_mask
> iw dev wlan0 interface add mon0 type monitor
> iw mon0 set freq 5180 80 5210
> ifconfig mon0 up
> 
> 
> 
> ######################
> 
> then … type the following command in shell prompt  
> 
> echo 0x1 > /sys/kernel/debug/ieee80211/phy*/ath10k/rx_chainmask
> echo 0x7 > /sys/kernel/debug/ieee80211/phy*/ath10k/rx_chainmask

You should be able to configure this using 'iw'

And, you probably need to configure the chainmask before
creating or starting the wlan and other vifs.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-12 16:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11  7:37 Change the number of active antennas (RF-chains) Okhwan Lee
2014-09-11 14:21 ` Ben Greear
2014-09-12  3:48   ` Okhwan Lee
2014-09-12 16:23     ` Ben Greear

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.