mac80211: store tx power value from user to station
Subsystems (2)
PATCH 2/3 mac80211: store tx power value from user to station
From: Ashok Raj Nagarajan <[email protected]>
This patch introduce a new driver callback drv_sta_set_txpwr. This API will copy the transmit power value passed from user space and call the driver callback to set the tx power for the station.
--- include/net/mac80211.h | 12 ++++++++++++ net/mac80211/cfg.c | 9 +++++++++ net/mac80211/driver-ops.c | 21 +++++++++++++++++++++ net/mac80211/driver-ops.h | 5 +++++ net/mac80211/trace.h | 27 +++++++++++++++++++++++++++ 5 files changed, 74 insertions(+)
include/net/mac80211.h +12 -0
@@ -1877,6 +1877,13 @@ struct ieee80211_sta_rates {* @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not. * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control. * @max_tid_amsdu_len: Maximum A-MSDU size in bytes for this TID +* @txpwr: indicates the tx power, in mBm, to be used when sending data frames +* to the STA. +* @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then txpwr will +* be less than or equal to specified from userspace, whereas if TPC %type +* is NL80211_TX_POWER_AUTOMATIC then it indicates default txpwr. +* NL80211_TX_POWER_FIXED is not a valid configuration option for +* per peer TPC. * @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that * the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames */
@@ -1919,6 +1926,8 @@ struct ieee80211_sta {bool support_p2p_ps;u16 max_rc_amsdu_len;u16 max_tid_amsdu_len[IEEE80211_NUM_TIDS ]; +s16 txpwr; +enum nl80211_tx_power_setting type;struct ieee80211_txq *txq[IEEE80211_NUM_TIDS +1 ];
@@ -3718,6 +3727,9 @@ struct ieee80211_ops {#endif void (*sta_notify)(struct ieee80211_hw *hw,struct ieee80211_vif *vif,enum sta_notify_cmd ,struct ieee80211_sta *sta); +int (*sta_set_txpwr)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta); int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, enum ieee80211_sta_state old_state,
net/mac80211/cfg.c +9 -0
@@ -1412,6 +1412,15 @@ static int sta_apply_parameters(struct ieee80211_local *local,if (params->listen_interval >=0 ) sta->listen_interval = params->listen_interval; +if (params->sta_modify_mask &STATION_PARAM_APPLY_STA_TXPOWER ) { + sta->sta.type = params->type; +if (params->type ==NL80211_TX_POWER_LIMITED ) + sta->sta.txpwr = params->txpwr; + ret =drv_sta_set_txpwr (local, sdata, sta); +if (ret) +return ret; + } +if (params->supported_rates) { ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef, sband, params->supported_rates,
net/mac80211/driver-ops.c +21 -0
@@ -138,6 +138,27 @@ int drv_sta_state(struct ieee80211_local *local,return ret; } +__must_check +int drv_sta_set_txpwr (struct ieee80211_local *local, +struct ieee80211_sub_if_data *sdata, +struct sta_info *sta) +{ +int ret = -EOPNOTSUPP ; + +might_sleep (); + + sdata =get_bss_sdata (sdata); +if (!check_sdata_in_driver (sdata)) +return -EIO ; + +trace_drv_sta_set_txpwr (local, sdata, &sta->sta); +if (local->ops->sta_set_txpwr) + ret = local->ops->sta_set_txpwr (&local->hw, &sdata->vif, + &sta->sta); +trace_drv_return_int (local, ret); +return ret; +} +void drv_sta_rc_update (struct ieee80211_local *local,struct ieee80211_sub_if_data *sdata,struct ieee80211_sta *sta,u32 changed)
net/mac80211/driver-ops.h +5 -0
@@ -529,6 +529,11 @@ int drv_sta_state(struct ieee80211_local *local,enum ieee80211_sta_state old_state, enum ieee80211_sta_state new_state); +__must_check +int drv_sta_set_txpwr (struct ieee80211_local *local, +struct ieee80211_sub_if_data *sdata, +struct sta_info *sta); +void drv_sta_rc_update (struct ieee80211_local *local,struct ieee80211_sub_if_data *sdata,struct ieee80211_sta *sta,u32 changed);
net/mac80211/trace.h +27 -0
@@ -828,6 +828,33 @@ TRACE_EVENT(drv_sta_state, ) ); +TRACE_EVENT (drv_sta_set_txpwr, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta), + +TP_ARGS (local, sdata, sta), + +TP_STRUCT__entry ( + LOCAL_ENTRY + VIF_ENTRY + STA_ENTRY +__field (s16, txpwr) + ), + +TP_fast_assign ( + LOCAL_ASSIGN; + VIF_ASSIGN; + STA_ASSIGN; + __entry->txpwr = sta->txpwr; + ), + +TP_printk ( + LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " txpwr: %d", +LOCAL_PR_ARG ,VIF_PR_ARG ,STA_PR_ARG , __entry->txpwr + ) +); + TRACE_EVENT(drv_sta_rc_update, TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata,
Signature · 7 lines
2.7.4 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Johannes Berg
maintainerQuoted 8 lines · Balaji Pothunoori
+ * @txpwr: indicates the tx power, in mBm, to be used when sending data frames
+ * to the STA.
+ * @type: In particular if TPC %type isNL80211_TX_POWER_LIMITEDthen txpwr will
+ * be less than or equal to specified from userspace, whereas if TPC %type
+ * isNL80211_TX_POWER_AUTOMATICthen it indicates default txpwr.
+ *NL80211_TX_POWER_FIXEDis not a valid configuration option for
+ * per peer TPC.
Same comment here wrt. txpower_type or so.
Quoted 10 lines
net/mac80211/trace.h +10
-0+TRACE_EVENT(drv_sta_set_txpwr, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta), + + TP_ARGS(local, sdata, sta), + + TP_STRUCT__entry( + LOCAL_ENTRY + VIF_ENTRY
net/mac80211/trace.h TRACE_EVENT(drv_sta_state, · line 850
Quoted 10 lines
net/mac80211/trace.h +10
-0+ STA_ENTRY + __field(s16, txpwr) + ), + + TP_fast_assign( + LOCAL_ASSIGN; + VIF_ASSIGN; + STA_ASSIGN; + __entry->txpwr = sta->txpwr; + ),
Include the type as well?
OTOH, is this whole business with the type even needed everywhere?
johannes
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k