1
0
mirror of https://github.com/morrownr/8821cu-20210916.git synced 2024-11-19 12:04:48 +00:00

cleanup code and minor mods to docs

This commit is contained in:
morrownr 2023-02-23 14:29:27 -06:00
parent 589ec21474
commit 8c45ce6dae
5 changed files with 69 additions and 53 deletions

View File

@ -11,7 +11,7 @@ EXTRA_CFLAGS += -Wno-unused-variable
#EXTRA_CFLAGS += -Wno-unused-value
#EXTRA_CFLAGS += -Wno-unused-label
#EXTRA_CFLAGS += -Wno-unused-parameter
EXTRA_CFLAGS += -Wno-unused-function
#EXTRA_CFLAGS += -Wno-unused-function
#EXTRA_CFLAGS += -Wno-unused
#EXTRA_CFLAGS += -Wno-uninitialized
#EXTRA_CFLAGS += -Wno-vla
@ -122,7 +122,7 @@ CONFIG_RTW_DEBUG = y
CONFIG_RTW_LOG_LEVEL = 1
# enable /proc/net/rtlxxxx/ debug interfaces
CONFIG_PROC_DEBUG = y
CONFIG_PROC_DEBUG = n
######################## Wake On Lan ##########################
CONFIG_WOWLAN = n

View File

@ -563,10 +563,9 @@ as good as it.
To-Do:
- Improve secure boot support.
- Add driver compression for kernels > 5.3.
- Detect and alert users when Airplane Mode is on.
- Test for installation in VM's.
- Installation script needs to check country code setup.
- Check country code setup.
- Reduce the size of the README while keeping the needed information.
- Optimize scripts.
@ -575,4 +574,3 @@ To-Do:
#### [Go to Main Menu](https://github.com/morrownr/USB-WiFi)
-----

View File

