From: Joe Perches <joe@perches.com>
To: Reto Schneider <code@reto-schneider.ch>,
Jes.Sorensen@gmail.com, linux-wireless@vger.kernel.org,
pkshih@realtek.com
Cc: yhchuang@realtek.com, Larry.Finger@lwfinger.net,
tehuang@realtek.com, reto.schneider@husqvarnagroup.com,
ccchiu77@gmail.com, kvalo@codeaurora.org, davem@davemloft.net,
kuba@kernel.org, Chris Chiu <chiu@endlessos.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 1/7] rtl8xxxu: add code to handle BSS_CHANGED_TXPOWER/IEEE80211_CONF_CHANGE_POWER
Date: Thu, 13 May 2021 21:09:01 -0700 [thread overview]
Message-ID: <fad21a091625a2d1c7975ffc620cab9efa4ce09e.camel@perches.com> (raw)
In-Reply-To: <20210514020442.946-2-code@reto-schneider.ch>
On Fri, 2021-05-14 at 04:04 +0200, Reto Schneider wrote:
> From: Chris Chiu <chiu@endlessos.org>
>
> The 'iw set txpower' is not handled by the driver. Use the existing
> set_tx_power function to apply the tx power change
trivial notes:
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
[]
> @@ -1382,6 +1382,38 @@ void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw)
> }
> }
>
>
> +#define MAX_TXPWR_IDX_NMODE_92S 63
> +
> +u8
> +rtl8xxxu_gen1_dbm_to_txpwridx(struct rtl8xxxu_priv *priv, u16 mode, int dbm)
> +{
> + u8 txpwridx;
> + long offset;
why should offset be long when dbm is int?
> +
> + switch (mode) {
> + case WIRELESS_MODE_B:
> + offset = -7;
> + break;
> + case WIRELESS_MODE_G:
> + case WIRELESS_MODE_N_24G:
> + offset = -8;
> + break;
> + default:
> + offset = -8;
> + break;
> + }
> +
> + if ((dbm - offset) > 0)
> + txpwridx = (u8)((dbm - offset) * 2);
overflow of u8 when dbm >= 136?
> + else
> + txpwridx = 0;
> +
> + if (txpwridx > MAX_TXPWR_IDX_NMODE_92S)
> + txpwridx = MAX_TXPWR_IDX_NMODE_92S;
> +
> + return txpwridx;
> +}
> +
> void
> rtl8xxxu_gen1_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
> {
> @@ -4508,6 +4540,55 @@ rtl8xxxu_wireless_mode(struct ieee80211_hw *hw, struct ieee80211_sta *sta)
> return network_type;
> }
>
>
> +static void rtl8xxxu_update_txpower(struct rtl8xxxu_priv *priv, int power)
> +{
> + bool ht40 = false;
unnecessary initializations.
> + struct ieee80211_hw *hw = priv->hw;
> + int channel = hw->conf.chandef.chan->hw_value;
> + u8 cck_txpwridx, ofdm_txpwridx;
> + int i, group;
> +
> + if (!priv->fops->dbm_to_txpwridx)
> + return;
> +
> + switch (hw->conf.chandef.width) {
> + case NL80211_CHAN_WIDTH_20_NOHT:
> + case NL80211_CHAN_WIDTH_20:
> + ht40 = false;
> + break;
> + case NL80211_CHAN_WIDTH_40:
> + ht40 = true;
> + break;
> + default:
> + return;
> + }
next prev parent reply other threads:[~2021-05-14 4:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <a31d9500-73a3-f890-bebd-d0a4014f87da@reto-schneider.ch>
2021-05-14 2:04 ` [PATCH 0/7] [RFC] rtl8xxxu/RTL8188CUS: Wi-Fi Alliance Certification Reto Schneider
2021-05-14 2:04 ` [PATCH 1/7] rtl8xxxu: add code to handle BSS_CHANGED_TXPOWER/IEEE80211_CONF_CHANGE_POWER Reto Schneider
2021-05-14 4:09 ` Joe Perches [this message]
2021-05-14 2:04 ` [PATCH 2/7] rtl8xxxu: add handle for mac80211 get_txpower Reto Schneider
2021-05-14 4:22 ` Joe Perches
2021-05-14 2:04 ` [PATCH 3/7] rtl8xxxu: Enable RX STBC by default Reto Schneider
2021-05-14 2:04 ` [PATCH 4/7] rtl8xxxu: feed antenna information for mac80211 Reto Schneider
2021-05-14 2:04 ` [PATCH 5/7] rtl8xxxu: fill up txrate info for all chips Reto Schneider
2021-05-14 2:04 ` [PATCH 6/7] rtl8xxxu: Fix the reported rx signal strength Reto Schneider
2021-05-14 2:04 ` [PATCH 7/7] rtl8xxxu: Fix ampdu_action to get block ack session work Reto Schneider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fad21a091625a2d1c7975ffc620cab9efa4ce09e.camel@perches.com \
--to=joe@perches.com \
--cc=Jes.Sorensen@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=ccchiu77@gmail.com \
--cc=chiu@endlessos.org \
--cc=code@reto-schneider.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=reto.schneider@husqvarnagroup.com \
--cc=tehuang@realtek.com \
--cc=yhchuang@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®