diff mbox series

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

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

Commit Message

Balaji Pothunoori Jan. 30, 2019, 10:34 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

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

Comments

kernel test robot Jan. 30, 2019, 2:41 p.m. UTC | #1
Hi Ashok,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20190130]
[cannot apply to v5.0-rc4]
[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/20190130-192343
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/interrupt.h:268: warning: Function parameter or member 'is_managed' not described in 'irq_affinity_desc'
   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:4737: warning: Function parameter or member 'wext.ibss' not described in 'wireless_dev'
   include/net/cfg80211.h:4737: warning: Function parameter or member 'wext.connect' not described in 'wireless_dev'
   include/net/cfg80211.h:4737: warning: Function parameter or member 'wext.keys' not described in 'wireless_dev'
   include/net/cfg80211.h:4737: warning: Function parameter or member 'wext.ie' not described in 'wireless_dev'
   include/net/cfg80211.h:4737: warning: Function parameter or member 'wext.ie_len' not described in 'wireless_dev'
   include/net/cfg80211.h:4737: warning: Function parameter or member 'wext.bssid' not described in 'wireless_dev'
   include/net/cfg80211.h:4737: warning: Function parameter or member 'wext.ssid' not described in 'wireless_dev'
   include/net/cfg80211.h:4737: warning: Function parameter or member 'wext.default_key' not described in 'wireless_dev'
   include/net/cfg80211.h:4737: warning: Function parameter or member 'wext.default_mgmt_key' not described in 'wireless_dev'
   include/net/cfg80211.h:4737: warning: Function parameter or member 'wext.prev_bssid_valid' not described in 'wireless_dev'
>> include/net/cfg80211.h:1064: warning: Function parameter or member 'txpwr' not described in 'station_parameters'
>> include/net/cfg80211.h:1064: warning: Function parameter or member 'txpwr.power' not described in 'station_parameters'
>> include/net/cfg80211.h:1064: warning: Function parameter or member 'txpwr.type' not described in 'station_parameters'
   include/net/cfg80211.h:1471: warning: Enum value 'MPATH_INFO_PATH_CHANGE' not described in enum 'mpath_info_flags'
   include/net/mac80211.h:2407: warning: Function parameter or member 'radiotap_timestamp.units_pos' not described in 'ieee80211_hw'
   include/net/mac80211.h:2407: warning: Function parameter or member 'radiotap_timestamp.accuracy' not described in 'ieee80211_hw'
   include/net/mac80211.h:2407: warning: Function parameter or member 'weight_multiplier' not described in 'ieee80211_hw'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.rates' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.rts_cts_rate_idx' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.use_rts' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.use_cts_prot' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.short_preamble' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.skip_table' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.jiffies' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.vif' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.hw_key' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.flags' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'control.enqueue_time' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'ack' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'ack.cookie' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'status.rates' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'status.ack_signal' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'status.ampdu_ack_len' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'status.ampdu_len' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'status.antenna' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'status.tx_time' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'status.is_valid_ack_signal' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'status.status_driver_data' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'driver_rates' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'pad' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1010: warning: Function parameter or member 'rate_driver_data' not described in 'ieee80211_tx_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'rx_stats_avg' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'rx_stats_avg.signal' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'rx_stats_avg.chain_signal' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.filtered' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.retry_failed' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.retry_count' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.lost_packets' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.last_tdls_pkt_time' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.msdu_retries' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.msdu_failed' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.last_ack' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.last_ack_signal' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.ack_signal_filled' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'status_stats.avg_ack_signal' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'tx_stats.packets' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'tx_stats.bytes' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'tx_stats.last_rate' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'tx_stats.msdu' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'airtime' not described in 'sta_info'
   net/mac80211/sta_info.h:607: warning: Function parameter or member 'airtime_weight' not described in 'sta_info'
   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'
   drivers/mtd/nand/raw/nand_base.c:420: warning: Function parameter or member 'chip' not described in 'nand_fill_oob'
   drivers/mtd/nand/raw/nand_bbt.c:173: warning: Function parameter or member 'this' not described in 'read_bbt'
   drivers/mtd/nand/raw/nand_bbt.c:173: warning: Excess function parameter 'chip' description in 'read_bbt'
   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'

vim +1064 include/net/cfg80211.h

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

:::::: The code at line 1064 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
diff mbox series

Patch

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7033c90..029d9fe 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -973,6 +973,7 @@  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),
 };
 
 /**
@@ -1017,6 +1018,15 @@  enum station_parameters_apply_mask {
  * @he_capa: HE capabilities of station
  * @he_capa_len: the length of the HE capabilities
  * @airtime_weight: airtime scheduler weight for this 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 station_parameters {
 	const u8 *supported_rates;
@@ -1047,6 +1057,10 @@  struct station_parameters {
 	const struct ieee80211_he_cap_elem *he_capa;
 	u8 he_capa_len;
 	u16 airtime_weight;
+	struct {
+		s16 power;
+		enum nl80211_tx_power_setting type;
+	} 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 af89e5c..7e8073a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -347,6 +347,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,
@@ -5404,6 +5409,31 @@  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;
+			params->txpwr.power = nla_get_s16(info->attrs[idx]);
+		}
+		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];
@@ -5497,6 +5527,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)
@@ -5634,6 +5668,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;