@ -59,7 +59,7 @@ u8 rtw_set_tim_ie(u8 dtim_cnt, u8 dtim_period
if (tim_bmp[i])
break;
n1 = i & 0xFE;
/* find the last nonzero octet in tim_bitmap, except octet 0 */
for (i = tim_bmp_len - 1; i > 0; i--)
if (tim_bmp[i])
@ -301,7 +301,7 @@ u8 chk_sta_is_alive(struct sta_info *psta)
hwmp_alive = (psta->sta_stats.rx_hwmp_pkts !=
psta->sta_stats.last_rx_hwmp_pkts);
bcn_alive = (psta->sta_stats.rx_beacon_pkts !=
bcn_alive = (psta->sta_stats.rx_beacon_pkts !=
psta->sta_stats.last_rx_beacon_pkts);
/* The reference for nexthop_lookup */
psta->alive = ret || hwmp_alive || bcn_alive;
@ -372,7 +372,7 @@ static void rtw_check_restore_rf18(_adapter *padapter)
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
u32 reg;
u8 union_ch = 0, union_bw = 0, union_offset = 0, setchbw = _FALSE;
reg = rtw_hal_read_rfreg(padapter, 0, 0x18, 0x3FF);
if ((reg & 0xFF) == 0)
setchbw = _TRUE;
@ -726,7 +726,7 @@ void expire_timeout_chk(_adapter *padapter)
#ifdef CONFIG_RTW_TOKEN_BASED_XMIT
if (psta->tbtx_enable)
pstapriv->tbtx_asoc_list_cnt--;
#endif
#endif
STA_SET_MESH_PLINK(psta, NULL);
}
_exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
@ -1207,18 +1207,20 @@ void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta)
_exit_critical_bh(&psta->lock, &irqL);
}
#ifdef CONFIG_RTW_80211K
static void update_rm_cap(u8 *frame_head, _adapter *pa, u32 pktlen, int offset)
{
u8 *res;
sint len;
res = rtw_get_ie(frame_head + offset, _EID_RRM_EN_CAP_IE_, &len,
pktlen - offset);
if (res != NULL)
_rtw_memcpy((void *)pa->rmpriv.rm_en_cap_def, (res + 2), len);
}
#endif
// nrm
// not used
//#ifdef CONFIG_RTW_80211K
//static void update_rm_cap(u8 *frame_head, _adapter *pa, u32 pktlen, int offset)
//{
// u8 *res;
// sint len;
//
// res = rtw_get_ie(frame_head + offset, _EID_RRM_EN_CAP_IE_, &len,
// pktlen - offset);
// if (res != NULL)
// _rtw_memcpy((void *)pa->rmpriv.rm_en_cap_def, (res + 2), len);
//}
//#endif
static void update_ap_info(_adapter *padapter, struct sta_info *psta)
{
@ -1544,7 +1546,7 @@ static void rtw_ap_check_scan(_adapter *padapter)
if (_FALSE == ATOMIC_READ(&pmlmepriv->olbc_ht))
ATOMIC_SET(&pmlmepriv->olbc_ht, _TRUE);
if (padapter->registrypriv.wifi_spec)
RTW_INFO("%s: %s is a/b/g ap\n", __func__, pnetwork->network.Ssid.Ssid);
}
@ -1762,7 +1764,7 @@ chbw_decision:
#ifdef CONFIG_MCC_MODE
if (MCC_EN(padapter)) {
/*
/*
* due to check under rtw_ap_chbw_decision
* if under MCC mode, means req channel setting is the same as current channel setting
* if not under MCC mode, mean req channel setting is not the same as current channel setting
@ -2066,7 +2068,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
pbss_network->IELength = pbss_network->IELength - *(p+1) - 2;
ret_rm = rtw_ies_remove_ie(ie , &len, _BEACON_IE_OFFSET_, _ERPINFO_IE_,NULL,0);
RTW_DBG("%s, remove_ie of ERP_IE=%d\n", __FUNCTION__, ret_rm);
} else
} else
ERP_IE_handler(padapter, (PNDIS_802_11_VARIABLE_IEs)p);
}
@ -3920,10 +3922,10 @@ u8 ap_free_sta(_adapter *padapter, struct sta_info *psta, bool active, u16 reaso
beacon_updated = bss_cap_update_on_sta_leave(padapter, psta);
report_del_sta_event(padapter, psta->cmn.mac_addr, reason, enqueue, _FALSE);
/* clear cam entry / key */
rtw_clearstakey_cmd(padapter, psta, enqueue);
return beacon_updated;
}
@ -4735,7 +4737,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp
rtw_hal_set_mcc_setting_disconnect(adapter);
}
}
}
}
#endif /* CONFIG_MCC_MODE */
@ -4859,7 +4861,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp
u8 tmp_ch = dec_ch[i];
u8 tmp_bw = dec_bw[i];
u8 tmp_offset = dec_offset[i];
rtw_adjust_chbw(adapter, tmp_ch, &tmp_bw, &tmp_offset);
rtw_get_offset_by_chbw(tmp_ch, tmp_bw, &tmp_offset);
@ -5586,7 +5588,7 @@ static bool rtw_ap_data_bmc_to_uc(_adapter *adapter
sta = LIST_CONTAINOR(list, struct sta_info, asoc_list);
list = get_next(list);
stainfo_offset = rtw_stainfo_offset(stapriv, sta);
if (stainfo_offset_valid(stainfo_offset))
b2u_sta_id[b2u_sta_num++] = stainfo_offset;
@ -5907,7 +5909,7 @@ int rtw_ap_rx_msdu_act_check(union recv_frame *rframe
goto fwd_chk;
}
if (is_da_self) {
/* DA is self, indicate */
act |= RTW_RX_MSDU_ACT_INDICATE;
@ -6056,8 +6058,8 @@ void rtw_issue_action_token_req(_adapter *padapter, struct sta_info *pstat)
/* update attribute */
pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib);
pattrib->rate = MGN_24M; /* issue action request using OFDM rate? 20190716 Bruce add */
pattrib->rate = MGN_24M; /* issue action request using OFDM rate? 20190716 Bruce add */
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
@ -6069,7 +6071,7 @@ void rtw_issue_action_token_req(_adapter *padapter, struct sta_info *pstat)
_rtw_memcpy((void *)GetAddr1Ptr(pwlanhdr), pstat->cmn.mac_addr, ETH_ALEN);
_rtw_memcpy((void *)get_addr2_ptr(pwlanhdr), adapter_mac_addr(padapter), ETH_ALEN);
_rtw_memcpy((void *)GetAddr3Ptr(pwlanhdr), get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
pmlmeext->mgnt_seq++;

View File

@ -28,7 +28,7 @@
# GNU General Public License for more details.
SCRIPT_NAME="install-driver.sh"
SCRIPT_VERSION="20230126"
SCRIPT_VERSION="20230221"
MODULE_NAME="8821cu"
DRV_VERSION="5.12.0.4"
@ -188,6 +188,9 @@ fi
#fi
echo ": ---------------------------"
echo
echo "Checking for previously installed drivers."
# check for and remove non-dkms installations
# standard naming
@ -200,6 +203,8 @@ if [ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]; then
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION}
make clean >/dev/null 2>&1
echo "Removal complete."
echo ": ---------------------------"
fi
# check for and remove non-dkms installations
@ -213,6 +218,8 @@ if [ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]; then
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION}
make clean >/dev/null 2>&1
echo "Removal complete."
echo ": ---------------------------"
fi
# check for and remove non-dkms installations
@ -228,6 +235,8 @@ if [ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODU
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION}
make clean >/dev/null 2>&1
echo "Removal complete."
echo ": ---------------------------"
fi
# check for and remove dkms installations
@ -239,10 +248,13 @@ if command -v dkms >/dev/null 2>&1; then
rm -f /etc/modprobe.d/${OPTIONS_FILE}
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION}
echo "Removal complete."
echo ": ---------------------------"
fi
fi
# sets module parameters (driver options) and blacklisted modules
echo "Starting installation."
echo "Installing ${OPTIONS_FILE} to /etc/modprobe.d"
cp -f ${OPTIONS_FILE} /etc/modprobe.d
@ -310,6 +322,7 @@ else
fi
else
echo "The driver was added to dkms successfully."
echo ": ---------------------------"
fi
if command -v /usr/bin/time >/dev/null 2>&1; then
@ -328,6 +341,7 @@ else
exit $RESULT
else
echo "The driver was built by dkms successfully."
echo ": ---------------------------"
fi
dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
@ -342,6 +356,7 @@ else
exit $RESULT
else
echo "The driver was installed by dkms successfully."
echo ": ---------------------------"
fi
fi
@ -354,6 +369,7 @@ fi
# if NoPrompt is not used, ask user some questions
if [ $NO_PROMPT -ne 1 ]; then
echo
printf "Do you want to edit the driver options file now? [y/N] "
read -r REPLY
case "$REPLY" in

View File

@ -1079,7 +1079,7 @@ static void rtw_regsty_load_tx_ac_lifetime(struct registry_priv *regsty)
conf->en = parm[0] & 0xF;
conf->vo_vi = parm[1];
conf->be_bk = parm[2];
}
}
}
}
#endif
@ -2089,7 +2089,7 @@ static void rtw_ethtool_get_stats(struct net_device *dev,
struct recv_priv *precvpriv = NULL;
memset(data, 0, sizeof(u64) * RTW_ETHTOOL_STATS_LEN);
padapter = (_adapter *)rtw_netdev_priv(dev);
if (padapter) {
pxmitpriv = &(padapter->xmitpriv);
@ -2120,7 +2120,7 @@ static const struct ethtool_ops rtw_ethtool_ops = {
.get_ethtool_stats = rtw_ethtool_get_stats,
.get_sset_count = rtw_ethtool_get_sset_count,
};
#endif // LINUX_VERSION_CODE >= 3.7.8
#endif // LINUX_VERSION_CODE >= 3.7.8
#endif /* CONFIG_IOCTL_CFG80211 */
/* For ethtool --- */
@ -2664,7 +2664,7 @@ struct dvobj_priv *devobj_init(void)
pdvobj->tpt_mode = 0;
pdvobj->edca_be_ul = 0x5ea42b;
pdvobj->edca_be_dl = 0x00a42b;
#endif
#endif
pdvobj->scan_deny = _FALSE;
/* wpas type default from w1.fi */
@ -2846,14 +2846,14 @@ u8 rtw_init_drv_sw(_adapter *padapter)
dvobj->macid_ctl.macid_txrpt_pgsz = hal_spec->macid_txrpt_pgsz;
dvobj->cam_ctl.sec_cap = hal_spec->sec_cap;
dvobj->cam_ctl.num = rtw_min(hal_spec->sec_cam_ent_num, SEC_CAM_ENT_NUM_SW_LIMIT);
dvobj->wow_ctl.wow_cap = hal_spec->wow_cap;
#ifdef CONFIG_SDIO_TX_ENABLE_AVAL_INT
dvobj->tx_aval_int_thr_mode = 2; /*setting by max tx length*/
dvobj->tx_aval_int_thr_value = 0;
#endif /*CONFIG_SDIO_TX_ENABLE_AVAL_INT*/
#if CONFIG_TX_AC_LIFETIME
{
struct registry_priv *regsty = adapter_to_regsty(padapter);
@ -3092,7 +3092,7 @@ void rtw_cancel_all_timer(_adapter *padapter)
_cancel_timer_ex(&(adapter_to_pwrctl(padapter)->pwr_rpwm_timer));
#endif /* CONFIG_LPS_RPWM_TIMER */
#ifdef CONFIG_RTW_TOKEN_BASED_XMIT
#ifdef CONFIG_RTW_TOKEN_BASED_XMIT
_cancel_timer_ex(&padapter->mlmeextpriv.tbtx_xmit_timer);
_cancel_timer_ex(&padapter->mlmeextpriv.tbtx_token_dispatch_timer);
#endif
@ -3862,7 +3862,7 @@ int _netdev_open(struct net_device *pnetdev)
RTW_INFO(FUNC_NDEV_FMT" start\n", FUNC_NDEV_ARG(pnetdev));
if (!rtw_is_hw_init_completed(padapter)) { // ips
if (!rtw_is_hw_init_completed(padapter)) { // ips
rtw_clr_surprise_removed(padapter);
rtw_clr_drv_stopped(padapter);
RTW_ENABLE_FUNC(padapter, DF_RX_BIT);
@ -3884,7 +3884,7 @@ int _netdev_open(struct net_device *pnetdev)
{
#ifdef CONFIG_BT_COEXIST_SOCKET_TRX
_adapter *prim_adpt = GET_PRIMARY_ADAPTER(padapter);
if (prim_adpt && (_TRUE == prim_adpt->EEPROMBluetoothCoexist)) {
rtw_btcoex_init_socket(prim_adpt);
prim_adpt->coex_info.BtMgnt.ExtConfig.HCIExtensionVer = 0x04;
@ -4250,7 +4250,7 @@ int _pm_netdev_open(_adapter *padapter)
RTW_INFO(FUNC_NDEV_FMT" start\n", FUNC_NDEV_ARG(pnetdev));
if (!rtw_is_hw_init_completed(padapter)) { // ips
if (!rtw_is_hw_init_completed(padapter)) { // ips
rtw_clr_surprise_removed(padapter);
rtw_clr_drv_stopped(padapter);
status = rtw_hal_init(padapter);
@ -4805,14 +4805,14 @@ void rtw_dev_unload(PADAPTER padapter)
#endif
rtw_intf_stop(padapter);
rtw_stop_drv_threads(padapter);
if (ATOMIC_READ(&(pcmdpriv->cmdthd_running)) == _TRUE) {
RTW_ERR("cmd_thread not stop !!\n");
rtw_warn_on(1);
}
/* check the status of IPS */
if (rtw_hal_check_ips_status(padapter) == _TRUE || pwrctl->rf_pwrstate == rf_off) { /* check HW status and SW state */
RTW_PRINT("%s: driver in IPS-FWLPS\n", __func__);
@ -4945,16 +4945,16 @@ int rtw_suspend_wow(_adapter *padapter)
/* 2.1 clean interrupt */
rtw_hal_clear_interrupt(padapter);
#endif /* CONFIG_SDIO_HCI */
/* enable ac lifetime during scan to avoid txfifo not empty. */
dvobj->lifetime_en = rtw_read8(padapter, 0x426);
dvobj->pkt_lifetime = rtw_read32(padapter, 0x4c0);
rtw_write8(padapter, 0x426, rtw_read8(padapter, 0x426) | 0x0f);
if(hal_spec->tx_aclt_unit_factor == 1) {
rtw_write16(padapter, 0x4c0, 0x1000); // unit: 32us. 131ms
rtw_write16(padapter, 0x4c0, 0x1000); // unit: 32us. 131ms
rtw_write16(padapter, 0x4c0 + 2 , 0x1000); // unit: 32us. 131ms
} else {
rtw_write16(padapter, 0x4c0, 0x0200); // unit: 256us. 131ms
rtw_write16(padapter, 0x4c0, 0x0200); // unit: 256us. 131ms
rtw_write16(padapter, 0x4c0 + 2 , 0x0200); // unit: 256us. 131ms
}
for (i = 0; i < dvobj->iface_nums; i++) {
@ -4966,7 +4966,7 @@ int rtw_suspend_wow(_adapter *padapter)
}
RTW_INFO("lifetime_en=%x, pkt_lifetime=%x\n", rtw_read8(padapter, 0x426), rtw_read32(padapter, 0x4c0));
rtw_msleep_os(200);
/* 1. stop thread */
rtw_set_drv_stopped(padapter); /*for stop thread*/
rtw_mi_stop_drv_threads(padapter);
@ -5359,14 +5359,14 @@ int rtw_resume_process_wow(_adapter *padapter)
rtw_clr_drv_stopped(padapter);
RTW_INFO("%s: wowmode resuming, DriverStopped:%s\n", __func__, rtw_is_drv_stopped(padapter) ? "True" : "False");
if(registry_par->suspend_type == FW_IPS_WRC)
rtw_hal_set_hwreg(padapter, HW_VAR_VENDOR_WOW_MODE, &en);
rtw_mi_start_drv_threads(padapter);
rtw_mi_intf_start(padapter);
if(registry_par->suspend_type == FW_IPS_DISABLE_BBRF && !check_fwstate(pmlmepriv, WIFI_ASOC_STATE)) {
if (!rtw_is_surprise_removed(padapter)) {
rtw_hal_deinit(padapter);