2016-06-14 17:39:11

by Ashok Raj Nagarajan

[permalink] [raw]
Subject: [PATCH] ath10k: add support for controlling tx power to a station

This patch will add the support to control the transmit power for traffic
to a station associated with the AP. Userspace provide the transmit power
value in mBm units and the allowed range is from 0 to 70. Underlying FW
will enforce that the maximum tx power will be based on the regulatory
requirements. If the user given transmit power is greater than the allowed
tx power in the given channel, then the FW will use the maximum tx power
in the same channel.

When 0 is sent to the FW as tx power, it will revert to the automatic tx
power for the station.

Signed-off-by: Ashok Raj Nagarajan <[email protected]>
---
drivers/net/wireless/ath/ath10k/debug.h | 3 +++
drivers/net/wireless/ath/ath10k/mac.c | 29 +++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath10k/wmi.h | 1 +
3 files changed, 33 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index 75c89e3..340950b 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -59,6 +59,9 @@ enum ath10k_dbg_aggr_mode {
/* FIXME: How to calculate the buffer size sanely? */
#define ATH10K_FW_STATS_BUF_SIZE (1024 * 1024)

+#define ATH10K_TX_POWER_MAX_VAL 70
+#define ATH10K_TX_POWER_MIN_VAL 0
+
extern unsigned int ath10k_debug_mask;

__printf(2, 3) void ath10k_info(struct ath10k *ar, const char *fmt, ...);
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index d4b7a16..79aaf6c 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -5824,6 +5824,34 @@ static int ath10k_mac_tdls_vifs_count(struct ieee80211_hw *hw)
return num_tdls_vifs;
}

