diff options
| -rw-r--r-- | include/net/mac80211.h | 22 | ||||
| -rw-r--r-- | net/mac80211/cfg.c | 9 | ||||
| -rw-r--r-- | net/mac80211/driver-ops.c | 21 | ||||
| -rw-r--r-- | net/mac80211/driver-ops.h | 5 | ||||
| -rw-r--r-- | net/mac80211/trace.h | 30 |
5 files changed, 87 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index c10abca55fde..d66fbfe8d55d 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -1890,6 +1890,24 @@ struct ieee80211_sta_rates { | |||
| 1890 | }; | 1890 | }; |
| 1891 | 1891 | ||
| 1892 | /** | 1892 | /** |
| 1893 | * struct ieee80211_sta_txpwr - station txpower configuration | ||
| 1894 | * | ||
| 1895 | * Used to configure txpower for station. | ||
| 1896 | * | ||
| 1897 | * @power: indicates the tx power, in dBm, to be used when sending data frames | ||
| 1898 | * to the STA. | ||
| 1899 | * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power | ||
| 1900 | * will be less than or equal to specified from userspace, whereas if TPC | ||
| 1901 | * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power. | ||
| 1902 | * NL80211_TX_POWER_FIXED is not a valid configuration option for | ||
| 1903 | * per peer TPC. | ||
| 1904 | */ | ||
| 1905 | struct ieee80211_sta_txpwr { | ||
| 1906 | s16 power; | ||
| 1907 | enum nl80211_tx_power_setting type; | ||
| 1908 | }; | ||
| 1909 | |||
| 1910 | /** | ||
| 1893 | * struct ieee80211_sta - station table entry | 1911 | * struct ieee80211_sta - station table entry |
| 1894 | * | 1912 | * |
| 1895 | * A station table entry represents a station we are possibly | 1913 | * A station table entry represents a station we are possibly |
| @@ -1975,6 +1993,7 @@ struct ieee80211_sta { | |||
| 1975 | bool support_p2p_ps; | 1993 | bool support_p2p_ps; |
| 1976 | u16 max_rc_amsdu_len; | 1994 | u16 max_rc_amsdu_len; |
| 1977 | u16 max_tid_amsdu_len[IEEE80211_NUM_TIDS]; | 1995 | u16 max_tid_amsdu_len[IEEE80211_NUM_TIDS]; |
| 1996 | struct ieee80211_sta_txpwr txpwr; | ||
| 1978 | 1997 | ||
| 1979 | struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; | 1998 | struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; |
| 1980 | 1999 | ||
| @@ -3800,6 +3819,9 @@ struct ieee80211_ops { | |||
| 3800 | #endif | 3819 | #endif |
| 3801 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 3820 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 3802 | enum sta_notify_cmd, struct ieee80211_sta *sta); | 3821 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
| 3822 | int (*sta_set_txpwr)(struct ieee80211_hw *hw, | ||
| 3823 | struct ieee80211_vif *vif, | ||
| 3824 | struct ieee80211_sta *sta); | ||
| 3803 | int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 3825 | int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 3804 | struct ieee80211_sta *sta, | 3826 | struct ieee80211_sta *sta, |
| 3805 | enum ieee80211_sta_state old_state, | 3827 | enum ieee80211_sta_state old_state, |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 14bbb7e8ad0e..ba6e4080d63d 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
| @@ -1457,6 +1457,15 @@ static int sta_apply_parameters(struct ieee80211_local *local, | |||
| 1457 | if (params->listen_interval >= 0) | 1457 | if (params->listen_interval >= 0) |
| 1458 | sta->listen_interval = params->listen_interval; | 1458 | sta->listen_interval = params->listen_interval; |
| 1459 | 1459 | ||
| 1460 | if (params->sta_modify_mask & STATION_PARAM_APPLY_STA_TXPOWER) { | ||
| 1461 | sta->sta.txpwr.type = params->txpwr.type; | ||
| 1462 | if (params->txpwr.type == NL80211_TX_POWER_LIMITED) | ||
| 1463 | sta->sta.txpwr.power = params->txpwr.power; | ||
| 1464 | ret = drv_sta_set_txpwr(local, sdata, sta); | ||
| 1465 | if (ret) | ||
| 1466 | return ret; | ||
| 1467 | } | ||
| 1468 | |||
| 1460 | if (params->supported_rates) { | 1469 | if (params->supported_rates) { |
| 1461 | ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef, | 1470 | ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef, |
| 1462 | sband, params->supported_rates, | 1471 | sband, params->supported_rates, |
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c index bb886e7db47f..839c0022a29c 100644 --- a/net/mac80211/driver-ops.c +++ b/net/mac80211/driver-ops.c | |||
| @@ -138,6 +138,27 @@ int drv_sta_state(struct ieee80211_local *local, | |||
| 138 | return ret; | 138 | return ret; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | __must_check | ||
| 142 | int drv_sta_set_txpwr(struct ieee80211_local *local, | ||
| 143 | struct ieee80211_sub_if_data *sdata, | ||
| 144 | struct sta_info *sta) | ||
| 145 | { | ||
| 146 | int ret = -EOPNOTSUPP; | ||
| 147 | |||
| 148 | might_sleep(); | ||
| 149 | |||
| 150 | sdata = get_bss_sdata(sdata); | ||
| 151 | if (!check_sdata_in_driver(sdata)) | ||
| 152 | return -EIO; | ||
| 153 | |||
| 154 | trace_drv_sta_set_txpwr(local, sdata, &sta->sta); | ||
| 155 | if (local->ops->sta_set_txpwr) | ||
| 156 | ret = local->ops->sta_set_txpwr(&local->hw, &sdata->vif, | ||
| 157 | &sta->sta); | ||
| 158 | trace_drv_return_int(local, ret); | ||
| 159 | return ret; | ||
| 160 | } | ||
| 161 | |||
| 141 | void drv_sta_rc_update(struct ieee80211_local *local, | 162 | void drv_sta_rc_update(struct ieee80211_local *local, |
| 142 | struct ieee80211_sub_if_data *sdata, | 163 | struct ieee80211_sub_if_data *sdata, |
| 143 | struct ieee80211_sta *sta, u32 changed) | 164 | struct ieee80211_sta *sta, u32 changed) |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 28d022a3eee3..62edfa6a73ed 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
| @@ -529,6 +529,11 @@ int drv_sta_state(struct ieee80211_local *local, | |||
| 529 | enum ieee80211_sta_state old_state, | 529 | enum ieee80211_sta_state old_state, |
| 530 | enum ieee80211_sta_state new_state); | 530 | enum ieee80211_sta_state new_state); |
| 531 | 531 | ||
| 532 | __must_check | ||
| 533 | int drv_sta_set_txpwr(struct ieee80211_local *local, | ||
| 534 | struct ieee80211_sub_if_data *sdata, | ||
| 535 | struct sta_info *sta); | ||
| 536 | |||
| 532 | void drv_sta_rc_update(struct ieee80211_local *local, | 537 | void drv_sta_rc_update(struct ieee80211_local *local, |
| 533 | struct ieee80211_sub_if_data *sdata, | 538 | struct ieee80211_sub_if_data *sdata, |
| 534 | struct ieee80211_sta *sta, u32 changed); | 539 | struct ieee80211_sta *sta, u32 changed); |
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 8ba70d26b82e..3bb4459b52c7 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h | |||
| @@ -828,6 +828,36 @@ TRACE_EVENT(drv_sta_state, | |||
| 828 | ) | 828 | ) |
| 829 | ); | 829 | ); |
| 830 | 830 | ||
| 831 | TRACE_EVENT(drv_sta_set_txpwr, | ||
| 832 | TP_PROTO(struct ieee80211_local *local, | ||
| 833 | struct ieee80211_sub_if_data *sdata, | ||
| 834 | struct ieee80211_sta *sta), | ||
| 835 | |||
| 836 | TP_ARGS(local, sdata, sta), | ||
| 837 | |||
| 838 | TP_STRUCT__entry( | ||
| 839 | LOCAL_ENTRY | ||
| 840 | VIF_ENTRY | ||
| 841 | STA_ENTRY | ||
| 842 | __field(s16, txpwr) | ||
| 843 | __field(u8, type) | ||
| 844 | ), | ||
| 845 | |||
| 846 | TP_fast_assign( | ||
| 847 | LOCAL_ASSIGN; | ||
| 848 | VIF_ASSIGN; | ||
| 849 | STA_ASSIGN; | ||
| 850 | __entry->txpwr = sta->txpwr.power; | ||
| 851 | __entry->type = sta->txpwr.type; | ||
| 852 | ), | ||
| 853 | |||
| 854 | TP_printk( | ||
| 855 | LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " txpwr: %d type %d", | ||
| 856 | LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, | ||
| 857 | __entry->txpwr, __entry->type | ||
| 858 | ) | ||
| 859 | ); | ||
| 860 | |||
| 831 | TRACE_EVENT(drv_sta_rc_update, | 861 | TRACE_EVENT(drv_sta_rc_update, |
| 832 | TP_PROTO(struct ieee80211_local *local, | 862 | TP_PROTO(struct ieee80211_local *local, |
| 833 | struct ieee80211_sub_if_data *sdata, | 863 | struct ieee80211_sub_if_data *sdata, |
