diff mbox series

[v4,1/3] cfg80211: Add support to set tx power for a station associated

Message ID 1553856501-21492-1-git-send-email-bpothuno@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series [v4,1/3] cfg80211: Add support to set tx power for a station associated | expand

Commit Message

Balaji Pothunoori March 29, 2019, 10:48 a.m. UTC
From: Ashok Raj Nagarajan <arnagara@codeaurora.org>

This patch adds support to set transmit power setting type and transmit
power level attributes to NL80211_CMD_SET_STATION in order to facilitate
adjusting the transmit power level of a station associated to the AP.

The added attributes allow selection of automatic and limited transmit
power level, with the level defined in dBm format.

Co-developed-by: Balaji Pothunoori <bpothuno@codeaurora.org>
Signed-off-by: Ashok Raj Nagarajan <arnagara@codeaurora.org>
Signed-off-by: Balaji Pothunoori <bpothuno@codeaurora.org>
---
v2: add txpwr structure
    replaced nla_get_u32 with nla_get_u8/s16
    added NLA_POLICY_RANGE check
v3: updated kernel-doc for sta_txpwr
     structure and rebased
v4: added attribute check for tx power

 include/net/cfg80211.h       | 22 ++++++++++++++++++++++
 include/uapi/linux/nl80211.h | 14 ++++++++++++++
 net/wireless/nl80211.c       | 43 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+)

Comments

kernel test robot March 31, 2019, 6 a.m. UTC | #1
Hi Balaji,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on v5.1-rc2 next-20190329]
[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/Balaji-Pothunoori/cfg80211-Add-support-to-set-tx-power-for-a-station-associated/20190331-104601
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
   include/linux/rcupdate_wait.h:1: warning: no structured comments found
   include/linux/rcutree.h:1: warning: no structured comments found
   kernel/rcu/tree.c:710: warning: Excess function parameter 'irq' description in 'rcu_nmi_exit'
   include/linux/gfp.h:1: warning: no structured comments found
>> include/net/cfg80211.h:1072: warning: Function parameter or member 'txpwr' not described in 'station_parameters'
   kernel/rcu/tree.c:711: warning: Excess function parameter 'irq' description in 'rcu_nmi_exit'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_excl.cb' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_excl.poll' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_excl.active' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_shared.cb' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_shared.poll' not described in 'dma_buf'
   include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_shared.active' not described in 'dma_buf'
   include/linux/dma-fence-array.h:54: warning: Function parameter or member 'work' not described in 'dma_fence_array'
   include/linux/firmware/intel/stratix10-svc-client.h:1: warning: no structured comments found
   include/linux/gpio/driver.h:371: warning: Function parameter or member 'init_valid_mask' not described in 'gpio_chip'
   include/linux/iio/hw-consumer.h:1: warning: no structured comments found
   include/linux/input/sparse-keymap.h:46: warning: Function parameter or member 'sw' not described in 'key_entry'
   include/linux/regulator/machine.h:199: warning: Function parameter or member 'max_uV_step' not described in 'regulation_constraints'
   include/linux/regulator/driver.h:228: warning: Function parameter or member 'resume' not described in 'regulator_ops'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw0' not described in 'irb'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw1' not described in 'irb'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw2' not described in 'irb'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw3' not described in 'irb'
   arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.eadm' not described in 'irb'
   drivers/slimbus/stream.c:1: warning: no structured comments found
   include/linux/spi/spi.h:180: warning: Function parameter or member 'driver_override' not described in 'spi_device'
   drivers/target/target_core_device.c:1: warning: no structured comments found
   drivers/usb/typec/bus.c:1: warning: no structured comments found
   drivers/usb/typec/class.c:1: warning: no structured comments found
   include/linux/w1.h:281: warning: Function parameter or member 'of_match_table' not described in 'w1_family'
   fs/direct-io.c:257: warning: Excess function parameter 'offset' description in 'dio_complete'
   fs/file_table.c:1: warning: no structured comments found
   fs/libfs.c:477: warning: Excess function parameter 'available' description in 'simple_write_end'
   fs/posix_acl.c:646: warning: Function parameter or member 'inode' not described in 'posix_acl_update_mode'
   fs/posix_acl.c:646: warning: Function parameter or member 'mode_p' not described in 'posix_acl_update_mode'
   fs/posix_acl.c:646: warning: Function parameter or member 'acl' not described in 'posix_acl_update_mode'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:294: warning: Excess function parameter 'mm' description in 'amdgpu_mn_invalidate_range_start_hsa'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:294: warning: Excess function parameter 'start' description in 'amdgpu_mn_invalidate_range_start_hsa'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:294: warning: Excess function parameter 'end' description in 'amdgpu_mn_invalidate_range_start_hsa'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:343: warning: Excess function parameter 'mm' description in 'amdgpu_mn_invalidate_range_end'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:343: warning: Excess function parameter 'start' description in 'amdgpu_mn_invalidate_range_end'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:343: warning: Excess function parameter 'end' description in 'amdgpu_mn_invalidate_range_end'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:183: warning: Function parameter or member 'blockable' not described in 'amdgpu_mn_read_lock'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:295: warning: Function parameter or member 'range' not described in 'amdgpu_mn_invalidate_range_start_hsa'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:295: warning: Excess function parameter 'mm' description in 'amdgpu_mn_invalidate_range_start_hsa'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:295: warning: Excess function parameter 'start' description in 'amdgpu_mn_invalidate_range_start_hsa'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:295: warning: Excess function parameter 'end' description in 'amdgpu_mn_invalidate_range_start_hsa'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:344: warning: Function parameter or member 'range' not described in 'amdgpu_mn_invalidate_range_end'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:344: warning: Excess function parameter 'mm' description in 'amdgpu_mn_invalidate_range_end'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:344: warning: Excess function parameter 'start' description in 'amdgpu_mn_invalidate_range_end'
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:344: warning: Excess function parameter 'end' description in 'amdgpu_mn_invalidate_range_end'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:382: warning: cannot understand function prototype: 'struct amdgpu_vm_pt_cursor '
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:383: warning: cannot understand function prototype: 'struct amdgpu_vm_pt_cursor '
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:555: warning: Function parameter or member 'adev' not described in 'for_each_amdgpu_vm_pt_leaf'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:555: warning: Function parameter or member 'vm' not described in 'for_each_amdgpu_vm_pt_leaf'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:555: warning: Function parameter or member 'start' not described in 'for_each_amdgpu_vm_pt_leaf'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:555: warning: Function parameter or member 'end' not described in 'for_each_amdgpu_vm_pt_leaf'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:555: warning: Function parameter or member 'cursor' not described in 'for_each_amdgpu_vm_pt_leaf'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:603: warning: Function parameter or member 'adev' not described in 'for_each_amdgpu_vm_pt_dfs_safe'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:603: warning: Function parameter or member 'vm' not described in 'for_each_amdgpu_vm_pt_dfs_safe'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:603: warning: Function parameter or member 'cursor' not described in 'for_each_amdgpu_vm_pt_dfs_safe'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:603: warning: Function parameter or member 'entry' not described in 'for_each_amdgpu_vm_pt_dfs_safe'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:847: warning: Function parameter or member 'level' not described in 'amdgpu_vm_bo_param'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1352: warning: Function parameter or member 'params' not described in 'amdgpu_vm_update_func'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1352: warning: Function parameter or member 'bo' not described in 'amdgpu_vm_update_func'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1352: warning: Function parameter or member 'pe' not described in 'amdgpu_vm_update_func'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1352: warning: Function parameter or member 'addr' not described in 'amdgpu_vm_update_func'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1352: warning: Function parameter or member 'count' not described in 'amdgpu_vm_update_func'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1352: warning: Function parameter or member 'incr' not described in 'amdgpu_vm_update_func'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1352: warning: Function parameter or member 'flags' not described in 'amdgpu_vm_update_func'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1519: warning: Function parameter or member 'params' not described in 'amdgpu_vm_update_huge'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1519: warning: Function parameter or member 'bo' not described in 'amdgpu_vm_update_huge'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1519: warning: Function parameter or member 'level' not described in 'amdgpu_vm_update_huge'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1519: warning: Function parameter or member 'pe' not described in 'amdgpu_vm_update_huge'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1519: warning: Function parameter or member 'addr' not described in 'amdgpu_vm_update_huge'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1519: warning: Function parameter or member 'count' not described in 'amdgpu_vm_update_huge'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1519: warning: Function parameter or member 'incr' not described in 'amdgpu_vm_update_huge'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1519: warning: Function parameter or member 'flags' not described in 'amdgpu_vm_update_huge'
   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3095: warning: Function parameter or member 'pasid' not described in 'amdgpu_vm_make_compute'
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:128: warning: Incorrect use of kernel-doc format: Documentation Makefile include scripts source @atomic_obj
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:203: warning: Function parameter or member 'atomic_obj' not described in 'amdgpu_display_manager'
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:203: warning: Function parameter or member 'atomic_obj_lock' not described in 'amdgpu_display_manager'
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:203: warning: Function parameter or member 'backlight_link' not described in 'amdgpu_display_manager'
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:203: warning: Function parameter or member 'backlight_caps' not described in 'amdgpu_display_manager'
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:203: warning: Function parameter or member 'freesync_module' not described in 'amdgpu_display_manager'
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:203: warning: Function parameter or member 'fw_dmcu' not described in 'amdgpu_display_manager'
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:203: warning: Function parameter or member 'dmcu_fw_version' not described in 'amdgpu_display_manager'
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:1: warning: no structured comments found
   include/drm/drm_drv.h:618: warning: Function parameter or member 'gem_prime_pin' not described in 'drm_driver'
   include/drm/drm_drv.h:618: warning: Function parameter or member 'gem_prime_unpin' not described in 'drm_driver'
   include/drm/drm_drv.h:618: warning: Function parameter or member 'gem_prime_res_obj' not described in 'drm_driver'
   include/drm/drm_drv.h:618: warning: Function parameter or member 'gem_prime_get_sg_table' not described in 'drm_driver'
   include/drm/drm_drv.h:618: warning: Function parameter or member 'gem_prime_import_sg_table' not described in 'drm_driver'
   include/drm/drm_drv.h:618: warning: Function parameter or member 'gem_prime_vmap' not described in 'drm_driver'
   include/drm/drm_drv.h:618: warning: Function parameter or member 'gem_prime_vunmap' not described in 'drm_driver'
   include/drm/drm_drv.h:618: warning: Function parameter or member 'gem_prime_mmap' not described in 'drm_driver'
   include/drm/drm_atomic_state_helper.h:1: warning: no structured comments found
   drivers/gpu/drm/drm_dp_helper.c:1364: warning: Function parameter or member 'dsc_dpcd' not described in 'drm_dp_dsc_sink_max_slice_count'
   drivers/gpu/drm/drm_dp_helper.c:1364: warning: Function parameter or member 'is_edp' not described in 'drm_dp_dsc_sink_max_slice_count'
   drivers/gpu/drm/i915/i915_vma.h:49: warning: cannot understand function prototype: 'struct i915_vma '
   drivers/gpu/drm/i915/i915_vma.h:1: warning: no structured comments found
   drivers/gpu/drm/i915/intel_guc_fwif.h:536: warning: cannot understand function prototype: 'struct guc_log_buffer_state '
   drivers/gpu/drm/i915/i915_trace.h:1: warning: no structured comments found
   include/linux/skbuff.h:876: warning: Function parameter or member 'dev_scratch' not described in 'sk_buff'
   include/linux/skbuff.h:876: warning: Function parameter or member 'list' not described in 'sk_buff'

vim +1072 include/net/cfg80211.h

3b9ce80ce Johannes Berg          2011-09-27   998  
3b9ce80ce Johannes Berg          2011-09-27   999  /**
5727ef1b2 Johannes Berg          2007-12-19  1000   * struct station_parameters - station parameters
5727ef1b2 Johannes Berg          2007-12-19  1001   *
5727ef1b2 Johannes Berg          2007-12-19  1002   * Used to change and create a new station.
5727ef1b2 Johannes Berg          2007-12-19  1003   *
5727ef1b2 Johannes Berg          2007-12-19  1004   * @vlan: vlan interface station should belong to
5727ef1b2 Johannes Berg          2007-12-19  1005   * @supported_rates: supported rates in IEEE 802.11 format
5727ef1b2 Johannes Berg          2007-12-19  1006   *	(or NULL for no change)
5727ef1b2 Johannes Berg          2007-12-19  1007   * @supported_rates_len: number of supported rates
eccb8e8f0 Johannes Berg          2009-05-11  1008   * @sta_flags_mask: station flags that changed
819bf5937 Johannes Berg          2016-10-11  1009   *	(bitmask of BIT(%NL80211_STA_FLAG_...))
eccb8e8f0 Johannes Berg          2009-05-11  1010   * @sta_flags_set: station flags values
819bf5937 Johannes Berg          2016-10-11  1011   *	(bitmask of BIT(%NL80211_STA_FLAG_...))
5727ef1b2 Johannes Berg          2007-12-19  1012   * @listen_interval: listen interval or -1 for no change
5727ef1b2 Johannes Berg          2007-12-19  1013   * @aid: AID or zero for no change
7d27a0ba7 Masashi Honma          2016-07-01  1014   * @peer_aid: mesh peer AID or zero for no change
abe37c4b8 Johannes Berg          2010-06-07  1015   * @plink_action: plink action to take
9c3990aae Javier Cardona         2011-05-03  1016   * @plink_state: set the peer link state for a station
abe37c4b8 Johannes Berg          2010-06-07  1017   * @ht_capa: HT capabilities of station
f461be3ef Mahesh Palivela        2012-10-11  1018   * @vht_capa: VHT capabilities of station
910868db3 Eliad Peller           2011-09-11  1019   * @uapsd_queues: bitmap of queues configured for uapsd. same format
910868db3 Eliad Peller           2011-09-11  1020   *	as the AC bitmap in the QoS info field
910868db3 Eliad Peller           2011-09-11  1021   * @max_sp: max Service Period. same format as the MAX_SP in the
910868db3 Eliad Peller           2011-09-11  1022   *	QoS info field (but already shifted down)
c26887d2a Johannes Berg          2011-11-08  1023   * @sta_modify_mask: bitmap indicating which parameters changed
c26887d2a Johannes Berg          2011-11-08  1024   *	(for those that don't have a natural "no change" value),
c26887d2a Johannes Berg          2011-11-08  1025   *	see &enum station_parameters_apply_mask
3b1c5a530 Marco Porsch           2013-01-07  1026   * @local_pm: local link-specific mesh power save mode (no change when set
3b1c5a530 Marco Porsch           2013-01-07  1027   *	to unknown)
9d62a9861 Jouni Malinen          2013-02-14  1028   * @capability: station capability
9d62a9861 Jouni Malinen          2013-02-14  1029   * @ext_capab: extended capabilities of the station
9d62a9861 Jouni Malinen          2013-02-14  1030   * @ext_capab_len: number of extended capabilities
c01fc9ada Sunil Dutt             2013-10-09  1031   * @supported_channels: supported channels in IEEE 802.11 format
c01fc9ada Sunil Dutt             2013-10-09  1032   * @supported_channels_len: number of supported channels
c01fc9ada Sunil Dutt             2013-10-09  1033   * @supported_oper_classes: supported oper classes in IEEE 802.11 format
c01fc9ada Sunil Dutt             2013-10-09  1034   * @supported_oper_classes_len: number of supported operating classes
60f4a7b16 Marek Kwaczynski       2013-12-03  1035   * @opmode_notif: operating mode field from Operating Mode Notification
60f4a7b16 Marek Kwaczynski       2013-12-03  1036   * @opmode_notif_used: information if operating mode field is used
17b942478 Ayala Beker            2016-03-17  1037   * @support_p2p_ps: information if station supports P2P PS mechanism
c4cbaf797 Luca Coelho            2018-06-09  1038   * @he_capa: HE capabilities of station
c4cbaf797 Luca Coelho            2018-06-09  1039   * @he_capa_len: the length of the HE capabilities
36647055b Toke Høiland-Jørgensen 2018-12-18  1040   * @airtime_weight: airtime scheduler weight for this station
5727ef1b2 Johannes Berg          2007-12-19  1041   */
5727ef1b2 Johannes Berg          2007-12-19  1042  struct station_parameters {
2c1aabf33 Johannes Berg          2013-02-14  1043  	const u8 *supported_rates;
5727ef1b2 Johannes Berg          2007-12-19  1044  	struct net_device *vlan;
eccb8e8f0 Johannes Berg          2009-05-11  1045  	u32 sta_flags_mask, sta_flags_set;
3b9ce80ce Johannes Berg          2011-09-27  1046  	u32 sta_modify_mask;
5727ef1b2 Johannes Berg          2007-12-19  1047  	int listen_interval;
5727ef1b2 Johannes Berg          2007-12-19  1048  	u16 aid;
7d27a0ba7 Masashi Honma          2016-07-01  1049  	u16 peer_aid;
5727ef1b2 Johannes Berg          2007-12-19  1050  	u8 supported_rates_len;
2ec600d67 Luis Carlos Cobo       2008-02-23  1051  	u8 plink_action;
9c3990aae Javier Cardona         2011-05-03  1052  	u8 plink_state;
2c1aabf33 Johannes Berg          2013-02-14  1053  	const struct ieee80211_ht_cap *ht_capa;
2c1aabf33 Johannes Berg          2013-02-14  1054  	const struct ieee80211_vht_cap *vht_capa;
c75786c9e Eliad Peller           2011-08-23  1055  	u8 uapsd_queues;
c75786c9e Eliad Peller           2011-08-23  1056  	u8 max_sp;
3b1c5a530 Marco Porsch           2013-01-07  1057  	enum nl80211_mesh_power_mode local_pm;
9d62a9861 Jouni Malinen          2013-02-14  1058  	u16 capability;
2c1aabf33 Johannes Berg          2013-02-14  1059  	const u8 *ext_capab;
9d62a9861 Jouni Malinen          2013-02-14  1060  	u8 ext_capab_len;
c01fc9ada Sunil Dutt             2013-10-09  1061  	const u8 *supported_channels;
c01fc9ada Sunil Dutt             2013-10-09  1062  	u8 supported_channels_len;
c01fc9ada Sunil Dutt             2013-10-09  1063  	const u8 *supported_oper_classes;
c01fc9ada Sunil Dutt             2013-10-09  1064  	u8 supported_oper_classes_len;
60f4a7b16 Marek Kwaczynski       2013-12-03  1065  	u8 opmode_notif;
60f4a7b16 Marek Kwaczynski       2013-12-03  1066  	bool opmode_notif_used;
17b942478 Ayala Beker            2016-03-17  1067  	int support_p2p_ps;
c4cbaf797 Luca Coelho            2018-06-09  1068  	const struct ieee80211_he_cap_elem *he_capa;
c4cbaf797 Luca Coelho            2018-06-09  1069  	u8 he_capa_len;
36647055b Toke Høiland-Jørgensen 2018-12-18  1070  	u16 airtime_weight;
115e5b332 Ashok Raj Nagarajan    2019-03-29  1071  	struct sta_txpwr txpwr;
5727ef1b2 Johannes Berg          2007-12-19 @1072  };
5727ef1b2 Johannes Berg          2007-12-19  1073  

:::::: The code at line 1072 was first introduced by commit
:::::: 5727ef1b2e797a1922f5bc239b6afb2b4cfb80bc cfg80211/nl80211: station handling

:::::: TO: Johannes Berg <johannes@sipsolutions.net>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Bob Copeland April 1, 2019, 8:46 p.m. UTC | #2
Hi Balaji,

I started playing with these patches a bit -- they could be useful for
my use case, but I had a question:

> + * @power: tx power (in dBm) to be used for sending data traffic. If tx power
> + *	is not provided, the default per-interface tx power setting will be
> + *	overriding. Driver should be picking up the lowest tx power, either tx
> + *	power per-interface or per-station.

Should this really dBm?  It's a bit asymmetric for WIPHY_TX_POWER_LEVEL to
use mBm and this to use dBm, and I might want to adjust in half-dB steps if
supported by hardware.  Also allocating an s16 is a bit much for dBm.
Balaji Pothunoori April 2, 2019, 6:30 a.m. UTC | #3
On 2019-04-02 02:16, Bob Copeland wrote:
> Hi Balaji,
> 
> I started playing with these patches a bit -- they could be useful for
> my use case, but I had a question:
> 
>> + * @power: tx power (in dBm) to be used for sending data traffic. If 
>> tx power
>> + *	is not provided, the default per-interface tx power setting will 
>> be
>> + *	overriding. Driver should be picking up the lowest tx power, 
>> either tx
>> + *	power per-interface or per-station.
> 
> Should this really dBm?  It's a bit asymmetric for WIPHY_TX_POWER_LEVEL 
> to
> use mBm and this to use dBm, and I might want to adjust in half-dB 
> steps if
> supported by hardware.  Also allocating an s16 is a bit much for dBm.

if user will send mBm value then driver has to convert to dBm because 
firmware will expect the value in dBm.
Please refer johannes comments on following patch " [EXT] Re: [PATCH] 
iw: Add support for controlling tx power for per station"
for the reason why we opted dBm.

Yeah, s16 is required if units in mBm. i will modify to s8 in next 
version patch.

Regards,
Balaji.
Bob Copeland April 2, 2019, 12:59 p.m. UTC | #4
On Tue, Apr 02, 2019 at 12:00:29PM +0530, Balaji Pothunoori wrote:
> > Should this really dBm?  It's a bit asymmetric for WIPHY_TX_POWER_LEVEL
> > to
> > use mBm and this to use dBm, and I might want to adjust in half-dB steps
> > if
> > supported by hardware.  Also allocating an s16 is a bit much for dBm.
> 
> if user will send mBm value then driver has to convert to dBm because
> firmware will expect the value in dBm.
> Please refer johannes comments on following patch " [EXT] Re: [PATCH] iw:
> Add support for controlling tx power for per station"
> for the reason why we opted dBm.

The quote was:

> I would prefer if this was *dBm*, rather than mBm, and be allowed to
> take float values, i.e. this would become "limit 20".

I read that as "iw should convert fractional dBm to mBm" not "kernel should
only support dBm".

ath10k might only support dBm, fine -- but even ath5k could support
per-packet transmit power in 0.5 dB steps, so this is already limiting
applicability to existing hardware.
Johannes Berg April 2, 2019, 1:04 p.m. UTC | #5
On Tue, 2019-04-02 at 08:59 -0400, Bob Copeland wrote:
> On Tue, Apr 02, 2019 at 12:00:29PM +0530, Balaji Pothunoori wrote:
> > > Should this really dBm?  It's a bit asymmetric for WIPHY_TX_POWER_LEVEL
> > > to
> > > use mBm and this to use dBm, and I might want to adjust in half-dB steps
> > > if
> > > supported by hardware.  Also allocating an s16 is a bit much for dBm.
> > 
> > if user will send mBm value then driver has to convert to dBm because
> > firmware will expect the value in dBm.
> > Please refer johannes comments on following patch " [EXT] Re: [PATCH] iw:
> > Add support for controlling tx power for per station"
> > for the reason why we opted dBm.
> 
> The quote was:
> 
> > I would prefer if this was *dBm*, rather than mBm, and be allowed to
> > take float values, i.e. this would become "limit 20".
> 
> I read that as "iw should convert fractional dBm to mBm" not "kernel should
> only support dBm".

Yeah, I was scratching my head here now wondering why I'd have said
that... But yes, I intended that we should present the nicer UI (float
dBm or so) and then send mBm :)

