> -----Original Message----- > From: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> > Sent: Saturday, December 31, 2022 12:52 AM > To: linux-wireless@xxxxxxxxxxxxxxx > Cc: Jes Sorensen <Jes.Sorensen@xxxxxxxxx>; Ping-Ke Shih <pkshih@xxxxxxxxxxx> > Subject: [PATCH 1/2] wifi: rtl8xxxu: Report the RSSI to the firmware > > Or in the case of RTL8188EU, report the RSSI to the rate control code. > > The rate control code for RTL8188EU is less likely to switch to a lower > rate when the RSSI is high. The firmware-based rate control in the other > chips probably works the same way. > > This affects all the chips, but it was only tested with RTL8188EU, > RTL8188FU, and RTL8192EU. > > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> > --- > .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 23 +++++++++++++ > .../realtek/rtl8xxxu/rtl8xxxu_8188e.c | 6 ++++ > .../realtek/rtl8xxxu/rtl8xxxu_8188f.c | 1 + > .../realtek/rtl8xxxu/rtl8xxxu_8192c.c | 1 + > .../realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + > .../realtek/rtl8xxxu/rtl8xxxu_8723a.c | 1 + > .../realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + > .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 34 +++++++++++++++++++ > 8 files changed, 68 insertions(+) > [...] > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > index fd97c040948a..f5fd3c448587 100644 > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > @@ -4461,6 +4461,37 @@ void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, > rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.media_status_rpt)); > } > > +void rtl8xxxu_gen1_report_rssi(struct rtl8xxxu_priv *priv, u8 macid, u8 rssi) > +{ > + struct h2c_cmd h2c; > + const int h2c_size = 3; Shouldn't it be 4? struct { u8 cmd; u8 macid; u8 unknown0; u8 rssi; // you fill this field. > + > + memset(&h2c, 0, sizeof(struct h2c_cmd)); > + > + h2c.rssi_report.cmd = H2C_SET_RSSI; > + h2c.rssi_report.macid = macid; > + h2c.rssi_report.rssi = rssi; > + > + rtl8xxxu_gen1_h2c_cmd(priv, &h2c, h2c_size); > +} > + [...]