Merge pull request #11 from Icenowy/newest-kernel

Adapt for newest kernel (5.14)
This commit is contained in:
lwfinger 2021-07-24 12:40:07 -05:00 committed by GitHub
commit 1b6ddd544b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 7 deletions

View File

@ -72,7 +72,7 @@ CONFIG_APPEND_VENDOR_IE_ENABLE = n
CONFIG_RTW_NAPI = y CONFIG_RTW_NAPI = y
CONFIG_RTW_GRO = y CONFIG_RTW_GRO = y
########################## Debug ########################### ########################## Debug ###########################
CONFIG_RTW_DEBUG = y CONFIG_RTW_DEBUG = n
# default log level is _DRV_INFO_ = 2, # default log level is _DRV_INFO_ = 2,
# please refer to "How_to_set_driver_debug_log_level.doc" to set the available level. # please refer to "How_to_set_driver_debug_log_level.doc" to set the available level.
CONFIG_RTW_LOG_LEVEL = 2 CONFIG_RTW_LOG_LEVEL = 2

View File

@ -26,7 +26,7 @@ enum country_code_type_t {
COUNTRY_CODE_MAX COUNTRY_CODE_MAX
}; };
int rtw_regd_init(_adapter *padapter); int rtw_regd_init(struct wiphy *wiphy);
void rtw_reg_notify_by_driver(_adapter *adapter); void rtw_reg_notify_by_driver(_adapter *adapter);
#endif /* __RTW_WIFI_REGD_H__ */ #endif /* __RTW_WIFI_REGD_H__ */

View File

@ -6630,9 +6630,6 @@ void rtw_cfg80211_init_wiphy(_adapter *padapter)
rtw_cfg80211_init_ht_capab(padapter, &bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type); rtw_cfg80211_init_ht_capab(padapter, &bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type);
} }
#endif #endif
/* init regulary domain */
rtw_regd_init(padapter);
/* copy mac_addr to wiphy */ /* copy mac_addr to wiphy */
_rtw_memcpy(wiphy->perm_addr, adapter_mac_addr(padapter), ETH_ALEN); _rtw_memcpy(wiphy->perm_addr, adapter_mac_addr(padapter), ETH_ALEN);
@ -6934,6 +6931,9 @@ int rtw_wiphy_register(struct wiphy *wiphy)
rtw_cfgvendor_attach(wiphy); rtw_cfgvendor_attach(wiphy);
#endif #endif
/* init regulary domain */
rtw_regd_init(wiphy);
return wiphy_register(wiphy); return wiphy_register(wiphy);
} }

View File

@ -359,7 +359,11 @@ static int napi_recv(_adapter *padapter, int budget)
#ifdef CONFIG_RTW_GRO #ifdef CONFIG_RTW_GRO
if (pregistrypriv->en_gro) { if (pregistrypriv->en_gro) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_MERGED_FREE)
#else
if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_DROP) if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_DROP)
#endif
rx_ok = _TRUE; rx_ok = _TRUE;
goto next; goto next;
} }

View File

@ -519,9 +519,8 @@ static struct country_code_to_enum_rd *_rtw_regd_find_country(u16 countrycode)
return NULL; return NULL;
} }
int rtw_regd_init(_adapter *padapter) int rtw_regd_init(struct wiphy *wiphy)
{ {
struct wiphy *wiphy = padapter->rtw_wdev->wiphy;
#if 0 #if 0
if (rtw_regd == NULL) { if (rtw_regd == NULL) {

View File

@ -1282,15 +1282,19 @@ static int isFileReadable(const char *path, u32 *sz)
{ {
struct file *fp; struct file *fp;
int ret = 0; int ret = 0;
#ifdef set_fs
mm_segment_t oldfs; mm_segment_t oldfs;
#endif
char buf; char buf;
fp = filp_open(path, O_RDONLY, 0); fp = filp_open(path, O_RDONLY, 0);
if (IS_ERR(fp)) if (IS_ERR(fp))
ret = PTR_ERR(fp); ret = PTR_ERR(fp);
else { else {
#ifdef set_fs
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
#endif
if (1 != readFile(fp, &buf, 1)) if (1 != readFile(fp, &buf, 1))
ret = PTR_ERR(fp); ret = PTR_ERR(fp);
@ -1303,7 +1307,9 @@ static int isFileReadable(const char *path, u32 *sz)
#endif #endif
} }
#ifdef set_fs
set_fs(oldfs); set_fs(oldfs);
#endif
filp_close(fp, NULL); filp_close(fp, NULL);
} }
return ret; return ret;
@ -1319,7 +1325,9 @@ static int isFileReadable(const char *path, u32 *sz)
static int retriveFromFile(const char *path, u8 *buf, u32 sz) static int retriveFromFile(const char *path, u8 *buf, u32 sz)
{ {
int ret = -1; int ret = -1;
#ifdef set_fs
mm_segment_t oldfs; mm_segment_t oldfs;
#endif
struct file *fp; struct file *fp;
if (path && buf) { if (path && buf) {
@ -1327,10 +1335,14 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
if (0 == ret) { if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
#ifdef set_fs
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
#endif
ret = readFile(fp, buf, sz); ret = readFile(fp, buf, sz);
#ifdef set_fs
set_fs(oldfs); set_fs(oldfs);
#endif
closeFile(fp); closeFile(fp);
RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret); RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret);
@ -1354,7 +1366,9 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
static int storeToFile(const char *path, u8 *buf, u32 sz) static int storeToFile(const char *path, u8 *buf, u32 sz)
{ {
int ret = 0; int ret = 0;
#ifdef set_fs
mm_segment_t oldfs; mm_segment_t oldfs;
#endif
struct file *fp; struct file *fp;
if (path && buf) { if (path && buf) {
@ -1362,10 +1376,14 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
if (0 == ret) { if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
#ifdef set_fs
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
#endif
ret = writeFile(fp, buf, sz); ret = writeFile(fp, buf, sz);
#ifdef set_fs
set_fs(oldfs); set_fs(oldfs);
#endif
closeFile(fp); closeFile(fp);
RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret); RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret);