linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Kaistra <martin.kaistra@linutronix.de>
To: linux-wireless@vger.kernel.org
Cc: Jes Sorensen <Jes.Sorensen@gmail.com>,
	Kalle Valo <kvalo@kernel.org>, Ping-Ke Shih <pkshih@realtek.com>,
	Bitterblue Smith <rtl8821cerfe2@gmail.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH v3 12/18] wifi: rtl8xxxu: Add parameter macid to update_rate_mask
Date: Thu, 27 Apr 2023 11:09:16 +0200	[thread overview]
Message-ID: <20230427090922.165088-13-martin.kaistra@linutronix.de> (raw)
In-Reply-To: <20230427090922.165088-1-martin.kaistra@linutronix.de>

The HW maintains a rate_mask for each connection, referenced by the
macid. Add a parameter to update_rate_mask and add the macid to the
h2c call in the gen2 implementation.

Also extend refresh_rate_mask to get the macid from sta_info.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h    |  7 ++++---
 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c  |  3 ++-
 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c   | 13 +++++++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index 688168e0723c0..1cf2ea4b02655 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1916,7 +1916,8 @@ struct rtl8xxxu_fileops {
 	void (*set_tx_power) (struct rtl8xxxu_priv *priv, int channel,
 			      bool ht40);
 	void (*update_rate_mask) (struct rtl8xxxu_priv *priv,
-				  u32 ramask, u8 rateid, int sgi, int txbw_40mhz);
+				  u32 ramask, u8 rateid, int sgi, int txbw_40mhz,
+				  u8 macid);
 	void (*report_connect) (struct rtl8xxxu_priv *priv,
 				u8 macid, u8 role, bool connect);
 	void (*report_rssi) (struct rtl8xxxu_priv *priv, u8 macid, u8 rssi);
@@ -2035,9 +2036,9 @@ void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw);
 void rtl8xxxu_gen1_usb_quirks(struct rtl8xxxu_priv *priv);
 void rtl8xxxu_gen2_usb_quirks(struct rtl8xxxu_priv *priv);
 void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv,
-			       u32 ramask, u8 rateid, int sgi, int txbw_40mhz);
+			       u32 ramask, u8 rateid, int sgi, int txbw_40mhz, u8 macid);
 void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv,
-				    u32 ramask, u8 rateid, int sgi, int txbw_40mhz);
+				    u32 ramask, u8 rateid, int sgi, int txbw_40mhz, u8 macid);
 void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv,
 				  u8 macid, u8 role, bool connect);
 void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
index 8986783ae8fa7..6d0f975f891b7 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
@@ -1794,7 +1794,8 @@ static void rtl8188e_arfb_refresh(struct rtl8xxxu_ra_info *ra)
 
 static void
 rtl8188e_update_rate_mask(struct rtl8xxxu_priv *priv,
-			  u32 ramask, u8 rateid, int sgi, int txbw_40mhz)
+			  u32 ramask, u8 rateid, int sgi, int txbw_40mhz,
+			  u8 macid)
 {
 	struct rtl8xxxu_ra_info *ra = &priv->ra_info;
 
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 55f935a851c57..bd01a61a83036 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -4566,7 +4566,8 @@ static void rtl8xxxu_sw_scan_complete(struct ieee80211_hw *hw,
 }
 
 void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv,
-			       u32 ramask, u8 rateid, int sgi, int txbw_40mhz)
+			       u32 ramask, u8 rateid, int sgi, int txbw_40mhz,
+			       u8 macid)
 {
 	struct h2c_cmd h2c;
 
@@ -4586,7 +4587,8 @@ void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv,
 }
 
 void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv,
-				    u32 ramask, u8 rateid, int sgi, int txbw_40mhz)
+				    u32 ramask, u8 rateid, int sgi, int txbw_40mhz,
+				    u8 macid)
 {
 	struct h2c_cmd h2c;
 	u8 bw;
@@ -4603,6 +4605,7 @@ void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv,
 	h2c.b_macid_cfg.ramask1 = (ramask >> 8) & 0xff;
 	h2c.b_macid_cfg.ramask2 = (ramask >> 16) & 0xff;
 	h2c.b_macid_cfg.ramask3 = (ramask >> 24) & 0xff;
+	h2c.b_macid_cfg.macid = macid;
 
 	h2c.b_macid_cfg.data1 = rateid;
 	if (sgi)
@@ -4968,7 +4971,8 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			priv->vif = vif;
 			priv->rssi_level = RTL8XXXU_RATR_STA_INIT;
 
-			priv->fops->update_rate_mask(priv, ramask, 0, sgi, bw == RATE_INFO_BW_40);
+			priv->fops->update_rate_mask(priv, ramask, 0, sgi,
+						     bw == RATE_INFO_BW_40, 0);
 
 			rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff);
 
@@ -6874,6 +6878,7 @@ static void rtl8xxxu_refresh_rate_mask(struct rtl8xxxu_priv *priv,
 	u8 txbw_40mhz;
 	u8 snr, snr_thresh_high, snr_thresh_low;
 	u8 go_up_gap = 5;
+	u8 macid = rtl8xxxu_get_macid(priv, sta);
 
 	rssi_level = priv->rssi_level;
 	snr = rtl8xxxu_signal_to_snr(signal);
@@ -6993,7 +6998,7 @@ static void rtl8xxxu_refresh_rate_mask(struct rtl8xxxu_priv *priv,
 		}
 
 		priv->rssi_level = rssi_level;
-		priv->fops->update_rate_mask(priv, rate_bitmap, ratr_idx, sgi, txbw_40mhz);
+		priv->fops->update_rate_mask(priv, rate_bitmap, ratr_idx, sgi, txbw_40mhz, macid);
 	}
 }
 
-- 
2.30.2


  parent reply	other threads:[~2023-04-27  9:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27  9:09 [PATCH v3 00/18] wifi: rtl8xxxu: Add AP mode support for 8188f Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 01/18] wifi: rtl8xxxu: Add start_ap() callback Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 02/18] wifi: rtl8xxxu: Select correct queue for beacon frames Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 03/18] wifi: rtl8xxxu: Add beacon functions Martin Kaistra
2023-04-28  0:38   ` Ping-Ke Shih
2023-04-28  6:59     ` Martin Kaistra
2023-04-28  8:11       ` Ping-Ke Shih
2023-04-27  9:09 ` [PATCH v3 04/18] wifi: rtl8xxxu: Add set_tim() callback Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 05/18] wifi: rtl8xxxu: Allow setting rts threshold to -1 Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 06/18] wifi: rtl8xxxu: Allow creating interface in AP mode Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 07/18] wifi: rtl8xxxu: Actually use macid in rtl8xxxu_gen2_report_connect Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 08/18] wifi: rtl8xxxu: Add parameter role to report_connect Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 09/18] wifi: rtl8xxxu: Add parameter force to rtl8xxxu_refresh_rate_mask Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 10/18] wifi: rtl8xxxu: Add sta_add() and sta_remove() callbacks Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 11/18] wifi: rtl8xxxu: Put the macid in txdesc Martin Kaistra
2023-04-27  9:09 ` Martin Kaistra [this message]
2023-04-27  9:09 ` [PATCH v3 13/18] wifi: rtl8xxxu: Enable hw seq for mgmt/non-QoS data frames Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 14/18] wifi: rtl8xxxu: Clean up filter configuration Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 15/18] wifi: rtl8xxxu: Remove usage of ieee80211_get_tx_rate() Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 16/18] wifi: rtl8xxxu: Remove usage of tx_info->control.rates[0].flags Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 17/18] wifi: rtl8xxxu: Declare AP mode support for 8188f Martin Kaistra
2023-04-27  9:09 ` [PATCH v3 18/18] wifi: rtl8xxxu: Set maximum number of supported stations Martin Kaistra

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=20230427090922.165088-13-martin.kaistra@linutronix.de \
    --to=martin.kaistra@linutronix.de \
    --cc=Jes.Sorensen@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=rtl8821cerfe2@gmail.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;
as well as URLs for NNTP newsgroup(s).