Message ID | 1485888165-23504-1-git-send-email-arnagara@qti.qualcomm.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Kalle Valo |
Headers | show |
On 01/31/2017 10:42 AM, Ashok Raj Nagarajan 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 How did you come up with 70 mBm as the limit. This is only 7dBm? I would expect it to match the range of normal tx-power which is likely up to 30 dBm or so on some NICs (not counting regulatory limit). Thanks, Ben
Hi Ashok, [auto build test ERROR on ath6kl/ath-next] [also build test ERROR on v4.10-rc6 next-20170130] [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/20170201-032529 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next config: i386-allmodconfig (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 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:5997: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:7581:2: error: unknown field 'sta_set_txpwr' specified in initializer .sta_set_txpwr = ath10k_sta_set_txpwr, ^ >> drivers/net/wireless/ath/ath10k/mac.c:7581: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:7581:21: note: (near initialization for 'ath10k_ops.sta_pre_rcu_remove') drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_mac_register': >> drivers/net/wireless/ath/ath10k/mac.c:8226:11: error: 'NL80211_EXT_FEATURE_STA_TX_PWR' undeclared (first use in this function) NL80211_EXT_FEATURE_STA_TX_PWR); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/wireless/ath/ath10k/mac.c:8226:11: note: each undeclared identifier is reported only once for each function it appears in cc1: some warnings being treated as errors vim +5997 drivers/net/wireless/ath/ath10k/mac.c 5991 { 5992 struct ath10k *ar = hw->priv; 5993 struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif); 5994 int ret = 0; 5995 u8 txpwr; 5996 > 5997 txpwr = sta->txpwr; 5998 if (txpwr > ATH10K_TX_POWER_MAX_VAL || txpwr < ATH10K_TX_POWER_MIN_VAL) 5999 return -EINVAL; 6000 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Ashok, [auto build test WARNING on ath6kl/ath-next] [also build test WARNING on v4.10-rc6 next-20170131] [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/20170201-032529 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:5997: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:7581:2: error: unknown field 'sta_set_txpwr' specified in initializer .sta_set_txpwr = ath10k_sta_set_txpwr, ^ >> drivers/net/wireless/ath/ath10k/mac.c:7581:2: warning: initialization from incompatible pointer type drivers/net/wireless/ath/ath10k/mac.c:7581:2: warning: (near initialization for 'ath10k_ops.sta_pre_rcu_remove') drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_mac_register': drivers/net/wireless/ath/ath10k/mac.c:8226:11: error: 'NL80211_EXT_FEATURE_STA_TX_PWR' undeclared (first use in this function) NL80211_EXT_FEATURE_STA_TX_PWR); ^ drivers/net/wireless/ath/ath10k/mac.c:8226:11: note: each undeclared identifier is reported only once for each function it appears in vim +7581 drivers/net/wireless/ath/ath10k/mac.c 7565 static const struct ieee80211_ops ath10k_ops = { 7566 .tx = ath10k_mac_op_tx, 7567 .wake_tx_queue = ath10k_mac_op_wake_tx_queue, 7568 .start = ath10k_start, 7569 .stop = ath10k_stop, 7570 .config = ath10k_config, 7571 .add_interface = ath10k_add_interface, 7572 .remove_interface = ath10k_remove_interface, 7573 .configure_filter = ath10k_configure_filter, 7574 .bss_info_changed = ath10k_bss_info_changed, 7575 .set_coverage_class = ath10k_mac_op_set_coverage_class, 7576 .hw_scan = ath10k_hw_scan, 7577 .cancel_hw_scan = ath10k_cancel_hw_scan, 7578 .set_key = ath10k_set_key, 7579 .set_default_unicast_key = ath10k_set_default_unicast_key, 7580 .sta_state = ath10k_sta_state, > 7581 .sta_set_txpwr = ath10k_sta_set_txpwr, 7582 .conf_tx = ath10k_conf_tx, 7583 .remain_on_channel = ath10k_remain_on_channel, 7584 .cancel_remain_on_channel = ath10k_cancel_remain_on_channel, 7585 .set_rts_threshold = ath10k_set_rts_threshold, 7586 .set_frag_threshold = ath10k_mac_op_set_frag_threshold, 7587 .flush = ath10k_flush, 7588 .tx_last_beacon = ath10k_tx_last_beacon, 7589 .set_antenna = ath10k_set_antenna, --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
On 2017-02-01 00:27, Ben Greear wrote: > On 01/31/2017 10:42 AM, Ashok Raj Nagarajan 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 > > How did you come up with 70 mBm as the limit. This is only 7dBm? > > I would expect it to match the range of normal tx-power which is likely > up to > 30 dBm or so on some NICs (not counting regulatory limit). > I think I will have to re-word the commit log a bit. ath10k driver would get the value in dBm only and the range is from 0 to 70 dBm. Looking at the db.txt, I see a max value of 44 dm for a 60GHz channel. SO to be little future proof having a greater acceptable range from user. The final tx power will be calculated based on this extra parameter the user passes on, including the regulatory limit for the channel. Thanks, Ashok > Thanks, > Ben
On 02/01/2017 09:44 AM, Ashok Raj Nagarajan wrote: > On 2017-02-01 00:27, Ben Greear wrote: >> On 01/31/2017 10:42 AM, Ashok Raj Nagarajan 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 >> >> How did you come up with 70 mBm as the limit. This is only 7dBm? >> >> I would expect it to match the range of normal tx-power which is likely up to >> 30 dBm or so on some NICs (not counting regulatory limit). >> > > I think I will have to re-word the commit log a bit. ath10k driver would get the value in dBm only and the range is from 0 to 70 dBm. Looking at the db.txt, I > see a max value of 44 dm for a 60GHz channel. SO to be little future proof having a greater acceptable range from user. The final tx power will be calculated > based on this extra parameter the user passes on, including the regulatory limit for the channel. Why not just accept any value that fits within the storage (u16, probably). The regulatory logic and other constraints can already make sure that the tx-power is not out-of-bounds, so the user cannot really break something by attempting to set a large value. Thanks, Ben
kbuild test robot <lkp@intel.com> writes: > Hi Ashok, > > [auto build test WARNING on ath6kl/ath-next] > [also build test WARNING on v4.10-rc6 next-20170131] > [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/20170201-032529 > 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:5997: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:7581:2: error: unknown field 'sta_set_txpwr' specified in initializer > .sta_set_txpwr = ath10k_sta_set_txpwr, > ^ This is expected as this patch depends on a mac80211 feature not yet applied.
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h index 2368f47..db51453 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 9977829..d1a5937 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -5985,6 +5985,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, @@ -7550,6 +7578,7 @@ static void ath10k_mac_op_sta_pre_rcu_remove(struct ieee80211_hw *hw, .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, @@ -8193,11 +8222,15 @@ int ath10k_mac_register(struct ath10k *ar) ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb; ar->hw->wiphy->n_iface_combinations = ARRAY_SIZE(ath10k_10x_if_comb); + wiphy_ext_feature_set(ar->hw->wiphy, + NL80211_EXT_FEATURE_STA_TX_PWR); break; case ATH10K_FW_WMI_OP_VERSION_10_4: ar->hw->wiphy->iface_combinations = ath10k_10_4_if_comb; ar->hw->wiphy->n_iface_combinations = ARRAY_SIZE(ath10k_10_4_if_comb); + wiphy_ext_feature_set(ar->hw->wiphy, + NL80211_EXT_FEATURE_STA_TX_PWR); break; case ATH10K_FW_WMI_OP_VERSION_UNSET: case ATH10K_FW_WMI_OP_VERSION_MAX: diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 861c2d8..1ccb6bf 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -5811,6 +5811,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 */ };
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 <arnagara@qti.qualcomm.com> --- v2: - indicate that the driver supports this feature using NL80211_EXT_FEATURE_STA_TX_PWR drivers/net/wireless/ath/ath10k/debug.h | 3 +++ drivers/net/wireless/ath/ath10k/mac.c | 33 +++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi.h | 1 + 3 files changed, 37 insertions(+)