johannes
diff mbox series

Patch

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bb307a1..5413a58 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -973,6 +973,27 @@  enum station_parameters_apply_mask {
 	STATION_PARAM_APPLY_UAPSD = BIT(0),
 	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
 	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
+	STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
+};
+
+/**
+ * struct sta_txpwr - station txpower configuration
+ *
+ * Used to configure txpower for station.
+ *
+ * @power: tx power (in dBm) to be used for sending data traffic. If tx power
+ *	is not provided, the default per-interface tx power setting will be
+ *	overriding. Driver should be picking up the lowest tx power, either tx
+ *	power per-interface or per-station.
+ * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
+ *	will be less than or equal to specified from userspace, whereas if TPC
+ *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
+ *	NL80211_TX_POWER_FIXED is not a valid configuration option for
+ *	per peer TPC.
+ */
+struct sta_txpwr {
+	s16 power;
+	enum nl80211_tx_power_setting type;
 };
 
 /**
@@ -1047,6 +1068,7 @@  struct station_parameters {
 	const struct ieee80211_he_cap_elem *he_capa;
 	u8 he_capa_len;
 	u16 airtime_weight;
+	struct sta_txpwr txpwr;
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index dd4f86e..83040c6 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2308,6 +2308,15 @@  enum nl80211_commands {
  * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
  *	scheduler.
  *
+ * @NL80211_ATTR_STA_TX_POWER_SETTING: Transmit power setting type (u8) for
+ *	station associated with the AP. See &enum nl80211_tx_power_setting for
+ *	possible values.
+ * @NL80211_ATTR_STA_TX_POWER: Transmit power level (s16) in dBm units. This
+ *	allows to set Tx power for a station. If this attribute is not included,
+ *	the default per-interface tx power setting will be overriding. Driver
+ *	should be picking up the lowest tx power, either tx power per-interface
+ *	or per-station.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2758,6 +2767,8 @@  enum nl80211_attrs {
 	NL80211_ATTR_PEER_MEASUREMENTS,
 
 	NL80211_ATTR_AIRTIME_WEIGHT,
+	NL80211_ATTR_STA_TX_POWER_SETTING,
+	NL80211_ATTR_STA_TX_POWER,
 
 	/* add attributes here, update the policy in nl80211.c */
 