+static int ath10k_sta_set_txpwr(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta)
+{
+ struct ath10k *ar = hw->priv;
+ struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+ int ret = 0;
+ u8 txpwr;
+
+ txpwr = sta->txpwr;
+ if (txpwr > ATH10K_TX_POWER_MAX_VAL || txpwr < ATH10K_TX_POWER_MIN_VAL)
+ return -EINVAL;
+
+ mutex_lock(&ar->conf_mutex);
+
+ ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr,
+ WMI_PEER_USE_FIXED_PWR, txpwr);
+ if (ret) {
+ ath10k_warn(ar, "failed to set tx power for station ret: %d\n",
+ ret);
+ goto out;
+ }
+
+out:
+ mutex_unlock(&ar->conf_mutex);
+ return ret;
+}
+
static int ath10k_sta_state(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
@@ -7368,6 +7396,7 @@ static const struct ieee80211_ops ath10k_ops = {
.set_key = ath10k_set_key,
.set_default_unicast_key = ath10k_set_default_unicast_key,
.sta_state = ath10k_sta_state,
+ .sta_set_txpwr = ath10k_sta_set_txpwr,
.conf_tx = ath10k_conf_tx,
.remain_on_channel = ath10k_remain_on_channel,
.cancel_remain_on_channel = ath10k_cancel_remain_on_channel,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 90f594e..f4d4e6e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -5761,6 +5761,7 @@ enum wmi_peer_param {
WMI_PEER_CHAN_WIDTH = 0x4,
WMI_PEER_NSS = 0x5,
WMI_PEER_USE_4ADDR = 0x6,
+ WMI_PEER_USE_FIXED_PWR = 0x8,
WMI_PEER_DUMMY_VAR = 0xff, /* dummy parameter for STA PS workaround */
};

--
1.9.1



2016-06-16 14:08:20

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] ath10k: add support for controlling tx power to a station

kbuild test robot <[email protected]> writes:

> [auto build test ERROR on ath6kl/ath-next]
> [also build test ERROR on v4.7-rc3 next-20160614]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Ashok-Raj-Nagarajan/ath10k-add-support-for-controlling-tx-power-to-a-station/20160615-014225
> base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
> config: x86_64-allmodconfig (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All errors (new ones prefixed by >>):
>
> drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_sta_set_txpwr':
>>> drivers/net/wireless/ath/ath10k/mac.c:5836:13: error: 'struct ieee80211_sta' has no member named 'txpwr'
> txpwr = sta->txpwr;
> ^~
> drivers/net/wireless/ath/ath10k/mac.c: At top level:
>>> drivers/net/wireless/ath/ath10k/mac.c:7399:2: error: unknown field 'sta_set_txpwr' specified in initializer
> .sta_set_txpwr = ath10k_sta_set_txpwr,
> ^
>>> drivers/net/wireless/ath/ath10k/mac.c:7399:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
> .sta_set_txpwr = ath10k_sta_set_txpwr,
> ^~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/ath/ath10k/mac.c:7399:21: note: (near initialization for 'ath10k_ops.sta_pre_rcu_remove')
> cc1: some warnings being treated as errors

These errors are expected as this depends on a mac80211 patch which is
not yet applied.

--
Kalle Valo

2016-06-14 18:30:49

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] ath10k: add support for controlling tx power to a station

Hi,

[auto build test ERROR on ath6kl/ath-next]
[also build test ERROR on v4.7-rc3 next-20160614]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Ashok-Raj-Nagarajan/ath10k-add-support-for-controlling-tx-power-to-a-station/20160615-014225
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_sta_set_txpwr':
>> drivers/net/wireless/ath/ath10k/mac.c:5836:13: error: 'struct ieee80211_sta' has no member named 'txpwr'
txpwr = sta->txpwr;
^~
drivers/net/wireless/ath/ath10k/mac.c: At top level:
>> drivers/net/wireless/ath/ath10k/mac.c:7399:2: error: unknown field 'sta_set_txpwr' specified in initializer
.sta_set_txpwr = ath10k_sta_set_txpwr,
^
>> drivers/net/wireless/ath/ath10k/mac.c:7399:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.sta_set_txpwr = ath10k_sta_set_txpwr,
^~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath10k/mac.c:7399:21: note: (near initialization for 'ath10k_ops.sta_pre_rcu_remove')
cc1: some warnings being treated as errors

vim +5836 drivers/net/wireless/ath/ath10k/mac.c

5830 {
5831 struct ath10k *ar = hw->priv;
5832 struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
5833 int ret = 0;
5834 u8 txpwr;
5835
> 5836 txpwr = sta->txpwr;
5837 if (txpwr > ATH10K_TX_POWER_MAX_VAL || txpwr < ATH10K_TX_POWER_MIN_VAL)
5838 return -EINVAL;
5839

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (1.95 kB)
.config.gz (52.85 kB)
Download all attachments

2016-06-14 18:49:06

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] ath10k: add support for controlling tx power to a station

Hi,

[auto build test WARNING on ath6kl/ath-next]
[also build test WARNING on v4.7-rc3 next-20160614]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Ashok-Raj-Nagarajan/ath10k-add-support-for-controlling-tx-power-to-a-station/20160615-014225
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: m68k-allyesconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k

All warnings (new ones prefixed by >>):

drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_sta_set_txpwr':
drivers/net/wireless/ath/ath10k/mac.c:5836:13: error: 'struct ieee80211_sta' has no member named 'txpwr'
txpwr = sta->txpwr;
^
drivers/net/wireless/ath/ath10k/mac.c: At top level:
drivers/net/wireless/ath/ath10k/mac.c:7399:2: error: unknown field 'sta_set_txpwr' specified in initializer
.sta_set_txpwr = ath10k_sta_set_txpwr,
^
>> drivers/net/wireless/ath/ath10k/mac.c:7399:2: warning: initialization from incompatible pointer type
drivers/net/wireless/ath/ath10k/mac.c:7399:2: warning: (near initialization for 'ath10k_ops.sta_pre_rcu_remove')

vim +7399 drivers/net/wireless/ath/ath10k/mac.c

7383
7384 static const struct ieee80211_ops ath10k_ops = {
7385 .tx = ath10k_mac_op_tx,
7386 .wake_tx_queue = ath10k_mac_op_wake_tx_queue,
7387 .start = ath10k_start,
7388 .stop = ath10k_stop,
7389 .config = ath10k_config,
7390 .add_interface = ath10k_add_interface,
7391 .remove_interface = ath10k_remove_interface,
7392 .configure_filter = ath10k_configure_filter,
7393 .bss_info_changed = ath10k_bss_info_changed,
7394 .hw_scan = ath10k_hw_scan,
7395 .cancel_hw_scan = ath10k_cancel_hw_scan,
7396 .set_key = ath10k_set_key,
7397 .set_default_unicast_key = ath10k_set_default_unicast_key,
7398 .sta_state = ath10k_sta_state,
> 7399 .sta_set_txpwr = ath10k_sta_set_txpwr,
7400 .conf_tx = ath10k_conf_tx,
7401 .remain_on_channel = ath10k_remain_on_channel,
7402 .cancel_remain_on_channel = ath10k_cancel_remain_on_channel,
7403 .set_rts_threshold = ath10k_set_rts_threshold,
7404 .set_frag_threshold = ath10k_mac_op_set_frag_threshold,
7405 .flush = ath10k_flush,
7406 .tx_last_beacon = ath10k_tx_last_beacon,
7407 .set_antenna = ath10k_set_antenna,

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (2.78 kB)
.config.gz (35.47 kB)
Download all attachments

2016-07-18 20:08:14

by Kalle Valo

[permalink] [raw]
Subject: Re: ath10k: add support for controlling tx power to a station

Ashok Raj Nagarajan <[email protected]> wrote:
> This patch will add the support to control the transmit power for traffic
> to a station associated with the AP. Userspace provide the transmit power
> value in mBm units and the allowed range is from 0 to 70. Underlying FW
> will enforce that the maximum tx power will be based on the regulatory
> requirements. If the user given transmit power is greater than the allowed
> tx power in the given channel, then the FW will use the maximum tx power
> in the same channel.
>
> When 0 is sent to the FW as tx power, it will revert to the automatic tx
> power for the station.
>
> Signed-off-by: Ashok Raj Nagarajan <[email protected]>

(A note to patchwork)

Depends on these patches:

cfg80211: Add support to set tx power for a station associated
https://patchwork.kernel.org/patch/9176355/

mac80211: store tx power value from user to station
https://patchwork.kernel.org/patch/9176359/

Both are currently in state Changes Requested.

--
Sent by pwcli
https://patchwork.kernel.org/patch/9176353/


2016-09-28 10:14:15

by Kalle Valo

[permalink] [raw]
Subject: Re: ath10k: add support for controlling tx power to a station

Ashok Raj Nagarajan <[email protected]> wrote:
> This patch will add the support to control the transmit power for traffic
> to a station associated with the AP. Userspace provide the transmit power
> value in mBm units and the allowed range is from 0 to 70. Underlying FW
> will enforce that the maximum tx power will be based on the regulatory
> requirements. If the user given transmit power is greater than the allowed
> tx power in the given channel, then the FW will use the maximum tx power
> in the same channel.
>
> When 0 is sent to the FW as tx power, it will revert to the automatic tx
> power for the station.
>
> Signed-off-by: Ashok Raj Nagarajan <[email protected]>

No development on the dependency patches. I'm dropping this for now,
please resend once mac80211 patches are accepted.

Patch set to Changes Requested.

--
https://patchwork.kernel.org/patch/9176353/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches