1
0
mirror of https://github.com/morrownr/8821cu-20210916.git synced 2024-09-16 11:41:44 +00:00

various minor updates

This commit is contained in:
morrownr 2023-02-09 09:11:23 -06:00
parent 6447ce7ea7
commit 5f3bbbf007
11 changed files with 279 additions and 39 deletions

View File

@ -165,10 +165,6 @@ Warning: If you decide to upgrade to a new version of kernel such as
the newest available before installing the new kernel. Use the the newest available before installing the new kernel. Use the
following commands in the driver directory: following commands in the driver directory:
```
sudo ./remove-driver.sh
```
``` ```
git pull git pull
``` ```

View File

@ -402,8 +402,10 @@ sint rtw_fill_radiotap_hdr(_adapter *padapter, struct rx_pkt_attrib *a, u8 *buf)
} }
if (a->ampdu_eof) { if (a->ampdu_eof) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF_KNOWN); tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF_KNOWN);
tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF); tmp_16bit |= cpu_to_le16(IEEE80211_RADIOTAP_AMPDU_EOF);
#endif
} }
_rtw_memcpy(&hdr_buf[rt_len], &tmp_16bit, 2); _rtw_memcpy(&hdr_buf[rt_len], &tmp_16bit, 2);

View File

@ -17,9 +17,10 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <net/ip.h> #include <net/ip.h>
// #if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 14, 0)) #include <linux/version.h>
// #include <net/ipx.h> #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
// #endif #include <net/ipx.h>
#endif
#include <linux/atalk.h> #include <linux/atalk.h>
#include <linux/udp.h> #include <linux/udp.h>
#include <linux/if_pppox.h> #include <linux/if_pppox.h>
@ -170,8 +171,8 @@ static void __nat25_generate_ipv4_network_addr(unsigned char *networkAddr,
memcpy(networkAddr + 7, (unsigned char *)ipAddr, 4); memcpy(networkAddr + 7, (unsigned char *)ipAddr, 4);
} }
/* The following 3 functions are no longer used
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
static void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr, static void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr) unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
{ {
@ -203,8 +204,8 @@ static void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
memcpy(networkAddr + 1, (unsigned char *)network, 2); memcpy(networkAddr + 1, (unsigned char *)network, 2);
networkAddr[3] = *node; networkAddr[3] = *node;
} }
#endif
*/
static void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr, static void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
unsigned char *ac_mac, unsigned short *sid) unsigned char *ac_mac, unsigned short *sid)
@ -334,6 +335,7 @@ static int __nat25_network_hash(unsigned char *networkAddr)
x = networkAddr[7] ^ networkAddr[8] ^ networkAddr[9] ^ networkAddr[10]; x = networkAddr[7] ^ networkAddr[8] ^ networkAddr[9] ^ networkAddr[10];
return x & (NAT25_HASH_SIZE - 1); return x & (NAT25_HASH_SIZE - 1);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
} else if (networkAddr[0] == NAT25_IPX) { } else if (networkAddr[0] == NAT25_IPX) {
unsigned long x; unsigned long x;
@ -347,6 +349,7 @@ static int __nat25_network_hash(unsigned char *networkAddr)
x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3]; x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3];
return x & (NAT25_HASH_SIZE - 1); return x & (NAT25_HASH_SIZE - 1);
#endif
} else if (networkAddr[0] == NAT25_PPPOE) { } else if (networkAddr[0] == NAT25_PPPOE) {
unsigned long x; unsigned long x;
@ -893,6 +896,229 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
} }
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
/*---------------------------------------------------*/
/* Handle IPX and Apple Talk frame */
/*---------------------------------------------------*/
else if ((protocol == __constant_htons(ETH_P_IPX)) ||
(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)) {
RTW_INFO("NAT25: Protocol=IPX (Ethernet II)\n");
ipx = (struct ipxhdr *)framePtr;
} else { /* if(protocol <= __constant_htons(ETH_FRAME_LEN)) */
if (!memcmp(ipx_header, framePtr, 2)) {
RTW_INFO("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 */
RTW_INFO("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)) {
RTW_INFO("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)) {
RTW_INFO("NAT25: Check IPX skb_copy\n");
return 0;
}
return -1;
case NAT25_INSERT: {
RTW_INFO("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)) {
RTW_INFO("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)) {
RTW_INFO("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) {
/* Sanity check fields. */
if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) {
DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n");
return -1;
}
switch (method) {
case NAT25_CHECK:
return 0;
case NAT25_INSERT: {
/* change to AARP source mac address to wlan STA address */
memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
RTW_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
ea->pa_src_net,
ea->pa_src_node,
ea->pa_dst_net,
ea->pa_dst_node);
__nat25_generate_apple_network_addr(networkAddr, &ea->pa_src_net, &ea->pa_src_node);
__nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
__nat25_db_print(priv);
}
return 0;
case NAT25_LOOKUP: {
RTW_INFO("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n",
ea->pa_src_net,
ea->pa_src_node,
ea->pa_dst_net,
ea->pa_dst_node);
__nat25_generate_apple_network_addr(networkAddr, &ea->pa_dst_net, &ea->pa_dst_node);
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
/* change to AARP destination mac address to Lookup result */
memcpy(ea->hw_dst, skb->data, ETH_ALEN);
}
return 0;
default:
return -1;
}
}
/* DDP */
else if (ddp != NULL) {
switch (method) {
case NAT25_CHECK:
return -1;
case NAT25_INSERT: {
RTW_INFO("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n",
ddp->deh_snet,
ddp->deh_snode,
ddp->deh_dnet,
ddp->deh_dnode);
__nat25_generate_apple_network_addr(networkAddr, &ddp->deh_snet, &ddp->deh_snode);
__nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
__nat25_db_print(priv);
}
return 0;
case NAT25_LOOKUP: {
RTW_INFO("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n",
ddp->deh_snet,
ddp->deh_snode,
ddp->deh_dnet,
ddp->deh_dnode);
__nat25_generate_apple_network_addr(networkAddr, &ddp->deh_dnet, &ddp->deh_dnode);
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
}
return 0;
default:
return -1;
}
}
return -1;
}
#endif
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Handle PPPoE frame */ /* Handle PPPoE frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/

View File

@ -16165,6 +16165,12 @@ u8 rtw_set_chbw_hdl(_adapter *padapter, u8 *pbuf)
LeaveAllPowerSaveModeDirect(padapter); LeaveAllPowerSaveModeDirect(padapter);
#ifdef CONFIG_MONITOR_MODE_XMIT
pmlmeext->cur_channel = set_ch_parm->ch;
pmlmeext->cur_ch_offset = set_ch_parm->ch_offset;
pmlmeext->cur_bwmode = set_ch_parm->bw;
#endif /* CONFIG_MONITOR_MODE_XMIT */
set_channel_bwmode(padapter, set_ch_parm->ch, set_ch_parm->ch_offset, set_ch_parm->bw); set_channel_bwmode(padapter, set_ch_parm->ch, set_ch_parm->ch_offset, set_ch_parm->bw);
rtw_mi_get_ch_setting_union(padapter, &u_ch, &u_bw, &u_offset); rtw_mi_get_ch_setting_union(padapter, &u_ch, &u_bw, &u_offset);

View File

@ -26,7 +26,11 @@ int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz)
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
tasklet_init(&precvpriv->recv_tasklet, tasklet_init(&precvpriv->recv_tasklet,
(void(*))usb_recv_tasklet, #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
(void(*)(unsigned long))usb_recv_tasklet,
#else
(void *)usb_recv_tasklet,
#endif
(unsigned long)padapter); (unsigned long)padapter);
#endif /* PLATFORM_LINUX */ #endif /* PLATFORM_LINUX */

View File

@ -931,7 +931,12 @@ s32 rtl8821cu_init_xmit_priv(PADAPTER padapter)
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
tasklet_init(&pxmitpriv->xmit_tasklet, rtl8821cu_xmit_tasklet, tasklet_init(&pxmitpriv->xmit_tasklet,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
(void(*)(unsigned long))rtl8821cu_xmit_tasklet,
#else
(void *)rtl8821cu_xmit_tasklet,
#endif
(unsigned long)padapter); (unsigned long)padapter);
#endif #endif
#ifdef CONFIG_TX_EARLY_MODE #ifdef CONFIG_TX_EARLY_MODE

View File

@ -5111,9 +5111,11 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
ie_offset = _REASOCREQ_IE_OFFSET_; ie_offset = _REASOCREQ_IE_OFFSET_;
memset(&sinfo, 0, sizeof(sinfo)); memset(&sinfo, 0, sizeof(sinfo));
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
sinfo.filled = STATION_INFO_ASSOC_REQ_IES; sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset; sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset;
sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset; sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset;
#endif
cfg80211_new_sta(ndev, get_addr2_ptr(pmgmt_frame), &sinfo, GFP_ATOMIC); cfg80211_new_sta(ndev, get_addr2_ptr(pmgmt_frame), &sinfo, GFP_ATOMIC);
} }
#else /* defined(RTW_USE_CFG80211_STA_EVENT) */ #else /* defined(RTW_USE_CFG80211_STA_EVENT) */

View File

@ -3915,7 +3915,7 @@ int _netdev_open(struct net_device *pnetdev)
#ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_IOCTL_CFG80211
rtw_cfg80211_init_wdev_data(padapter); rtw_cfg80211_init_wdev_data(padapter);
#endif #endif
rtw_netif_carrier_on(pnetdev); /* call this func when rtw_joinbss_event_callback return success */ /* rtw_netif_carrier_on(pnetdev); */ /* call this func when rtw_joinbss_event_callback return success */
rtw_netif_wake_queue(pnetdev); rtw_netif_wake_queue(pnetdev);
#ifdef CONFIG_BR_EXT #ifdef CONFIG_BR_EXT
@ -4036,7 +4036,7 @@ int _netdev_open(struct net_device *pnetdev)
rtw_set_pwr_state_check_timer(pwrctrlpriv); rtw_set_pwr_state_check_timer(pwrctrlpriv);
#endif #endif
rtw_netif_carrier_on(pnetdev); /* call this func when rtw_joinbss_event_callback return success */ /* rtw_netif_carrier_on(pnetdev); */ /* call this func when rtw_joinbss_event_callback return success */
rtw_netif_wake_queue(pnetdev); rtw_netif_wake_queue(pnetdev);
#ifdef CONFIG_BR_EXT #ifdef CONFIG_BR_EXT

View File

@ -98,7 +98,6 @@ static void rtw_dev_shutdown(struct device *dev)
#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
#define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400 #define USB_DEVICE_ID_MATCH_INT_NUMBER 0x0400
#define USB_DEVICE_ID_MATCH_INT_INFO \ #define USB_DEVICE_ID_MATCH_INT_INFO \
(USB_DEVICE_ID_MATCH_INT_CLASS | \ (USB_DEVICE_ID_MATCH_INT_CLASS | \
USB_DEVICE_ID_MATCH_INT_SUBCLASS | \ USB_DEVICE_ID_MATCH_INT_SUBCLASS | \