@@ -5343,6 +5354,8 @@  enum nl80211_feature_flags {
  * @NL80211_EXT_FEATURE_AP_PMKSA_CACHING: Driver/device supports PMKSA caching
  *	(set/del PMKSA operations) in AP mode.
  *
+ * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power
+ 8	to a station.
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
@@ -5384,6 +5397,7 @@  enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
 	NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
 	NL80211_EXT_FEATURE_AP_PMKSA_CACHING,
+	NL80211_EXT_FEATURE_STA_TX_PWR,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 25a9e3b..a6e9cea 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -331,6 +331,11 @@  const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
 					       .len = NL80211_MAX_SUPP_RATES },
 	[NL80211_ATTR_STA_PLINK_ACTION] =
 		NLA_POLICY_MAX(NLA_U8, NUM_NL80211_PLINK_ACTIONS - 1),
+	[NL80211_ATTR_STA_TX_POWER_SETTING] =
+		NLA_POLICY_RANGE(NLA_U8,
+				 NL80211_TX_POWER_AUTOMATIC,
+				 NL80211_TX_POWER_FIXED),
+	[NL80211_ATTR_STA_TX_POWER] = { .type = NLA_S16 },
 	[NL80211_ATTR_STA_VLAN] = { .type = NLA_U32 },
 	[NL80211_ATTR_MNTR_FLAGS] = { /* NLA_NESTED can't be empty */ },
 	[NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY,
@@ -5387,6 +5392,36 @@  static int nl80211_set_station_tdls(struct genl_info *info,
 	return nl80211_parse_sta_wme(info, params);
 }
 
+static int nl80211_parse_sta_txpower_setting(struct genl_info *info,
+					     struct station_parameters *params)
+{
+	struct cfg80211_registered_device *rdev = info->user_ptr[0];
+	int idx;
+
+	if (info->attrs[NL80211_ATTR_STA_TX_POWER_SETTING]) {
+		if (!rdev->ops->set_tx_power ||
+		    !wiphy_ext_feature_isset(&rdev->wiphy,
+					 NL80211_EXT_FEATURE_STA_TX_PWR))
+			return -EOPNOTSUPP;
+
+		idx = NL80211_ATTR_STA_TX_POWER_SETTING;
+		params->txpwr.type = nla_get_u8(info->attrs[idx]);
+
+		if (params->txpwr.type == NL80211_TX_POWER_LIMITED) {
+			idx = NL80211_ATTR_STA_TX_POWER;
+
+			if (info->attrs[idx])
+				params->txpwr.power =
+					nla_get_s16(info->attrs[idx]);
+			else
+				return -EINVAL;
+		}
+		params->sta_modify_mask |= STATION_PARAM_APPLY_STA_TXPOWER;
+	}
+
+	return 0;
+}
+
 static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
 {
 	struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -5480,6 +5515,10 @@  static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
 				     NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
 		return -EOPNOTSUPP;
 
+	err = nl80211_parse_sta_txpower_setting(info, &params);
+	if (err)
+		return err;
+
 	/* Include parameters for TDLS peer (will check later) */
 	err = nl80211_set_station_tdls(info, &params);
 	if (err)
@@ -5617,6 +5656,10 @@  static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
 				     NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
 		return -EOPNOTSUPP;
 
+	err = nl80211_parse_sta_txpower_setting(info, &params);
+	if (err)
+		return err;
+
 	err = nl80211_parse_sta_channel_info(info, &params);
 	if (err)
 		return err;