staging: r8188eu: remove HW_VAR_BASIC_RATE from SetHwReg8188EU()

Remove the HW_VAR_BASIC_RATE case from SetHwReg8188EU() and move the
functionality to a separate function. This is part of the ongoing
effort to get rid of SetHwReg8188EU().

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220709094458.9578-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Michael Straube 2022-07-09 11:44:54 +02:00 committed by Greg Kroah-Hartman
parent 6a0c054930
commit ae9411408c
5 changed files with 42 additions and 40 deletions

View file

@ -6681,7 +6681,7 @@ void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res)
/* update IOT-releated issue */
update_IOT_info(padapter);
SetHwReg8188EU(padapter, HW_VAR_BASIC_RATE, cur_network->SupportedRates);
rtw_set_basic_rate(padapter, cur_network->SupportedRates);
/* BCN interval */
rtw_write16(padapter, REG_BCN_INTERVAL, pmlmeinfo->bcn_interval);

View file

@ -1265,6 +1265,45 @@ void set_sta_rate(struct adapter *padapter, struct sta_info *psta)
enable_rate_adaptive(padapter, psta->mac_id);
}
void rtw_set_basic_rate(struct adapter *adapter, u8 *rates)
{
u16 BrateCfg = 0;
u8 RateIndex = 0;
int res;
u8 reg;
/* 2007.01.16, by Emily */
/* Select RRSR (in Legacy-OFDM and CCK) */
/* For 8190, we select only 24M, 12M, 6M, 11M, 5.5M, 2M, and 1M from the Basic rate. */
/* We do not use other rates. */
HalSetBrateCfg(adapter, rates, &BrateCfg);
/* 2011.03.30 add by Luke Lee */
/* CCK 2M ACK should be disabled for some BCM and Atheros AP IOT */
/* because CCK 2M has poor TXEVM */
/* CCK 5.5M & 11M ACK should be enabled for better performance */
BrateCfg = (BrateCfg | 0xd) & 0x15d;
BrateCfg |= 0x01; /* default enable 1M ACK rate */
/* Set RRSR rate table. */
rtw_write8(adapter, REG_RRSR, BrateCfg & 0xff);
rtw_write8(adapter, REG_RRSR + 1, (BrateCfg >> 8) & 0xff);
res = rtw_read8(adapter, REG_RRSR + 2, &reg);
if (res)
return;
rtw_write8(adapter, REG_RRSR + 2, reg & 0xf0);
/* Set RTS initial rate */
while (BrateCfg > 0x1) {
BrateCfg = (BrateCfg >> 1);
RateIndex++;
}
/* Ziv - Check */
rtw_write8(adapter, REG_INIRTS_RATE_SEL, RateIndex);
}
/* Update RRSR and Rate for USERATE */
void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode)
{
@ -1290,7 +1329,7 @@ void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode)
else
update_mgnt_tx_rate(padapter, IEEE80211_OFDM_RATE_6MB);
SetHwReg8188EU(padapter, HW_VAR_BASIC_RATE, supported_rates);
rtw_set_basic_rate(padapter, supported_rates);
}
unsigned char check_assoc_AP(u8 *pframe, uint len)

View file

@ -1071,43 +1071,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val)
case HW_VAR_SET_OPMODE:
hw_var_set_opmode(Adapter, val);
break;
case HW_VAR_BASIC_RATE:
{
u16 BrateCfg = 0;
u8 RateIndex = 0;
/* 2007.01.16, by Emily */
/* Select RRSR (in Legacy-OFDM and CCK) */
/* For 8190, we select only 24M, 12M, 6M, 11M, 5.5M, 2M, and 1M from the Basic rate. */
/* We do not use other rates. */
HalSetBrateCfg(Adapter, val, &BrateCfg);
/* 2011.03.30 add by Luke Lee */
/* CCK 2M ACK should be disabled for some BCM and Atheros AP IOT */
/* because CCK 2M has poor TXEVM */
/* CCK 5.5M & 11M ACK should be enabled for better performance */
BrateCfg = (BrateCfg | 0xd) & 0x15d;
BrateCfg |= 0x01; /* default enable 1M ACK rate */
/* Set RRSR rate table. */
rtw_write8(Adapter, REG_RRSR, BrateCfg & 0xff);
rtw_write8(Adapter, REG_RRSR + 1, (BrateCfg >> 8) & 0xff);
res = rtw_read8(Adapter, REG_RRSR + 2, &reg);
if (res)
return;
rtw_write8(Adapter, REG_RRSR + 2, reg & 0xf0);
/* Set RTS initial rate */
while (BrateCfg > 0x1) {
BrateCfg = (BrateCfg >> 1);
RateIndex++;
}
/* Ziv - Check */
rtw_write8(Adapter, REG_INIRTS_RATE_SEL, RateIndex);
}
break;
case HW_VAR_CORRECT_TSF:
{
u64 tsf;

View file

@ -10,7 +10,6 @@
enum hw_variables {
HW_VAR_SET_OPMODE,
HW_VAR_BASIC_RATE,
HW_VAR_CORRECT_TSF,
HW_VAR_MLME_SITESURVEY,
HW_VAR_DM_FLAG,

View file

@ -455,6 +455,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len);
void update_IOT_info(struct adapter *padapter);
void update_capinfo(struct adapter *adapter, u16 updatecap);
void update_wireless_mode(struct adapter *padapter);
void rtw_set_basic_rate(struct adapter *adapter, u8 *rates);
void update_tx_basic_rate(struct adapter *padapter, u8 modulation);
void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id);
int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie,