From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bn3nam01on0114.outbound.protection.outlook.com ([104.47.33.114]:8240 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751239AbeCHFAI (ORCPT ); Thu, 8 Mar 2018 00:00:08 -0500 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Johannes Berg , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 019/190] mac80211_hwsim: use per-interface power level Date: Thu, 8 Mar 2018 04:58:58 +0000 Message-ID: <20180308045810.8041-19-alexander.levin@microsoft.com> References: <20180308045810.8041-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045810.8041-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Johannes Berg [ Upstream commit 1d5e9f80ab021e3e1f9436627a4ad07a143ccb2c ] When channel contexts are used, there's no global power level (the power_level is always 0). Use the per-interface TX power in mac80211_hwsim to have a proper setting for both cases. This fixes the bgscan_simple and bgscan_learn test cases when the number of channels advertised by hwsim is >1 by default. Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/mac80211_hwsim.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/m= ac80211_hwsim.c index 4b462dc21c41..990c857992f6 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -552,8 +552,6 @@ struct mac80211_hwsim_data { /* wmediumd portid responsible for netgroup of this radio */ u32 wmediumd; =20 - int power_level; - /* difference between this hw's clock and the real clock, in usecs */ s64 tsf_offset; s64 bcn_delta; @@ -1208,7 +1206,9 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee= 80211_hw *hw, if (info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI) rx_status.flag |=3D RX_FLAG_SHORT_GI; /* TODO: simulate real signal strength (and optional packet loss) */ - rx_status.signal =3D data->power_level - 50; + rx_status.signal =3D -50; + if (info->control.vif) + rx_status.signal +=3D info->control.vif->bss_conf.txpower; =20 if (data->ps !=3D PS_DISABLED) hdr->frame_control |=3D cpu_to_le16(IEEE80211_FCTL_PM); @@ -1607,7 +1607,6 @@ static int mac80211_hwsim_config(struct ieee80211_hw = *hw, u32 changed) =20 WARN_ON(data->channel && data->use_chanctx); =20 - data->power_level =3D conf->power_level; if (!data->started || !data->beacon_int) tasklet_hrtimer_cancel(&data->beacon_timer); else if (!hrtimer_is_queued(&data->beacon_timer.timer)) { @@ -2212,7 +2211,6 @@ static const char mac80211_hwsim_gstrings_stats[][ETH= _GSTRING_LEN] =3D { "d_tx_failed", "d_ps_mode", "d_group", - "d_tx_power", }; =20 #define MAC80211_HWSIM_SSTATS_LEN ARRAY_SIZE(mac80211_hwsim_gstrings_stats= ) @@ -2249,7 +2247,6 @@ static void mac80211_hwsim_get_et_stats(struct ieee80= 211_hw *hw, data[i++] =3D ar->tx_failed; data[i++] =3D ar->ps; data[i++] =3D ar->group; - data[i++] =3D ar->power_level; =20 WARN_ON(i !=3D MAC80211_HWSIM_SSTATS_LEN); } --=20 2.14.1