Compare commits
5 commits
fix/5_10_g
...
master
Author | SHA1 | Date | |
---|---|---|---|
Juan José Gutiérrez de Quevedo Pérez | b71593a785 | ||
Juan José Gutiérrez de Quevedo Pérez | d95287c99d | ||
Juan José Gutiérrez de Quevedo Pérez | 530f10b9e5 | ||
Juan José Gutiérrez de Quevedo Pérez | 2b9ebf386e | ||
Juan José Gutiérrez de Quevedo Pérez | bdd61e6735 |
17
Makefile
17
Makefile
|
@ -73,7 +73,8 @@ CONFIG_AP_WOWLAN = n
|
|||
######### Notify SDIO Host Keep Power During Syspend ##########
|
||||
CONFIG_RTW_SDIO_PM_KEEP_POWER = n
|
||||
###################### Platform Related #######################
|
||||
CONFIG_PLATFORM_I386_PC = y
|
||||
CONFIG_PLATFORM_I386_PC = n
|
||||
CONFIG_PLATFORM_PINEBOOK = y
|
||||
CONFIG_PLATFORM_ANDROID_X86 = n
|
||||
CONFIG_PLATFORM_ANDROID_INTEL_X86 = n
|
||||
CONFIG_PLATFORM_JB_X86 = n
|
||||
|
@ -159,7 +160,8 @@ _OS_INTFS_FILES := os_dep/osdep_service.o \
|
|||
os_dep/linux/rtw_cfgvendor.o \
|
||||
os_dep/linux/wifi_regd.o \
|
||||
os_dep/linux/rtw_android.o \
|
||||
os_dep/linux/rtw_proc.o
|
||||
os_dep/linux/rtw_proc.o \
|
||||
os_dep/linux/addr_utils.o
|
||||
|
||||
ifeq ($(CONFIG_MP_INCLUDED), y)
|
||||
_OS_INTFS_FILES += os_dep/linux/ioctl_mp.o
|
||||
|
@ -892,6 +894,17 @@ endif
|
|||
|
||||
EXTRA_CFLAGS += -DDM_ODM_SUPPORT_TYPE=0x04
|
||||
|
||||
ifeq ($(CONFIG_PLATFORM_PINEBOOK), y)
|
||||
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
|
||||
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
|
||||
ARCH := arm64
|
||||
CROSS_COMPILE ?=
|
||||
KVER := $(shell uname -r)
|
||||
KSRC := /lib/modules/$(KVER)/build
|
||||
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
|
||||
INSTALL_PREFIX :=
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PLATFORM_I386_PC), y)
|
||||
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
|
||||
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#ifdef __KERNEL__
|
||||
#include <linux/if_arp.h>
|
||||
#include <net/ip.h>
|
||||
#include <net/ipx.h>
|
||||
#include <linux/atalk.h>
|
||||
#include <linux/udp.h>
|
||||
#include <linux/if_pppox.h>
|
||||
|
@ -174,27 +173,6 @@ static __inline__ void __nat25_generate_ipv4_network_addr(unsigned char *network
|
|||
}
|
||||
|
||||
|
||||
static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
|
||||
unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
|
||||
{
|
||||
memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
|
||||
|
||||
networkAddr[0] = NAT25_IPX;
|
||||
memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4);
|
||||
memcpy(networkAddr+5, ipxNodeAddr, 6);
|
||||
}
|
||||
|
||||
|
||||
static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr,
|
||||
unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr)
|
||||
{
|
||||
memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
|
||||
|
||||
networkAddr[0] = NAT25_IPX;
|
||||
memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4);
|
||||
memcpy(networkAddr+5, (unsigned char *)ipxSocketAddr, 2);
|
||||
}
|
||||
|
||||
|
||||
static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
|
||||
unsigned short *network, unsigned char *node)
|
||||
|
@ -938,160 +916,12 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
|
|||
(protocol == __constant_htons(ETH_P_ATALK)) ||
|
||||
(protocol == __constant_htons(ETH_P_AARP)))
|
||||
{
|
||||
unsigned char ipx_header[2] = {0xFF, 0xFF};
|
||||
struct ipxhdr *ipx = NULL;
|
||||
struct elapaarp *ea = NULL;
|
||||
struct ddpehdr *ddp = NULL;
|
||||
unsigned char *framePtr = skb->data + ETH_HLEN;
|
||||
|
||||
if(protocol == __constant_htons(ETH_P_IPX))
|
||||
{
|
||||
DBG_871X("NAT25: Protocol=IPX (Ethernet II)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
}
|
||||
else //if(protocol <= __constant_htons(ETH_FRAME_LEN))
|
||||
{
|
||||
if(!memcmp(ipx_header, framePtr, 2))
|
||||
{
|
||||
DBG_871X("NAT25: Protocol=IPX (Ethernet 802.3)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char ipx_8022_type = 0xE0;
|
||||
unsigned char snap_8022_type = 0xAA;
|
||||
|
||||
if(*framePtr == snap_8022_type)
|
||||
{
|
||||
unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; // IPX SNAP ID
|
||||
unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; // Apple Talk AARP SNAP ID
|
||||
unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; // Apple Talk DDP SNAP ID
|
||||
|
||||
framePtr += 3; // eliminate the 802.2 header
|
||||
|
||||
if(!memcmp(ipx_snap_id, framePtr, 5))
|
||||
{
|
||||
framePtr += 5; // eliminate the SNAP header
|
||||
|
||||
DBG_871X("NAT25: Protocol=IPX (Ethernet SNAP)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
}
|
||||
else if(!memcmp(aarp_snap_id, framePtr, 5))
|
||||
{
|
||||
framePtr += 5; // eliminate the SNAP header
|
||||
|
||||
ea = (struct elapaarp *)framePtr;
|
||||
}
|
||||
else if(!memcmp(ddp_snap_id, framePtr, 5))
|
||||
{
|
||||
framePtr += 5; // eliminate the SNAP header
|
||||
|
||||
ddp = (struct ddpehdr *)framePtr;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_WARN("NAT25: Protocol=Ethernet SNAP %02x%02x%02x%02x%02x\n", framePtr[0],
|
||||
framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if(*framePtr == ipx_8022_type)
|
||||
{
|
||||
framePtr += 3; // eliminate the 802.2 header
|
||||
|
||||
if(!memcmp(ipx_header, framePtr, 2))
|
||||
{
|
||||
DBG_871X("NAT25: Protocol=IPX (Ethernet 802.2)\n");
|
||||
ipx = (struct ipxhdr *)framePtr;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* IPX */
|
||||
if(ipx != NULL)
|
||||
{
|
||||
switch(method)
|
||||
{
|
||||
case NAT25_CHECK:
|
||||
if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
|
||||
{
|
||||
DBG_871X("NAT25: Check IPX skb_copy\n");
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
||||
case NAT25_INSERT:
|
||||
{
|
||||
DBG_871X("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n",
|
||||
ipx->ipx_dest.net,
|
||||
ipx->ipx_dest.node[0],
|
||||
ipx->ipx_dest.node[1],
|
||||
ipx->ipx_dest.node[2],
|
||||
ipx->ipx_dest.node[3],
|
||||
ipx->ipx_dest.node[4],
|
||||
ipx->ipx_dest.node[5],
|
||||
ipx->ipx_dest.sock,
|
||||
ipx->ipx_source.net,
|
||||
ipx->ipx_source.node[0],
|
||||
ipx->ipx_source.node[1],
|
||||
ipx->ipx_source.node[2],
|
||||
ipx->ipx_source.node[3],
|
||||
ipx->ipx_source.node[4],
|
||||
ipx->ipx_source.node[5],
|
||||
ipx->ipx_source.sock);
|
||||
|
||||
if(!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
|
||||
{
|
||||
DBG_871X("NAT25: Use IPX Net, and Socket as network addr\n");
|
||||
|
||||
__nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
|
||||
|
||||
// change IPX source node addr to wlan STA address
|
||||
memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
__nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_source.net, ipx->ipx_source.node);
|
||||
}
|
||||
|
||||
__nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
|
||||
|
||||
__nat25_db_print(priv);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case NAT25_LOOKUP:
|
||||
{
|
||||
if(!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN))
|
||||
{
|
||||
DBG_871X("NAT25: Lookup IPX, Modify Destination IPX Node addr\n");
|
||||
|
||||
__nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_dest.net, &ipx->ipx_dest.sock);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
|
||||
// replace IPX destination node addr with Lookup destination MAC addr
|
||||
memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
__nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_dest.net, ipx->ipx_dest.node);
|
||||
|
||||
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* AARP */
|
||||
else if(ea != NULL)
|
||||
if(ea != NULL)
|
||||
{
|
||||
/* Sanity check fields. */
|
||||
if(ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN)
|
||||
|
|
|
@ -15121,7 +15121,9 @@ u8 set_chplan_hdl(_adapter *padapter, unsigned char *pbuf)
|
|||
rtw_hal_set_odm_var(padapter,HAL_ODM_REGULATION,NULL,_TRUE);
|
||||
|
||||
#ifdef CONFIG_IOCTL_CFG80211
|
||||
rtw_reg_notify_by_driver(padapter);
|
||||
if (padapter->rtw_wdev != NULL) {
|
||||
rtw_reg_notify_by_driver(padapter->rtw_wdev->wiphy);
|
||||
}
|
||||
#endif //CONFIG_IOCTL_CFG80211
|
||||
|
||||
return H2C_SUCCESS;
|
||||
|
|
|
@ -1390,22 +1390,26 @@ enum ieee80211_state {
|
|||
(((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \
|
||||
(((Addr[5]) & 0xff) == 0xff))
|
||||
#else
|
||||
extern __inline int is_multicast_mac_addr(const u8 *addr)
|
||||
int is_multicast_mac_addr(const u8 *addr);
|
||||
int is_broadcast_mac_addr(const u8 *addr);
|
||||
int is_zero_mac_addr(const u8 *addr);
|
||||
/*
|
||||
extern int is_multicast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] != 0xff) && (0x01 & addr[0]));
|
||||
}
|
||||
|
||||
extern __inline int is_broadcast_mac_addr(const u8 *addr)
|
||||
extern int is_broadcast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
|
||||
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
|
||||
}
|
||||
|
||||
extern __inline int is_zero_mac_addr(const u8 *addr)
|
||||
extern int is_zero_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
|
||||
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
|
||||
}
|
||||
}*/
|
||||
#endif //PLATFORM_FREEBSD
|
||||
|
||||
#define CFG_IEEE80211_RESERVE_FCS (1<<0)
|
||||
|
|
|
@ -167,7 +167,11 @@
|
|||
typedef int thread_return;
|
||||
typedef void* thread_context;
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0))
|
||||
#define thread_exit() kthread_complete_and_exit(NULL, 0)
|
||||
#else
|
||||
#define thread_exit() complete_and_exit(NULL, 0)
|
||||
#endif
|
||||
|
||||
typedef void timer_hdl_return;
|
||||
typedef void* timer_hdl_context;
|
||||
|
|
|
@ -19,8 +19,8 @@ enum country_code_type_t {
|
|||
COUNTRY_CODE_MAX
|
||||
};
|
||||
|
||||
int rtw_regd_init(_adapter *padapter);
|
||||
void rtw_reg_notify_by_driver(_adapter *adapter);
|
||||
void rtw_regd_init(struct wiphy *wiphy);
|
||||
void rtw_reg_notify_by_driver(struct wiphy *wiphy);
|
||||
|
||||
#endif /* __RTW_WIFI_REGD_H__ */
|
||||
|
||||
|
|
18
os_dep/linux/addr_utils.c
Normal file
18
os_dep/linux/addr_utils.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <linux/ctype.h> /* tolower() */
|
||||
|
||||
int is_multicast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] != 0xff) && (0x01 & addr[0]));
|
||||
}
|
||||
|
||||
int is_broadcast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
|
||||
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
|
||||
}
|
||||
|
||||
int is_zero_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
|
||||
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
|
||||
}
|
|
@ -808,8 +808,13 @@ check_bss:
|
|||
|
||||
DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter));
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0)
|
||||
roam_info.links[0].channel = notify_channel;
|
||||
roam_info.links[0].bssid = cur_network->network.MacAddress;
|
||||
#else
|
||||
roam_info.channel = notify_channel;
|
||||
roam_info.bssid = cur_network->network.MacAddress;
|
||||
#endif
|
||||
roam_info.req_ie =
|
||||
pmlmepriv->assoc_req+sizeof(struct ieee80211_hdr_3addr)+2;
|
||||
roam_info.req_ie_len =
|
||||
|
@ -1517,9 +1522,11 @@ exit:
|
|||
}
|
||||
|
||||
static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0))
|
||||
int link_id, u8 key_index, bool pairwise, const u8 *mac_addr,
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
u8 key_index, bool pairwise, const u8 *mac_addr,
|
||||
#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
|
||||
#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
|
||||
u8 key_index, const u8 *mac_addr,
|
||||
#endif // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
|
||||
struct key_params *params)
|
||||
|
@ -1668,7 +1675,9 @@ addkey_end:
|
|||
}
|
||||
|
||||
static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0))
|
||||
int link_id, u8 key_index, bool pairwise, const u8 *mac_addr,
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
u8 key_index, bool pairwise, const u8 *mac_addr,
|
||||
#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
|
||||
u8 key_index, const u8 *mac_addr,
|
||||
|
@ -1701,7 +1710,9 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev,
|
|||
}
|
||||
|
||||
static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0))
|
||||
int link_id, u8 key_index, bool pairwise, const u8 *mac_addr)
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
u8 key_index, bool pairwise, const u8 *mac_addr)
|
||||
#else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
|
||||
u8 key_index, const u8 *mac_addr)
|
||||
|
@ -1722,9 +1733,13 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
|
|||
}
|
||||
|
||||
static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
|
||||
struct net_device *ndev, u8 key_index
|
||||
struct net_device *ndev,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0))
|
||||
int link_id,
|
||||
#endif
|
||||
u8 key_index,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
, bool unicast, bool multicast
|
||||
bool unicast, bool multicast
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
@ -4302,7 +4317,7 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
|
||||
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int notify)
|
||||
{
|
||||
DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
|
||||
return 0;
|
||||
|
@ -6444,9 +6459,6 @@ void rtw_cfg80211_init_wiphy(_adapter *padapter)
|
|||
rtw_cfg80211_init_ht_capab(padapter, &bands->ht_cap, NL80211_BAND_5GHZ, rf_type);
|
||||
}
|
||||
#endif
|
||||
/* init regulary domain */
|
||||
rtw_regd_init(padapter);
|
||||
|
||||
/* copy mac_addr to wiphy */
|
||||
_rtw_memcpy(wiphy->perm_addr, adapter_mac_addr(padapter), ETH_ALEN);
|
||||
|
||||
|
@ -6679,6 +6691,8 @@ struct wiphy *rtw_wiphy_alloc(_adapter *padapter, struct device *dev)
|
|||
*((_adapter**)wiphy_priv(wiphy)) = padapter;
|
||||
|
||||
rtw_cfg80211_preinit_wiphy(padapter, wiphy);
|
||||
/* init regulatory domain */
|
||||
rtw_regd_init(wiphy);
|
||||
|
||||
DBG_871X(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(wiphy));
|
||||
|
||||
|
@ -6813,7 +6827,7 @@ void rtw_wdev_unregister(struct wireless_dev *wdev)
|
|||
rtw_cfg80211_indicate_scan_done(adapter, _TRUE);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
if (wdev->current_bss) {
|
||||
if (wdev->u.ibss.current_bss) {
|
||||
DBG_871X(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter));
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
|
||||
cfg80211_disconnected(adapter->pnetdev, 0, NULL, 0, GFP_ATOMIC);
|
||||
|
|
|
@ -37,6 +37,9 @@ inline struct proc_dir_entry *get_rtw_drv_proc(void)
|
|||
|
||||
#define RTW_PROC_NAME DRV_NAME
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0))
|
||||
#define PDE_DATA(inode) pde_data(inode)
|
||||
#endif
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))
|
||||
#define file_inode(file) ((file)->f_dentry->d_inode)
|
||||
#endif
|
||||
|
|
|
@ -476,12 +476,12 @@ void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
|
|||
#endif
|
||||
}
|
||||
|
||||
void rtw_reg_notify_by_driver(_adapter *adapter)
|
||||
void rtw_reg_notify_by_driver(struct wiphy *wiphy)
|
||||
{
|
||||
if ((adapter->rtw_wdev != NULL) && (adapter->rtw_wdev->wiphy)) {
|
||||
if (wiphy) {
|
||||
struct regulatory_request request;
|
||||
request.initiator = NL80211_REGDOM_SET_BY_DRIVER;
|
||||
rtw_reg_notifier(adapter->rtw_wdev->wiphy, &request);
|
||||
rtw_reg_notifier(wiphy, &request);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -521,28 +521,9 @@ static struct country_code_to_enum_rd *_rtw_regd_find_country(u16 countrycode)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int rtw_regd_init(_adapter * padapter)
|
||||
void rtw_regd_init(struct wiphy *wiphy)
|
||||
{
|
||||
struct wiphy *wiphy = padapter->rtw_wdev->wiphy;
|
||||
|
||||
#if 0
|
||||
if (rtw_regd == NULL) {
|
||||
rtw_regd = (struct rtw_regulatory *)
|
||||
rtw_malloc(sizeof(struct rtw_regulatory));
|
||||
|
||||
rtw_regd->alpha2[0] = '9';
|
||||
rtw_regd->alpha2[1] = '9';
|
||||
|
||||
rtw_regd->country_code = COUNTRY_CODE_USER;
|
||||
}
|
||||
|
||||
DBG_8192C("%s: Country alpha2 being used: %c%c\n",
|
||||
__func__, rtw_regd->alpha2[0], rtw_regd->alpha2[1]);
|
||||
#endif
|
||||
|
||||
_rtw_regd_init_wiphy(NULL, wiphy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif //CONFIG_IOCTL_CFG80211
|
||||
|
||||
|
|
|
@ -1949,7 +1949,6 @@ static int isFileReadable(char *path)
|
|||
{
|
||||
struct file *fp;
|
||||
int ret = 0;
|
||||
mm_segment_t oldfs;
|
||||
char buf;
|
||||
|
||||
fp=filp_open(path, O_RDONLY, 0);
|
||||
|
@ -1957,13 +1956,8 @@ static int isFileReadable(char *path)
|
|||
ret = PTR_ERR(fp);
|
||||
}
|
||||
else {
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
|
||||
if(1!=readFile(fp, &buf, 1))
|
||||
ret = PTR_ERR(fp);
|
||||
|
||||
set_fs(oldfs);
|
||||
filp_close(fp,NULL);
|
||||
ret = kernel_read(fp, &buf, 1, NULL);
|
||||
closeFile(fp);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1978,16 +1972,12 @@ static int isFileReadable(char *path)
|
|||
static int retriveFromFile(char *path, u8* buf, u32 sz)
|
||||
{
|
||||
int ret =-1;
|
||||
mm_segment_t oldfs;
|
||||
struct file *fp;
|
||||
|
||||
if(path && buf) {
|
||||
if( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ){
|
||||
DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
||||
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
ret=readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
ret = kernel_read(fp, buf, sz, NULL);
|
||||
closeFile(fp);
|
||||
|
||||
DBG_871X("%s readFile, ret:%d\n",__FUNCTION__, ret);
|
||||
|
@ -2012,16 +2002,12 @@ static int retriveFromFile(char *path, u8* buf, u32 sz)
|
|||
static int storeToFile(char *path, u8* buf, u32 sz)
|
||||
{
|
||||
int ret =0;
|
||||
mm_segment_t oldfs;
|
||||
struct file *fp;
|
||||
|
||||
if(path && buf) {
|
||||
if( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) {
|
||||
DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
||||
|
||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||
ret=writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
ret = kernel_write(fp, buf, sz, NULL);
|
||||
closeFile(fp);
|
||||
|
||||
DBG_871X("%s writeFile, ret:%d\n",__FUNCTION__, ret);
|
||||
|
@ -2326,7 +2312,9 @@ u64 rtw_division64(u64 x, u64 y)
|
|||
inline u32 rtw_random32(void)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0))
|
||||
return get_random_u32();
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
|
||||
return prandom_u32();
|
||||
#elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18))
|
||||
u32 random_int;
|
||||
|
|
Loading…
Reference in a new issue