developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1 | From 0f6ae2024ce001cf003239b3aaa56cb4a279bba9 Mon Sep 17 00:00:00 2001 |
| 2 | From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 3 | Date: Thu, 22 Feb 2024 15:21:49 +0800 |
| 4 | Subject: [PATCH 75/89] mtk: mac80211: add per-link txpower config |
| 5 | |
| 6 | Add per-link txpower config & info dump |
| 7 | |
| 8 | Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 9 | --- |
| 10 | include/net/cfg80211.h | 5 ++-- |
| 11 | include/net/mac80211.h | 2 +- |
| 12 | net/mac80211/cfg.c | 48 +++++++++++++++++++++++++++----------- |
| 13 | net/mac80211/chan.c | 4 ++-- |
| 14 | net/mac80211/driver-ops.h | 7 +++--- |
| 15 | net/mac80211/ieee80211_i.h | 5 ++-- |
| 16 | net/mac80211/iface.c | 23 +++++++++--------- |
| 17 | net/mac80211/link.c | 3 +++ |
| 18 | net/mac80211/mlme.c | 2 +- |
| 19 | net/mac80211/trace.h | 10 ++++---- |
| 20 | net/wireless/nl80211.c | 17 +++++++++++--- |
| 21 | net/wireless/rdev-ops.h | 12 ++++++---- |
| 22 | net/wireless/trace.h | 30 ++++++++++++++++++------ |
| 23 | net/wireless/wext-compat.c | 4 ++-- |
| 24 | 14 files changed, 116 insertions(+), 56 deletions(-) |
| 25 | |
| 26 | diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h |
| 27 | index bedf711..a63f5bb 100644 |
| 28 | --- a/include/net/cfg80211.h |
| 29 | +++ b/include/net/cfg80211.h |
| 30 | @@ -4749,9 +4749,10 @@ struct cfg80211_ops { |
| 31 | int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); |
| 32 | |
| 33 | int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 34 | - enum nl80211_tx_power_setting type, int mbm); |
| 35 | + unsigned int link_id, enum nl80211_tx_power_setting type, |
| 36 | + int mbm); |
| 37 | int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 38 | - int *dbm); |
| 39 | + unsigned int link_id, int *dbm); |
| 40 | |
| 41 | void (*rfkill_poll)(struct wiphy *wiphy); |
| 42 | |
| 43 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
| 44 | index bb4f12f..30aa436 100644 |
| 45 | --- a/include/net/mac80211.h |
| 46 | +++ b/include/net/mac80211.h |
| 47 | @@ -4746,7 +4746,7 @@ struct ieee80211_ops { |
| 48 | u32 (*get_expected_throughput)(struct ieee80211_hw *hw, |
| 49 | struct ieee80211_sta *sta); |
| 50 | int (*get_txpower)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 51 | - int *dbm); |
| 52 | + unsigned int link_id, int *dbm); |
| 53 | |
| 54 | int (*tdls_channel_switch)(struct ieee80211_hw *hw, |
| 55 | struct ieee80211_vif *vif, |
| 56 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
| 57 | index 02374b0..19171b0 100644 |
| 58 | --- a/net/mac80211/cfg.c |
| 59 | +++ b/net/mac80211/cfg.c |
| 60 | @@ -3048,10 +3048,13 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) |
| 61 | |
| 62 | static int ieee80211_set_tx_power(struct wiphy *wiphy, |
| 63 | struct wireless_dev *wdev, |
| 64 | + unsigned int link_id, |
| 65 | enum nl80211_tx_power_setting type, int mbm) |
| 66 | { |
| 67 | struct ieee80211_local *local = wiphy_priv(wiphy); |
| 68 | struct ieee80211_sub_if_data *sdata; |
| 69 | + struct ieee80211_link_data *link; |
| 70 | + struct ieee80211_bss_conf *link_conf; |
| 71 | enum nl80211_tx_power_setting txp_type = type; |
| 72 | bool update_txp_type = false; |
| 73 | bool has_monitor = false; |
| 74 | @@ -3060,6 +3063,11 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, |
| 75 | |
| 76 | if (wdev) { |
| 77 | sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); |
| 78 | + link = sdata_dereference(sdata->link[link_id], sdata); |
| 79 | + if (!link) |
| 80 | + return -ENOLINK; |
| 81 | + |
| 82 | + link_conf = link->conf; |
| 83 | |
| 84 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) { |
| 85 | sdata = wiphy_dereference(local->hw.wiphy, |
| 86 | @@ -3070,7 +3078,7 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, |
| 87 | |
| 88 | switch (type) { |
| 89 | case NL80211_TX_POWER_AUTOMATIC: |
| 90 | - sdata->deflink.user_power_level = |
| 91 | + link->user_power_level = |
| 92 | IEEE80211_UNSET_POWER_LEVEL; |
| 93 | txp_type = NL80211_TX_POWER_LIMITED; |
| 94 | break; |
| 95 | @@ -3078,20 +3086,24 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, |
| 96 | case NL80211_TX_POWER_FIXED: |
| 97 | if (mbm < 0 || (mbm % 100)) |
| 98 | return -EOPNOTSUPP; |
| 99 | - sdata->deflink.user_power_level = MBM_TO_DBM(mbm); |
| 100 | + link->user_power_level = MBM_TO_DBM(mbm); |
| 101 | break; |
| 102 | } |
| 103 | |
| 104 | - if (txp_type != sdata->vif.bss_conf.txpower_type) { |
| 105 | + if (txp_type != link_conf->txpower_type) { |
| 106 | update_txp_type = true; |
| 107 | - sdata->vif.bss_conf.txpower_type = txp_type; |
| 108 | + link_conf->txpower_type = txp_type; |
| 109 | } |
| 110 | |
| 111 | - ieee80211_recalc_txpower(sdata, update_txp_type); |
| 112 | + ieee80211_recalc_txpower(sdata, update_txp_type, link); |
| 113 | |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | + /*TODO: handle single wiphy */ |
| 118 | + wiphy_info(wiphy, "Setting txpower for the entire band is not supported\n"); |
| 119 | + return -EOPNOTSUPP; |
| 120 | + |
| 121 | switch (type) { |
| 122 | case NL80211_TX_POWER_AUTOMATIC: |
| 123 | local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; |
| 124 | @@ -3118,7 +3130,12 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, |
| 125 | list_for_each_entry(sdata, &local->interfaces, list) { |
| 126 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) |
| 127 | continue; |
| 128 | - ieee80211_recalc_txpower(sdata, update_txp_type); |
| 129 | + /* Due to mac80211 not pass link id to here, use first link for now */ |
| 130 | + if (ieee80211_vif_is_mld(&sdata->vif)) |
| 131 | + ieee80211_recalc_txpower(sdata, update_txp_type, sdata->link[0]); |
| 132 | + else |
| 133 | + ieee80211_recalc_txpower(sdata, update_txp_type, &sdata->deflink); |
| 134 | + |
| 135 | } |
| 136 | |
| 137 | if (has_monitor) { |
| 138 | @@ -3130,7 +3147,7 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, |
| 139 | update_txp_type = true; |
| 140 | sdata->vif.bss_conf.txpower_type = txp_type; |
| 141 | |
| 142 | - ieee80211_recalc_txpower(sdata, update_txp_type); |
| 143 | + ieee80211_recalc_txpower(sdata, update_txp_type, &sdata->deflink); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | @@ -3139,18 +3156,23 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, |
| 148 | |
| 149 | static int ieee80211_get_tx_power(struct wiphy *wiphy, |
| 150 | struct wireless_dev *wdev, |
| 151 | - int *dbm) |
| 152 | + unsigned int link_id, int *dbm) |
| 153 | { |
| 154 | struct ieee80211_local *local = wiphy_priv(wiphy); |
| 155 | struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); |
| 156 | + struct ieee80211_link_data *link; |
| 157 | |
| 158 | if (local->ops->get_txpower) |
| 159 | - return drv_get_txpower(local, sdata, dbm); |
| 160 | + return drv_get_txpower(local, sdata, link_id, dbm); |
| 161 | |
| 162 | - if (local->emulate_chanctx) |
| 163 | - *dbm = local->hw.conf.power_level; |
| 164 | - else |
| 165 | - *dbm = sdata->vif.bss_conf.txpower; |
| 166 | + *dbm = local->hw.conf.power_level; |
| 167 | + if (!local->emulate_chanctx) { |
| 168 | + link = sdata_dereference(sdata->link[link_id], sdata); |
| 169 | + if (!link) |
| 170 | + return -ENOLINK; |
| 171 | + |
| 172 | + *dbm = link->conf->txpower; |
| 173 | + } |
| 174 | |
| 175 | /* INT_MIN indicates no power level was set yet */ |
| 176 | if (*dbm == INT_MIN) |
| 177 | diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c |
| 178 | index 31d7fa8..e7d2ee2 100644 |
| 179 | --- a/net/mac80211/chan.c |
| 180 | +++ b/net/mac80211/chan.c |
| 181 | @@ -913,7 +913,7 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, |
| 182 | } |
| 183 | |
| 184 | if (new_ctx && ieee80211_chanctx_num_assigned(local, new_ctx) > 0) { |
| 185 | - ieee80211_recalc_txpower(sdata, false); |
| 186 | + ieee80211_recalc_txpower(sdata, false, link); |
| 187 | ieee80211_recalc_chanctx_min_def(local, new_ctx, NULL, false); |
| 188 | } |
| 189 | |
| 190 | @@ -1730,7 +1730,7 @@ static int ieee80211_vif_use_reserved_switch(struct ieee80211_local *local) |
| 191 | link, |
| 192 | changed); |
| 193 | |
| 194 | - ieee80211_recalc_txpower(sdata, false); |
| 195 | + ieee80211_recalc_txpower(sdata, false, link); |
| 196 | } |
| 197 | |
| 198 | ieee80211_recalc_chanctx_chantype(local, ctx); |
| 199 | diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h |
| 200 | index d226e31..aca4426 100644 |
| 201 | --- a/net/mac80211/driver-ops.h |
| 202 | +++ b/net/mac80211/driver-ops.h |
| 203 | @@ -1273,7 +1273,8 @@ static inline u32 drv_get_expected_throughput(struct ieee80211_local *local, |
| 204 | } |
| 205 | |
| 206 | static inline int drv_get_txpower(struct ieee80211_local *local, |
| 207 | - struct ieee80211_sub_if_data *sdata, int *dbm) |
| 208 | + struct ieee80211_sub_if_data *sdata, |
| 209 | + unsigned int link_id, int *dbm) |
| 210 | { |
| 211 | int ret; |
| 212 | |
| 213 | @@ -1283,8 +1284,8 @@ static inline int drv_get_txpower(struct ieee80211_local *local, |
| 214 | if (!local->ops->get_txpower) |
| 215 | return -EOPNOTSUPP; |
| 216 | |
| 217 | - ret = local->ops->get_txpower(&local->hw, &sdata->vif, dbm); |
| 218 | - trace_drv_get_txpower(local, sdata, *dbm, ret); |
| 219 | + ret = local->ops->get_txpower(&local->hw, &sdata->vif, link_id, dbm); |
| 220 | + trace_drv_get_txpower(local, sdata, link_id, *dbm, ret); |
| 221 | |
| 222 | return ret; |
| 223 | } |
| 224 | diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h |
| 225 | index 2cb80c3..6f9a9a6 100644 |
| 226 | --- a/net/mac80211/ieee80211_i.h |
| 227 | +++ b/net/mac80211/ieee80211_i.h |
| 228 | @@ -2050,9 +2050,10 @@ void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata); |
| 229 | int ieee80211_add_virtual_monitor(struct ieee80211_local *local); |
| 230 | void ieee80211_del_virtual_monitor(struct ieee80211_local *local); |
| 231 | |
| 232 | -bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); |
| 233 | +bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata, |
| 234 | + struct ieee80211_link_data *link); |
| 235 | void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata, |
| 236 | - bool update_bss); |
| 237 | + bool update_bss, struct ieee80211_link_data *link); |
| 238 | void ieee80211_recalc_offload(struct ieee80211_local *local); |
| 239 | |
| 240 | static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) |
| 241 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
| 242 | index d959901..eb7a05d 100644 |
| 243 | --- a/net/mac80211/iface.c |
| 244 | +++ b/net/mac80211/iface.c |
| 245 | @@ -44,13 +44,14 @@ |
| 246 | |
| 247 | static void ieee80211_iface_work(struct wiphy *wiphy, struct wiphy_work *work); |
| 248 | |
| 249 | -bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata) |
| 250 | +bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata, |
| 251 | + struct ieee80211_link_data *link) |
| 252 | { |
| 253 | struct ieee80211_chanctx_conf *chanctx_conf; |
| 254 | int power; |
| 255 | |
| 256 | rcu_read_lock(); |
| 257 | - chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf); |
| 258 | + chanctx_conf = rcu_dereference(link->conf->chanctx_conf); |
| 259 | if (!chanctx_conf) { |
| 260 | rcu_read_unlock(); |
| 261 | return false; |
| 262 | @@ -59,14 +60,14 @@ bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata) |
| 263 | power = ieee80211_chandef_max_power(&chanctx_conf->def); |
| 264 | rcu_read_unlock(); |
| 265 | |
| 266 | - if (sdata->deflink.user_power_level != IEEE80211_UNSET_POWER_LEVEL) |
| 267 | - power = min(power, sdata->deflink.user_power_level); |
| 268 | + if (link->user_power_level != IEEE80211_UNSET_POWER_LEVEL) |
| 269 | + power = min(power, link->user_power_level); |
| 270 | |
| 271 | - if (sdata->deflink.ap_power_level != IEEE80211_UNSET_POWER_LEVEL) |
| 272 | - power = min(power, sdata->deflink.ap_power_level); |
| 273 | + if (link->ap_power_level != IEEE80211_UNSET_POWER_LEVEL) |
| 274 | + power = min(power, link->ap_power_level); |
| 275 | |
| 276 | - if (power != sdata->vif.bss_conf.txpower) { |
| 277 | - sdata->vif.bss_conf.txpower = power; |
| 278 | + if (power != link->conf->txpower) { |
| 279 | + link->conf->txpower = power; |
| 280 | ieee80211_hw_config(sdata->local, 0); |
| 281 | return true; |
| 282 | } |
| 283 | @@ -75,11 +76,11 @@ bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata) |
| 284 | } |
| 285 | |
| 286 | void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata, |
| 287 | - bool update_bss) |
| 288 | + bool update_bss, struct ieee80211_link_data *link) |
| 289 | { |
| 290 | - if (__ieee80211_recalc_txpower(sdata) || |
| 291 | + if (__ieee80211_recalc_txpower(sdata, link) || |
| 292 | (update_bss && ieee80211_sdata_running(sdata))) |
| 293 | - ieee80211_link_info_change_notify(sdata, &sdata->deflink, |
| 294 | + ieee80211_link_info_change_notify(sdata, link, |
| 295 | BSS_CHANGED_TXPOWER); |
| 296 | } |
| 297 | |
| 298 | diff --git a/net/mac80211/link.c b/net/mac80211/link.c |
| 299 | index 11502da..349f596 100644 |
| 300 | --- a/net/mac80211/link.c |
| 301 | +++ b/net/mac80211/link.c |
| 302 | @@ -37,6 +37,9 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata, |
| 303 | link_conf->link_id = link_id; |
| 304 | link_conf->vif = &sdata->vif; |
| 305 | |
| 306 | + link->user_power_level = IEEE80211_UNSET_POWER_LEVEL; |
| 307 | + link->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; |
| 308 | + |
| 309 | wiphy_work_init(&link->csa.finalize_work, |
| 310 | ieee80211_csa_finalize_work); |
| 311 | wiphy_work_init(&link->color_change_finalize_work, |
| 312 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
| 313 | index b684fed..a3873d2 100644 |
| 314 | --- a/net/mac80211/mlme.c |
| 315 | +++ b/net/mac80211/mlme.c |
| 316 | @@ -2802,7 +2802,7 @@ static u64 ieee80211_handle_pwr_constr(struct ieee80211_link_data *link, |
| 317 | } |
| 318 | |
| 319 | link->ap_power_level = new_ap_level; |
| 320 | - if (__ieee80211_recalc_txpower(sdata)) |
| 321 | + if (__ieee80211_recalc_txpower(sdata, link)) |
| 322 | return BSS_CHANGED_TXPOWER; |
| 323 | return 0; |
| 324 | } |
| 325 | diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h |
| 326 | index 36e500d..3e06017 100644 |
| 327 | --- a/net/mac80211/trace.h |
| 328 | +++ b/net/mac80211/trace.h |
| 329 | @@ -2170,13 +2170,14 @@ DEFINE_EVENT(chanswitch_evt, drv_channel_switch_rx_beacon, |
| 330 | TRACE_EVENT(drv_get_txpower, |
| 331 | TP_PROTO(struct ieee80211_local *local, |
| 332 | struct ieee80211_sub_if_data *sdata, |
| 333 | - int dbm, int ret), |
| 334 | + unsigned int link_id, int dbm, int ret), |
| 335 | |
| 336 | - TP_ARGS(local, sdata, dbm, ret), |
| 337 | + TP_ARGS(local, sdata, link_id, dbm, ret), |
| 338 | |
| 339 | TP_STRUCT__entry( |
| 340 | LOCAL_ENTRY |
| 341 | VIF_ENTRY |
| 342 | + __field(unsigned int, link_id) |
| 343 | __field(int, dbm) |
| 344 | __field(int, ret) |
| 345 | ), |
| 346 | @@ -2184,13 +2185,14 @@ TRACE_EVENT(drv_get_txpower, |
| 347 | TP_fast_assign( |
| 348 | LOCAL_ASSIGN; |
| 349 | VIF_ASSIGN; |
| 350 | + __entry->link_id = link_id; |
| 351 | __entry->dbm = dbm; |
| 352 | __entry->ret = ret; |
| 353 | ), |
| 354 | |
| 355 | TP_printk( |
| 356 | - LOCAL_PR_FMT VIF_PR_FMT " dbm:%d ret:%d", |
| 357 | - LOCAL_PR_ARG, VIF_PR_ARG, __entry->dbm, __entry->ret |
| 358 | + LOCAL_PR_FMT VIF_PR_FMT " link_id:%d dbm:%d ret:%d", |
| 359 | + LOCAL_PR_ARG, VIF_PR_ARG, __entry->link_id, __entry->dbm, __entry->ret |
| 360 | ) |
| 361 | ); |
| 362 | |
| 363 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
| 364 | index 756a29a..36d35f0 100644 |
| 365 | --- a/net/wireless/nl80211.c |
| 366 | +++ b/net/wireless/nl80211.c |
| 367 | @@ -3753,6 +3753,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) |
| 368 | struct wireless_dev *txp_wdev = wdev; |
| 369 | enum nl80211_tx_power_setting type; |
| 370 | int idx, mbm = 0; |
| 371 | + unsigned int link_id = nl80211_link_id(info->attrs); |
| 372 | |
| 373 | if (!(rdev->wiphy.features & NL80211_FEATURE_VIF_TXPOWER)) |
| 374 | txp_wdev = NULL; |
| 375 | @@ -3776,7 +3777,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) |
| 376 | mbm = nla_get_u32(info->attrs[idx]); |
| 377 | } |
| 378 | |
| 379 | - result = rdev_set_tx_power(rdev, txp_wdev, type, mbm); |
| 380 | + result = rdev_set_tx_power(rdev, txp_wdev, link_id, type, mbm); |
| 381 | if (result) |
| 382 | goto out; |
| 383 | } |
| 384 | @@ -4047,10 +4048,10 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag |
| 385 | goto nla_put_failure; |
| 386 | } |
| 387 | |
| 388 | - if (rdev->ops->get_tx_power) { |
| 389 | + if (!wdev->valid_links && rdev->ops->get_tx_power) { |
| 390 | int dbm, ret; |
| 391 | |
| 392 | - ret = rdev_get_tx_power(rdev, wdev, &dbm); |
| 393 | + ret = rdev_get_tx_power(rdev, wdev, 0, &dbm); |
| 394 | if (ret == 0 && |
| 395 | nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, |
| 396 | DBM_TO_MBM(dbm))) |
| 397 | @@ -4119,6 +4120,16 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag |
| 398 | if (ret == 0 && nl80211_send_chandef(msg, &chandef)) |
| 399 | goto nla_put_failure; |
| 400 | |
| 401 | + if (rdev->ops->get_tx_power) { |
| 402 | + int dbm, ret; |
| 403 | + |
| 404 | + ret = rdev_get_tx_power(rdev, wdev, link_id, &dbm); |
| 405 | + if (ret == 0 && |
| 406 | + nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, |
| 407 | + DBM_TO_MBM(dbm))) |
| 408 | + goto nla_put_failure; |
| 409 | + } |
| 410 | + |
| 411 | nla_nest_end(msg, link); |
| 412 | } |
| 413 | |
| 414 | diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h |
| 415 | index 5b3c94f..9b411db 100644 |
| 416 | --- a/net/wireless/rdev-ops.h |
| 417 | +++ b/net/wireless/rdev-ops.h |
| 418 | @@ -589,21 +589,23 @@ rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed) |
| 419 | |
| 420 | static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev, |
| 421 | struct wireless_dev *wdev, |
| 422 | + unsigned int link_id, |
| 423 | enum nl80211_tx_power_setting type, int mbm) |
| 424 | { |
| 425 | int ret; |
| 426 | - trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm); |
| 427 | - ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, type, mbm); |
| 428 | + trace_rdev_set_tx_power(&rdev->wiphy, wdev, link_id, type, mbm); |
| 429 | + ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, link_id, type, mbm); |
| 430 | trace_rdev_return_int(&rdev->wiphy, ret); |
| 431 | return ret; |
| 432 | } |
| 433 | |
| 434 | static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev, |
| 435 | - struct wireless_dev *wdev, int *dbm) |
| 436 | + struct wireless_dev *wdev, |
| 437 | + unsigned int link_id, int *dbm) |
| 438 | { |
| 439 | int ret; |
| 440 | - trace_rdev_get_tx_power(&rdev->wiphy, wdev); |
| 441 | - ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, dbm); |
| 442 | + trace_rdev_get_tx_power(&rdev->wiphy, wdev, link_id); |
| 443 | + ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, link_id, dbm); |
| 444 | trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm); |
| 445 | return ret; |
| 446 | } |
| 447 | diff --git a/net/wireless/trace.h b/net/wireless/trace.h |
| 448 | index 6ff6091..6af432e 100644 |
| 449 | --- a/net/wireless/trace.h |
| 450 | +++ b/net/wireless/trace.h |
| 451 | @@ -1688,29 +1688,45 @@ TRACE_EVENT(rdev_set_wiphy_params, |
| 452 | WIPHY_PR_ARG, __entry->changed) |
| 453 | ); |
| 454 | |
| 455 | -DEFINE_EVENT(wiphy_wdev_evt, rdev_get_tx_power, |
| 456 | - TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev), |
| 457 | - TP_ARGS(wiphy, wdev) |
| 458 | +TRACE_EVENT(rdev_get_tx_power, |
| 459 | + TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 460 | + unsigned int link_id), |
| 461 | + TP_ARGS(wiphy, wdev, link_id), |
| 462 | + TP_STRUCT__entry( |
| 463 | + WIPHY_ENTRY |
| 464 | + WDEV_ENTRY |
| 465 | + __field(unsigned int, link_id) |
| 466 | + ), |
| 467 | + TP_fast_assign( |
| 468 | + WIPHY_ASSIGN; |
| 469 | + WDEV_ASSIGN; |
| 470 | + __entry->link_id = link_id; |
| 471 | + ), |
| 472 | + TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", link_id: %d", |
| 473 | + WIPHY_PR_ARG, WDEV_PR_ARG, __entry->link_id) |
| 474 | ); |
| 475 | |
| 476 | TRACE_EVENT(rdev_set_tx_power, |
| 477 | TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 478 | - enum nl80211_tx_power_setting type, int mbm), |
| 479 | - TP_ARGS(wiphy, wdev, type, mbm), |
| 480 | + unsigned int link_id, enum nl80211_tx_power_setting type, |
| 481 | + int mbm), |
| 482 | + TP_ARGS(wiphy, wdev, link_id, type, mbm), |
| 483 | TP_STRUCT__entry( |
| 484 | WIPHY_ENTRY |
| 485 | WDEV_ENTRY |
| 486 | + __field(unsigned int, link_id) |
| 487 | __field(enum nl80211_tx_power_setting, type) |
| 488 | __field(int, mbm) |
| 489 | ), |
| 490 | TP_fast_assign( |
| 491 | WIPHY_ASSIGN; |
| 492 | WDEV_ASSIGN; |
| 493 | + __entry->link_id = link_id; |
| 494 | __entry->type = type; |
| 495 | __entry->mbm = mbm; |
| 496 | ), |
| 497 | - TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", type: %u, mbm: %d", |
| 498 | - WIPHY_PR_ARG, WDEV_PR_ARG,__entry->type, __entry->mbm) |
| 499 | + TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", link_id: %d, type: %u, mbm: %d", |
| 500 | + WIPHY_PR_ARG, WDEV_PR_ARG, __entry->link_id, __entry->type, __entry->mbm) |
| 501 | ); |
| 502 | |
| 503 | TRACE_EVENT(rdev_return_int_int, |
| 504 | diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c |
| 505 | index 2371069..73ef854 100644 |
| 506 | --- a/net/wireless/wext-compat.c |
| 507 | +++ b/net/wireless/wext-compat.c |
| 508 | @@ -952,7 +952,7 @@ static int cfg80211_wext_siwtxpower(struct net_device *dev, |
| 509 | } |
| 510 | |
| 511 | wiphy_lock(&rdev->wiphy); |
| 512 | - ret = rdev_set_tx_power(rdev, wdev, type, DBM_TO_MBM(dbm)); |
| 513 | + ret = rdev_set_tx_power(rdev, wdev, 0, type, DBM_TO_MBM(dbm)); |
| 514 | wiphy_unlock(&rdev->wiphy); |
| 515 | |
| 516 | return ret; |
| 517 | @@ -975,7 +975,7 @@ static int cfg80211_wext_giwtxpower(struct net_device *dev, |
| 518 | return -EOPNOTSUPP; |
| 519 | |
| 520 | wiphy_lock(&rdev->wiphy); |
| 521 | - err = rdev_get_tx_power(rdev, wdev, &val); |
| 522 | + err = rdev_get_tx_power(rdev, wdev, 0, &val); |
| 523 | wiphy_unlock(&rdev->wiphy); |
| 524 | if (err) |
| 525 | return err; |
| 526 | -- |
| 527 | 2.18.0 |
| 528 | |