diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c index 6bb8065..b7c44e3 100644 --- a/core/rtw_br_ext.c +++ b/core/rtw_br_ext.c @@ -28,20 +28,8 @@ #include #endif -#if 1 /* rtw_wifi_driver */ - #include -#else /* rtw_wifi_driver */ - #include "./8192cd_cfg.h" - - #ifndef __KERNEL__ - #include "./sys-support.h" - #endif - - #include "./8192cd.h" - #include "./8192cd_headers.h" - #include "./8192cd_br_ext.h" - #include "./8192cd_debug.h" -#endif /* rtw_wifi_driver */ +#include +#include #ifdef CL_IPV6_PASS #ifdef __KERNEL__ @@ -100,16 +88,15 @@ static __inline__ unsigned char *__nat25_find_pppoe_tag(struct pppoe_hdr *ph, un return cur_ptr; cur_ptr = cur_ptr + TAG_HDR_LEN + tagLen; } - return 0; + return NULL; } - static __inline__ int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_tag *tag) { struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN); int data_len; - data_len = tag->tag_len + TAG_HDR_LEN; + data_len = be16_to_cpu(tag->tag_len) + TAG_HDR_LEN; if (skb_tailroom(skb) < data_len) { _DEBUG_ERR("skb_tailroom() failed in add SID tag!\n"); return -1; @@ -165,7 +152,7 @@ static __inline__ int __nat25_has_expired(_adapter *priv, static __inline__ void __nat25_generate_ipv4_network_addr(unsigned char *networkAddr, - unsigned int *ipAddr) + u32 *ipAddr) { memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN); @@ -175,7 +162,7 @@ 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) + __be32 *ipxNetAddr, unsigned char *ipxNodeAddr) { memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN); @@ -186,7 +173,7 @@ static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr, - unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr) + __be32 *ipxNetAddr, __be16 *ipxSocketAddr) { memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN); @@ -197,7 +184,7 @@ static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned ch static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr, - unsigned short *network, unsigned char *node) + __be16 *network, unsigned char *node) { memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN); @@ -208,7 +195,7 @@ static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networ static __inline__ void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr, - unsigned char *ac_mac, unsigned short *sid) + unsigned char *ac_mac, __be16 *sid) { memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN); @@ -757,8 +744,9 @@ static int checkIPMcAndReplace(_adapter *priv, struct sk_buff *skb, unsigned int int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) { - unsigned short protocol; + __be16 protocol; unsigned char networkAddr[MAX_NETWORK_ADDR_LEN]; + unsigned int tmp; if (skb == NULL) return -1; @@ -766,7 +754,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) if ((method <= NAT25_MIN) || (method >= NAT25_MAX)) return -1; - protocol = *((unsigned short *)(skb->data + 2 * ETH_ALEN)); + protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN)); /*---------------------------------------------------*/ /* Handle IP frame */ @@ -788,8 +776,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) /* in class A, B, C, host address is all zero or all one is illegal */ if (iph->saddr == 0) return 0; + tmp = be32_to_cpu(iph->saddr); RTW_INFO("NAT25: Insert IP, SA=%08x, DA=%08x\n", iph->saddr, iph->daddr); - __nat25_generate_ipv4_network_addr(networkAddr, &iph->saddr); + __nat25_generate_ipv4_network_addr(networkAddr, &tmp); /* record source IP address and , source mac address into db */ __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr); @@ -807,7 +796,8 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) (OPMODE & WIFI_ADHOC_STATE))) #endif { - __nat25_generate_ipv4_network_addr(networkAddr, &iph->daddr); + tmp = be32_to_cpu(iph->daddr); + __nat25_generate_ipv4_network_addr(networkAddr, &tmp); if (!__nat25_db_network_lookup_and_replace(priv, skb, networkAddr)) { if (*((unsigned char *)&iph->daddr + 3) == 0xff) { @@ -843,7 +833,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) unsigned int *sender, *target; if (arp->ar_pro != __constant_htons(ETH_P_IP)) { - DEBUG_WARN("NAT25: arp protocol unknown (%4x)!\n", htons(arp->ar_pro)); + DEBUG_WARN("NAT25: arp protocol unknown (%4x)!\n", be16_to_cpu(arp->ar_pro)); return -1; } @@ -1120,7 +1110,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) else if ((protocol == __constant_htons(ETH_P_PPP_DISC)) || (protocol == __constant_htons(ETH_P_PPP_SES))) { struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN); - unsigned short *pMagic; + __be16 *pMagic; switch (method) { case NAT25_CHECK: @@ -1159,7 +1149,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) tag->tag_len = htons(MAGIC_CODE_LEN + RTL_RELAY_TAG_LEN + old_tag_len); /* insert the magic_code+client mac in relay tag */ - pMagic = (unsigned short *)tag->tag_data; + pMagic = (__be16 *)tag->tag_data; *pMagic = htons(MAGIC_CODE); memcpy(tag->tag_data + MAGIC_CODE_LEN, skb->data + ETH_ALEN, ETH_ALEN); @@ -1208,7 +1198,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) int offset = 0; ptr = __nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID)); - if (ptr == 0) { + if (!ptr) { DEBUG_ERR("Fail to find PTT_RELAY_SID in FADO!\n"); return -1; } @@ -1222,7 +1212,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) return -1; } - pMagic = (unsigned short *)tag->tag_data; + pMagic = (__be16 *)tag->tag_data; if (ntohs(*pMagic) != MAGIC_CODE) { DEBUG_ERR("Can't find MAGIC_CODE in %s packet!\n", (ph->code == PADO_CODE ? "PADO" : "PADS")); @@ -1348,9 +1338,9 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) struct icmp6hdr *hdr = (struct icmp6hdr *)(skb->data + ETH_HLEN + sizeof(*iph)); hdr->icmp6_cksum = 0; hdr->icmp6_cksum = csum_ipv6_magic(&iph->saddr, &iph->daddr, - iph->payload_len, + be16_to_cpu(iph->payload_len), IPPROTO_ICMPV6, - csum_partial((__u8 *)hdr, iph->payload_len, 0)); + csum_partial((__u8 *)hdr, be16_to_cpu(iph->payload_len), 0)); } } } @@ -1409,7 +1399,7 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb) int is_vlan_tag = 0, i, retval = 0; unsigned short vlan_hdr = 0; - if (*((unsigned short *)(skb->data + ETH_ALEN * 2)) == __constant_htons(ETH_P_8021Q)) { + if (*((__be16 *)(skb->data + ETH_ALEN * 2)) == __constant_htons(ETH_P_8021Q)) { is_vlan_tag = 1; vlan_hdr = *((unsigned short *)(skb->data + ETH_ALEN * 2 + 2)); for (i = 0; i < 6; i++) @@ -1426,7 +1416,7 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb) * corresponding network protocol is NOT support. */ if (!priv->ethBrExtInfo.nat25sc_disable && - (*((unsigned short *)(skb->data + ETH_ALEN * 2)) == __constant_htons(ETH_P_IP)) && + (*((__be16 *)(skb->data + ETH_ALEN * 2)) == __constant_htons(ETH_P_IP)) && !memcmp(priv->scdb_ip, skb->data + ETH_HLEN + 16, 4)) { memcpy(skb->data, priv->scdb_mac, ETH_ALEN); @@ -1437,9 +1427,9 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb) retval = nat25_db_handle(priv, skb, NAT25_LOOKUP); } } else { - if (((*((unsigned short *)(skb->data + ETH_ALEN * 2)) == __constant_htons(ETH_P_IP)) && + if (((*((__be16 *)(skb->data + ETH_ALEN * 2)) == __constant_htons(ETH_P_IP)) && !memcmp(priv->br_ip, skb->data + ETH_HLEN + 16, 4)) || - ((*((unsigned short *)(skb->data + ETH_ALEN * 2)) == __constant_htons(ETH_P_ARP)) && + ((*((__be16 *)(skb->data + ETH_ALEN * 2)) == __constant_htons(ETH_P_ARP)) && !memcmp(priv->br_ip, skb->data + ETH_HLEN + 24, 4))) { /* for traffic to upper TCP/IP */ retval = nat25_db_handle(priv, skb, NAT25_LOOKUP); @@ -1449,9 +1439,9 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb) if (is_vlan_tag) { skb_push(skb, 4); for (i = 0; i < 6; i++) - *((unsigned short *)(skb->data + i * 2)) = *((unsigned short *)(skb->data + 4 + i * 2)); - *((unsigned short *)(skb->data + ETH_ALEN * 2)) = __constant_htons(ETH_P_8021Q); - *((unsigned short *)(skb->data + ETH_ALEN * 2 + 2)) = vlan_hdr; + *((__be16 *)(skb->data + i * 2)) = *((__be16 *)(skb->data + 4 + i * 2)); + *((__be16 *)(skb->data + ETH_ALEN * 2)) = __constant_htons(ETH_P_8021Q); + *((u16 *)(skb->data + ETH_ALEN * 2 + 2)) = vlan_hdr; } if (retval == -1) { @@ -1463,35 +1453,6 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb) return 0; } -#if 0 -void mac_clone(_adapter *priv, unsigned char *addr) -{ - struct sockaddr sa; - - memcpy(sa.sa_data, addr, ETH_ALEN); - RTW_INFO("MAC Clone: Addr=%02x%02x%02x%02x%02x%02x\n", - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); - rtl8192cd_set_hwaddr(priv->dev, &sa); -} - - -int mac_clone_handle_frame(_adapter *priv, struct sk_buff *skb) -{ - if (priv->ethBrExtInfo.macclone_enable && !priv->macclone_completed) { - if (!(skb->data[ETH_ALEN] & 1)) { /* check any other particular MAC add */ - if (memcmp(skb->data + ETH_ALEN, GET_MY_HWADDR(priv), ETH_ALEN) && - ((priv->dev->br_port) && - memcmp(skb->data + ETH_ALEN, priv->br_mac, ETH_ALEN))) { - mac_clone(priv, skb->data + ETH_ALEN); - priv->macclone_completed = 1; - } - } - } - - return 0; -} -#endif /* 0 */ - #define SERVER_PORT 67 #define CLIENT_PORT 68 #define DHCP_MAGIC 0x63825363 @@ -1535,13 +1496,13 @@ void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb) struct dhcpMessage *dhcph = (struct dhcpMessage *)((SIZE_PTR)udph + sizeof(struct udphdr)); - if (dhcph->cookie == __constant_htonl(DHCP_MAGIC)) { /* match magic word */ - if (!(dhcph->flags & htons(BROADCAST_FLAG))) { /* if not broadcast */ + if (dhcph->cookie == DHCP_MAGIC) { /* match magic word */ + if (!(dhcph->flags & BROADCAST_FLAG)) { /* if not broadcast */ register int sum = 0; RTW_INFO("DHCP: change flag of DHCP request to broadcast.\n"); /* or BROADCAST flag */ - dhcph->flags |= htons(BROADCAST_FLAG); + dhcph->flags |= BROADCAST_FLAG; /* recalculate checksum */ sum = ~(udph->check) & 0xffff; sum += dhcph->flags; diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index e22b24d..08bac24 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -4298,10 +4298,6 @@ static void session_tracker_chk_for_sta(_adapter *adapter, struct sta_info *sta) continue; #ifdef CONFIG_WFD - if (0) - RTW_INFO(FUNC_ADPT_FMT" local:%u, remote:%u, rtsp:%u, %u, %u\n", FUNC_ADPT_ARG(adapter) - , ntohs(st->local_port), ntohs(st->remote_port), adapter->wfd_info.rtsp_ctrlport, adapter->wfd_info.tdls_rtsp_ctrlport - , adapter->wfd_info.peer_rtsp_ctrlport); if (ntohs(st->local_port) == adapter->wfd_info.rtsp_ctrlport) op_wfd_mode |= MIRACAST_SINK; if (ntohs(st->local_port) == adapter->wfd_info.tdls_rtsp_ctrlport) diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index 98758c9..39ef5a9 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -2546,7 +2546,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork) p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_); if (p && len > 0) { pht_cap = (struct rtw_ieee80211_ht_cap *)(p + 2); - pnetwork->BcnInfo.ht_cap_info = pht_cap->cap_info; + pnetwork->BcnInfo.ht_cap_info = le16_to_cpu(pht_cap->cap_info); } else pnetwork->BcnInfo.ht_cap_info = 0; /* parsing HT_INFO_IE */ diff --git a/core/rtw_ioctl_set.c b/core/rtw_ioctl_set.c index f2881ed..1bc420a 100644 --- a/core/rtw_ioctl_set.c +++ b/core/rtw_ioctl_set.c @@ -21,8 +21,7 @@ #include #include - -extern void indicate_wx_scan_complete_event(_adapter *padapter); +#include #define IS_MAC_ADDRESS_BROADCAST(addr) \ (\ diff --git a/core/rtw_iol.c b/core/rtw_iol.c index 9e97777..3bb8f96 100644 --- a/core/rtw_iol.c +++ b/core/rtw_iol.c @@ -186,7 +186,7 @@ int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, /* RTW_PUT_LE16((u8*)&cmd.address, addr); */ /* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */ - cmd.address = (rf_path << 8) | ((addr) & 0xFF); + cmd.address = cpu_to_le16((rf_path << 8) | ((addr) & 0xFF)); cmd.data = cpu_to_le32(value); if (mask != 0x000FFFFF) { @@ -225,7 +225,7 @@ int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms) } int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame) { - struct ioreg_cfg cmd = {4, IOREG_CMD_END, 0xFFFF, 0xFF, 0x0}; + struct ioreg_cfg cmd = {4, IOREG_CMD_END, cpu_to_le16(0xFFFF), cpu_to_le32(0xFF), 0x0}; return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4); } diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index e5eea91..fd25664 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -20,6 +20,7 @@ #define _RTW_MLME_C_ #include +#include extern void indicate_wx_scan_complete_event(_adapter *padapter); extern u8 rtw_do_join(_adapter *padapter); @@ -2914,7 +2915,6 @@ void rtw_iface_dynamic_check_timer_handler(_adapter *adapter) #endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */ && (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE) == _TRUE)) { /* expire NAT2.5 entry */ - void nat25_db_expire(_adapter *priv); nat25_db_expire(adapter); if (adapter->pppoe_connection_in_progress > 0) diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index 2144408..80a32a4 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -23,7 +23,9 @@ #ifdef CONFIG_P2P -int rtw_p2p_is_channel_list_ok(u8 desired_ch, u8 *ch_list, u8 ch_cnt) +void p2p_concurrent_handler(_adapter *padapter); + +static int rtw_p2p_is_channel_list_ok(u8 desired_ch, u8 *ch_list, u8 ch_cnt) { int found = 0, i = 0; @@ -36,7 +38,7 @@ int rtw_p2p_is_channel_list_ok(u8 desired_ch, u8 *ch_list, u8 ch_cnt) return found ; } -int is_any_client_associated(_adapter *padapter) +static int is_any_client_associated(_adapter *padapter) { return padapter->stapriv.asoc_list_cnt ? _TRUE : _FALSE; } @@ -149,12 +151,12 @@ static void issue_group_disc_req(struct wifidirect_info *pwdinfo, u8 *da) struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; _adapter *padapter = pwdinfo->padapter; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); unsigned char category = RTW_WLAN_CATEGORY_P2P;/* P2P action frame */ - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_GO_DISC_REQUEST; u8 dialogToken = 0; @@ -207,13 +209,13 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 s struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; _adapter *padapter = pwdinfo->padapter; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; u8 action = P2P_PUB_ACTION_ACTION; - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_DEVDISC_RESP; u8 p2pie[8] = { 0x00 }; u32 p2pielen = 0; @@ -280,7 +282,7 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8 *raddr, unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; u8 action = P2P_PUB_ACTION_ACTION; u8 dialogToken = frame_body[7]; /* The Dialog Token of provisioning discovery request frame. */ - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_PROVISION_DISC_RESP; u8 wpsie[100] = { 0x00 }; u8 wpsielen = 0; @@ -292,7 +294,7 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8 *raddr, struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -389,12 +391,12 @@ static void issue_p2p_presence_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; _adapter *padapter = pwdinfo->padapter; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); unsigned char category = RTW_WLAN_CATEGORY_P2P;/* P2P action frame */ - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_PRESENCE_RESPONSE; u8 p2pie[MAX_P2P_IE_LEN] = { 0x00 }; u8 noa_attr_content[32] = { 0x00 }; @@ -471,7 +473,7 @@ u32 build_beacon_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) u8 p2pie[MAX_P2P_IE_LEN] = { 0x00 }; u16 capability = 0; u32 len = 0, p2pielen = 0; - + __le16 le_tmp; /* P2P OUI */ p2pielen = 0; @@ -499,9 +501,9 @@ u32 build_beacon_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_PROVISIONING_ING)) capability |= (P2P_GRPCAP_GROUP_FORMATION << 8); - capability = cpu_to_le16(capability); + le_tmp = cpu_to_le16(capability); - p2pielen += rtw_set_p2p_attr_content(&p2pie[p2pielen], P2P_ATTR_CAPABILITY, 2, (u8 *)&capability); + p2pielen += rtw_set_p2p_attr_content(&p2pie[p2pielen], P2P_ATTR_CAPABILITY, 2, (u8 *)&le_tmp); /* P2P Device ID ATTR */ @@ -2324,6 +2326,8 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l u32 ies_len; u8 *p2p_ie; u32 p2p_ielen = 0; + __be16 be_tmp; + __le16 le_tmp; if (!rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) return P2P_STATUS_FAIL_REQUEST_UNABLE; @@ -2347,9 +2351,9 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l while (p2p_ie) { /* Check P2P Capability ATTR */ - if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&cap_attr, (uint *) &attr_contentlen)) { + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&le_tmp, (uint *) &attr_contentlen)) { RTW_INFO("[%s] Got P2P Capability Attr!!\n", __FUNCTION__); - cap_attr = le16_to_cpu(cap_attr); + cap_attr = le16_to_cpu(le_tmp); psta->dev_cap = cap_attr & 0xff; } @@ -2371,8 +2375,8 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l pattr_content += ETH_ALEN; - _rtw_memcpy(&psta->config_methods, pattr_content, 2);/* Config Methods */ - psta->config_methods = be16_to_cpu(psta->config_methods); + _rtw_memcpy(&be_tmp, pattr_content, 2);/* Config Methods */ + psta->config_methods = be16_to_cpu(be_tmp); pattr_content += 2; @@ -2400,8 +2404,8 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l /* dev_name_len = attr_contentlen - ETH_ALEN - 2 - 8 - 1 - (num_of_secdev_type*8); */ psta->dev_name_len = 0; - if (WPS_ATTR_DEVICE_NAME == be16_to_cpu(*(u16 *)pattr_content)) { - dev_name_len = be16_to_cpu(*(u16 *)(pattr_content + 2)); + if (WPS_ATTR_DEVICE_NAME == be16_to_cpu(*(__be16 *)(pattr_content))) { + dev_name_len = be16_to_cpu(*(__be16 *)(pattr_content + 2)); psta->dev_name_len = (sizeof(psta->dev_name) < dev_name_len) ? sizeof(psta->dev_name) : dev_name_len; @@ -2509,14 +2513,14 @@ u8 process_p2p_provdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint l u8 *wpsie; uint wps_ielen = 0, attr_contentlen = 0; u16 uconfig_method = 0; - + __be16 be_tmp; frame_body = (pframe + sizeof(struct rtw_ieee80211_hdr_3addr)); wpsie = rtw_get_wps_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &wps_ielen); if (wpsie) { - if (rtw_get_wps_attr_content(wpsie, wps_ielen, WPS_ATTR_CONF_METHOD , (u8 *) &uconfig_method, &attr_contentlen)) { - uconfig_method = be16_to_cpu(uconfig_method); + if (rtw_get_wps_attr_content(wpsie, wps_ielen, WPS_ATTR_CONF_METHOD , (u8 *)&be_tmp, &attr_contentlen)) { + uconfig_method = be16_to_cpu(be_tmp); switch (uconfig_method) { case WPS_CM_DISPLYA: { _rtw_memcpy(pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "dis", 3); @@ -2549,7 +2553,7 @@ u8 process_p2p_provdisc_resp(struct wifidirect_info *pwdinfo, u8 *pframe) return _TRUE; } -u8 rtw_p2p_get_peer_ch_list(struct wifidirect_info *pwdinfo, u8 *ch_content, u8 ch_cnt, u8 *peer_ch_list) +static u8 rtw_p2p_get_peer_ch_list(struct wifidirect_info *pwdinfo, u8 *ch_content, u8 ch_cnt, u8 *peer_ch_list) { u8 i = 0, j = 0; u8 temp = 0; @@ -2571,7 +2575,7 @@ u8 rtw_p2p_get_peer_ch_list(struct wifidirect_info *pwdinfo, u8 *ch_content, u8 return ch_no; } -u8 rtw_p2p_check_peer_oper_ch(struct mlme_ext_priv *pmlmeext, u8 ch) +static u8 rtw_p2p_check_peer_oper_ch(struct mlme_ext_priv *pmlmeext, u8 ch) { u8 i = 0; @@ -2583,7 +2587,7 @@ u8 rtw_p2p_check_peer_oper_ch(struct mlme_ext_priv *pmlmeext, u8 ch) return _FAIL; } -u8 rtw_p2p_ch_inclusion(struct mlme_ext_priv *pmlmeext, u8 *peer_ch_list, u8 peer_ch_num, u8 *ch_list_inclusioned) +static u8 rtw_p2p_ch_inclusion(struct mlme_ext_priv *pmlmeext, u8 *peer_ch_list, u8 peer_ch_num, u8 *ch_list_inclusioned) { int i = 0, j = 0, temp = 0; u8 ch_no = 0; @@ -2612,6 +2616,7 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, u8 *wpsie; u16 wps_devicepassword_id = 0x0000; uint wps_devicepassword_id_len = 0; + __be16 be_tmp; #ifdef CONFIG_WFD #ifdef CONFIG_TDLS struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; @@ -2623,8 +2628,8 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, /* If some device wants to do p2p handshake without sending prov_disc_req */ /* We have to get peer_req_cm from here. */ if (_rtw_memcmp(pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "000", 3)) { - rtw_get_wps_attr_content(wpsie, wps_ielen, WPS_ATTR_DEVICE_PWID, (u8 *) &wps_devicepassword_id, &wps_devicepassword_id_len); - wps_devicepassword_id = be16_to_cpu(wps_devicepassword_id); + rtw_get_wps_attr_content(wpsie, wps_ielen, WPS_ATTR_DEVICE_PWID, (u8 *) &be_tmp, &wps_devicepassword_id_len); + wps_devicepassword_id = be16_to_cpu(be_tmp); if (wps_devicepassword_id == WPS_DPID_USER_SPEC) _rtw_memcpy(pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "dis", 3); @@ -2662,12 +2667,13 @@ u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo, u8 *pframe, u8 ch_num_inclusioned = 0; u16 cap_attr; u8 listen_ch_attr[5] = { 0x00 }; + __le16 le_tmp; rtw_p2p_set_state(pwdinfo, P2P_STATE_GONEGO_ING); /* Check P2P Capability ATTR */ - if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&cap_attr, (uint *)&attr_contentlen)) { - cap_attr = le16_to_cpu(cap_attr); + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&le_tmp, (uint *)&attr_contentlen)) { + cap_attr = le16_to_cpu(le_tmp); #if defined(CONFIG_WFD) && defined(CONFIG_TDLS) if (!(cap_attr & P2P_GRPCAP_INTRABSS)) @@ -2823,12 +2829,12 @@ u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo, u8 *pframe u8 peer_ch_num = 0; u8 ch_list_inclusioned[100] = { 0x00 }; u8 ch_num_inclusioned = 0; + __le16 le_tmp; while (p2p_ie) { /* Found the P2P IE. */ - /* Check P2P Capability ATTR */ - if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&cap_attr, (uint *)&attr_contentlen)) { - cap_attr = le16_to_cpu(cap_attr); + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&le_tmp, (uint *)&attr_contentlen)) { + cap_attr = le16_to_cpu(le_tmp); #ifdef CONFIG_TDLS if (!(cap_attr & P2P_GRPCAP_INTRABSS)) ptdlsinfo->ap_prohibited = _TRUE; @@ -3078,7 +3084,7 @@ u8 process_p2p_presence_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le return _TRUE; } -void find_phase_handler(_adapter *padapter) +static void find_phase_handler(_adapter *padapter) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -3100,9 +3106,7 @@ void find_phase_handler(_adapter *padapter) } -void p2p_concurrent_handler(_adapter *padapter); - -void restore_p2p_state_handler(_adapter *padapter) +static void restore_p2p_state_handler(_adapter *padapter) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -3137,7 +3141,7 @@ void restore_p2p_state_handler(_adapter *padapter) } } -void pre_tx_invitereq_handler(_adapter *padapter) +static void pre_tx_invitereq_handler(_adapter *padapter) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; u8 val8 = 1; @@ -3149,7 +3153,7 @@ void pre_tx_invitereq_handler(_adapter *padapter) } -void pre_tx_provdisc_handler(_adapter *padapter) +static void pre_tx_provdisc_handler(_adapter *padapter) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; u8 val8 = 1; @@ -3161,7 +3165,7 @@ void pre_tx_provdisc_handler(_adapter *padapter) } -void pre_tx_negoreq_handler(_adapter *padapter) +static void pre_tx_negoreq_handler(_adapter *padapter) { struct wifidirect_info *pwdinfo = &padapter->wdinfo; u8 val8 = 1; @@ -3612,7 +3616,7 @@ static void rtw_cfg80211_adjust_p2pie_channel(_adapter *padapter, const u8 *fram } #ifdef CONFIG_WFD -u32 rtw_xframe_build_wfd_ie(struct xmit_frame *xframe) +static u32 rtw_xframe_build_wfd_ie(struct xmit_frame *xframe) { _adapter *adapter = xframe->padapter; struct wifidirect_info *wdinfo = &adapter->wdinfo; @@ -3690,7 +3694,7 @@ u32 rtw_xframe_build_wfd_ie(struct xmit_frame *xframe) } #endif /* CONFIG_WFD */ -bool rtw_xframe_del_wfd_ie(struct xmit_frame *xframe) +static bool rtw_xframe_del_wfd_ie(struct xmit_frame *xframe) { #define DBG_XFRAME_DEL_WFD_IE 0 @@ -3767,7 +3771,7 @@ void rtw_xframe_chk_wfd_ie(struct xmit_frame *xframe) #endif } -u8 *dump_p2p_attr_ch_list(u8 *p2p_ie, uint p2p_ielen, u8 *buf, u32 buf_len) +static u8 *dump_p2p_attr_ch_list(u8 *p2p_ie, uint p2p_ielen, u8 *buf, u32 buf_len) { uint attr_contentlen = 0; u8 *pattr = NULL; @@ -3820,7 +3824,7 @@ u8 *dump_p2p_attr_ch_list(u8 *p2p_ie, uint p2p_ielen, u8 *buf, u32 buf_len) /* * return _TRUE if requester is GO, _FALSE if responder is GO */ -bool rtw_p2p_nego_intent_compare(u8 req, u8 resp) +static bool rtw_p2p_nego_intent_compare(u8 req, u8 resp) { if (req >> 1 == resp >> 1) return req & 0x01 ? _TRUE : _FALSE; diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index 932a5b3..5a7bf36 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -174,12 +174,7 @@ int ips_leave(_adapter *padapter) extern int autoresume_enter(_adapter *padapter); #endif -#ifdef SUPPORT_HW_RFOFF_DETECTED - int rtw_hw_suspend(_adapter *padapter); - int rtw_hw_resume(_adapter *padapter); -#endif - -bool rtw_pwr_unassociated_idle(_adapter *adapter) +static bool rtw_pwr_unassociated_idle(_adapter *adapter) { u8 i; _adapter *iface; @@ -394,9 +389,9 @@ exit: } #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) -void pwr_state_check_handler(RTW_TIMER_HDL_ARGS) +static void pwr_state_check_handler(RTW_TIMER_HDL_ARGS) #else -void pwr_state_check_handler(struct timer_list *t) +static void pwr_state_check_handler(struct timer_list *t) #endif { #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) @@ -592,7 +587,7 @@ void rtw_set_rpwm(PADAPTER padapter, u8 pslv) } -u8 PS_RDY_CHECK(_adapter *padapter) +static u8 PS_RDY_CHECK(_adapter *padapter) { u32 curr_time, delta_time; struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 8a7cc05..a38fa14 100755 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -35,7 +35,7 @@ enum { SIGNAL_STAT_CALC_PROFILE_MAX }; -u8 signal_stat_calc_profile[SIGNAL_STAT_CALC_PROFILE_MAX][2] = { +static u8 signal_stat_calc_profile[SIGNAL_STAT_CALC_PROFILE_MAX][2] = { {4, 1}, /* Profile 0 => pre_stat : curr_stat = 4 : 1 */ {3, 7} /* Profile 1 => pre_stat : curr_stat = 3 : 7 */ }; @@ -160,7 +160,7 @@ exit: } -void rtw_mfree_recv_priv_lock(struct recv_priv *precvpriv) +static void rtw_mfree_recv_priv_lock(struct recv_priv *precvpriv) { _rtw_spinlock_free(&precvpriv->lock); #ifdef CONFIG_RECV_THREAD_MODE @@ -700,7 +700,7 @@ union recv_frame *portctrl(_adapter *adapter, union recv_frame *precv_frame) u16 ether_type = 0; u16 eapol_type = 0x888e;/* for Funia BD's WPA issue */ struct rx_pkt_attrib *pattrib; - + __be16 be_tmp; pstapriv = &adapter->stapriv; @@ -725,8 +725,8 @@ union recv_frame *portctrl(_adapter *adapter, union recv_frame *precv_frame) /* get ether_type */ ptr = ptr + pfhdr->attrib.hdrlen + pfhdr->attrib.iv_len + LLC_HEADER_SIZE; - _rtw_memcpy(ðer_type, ptr, 2); - ether_type = ntohs((unsigned short)ether_type); + _rtw_memcpy(&be_tmp, ptr, 2); + ether_type = ntohs(be_tmp); if (ether_type == eapol_type) prtnframe = precv_frame; @@ -761,14 +761,11 @@ sint recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcac { sint tid = precv_frame->u.hdr.attrib.priority; - u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num & 0xffff) << 4) | + u16 seq_ctrl = ((le16_to_cpu(precv_frame->u.hdr.attrib.seq_num) & 0xffff) << 4) | (precv_frame->u.hdr.attrib.frag_num & 0xf); - - if (tid > 15) { - + if (tid > 15) return _FAIL; - } if (1) { /* if(bretry) */ if (seq_ctrl == prxcache->tid_rxseq[tid]) { @@ -784,9 +781,7 @@ sint recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcac prxcache->tid_rxseq[tid] = seq_ctrl; - return _SUCCESS; - } /* VALID_PN_CHK @@ -795,11 +790,11 @@ sint recv_decache(union recv_frame *precv_frame, u8 bretry, struct stainfo_rxcac * 1. If old PN is 0, any PN is legal * 2. PN > old PN */ -#define PN_LESS_CHK(a, b) (((a-b) & 0x800000000000) != 0) +#define PN_LESS_CHK(a, b) (((a-b) & 0x800000000000L) != 0) #define VALID_PN_CHK(new, old) (((old) == 0) || PN_LESS_CHK(old, new)) -#define CCMPH_2_KEYID(ch) (((ch) & 0x00000000c0000000) >> 30) -#define CCMPH_2_PN(ch) ((ch) & 0x000000000000ffff) \ - | (((ch) & 0xffffffff00000000) >> 16) +#define CCMPH_2_KEYID(ch) (((ch) & 0x00000000c0000000L) >> 30) +#define CCMPH_2_PN(ch) ((ch) & 0x000000000000ffffL) \ + | (((ch) & 0xffffffff00000000L) >> 16) sint recv_ucast_pn_decache(union recv_frame *precv_frame, struct stainfo_rxcache *prxcache); sint recv_ucast_pn_decache(union recv_frame *precv_frame, struct stainfo_rxcache *prxcache) { @@ -815,10 +810,10 @@ sint recv_ucast_pn_decache(union recv_frame *precv_frame, struct stainfo_rxcache return _FAIL; if (pattrib->encrypt == _AES_) { - tmp_iv_hdr = le64_to_cpu(*(u64*)(pdata + pattrib->hdrlen)); + tmp_iv_hdr = le64_to_cpu(*(__le64*)(pdata + pattrib->hdrlen)); pkt_pn = CCMPH_2_PN(tmp_iv_hdr); - tmp_iv_hdr = le64_to_cpu(*(u64*)prxcache->iv[tid]); + tmp_iv_hdr = le64_to_cpu(*(__le64*)prxcache->iv[tid]); curr_pn = CCMPH_2_PN(tmp_iv_hdr); if (!VALID_PN_CHK(pkt_pn, curr_pn)) { @@ -830,8 +825,7 @@ sint recv_ucast_pn_decache(union recv_frame *precv_frame, struct stainfo_rxcache return _SUCCESS; } -sint recv_bcast_pn_decache(union recv_frame *precv_frame); -sint recv_bcast_pn_decache(union recv_frame *precv_frame) +static sint recv_bcast_pn_decache(union recv_frame *precv_frame) { _adapter *padapter = precv_frame->u.hdr.adapter; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -846,17 +840,17 @@ sint recv_bcast_pn_decache(union recv_frame *precv_frame) if ((pattrib->encrypt == _AES_) && (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)) { - tmp_iv_hdr = le64_to_cpu(*(u64*)(pdata + pattrib->hdrlen)); + tmp_iv_hdr = le64_to_cpu(*(__le64*)(pdata + pattrib->hdrlen)); key_id = CCMPH_2_KEYID(tmp_iv_hdr); pkt_pn = CCMPH_2_PN(tmp_iv_hdr); - curr_pn = le64_to_cpu(*(u64*)psecuritypriv->iv_seq[key_id]); - curr_pn &= 0x0000ffffffffffff; + curr_pn = le64_to_cpu(*(__le64*)psecuritypriv->iv_seq[key_id]); + curr_pn &= 0x0000ffffffffffffL; if (!VALID_PN_CHK(pkt_pn, curr_pn)) return _FAIL; - *(u64*)psecuritypriv->iv_seq[key_id] = cpu_to_le64(pkt_pn); + *(__le64*)psecuritypriv->iv_seq[key_id] = cpu_to_le64(pkt_pn); } return _SUCCESS; @@ -1701,7 +1695,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) union recv_frame *recvframe_chk_defrag(PADAPTER padapter, union recv_frame *precv_frame); -sint validate_recv_mgnt_frame(PADAPTER padapter, union recv_frame *precv_frame) +static sint validate_recv_mgnt_frame(PADAPTER padapter, union recv_frame *precv_frame) { precv_frame = recvframe_chk_defrag(padapter, precv_frame); if (precv_frame == NULL) { @@ -2119,7 +2113,7 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame) pattrib->to_fr_ds = get_tofr_ds(ptr); pattrib->frag_num = GetFragNum(ptr); - pattrib->seq_num = GetSequence(ptr); + pattrib->seq_num = cpu_to_le16(GetSequence(ptr)); pattrib->pw_save = GetPwrMgt(ptr); pattrib->mfrag = GetMFrag(ptr); @@ -2248,6 +2242,7 @@ sint wlanhdr_to_ethhdr(union recv_frame *precvframe) u16 eth_type, len; u8 bsnaphdr; u8 *psnap_type; + __be16 be_tmp; struct ieee80211_snap_hdr *psnap; sint ret = _SUCCESS; @@ -2281,9 +2276,9 @@ sint wlanhdr_to_ethhdr(union recv_frame *precvframe) len = precvframe->u.hdr.len - rmv_len; - _rtw_memcpy(ð_type, ptr + rmv_len, 2); - eth_type = ntohs((unsigned short)eth_type); /* pattrib->ether_type */ - pattrib->eth_type = eth_type; + _rtw_memcpy(&be_tmp, ptr + rmv_len, 2); + eth_type = ntohs(be_tmp); /* pattrib->ether_type */ + pattrib->eth_type = cpu_to_le16(eth_type); #ifdef CONFIG_AUTO_AP_MODE if (0x8899 == pattrib->eth_type) { @@ -2581,7 +2576,7 @@ union recv_frame *recvframe_defrag(_adapter *adapter, _queue *defrag_q) /* memcpy */ _rtw_memcpy(pfhdr->rx_tail, pnfhdr->rx_data, pnfhdr->len); - recvframe_put(prframe, pnfhdr->len); + recvframe_put(prframe, cpu_to_le16(pnfhdr->len)); pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len; plist = get_next(plist); @@ -2591,8 +2586,6 @@ union recv_frame *recvframe_defrag(_adapter *adapter, _queue *defrag_q) /* free the defrag_q queue and return the prframe */ rtw_free_recvframe_queue(defrag_q, pfree_recv_queue); - - return prframe; } @@ -2702,7 +2695,7 @@ union recv_frame *recvframe_chk_defrag(PADAPTER padapter, union recv_frame *prec } -int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe) +static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe) { int a_len, padding_len; u16 nSubframe_Length; @@ -2781,8 +2774,7 @@ int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe) return ret; } -int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num); -int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num) +static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, __le16 seq_num) { PADAPTER padapter = preorder_ctrl->padapter; struct dvobj_priv *psdpriv = padapter->dvobj; @@ -2792,27 +2784,18 @@ int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num) /* Rx Reorder initialize condition. */ if (preorder_ctrl->indicate_seq == 0xFFFF) { - preorder_ctrl->indicate_seq = seq_num; + preorder_ctrl->indicate_seq = le16_to_cpu(seq_num); #ifdef DBG_RX_SEQ RTW_INFO("DBG_RX_SEQ %s:%d init IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, preorder_ctrl->indicate_seq, seq_num); #endif - - /* DbgPrint("check_indicate_seq, 1st->indicate_seq=%d\n", precvpriv->indicate_seq); */ } - - /* DbgPrint("enter->check_indicate_seq(): IndicateSeq: %d, NewSeq: %d\n", precvpriv->indicate_seq, seq_num); */ - /* Drop out the packet which SeqNum is smaller than WinStart */ - if (SN_LESS(seq_num, preorder_ctrl->indicate_seq)) { - /* DbgPrint("CheckRxTsIndicateSeq(): Packet Drop! IndicateSeq: %d, NewSeq: %d\n", precvpriv->indicate_seq, seq_num); */ - + if (SN_LESS(le16_to_cpu(seq_num), preorder_ctrl->indicate_seq)) { #ifdef DBG_RX_DROP_FRAME RTW_INFO("%s IndicateSeq: %d > NewSeq: %d\n", __FUNCTION__, preorder_ctrl->indicate_seq, seq_num); #endif - - return _FALSE; } @@ -2821,25 +2804,25 @@ int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num) /* 1. Incoming SeqNum is equal to WinStart =>Window shift 1 */ /* 2. Incoming SeqNum is larger than the WinEnd => Window shift N */ /* */ - if (SN_EQUAL(seq_num, preorder_ctrl->indicate_seq)) { + if (SN_EQUAL(le16_to_cpu(seq_num), preorder_ctrl->indicate_seq)) { preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) & 0xFFF; #ifdef DBG_RX_SEQ RTW_INFO("DBG_RX_SEQ %s:%d SN_EQUAL IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, preorder_ctrl->indicate_seq, seq_num); #endif - } else if (SN_LESS(wend, seq_num)) { + } else if (SN_LESS(wend, le16_to_cpu(seq_num))) { /* DbgPrint("CheckRxTsIndicateSeq(): Window Shift! IndicateSeq: %d, NewSeq: %d\n", precvpriv->indicate_seq, seq_num); */ /* boundary situation, when seq_num cross 0xFFF */ - if (seq_num >= (wsize - 1)) - preorder_ctrl->indicate_seq = seq_num + 1 - wsize; + if (le16_to_cpu(seq_num) >= (wsize - 1)) + preorder_ctrl->indicate_seq = le16_to_cpu(seq_num) + 1 - wsize; else - preorder_ctrl->indicate_seq = 0xFFF - (wsize - (seq_num + 1)) + 1; + preorder_ctrl->indicate_seq = 0xFFF - (wsize - (le16_to_cpu(seq_num) + 1)) + 1; pdbgpriv->dbg_rx_ampdu_window_shift_cnt++; #ifdef DBG_RX_SEQ RTW_INFO("DBG_RX_SEQ %s:%d SN_LESS(wend, seq_num) IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, - preorder_ctrl->indicate_seq, seq_num); + preorder_ctrl->indicate_seq, le16_to_cpu(seq_num)); #endif } @@ -2848,8 +2831,7 @@ int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num) return _TRUE; } -int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union recv_frame *prframe); -int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union recv_frame *prframe) +static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union recv_frame *prframe) { struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; _queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; @@ -2870,7 +2852,7 @@ int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, union rec pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u); pnextattrib = &pnextrframe->u.hdr.attrib; - if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) + if (SN_LESS(le16_to_cpu(pnextattrib->seq_num), le16_to_cpu(pattrib->seq_num))) plist = get_next(plist); else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num)) { /* Duplicate entry is found!! Do not insert current entry. */ @@ -2951,8 +2933,8 @@ int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ctrl *pre RTW_INFO("DBG_RX_SEQ %s:%d IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, preorder_ctrl->indicate_seq, pattrib->seq_num); #endif - recv_indicatepkts_pkt_loss_cnt(pdbgpriv, preorder_ctrl->indicate_seq, pattrib->seq_num); - preorder_ctrl->indicate_seq = pattrib->seq_num; + recv_indicatepkts_pkt_loss_cnt(pdbgpriv, preorder_ctrl->indicate_seq, le16_to_cpu(pattrib->seq_num)); + preorder_ctrl->indicate_seq = le16_to_cpu(pattrib->seq_num); } @@ -2963,11 +2945,11 @@ int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ctrl *pre prframe = LIST_CONTAINOR(plist, union recv_frame, u); pattrib = &prframe->u.hdr.attrib; - if (!SN_LESS(preorder_ctrl->indicate_seq, pattrib->seq_num)) { + if (!SN_LESS(preorder_ctrl->indicate_seq, le16_to_cpu(pattrib->seq_num))) { plist = get_next(plist); rtw_list_delete(&(prframe->u.hdr.list)); - if (SN_EQUAL(preorder_ctrl->indicate_seq, pattrib->seq_num)) { + if (SN_EQUAL(preorder_ctrl->indicate_seq, le16_to_cpu(pattrib->seq_num))) { preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) & 0xFFF; #ifdef DBG_RX_SEQ RTW_INFO("DBG_RX_SEQ %s:%d IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, @@ -3003,7 +2985,7 @@ int recv_indicatepkts_in_order(_adapter *padapter, struct recv_reorder_ctrl *pre return bPktInBuf; } -int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) +static int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) { _irqL irql; int retval = _SUCCESS; @@ -3045,7 +3027,7 @@ int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) if (preorder_ctrl->enable == _FALSE) { /* indicate this recv_frame */ - preorder_ctrl->indicate_seq = pattrib->seq_num; + preorder_ctrl->indicate_seq = le16_to_cpu(pattrib->seq_num); #ifdef DBG_RX_SEQ RTW_INFO("DBG_RX_SEQ %s:%d IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, preorder_ctrl->indicate_seq, pattrib->seq_num); @@ -3070,7 +3052,7 @@ int recv_indicatepkt_reorder(_adapter *padapter, union recv_frame *prframe) } else if (pattrib->amsdu == 1) { /* temp filter->means didn't support A-MSDUs in a A-MPDU */ if (preorder_ctrl->enable == _FALSE) { - preorder_ctrl->indicate_seq = pattrib->seq_num; + preorder_ctrl->indicate_seq = le16_to_cpu(pattrib->seq_num); #ifdef DBG_RX_SEQ RTW_INFO("DBG_RX_SEQ %s:%d IndicateSeq: %d, NewSeq: %d\n", __FUNCTION__, __LINE__, preorder_ctrl->indicate_seq, pattrib->seq_num); @@ -3245,7 +3227,7 @@ int process_recv_indicatepkts(_adapter *padapter, union recv_frame *prframe) } #ifdef CONFIG_MP_INCLUDED -int validate_mp_recv_frame(_adapter *adapter, union recv_frame *precv_frame) +static int validate_mp_recv_frame(_adapter *adapter, union recv_frame *precv_frame) { int ret = _SUCCESS; u8 *ptr = precv_frame->u.hdr.rx_data; @@ -3295,7 +3277,8 @@ static sint MPwlanhdr_to_ethhdr(union recv_frame *precvframe) u8 bsnaphdr; u8 *psnap_type; u8 mcastheadermac[] = {0x01, 0x00, 0x5e}; - + __be16 be_tmp; + __le16 le_tmp; struct ieee80211_snap_hdr *psnap; sint ret = _SUCCESS; @@ -3328,27 +3311,24 @@ static sint MPwlanhdr_to_ethhdr(union recv_frame *precvframe) rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0); len = precvframe->u.hdr.len - rmv_len; + _rtw_memcpy(&be_tmp, ptr + rmv_len, 2); + eth_type = ntohs((__be16)be_tmp); /* pattrib->ether_type */ + pattrib->eth_type = cpu_to_le16(eth_type); - _rtw_memcpy(ð_type, ptr + rmv_len, 2); - eth_type = ntohs((unsigned short)eth_type); /* pattrib->ether_type */ - pattrib->eth_type = eth_type; - - { - ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0))); - } + ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0))); _rtw_memcpy(ptr, pattrib->dst, ETH_ALEN); _rtw_memcpy(ptr + ETH_ALEN, pattrib->src, ETH_ALEN); if (!bsnaphdr) { - len = htons(len); - _rtw_memcpy(ptr + 12, &len, 2); + be_tmp = htons(len); + _rtw_memcpy(ptr + 12, &be_tmp, 2); } - len = htons(pattrib->seq_num); + be_tmp = htons(le16_to_cpu(pattrib->seq_num)); /* RTW_INFO("wlan seq = %d ,seq_num =%x\n",len,pattrib->seq_num); */ - _rtw_memcpy(ptr + 12, &len, 2); + _rtw_memcpy(ptr + 12, &be_tmp, 2); if (adapter->mppriv.bRTWSmbCfg == _TRUE) { /* if(_rtw_memcmp(mcastheadermac, pattrib->dst, 3) == _TRUE) */ /* SimpleConfig Dest. */ /* _rtw_memcpy(ptr+ETH_ALEN, pattrib->bssid, ETH_ALEN); */ @@ -3364,7 +3344,7 @@ static sint MPwlanhdr_to_ethhdr(union recv_frame *precvframe) } -int mp_recv_frame(_adapter *padapter, union recv_frame *rframe) +static int mp_recv_frame(_adapter *padapter, union recv_frame *rframe) { int ret = _SUCCESS; struct rx_pkt_attrib *pattrib = &rframe->u.hdr.attrib; @@ -3398,7 +3378,7 @@ int mp_recv_frame(_adapter *padapter, union recv_frame *rframe) type = GetFrameType(ptr); pattrib->to_fr_ds = get_tofr_ds(ptr); pattrib->frag_num = GetFragNum(ptr); - pattrib->seq_num = GetSequence(ptr); + pattrib->seq_num = cpu_to_le16(GetSequence(ptr)); pattrib->pw_save = GetPwrMgt(ptr); pattrib->mfrag = GetMFrag(ptr); pattrib->mdata = GetMData(ptr); @@ -3519,7 +3499,7 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - u16 tmp_16bit = 0; + __le16 tmp_16bit = 0; u8 data_rate[] = { 2, 4, 11, 22, /* CCK */ @@ -3546,16 +3526,13 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, /* tsft */ if (pattrib->tsfl) { - u64 tmp_64bit; - - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_TSFT); - tmp_64bit = cpu_to_le64(pattrib->tsfl); - memcpy(&hdr_buf[rt_len], &tmp_64bit, 8); + rtap_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_TSFT); + memcpy(&hdr_buf[rt_len], &pattrib->tsfl, 8); rt_len += 8; } /* flags */ - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_FLAGS); + rtap_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_FLAGS); if (0) hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_CFP; @@ -3586,7 +3563,7 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, /* rate */ if (pattrib->data_rate < 12) { - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_RATE); + rtap_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE); if (pattrib->data_rate < 4) { /* CCK */ hdr_buf[rt_len] = data_rate[pattrib->data_rate]; @@ -3599,8 +3576,8 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, /* channel */ tmp_16bit = 0; - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_CHANNEL); - tmp_16bit = CHAN2FREQ(rtw_get_oper_ch(padapter)); + rtap_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_CHANNEL); + tmp_16bit = cpu_to_le16(CHAN2FREQ(rtw_get_oper_ch(padapter))); /*tmp_16bit = CHAN2FREQ(pHalData->current_channel);*/ memcpy(&hdr_buf[rt_len], &tmp_16bit, 2); rt_len += 2; @@ -3626,22 +3603,22 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, rt_len += 2; /* dBm Antenna Signal */ - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); + rtap_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); hdr_buf[rt_len] = pattrib->phy_info.RecvSignalPower; rt_len += 1; /* Antenna */ - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_ANTENNA); + rtap_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_ANTENNA); hdr_buf[rt_len] = 0; /* pHalData->rf_type; */ rt_len += 1; /* RX flags */ - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_RX_FLAGS); + rtap_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RX_FLAGS); rt_len += 2; /* MCS information */ if (pattrib->data_rate >= 12 && pattrib->data_rate < 44) { - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_MCS); + rtap_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS); /* known, flag */ hdr_buf[rt_len] |= BIT1; /* MCS index known */ @@ -3666,30 +3643,30 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, /* VHT */ if (pattrib->data_rate >= 44 && pattrib->data_rate < 84) { - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_VHT); + rtap_hdr->it_present |= cpu_to_le32((1 << IEEE80211_RADIOTAP_VHT)); /* known 16 bit, flag 8 bit */ tmp_16bit = 0; /* Bandwidth */ - tmp_16bit |= BIT6; + tmp_16bit |= cpu_to_le16(BIT6); /* Group ID */ - tmp_16bit |= BIT7; + tmp_16bit |= cpu_to_le16(BIT7); /* Partial AID */ - tmp_16bit |= BIT8; + tmp_16bit |= cpu_to_le16(BIT8); /* STBC */ - tmp_16bit |= BIT0; + tmp_16bit |= cpu_to_le16(BIT0); hdr_buf[rt_len + 2] |= (pattrib->stbc & 0x01); /* Guard interval */ - tmp_16bit |= BIT2; + tmp_16bit |= cpu_to_le16(BIT2); hdr_buf[rt_len + 2] |= (pattrib->sgi & 0x01) << 2; /* LDPC extra OFDM symbol */ - tmp_16bit |= BIT4; + tmp_16bit |= cpu_to_le16(BIT4); hdr_buf[rt_len + 2] |= (pattrib->ldpc & 0x01) << 4; memcpy(&hdr_buf[rt_len], &tmp_16bit, 2); @@ -3755,7 +3732,7 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)) -int recv_frame_monitor(_adapter *padapter, union recv_frame *rframe) +static int recv_frame_monitor(_adapter *padapter, union recv_frame *rframe) { int ret = _SUCCESS; struct rx_pkt_attrib *pattrib = &rframe->u.hdr.attrib; @@ -3802,7 +3779,7 @@ exit: return ret; } #endif -int recv_func_prehandle(_adapter *padapter, union recv_frame *rframe) +static int recv_func_prehandle(_adapter *padapter, union recv_frame *rframe) { int ret = _SUCCESS; struct rx_pkt_attrib *pattrib = &rframe->u.hdr.attrib; @@ -3838,7 +3815,7 @@ exit: } /*#define DBG_RX_BMC_FRAME*/ -int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe) +static int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe) { int ret = _SUCCESS; union recv_frame *orig_prframe = prframe; @@ -4293,7 +4270,7 @@ static void rx_process_link_qual(_adapter *padapter, union recv_frame *prframe) #endif /* CONFIG_NEW_SIGNAL_STAT_PROCESS */ } -void rx_process_phy_info(_adapter *padapter, union recv_frame *rframe) +static void rx_process_phy_info(_adapter *padapter, union recv_frame *rframe) { /* Check RSSI */ rx_process_rssi(padapter, rframe); diff --git a/core/rtw_rf.c b/core/rtw_rf.c index 38ea85e..9d8c7a6 100644 --- a/core/rtw_rf.c +++ b/core/rtw_rf.c @@ -43,7 +43,7 @@ u8 center_ch_2g_40m[CENTER_CH_2G_40M_NUM] = { 11, }; -u8 op_chs_of_cch_2g_40m[CENTER_CH_2G_40M_NUM][2] = { +static u8 op_chs_of_cch_2g_40m[CENTER_CH_2G_40M_NUM][2] = { {1, 5}, /* 3 */ {2, 6}, /* 4 */ {3, 7}, /* 5 */ @@ -133,7 +133,7 @@ u8 center_ch_5g_20m_40m[CENTER_CH_5G_20M_NUM + CENTER_CH_5G_40M_NUM] = { /* G13 */173, 175, 177 }; -u8 op_chs_of_cch_5g_40m[CENTER_CH_5G_40M_NUM][2] = { +static u8 op_chs_of_cch_5g_40m[CENTER_CH_5G_40M_NUM][2] = { {36, 40}, /* 38 */ {44, 48}, /* 46 */ {52, 56}, /* 54 */ @@ -160,7 +160,7 @@ u8 center_ch_5g_80m[CENTER_CH_5G_80M_NUM] = { /* G12 ~ G13*/171 }; -u8 op_chs_of_cch_5g_80m[CENTER_CH_5G_80M_NUM][4] = { +static u8 op_chs_of_cch_5g_80m[CENTER_CH_5G_80M_NUM][4] = { {36, 40, 44, 48}, /* 42 */ {52, 56, 60, 64}, /* 58 */ {100, 104, 108, 112}, /* 106 */ @@ -170,13 +170,13 @@ u8 op_chs_of_cch_5g_80m[CENTER_CH_5G_80M_NUM][4] = { {165, 169, 173, 177}, /* 171 */ }; -u8 center_ch_5g_160m[CENTER_CH_5G_160M_NUM] = { +static u8 center_ch_5g_160m[CENTER_CH_5G_160M_NUM] = { /* G00 ~ G03*/50, /* G04 ~ G07*/114, /* G10 ~ G13*/163 }; -u8 op_chs_of_cch_5g_160m[CENTER_CH_5G_160M_NUM][8] = { +static u8 op_chs_of_cch_5g_160m[CENTER_CH_5G_160M_NUM][8] = { {36, 40, 44, 48, 52, 56, 60, 64}, /* 50 */ {100, 104, 108, 112, 116, 120, 124, 128}, /* 114 */ {149, 153, 157, 161, 165, 169, 173, 177}, /* 163 */ @@ -187,12 +187,12 @@ struct center_chs_ent_t { u8 *chs; }; -struct center_chs_ent_t center_chs_2g_by_bw[] = { +static struct center_chs_ent_t center_chs_2g_by_bw[] = { {CENTER_CH_2G_NUM, center_ch_2g}, {CENTER_CH_2G_40M_NUM, center_ch_2g_40m}, }; -struct center_chs_ent_t center_chs_5g_by_bw[] = { +static struct center_chs_ent_t center_chs_5g_by_bw[] = { {CENTER_CH_5G_20M_NUM, center_ch_5g_20m}, {CENTER_CH_5G_40M_NUM, center_ch_5g_40m}, {CENTER_CH_5G_80M_NUM, center_ch_5g_80m}, @@ -257,12 +257,12 @@ struct op_chs_ent_t { u8 *chs; }; -struct op_chs_ent_t op_chs_of_cch_2g_by_bw[] = { +static struct op_chs_ent_t op_chs_of_cch_2g_by_bw[] = { {1, center_ch_2g}, {2, (u8 *)op_chs_of_cch_2g_40m}, }; -struct op_chs_ent_t op_chs_of_cch_5g_by_bw[] = { +static struct op_chs_ent_t op_chs_of_cch_5g_by_bw[] = { {1, center_ch_5g_20m}, {2, (u8 *)op_chs_of_cch_5g_40m}, {4, (u8 *)op_chs_of_cch_5g_80m}, @@ -935,7 +935,7 @@ static const struct country_chplan country_chplan_map[] = { COUNTRY_CHPLAN_ENT("ZW", 0x26, 1, 0xF1), /* Zimbabwe */ }; -u16 const country_chplan_map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); +static u16 const country_chplan_map_sz = sizeof(country_chplan_map) / sizeof(struct country_chplan); /* * rtw_get_chplan_from_country - @@ -1006,7 +1006,7 @@ int rtw_ch_to_bb_gain_sel(int ch) return sel; } -s8 rtw_rf_get_kfree_tx_gain_offset(_adapter *padapter, u8 path, u8 ch) +static s8 rtw_rf_get_kfree_tx_gain_offset(_adapter *padapter, u8 path, u8 ch) { s8 kfree_offset = 0; diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 64132db..57f59c0 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -21,6 +21,7 @@ #include #include +#include static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; @@ -486,7 +487,7 @@ exit: *r_bmp_vht = bmp_vht; } -void rtw_get_shared_macid_tx_rate_bmp_by_bw(struct dvobj_priv *dvobj, u8 bw, u16 *r_bmp_cck_ofdm, u32 *r_bmp_ht, u32 *r_bmp_vht) +static void rtw_get_shared_macid_tx_rate_bmp_by_bw(struct dvobj_priv *dvobj, u8 bw, u16 *r_bmp_cck_ofdm, u32 *r_bmp_ht, u32 *r_bmp_vht) { struct macid_ctl_t *macid_ctl = dvobj_to_macidctl(dvobj); u16 bmp_cck_ofdm = 0; @@ -1590,7 +1591,7 @@ s32 rtw_make_wlanhdr(_adapter *padapter , u8 *hdr, struct pkt_attrib *pattrib) struct qos_priv *pqospriv = &pmlmepriv->qospriv; u8 qos_option = _FALSE; sint res = _SUCCESS; - u16 *fctrl = &pwlanhdr->frame_ctl; + __le16 *fctrl = &pwlanhdr->frame_ctl; /* struct sta_info *psta; */ @@ -2700,7 +2701,7 @@ s32 rtw_put_snap(u8 *data, u16 h_proto) snap->oui[1] = oui[1]; snap->oui[2] = oui[2]; - *(u16 *)(data + SNAP_SIZE) = htons(h_proto); + *(__be16 *)(data + SNAP_SIZE) = htons(h_proto); return SNAP_SIZE + sizeof(u16); } @@ -3033,7 +3034,7 @@ s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) return _SUCCESS; } -void rtw_init_xmitframe(struct xmit_frame *pxframe) +static void rtw_init_xmitframe(struct xmit_frame *pxframe) { if (pxframe != NULL) { /* default value setting */ pxframe->buf_addr = NULL; @@ -3295,7 +3296,7 @@ static struct xmit_frame *get_one_xmitframe(struct xmit_priv *pxmitpriv, struct return pxmitframe; } -struct xmit_frame *rtw_get_xframe(struct xmit_priv *pxmitpriv, int *num_frame) +static struct xmit_frame *rtw_get_xframe(struct xmit_priv *pxmitpriv, int *num_frame) { _irqL irqL0; _list *sta_plist, *sta_phead; @@ -3670,7 +3671,7 @@ void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry) } #ifdef CONFIG_BR_EXT -int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) +static int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) { struct sk_buff *skb = *pskb; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; @@ -3694,8 +3695,8 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) if (!(skb->data[0] & 1) && br_port && memcmp(skb->data + MACADDRLEN, padapter->br_mac, MACADDRLEN) && - *((unsigned short *)(skb->data + MACADDRLEN * 2)) != __constant_htons(ETH_P_8021Q) && - *((unsigned short *)(skb->data + MACADDRLEN * 2)) == __constant_htons(ETH_P_IP) && + *((__be16 *)(skb->data + MACADDRLEN * 2)) != __constant_htons(ETH_P_8021Q) && + *((__be16 *)(skb->data + MACADDRLEN * 2)) == __constant_htons(ETH_P_IP) && !memcmp(padapter->scdb_mac, skb->data + MACADDRLEN, MACADDRLEN) && padapter->scdb_entry) { memcpy(skb->data + MACADDRLEN, GET_MY_HWADDR(padapter), MACADDRLEN); padapter->scdb_entry->ageing_timer = jiffies; @@ -3715,10 +3716,10 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) } /* if SA == br_mac && skb== IP => copy SIP to br_ip ?? why */ if (!memcmp(skb->data + MACADDRLEN, padapter->br_mac, MACADDRLEN) && - (*((unsigned short *)(skb->data + MACADDRLEN * 2)) == __constant_htons(ETH_P_IP))) + (*((__be16 *)(skb->data + MACADDRLEN * 2)) == __constant_htons(ETH_P_IP))) memcpy(padapter->br_ip, skb->data + WLAN_ETHHDR_LEN + 12, 4); - if (*((unsigned short *)(skb->data + MACADDRLEN * 2)) == __constant_htons(ETH_P_IP)) { + if (*((__be16 *)(skb->data + MACADDRLEN * 2)) == __constant_htons(ETH_P_IP)) { if (memcmp(padapter->scdb_mac, skb->data + MACADDRLEN, MACADDRLEN)) { padapter->scdb_entry = (struct nat25_network_db_entry *)scdb_findEntry(padapter, @@ -3742,7 +3743,6 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) _exit_critical_bh(&padapter->br_ext_lock, &irqL); #endif /* 1 */ if (do_nat25) { - int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method); if (nat25_db_handle(padapter, skb, NAT25_CHECK) == 0) { struct sk_buff *newskb; @@ -3750,7 +3750,7 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) skb_push(skb, 4); for (i = 0; i < 6; i++) *((unsigned short *)(skb->data + i * 2)) = *((unsigned short *)(skb->data + 4 + i * 2)); - *((unsigned short *)(skb->data + MACADDRLEN * 2)) = __constant_htons(ETH_P_8021Q); + *((__be16 *)(skb->data + MACADDRLEN * 2)) = __constant_htons(ETH_P_8021Q); *((unsigned short *)(skb->data + MACADDRLEN * 2 + 2)) = vlan_hdr; } @@ -3810,7 +3810,7 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) skb_push(skb, 4); for (i = 0; i < 6; i++) *((unsigned short *)(skb->data + i * 2)) = *((unsigned short *)(skb->data + 4 + i * 2)); - *((unsigned short *)(skb->data + MACADDRLEN * 2)) = __constant_htons(ETH_P_8021Q); + *((__be16 *)(skb->data + MACADDRLEN * 2)) = __constant_htons(ETH_P_8021Q); *((unsigned short *)(skb->data + MACADDRLEN * 2 + 2)) = vlan_hdr; } } @@ -5222,7 +5222,7 @@ int rtw_sctx_wait(struct submit_ctx *sctx, const char *msg) return ret; } -bool rtw_sctx_chk_waring_status(int status) +static bool rtw_sctx_chk_waring_status(int status) { switch (status) { case RTW_SCTX_DONE_UNKNOWN: diff --git a/hal/hal8188e_t_fw.c b/hal/hal8188e_t_fw.c index 16a4e93..67797ef 100644 --- a/hal/hal8188e_t_fw.c +++ b/hal/hal8188e_t_fw.c @@ -19,6 +19,7 @@ ******************************************************************************/ #include "drv_types.h" +#include "hal8188e_t_fw.h" #ifdef LOAD_FW_HEADER_FROM_DRIVER diff --git a/hal/hal_com.c b/hal/hal_com.c index e64cc63..3308734 100644 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -2624,7 +2624,7 @@ void rtw_hal_set_bssid(_adapter *adapter, u8 *val) RTW_INFO("%s "ADPT_FMT"- hw port -%d BSSID: "MAC_FMT"\n", __func__, ADPT_ARG(adapter), adapter->hw_port, MAC_ARG(val)); } -void rtw_hal_get_msr(_adapter *adapter, u8 *net_type) +static void rtw_hal_get_msr(_adapter *adapter, u8 *net_type) { switch (adapter->hw_port) { case HW_PORT0: @@ -3098,7 +3098,7 @@ inline s32 rtw_hal_set_FwMediaStatusRpt_range_cmd(_adapter *adapter, bool opmode return rtw_hal_set_FwMediaStatusRpt_cmd(adapter, opmode, miracast, miracast_sink, role, macid, 1, macid_end); } -void rtw_hal_set_FwRsvdPage_cmd(PADAPTER padapter, PRSVDPAGE_LOC rsvdpageloc) +static void rtw_hal_set_FwRsvdPage_cmd(PADAPTER padapter, PRSVDPAGE_LOC rsvdpageloc) { struct hal_ops *pHalFunc = &padapter->hal_func; u8 u1H2CRsvdPageParm[H2C_RSVDPAGE_LOC_LEN] = {0}; @@ -3194,7 +3194,7 @@ void rtw_hal_set_output_gpio(_adapter *padapter, u8 index, u8 outputval) } #endif -void rtw_hal_set_FwAoacRsvdPage_cmd(PADAPTER padapter, PRSVDPAGE_LOC rsvdpageloc) +static void rtw_hal_set_FwAoacRsvdPage_cmd(PADAPTER padapter, PRSVDPAGE_LOC rsvdpageloc) { struct hal_ops *pHalFunc = &padapter->hal_func; struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); @@ -4410,7 +4410,7 @@ static void rtw_hal_construct_P2PBeacon(_adapter *padapter, u8 *pframe, u32 *pLe /* struct pkt_attrib *pattrib; */ /* unsigned char *pframe; */ struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; unsigned int rate_len; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); u32 pktlen; @@ -4698,7 +4698,7 @@ static void rtw_hal_construct_P2PProbeRsp(_adapter *padapter, u8 *pframe, u32 *p /* struct pkt_attrib *pattrib; */ /* unsigned char *pframe; */ struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; unsigned char *mac; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); @@ -5033,7 +5033,7 @@ static void rtw_hal_construct_P2PNegoRsp(_adapter *padapter, u8 *pframe, u32 *pL /* struct pkt_attrib *pattrib; */ /* unsigned char *pframe; */ struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -5451,7 +5451,7 @@ static void rtw_hal_construct_P2PInviteRsp(_adapter *padapter, u8 *pframe, u32 * /* struct pkt_attrib *pattrib; */ /* unsigned char *pframe; */ struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -5708,7 +5708,7 @@ static void rtw_hal_construct_P2PProvisionDisRsp(_adapter *padapter, u8 *pframe, /* struct pkt_attrib *pattrib; */ /* unsigned char *pframe; */ struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -5875,7 +5875,7 @@ static void rtw_hal_construct_beacon(_adapter *padapter, u8 *pframe, u32 *pLength) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; + __le16 *fctrl; u32 rate_len, pktlen; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -5973,7 +5973,7 @@ static void rtw_hal_construct_PSPoll(_adapter *padapter, u8 *pframe, u32 *pLength) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; + __le16 *fctrl; u32 pktlen; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -6011,7 +6011,7 @@ void rtw_hal_construct_NullFunctionData( u8 bForcePowerSave) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; + __le16 *fctrl; u32 pktlen; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; @@ -6070,11 +6070,11 @@ void rtw_hal_construct_NullFunctionData( *pLength = pktlen; } -void rtw_hal_construct_ProbeRsp(_adapter *padapter, u8 *pframe, u32 *pLength, +static void rtw_hal_construct_ProbeRsp(_adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, BOOLEAN bHideSSID) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; + __le16 *fctrl; u8 *mac, *bssid; u32 pktlen; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); @@ -6169,7 +6169,7 @@ static void rtw_hal_construct_ARPRsp( ) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; + __le16 *fctrl; u32 pktlen; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; @@ -6293,7 +6293,7 @@ static void rtw_hal_construct_ProbeReq(_adapter *padapter, u8 *pframe, u32 *pLength, pno_ssid_t *ssid) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; + __le16 *fctrl; u32 pktlen; unsigned char *mac; unsigned char bssrate[NumRates]; @@ -6473,7 +6473,7 @@ static void rtw_hal_construct_GTKRsp( ) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; + __le16 *fctrl; u32 pktlen; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; @@ -10096,7 +10096,7 @@ bool kfree_data_is_bb_gain_empty(struct kfree_data_t *data) } #ifdef CONFIG_USB_RX_AGGREGATION -void rtw_set_usb_agg_by_mode_normal(_adapter *padapter, u8 cur_wireless_mode) +static void rtw_set_usb_agg_by_mode_normal(_adapter *padapter, u8 cur_wireless_mode) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); if (cur_wireless_mode < WIRELESS_11_24N @@ -10164,7 +10164,7 @@ void rtw_set_usb_agg_by_mode_normal(_adapter *padapter, u8 cur_wireless_mode) } } -void rtw_set_usb_agg_by_mode_customer(_adapter *padapter, u8 cur_wireless_mode, u8 UsbDmaSize, u8 Legacy_UsbDmaSize) +static void rtw_set_usb_agg_by_mode_customer(_adapter *padapter, u8 cur_wireless_mode, u8 UsbDmaSize, u8 Legacy_UsbDmaSize) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); @@ -10191,7 +10191,7 @@ void rtw_set_usb_agg_by_mode_customer(_adapter *padapter, u8 cur_wireless_mode, } } -void rtw_set_usb_agg_by_mode(_adapter *padapter, u8 cur_wireless_mode) +static void rtw_set_usb_agg_by_mode(_adapter *padapter, u8 cur_wireless_mode) { #ifdef CONFIG_PLATFORM_NOVATEK_NT72668 rtw_set_usb_agg_by_mode_customer(padapter, cur_wireless_mode, 0x3, 0x3); @@ -11319,7 +11319,7 @@ void rtw_hal_antdiv_rssi_compared(_adapter *padapter, WLAN_BSSID_EX *dst, WLAN_B #endif #ifdef CONFIG_PHY_CAPABILITY_QUERY -void rtw_dump_phy_cap_by_phydmapi(void *sel, _adapter *adapter) +static void rtw_dump_phy_cap_by_phydmapi(void *sel, _adapter *adapter) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter); struct phy_spec_t *phy_spec = &pHalData->phy_spec; @@ -11369,7 +11369,7 @@ void rtw_dump_phy_cap_by_phydmapi(void *sel, _adapter *adapter) #endif } #else -void rtw_dump_phy_cap_by_hal(void *sel, _adapter *adapter) +static void rtw_dump_phy_cap_by_hal(void *sel, _adapter *adapter) { u8 phy_cap = _FALSE; diff --git a/hal/hal_com_phycfg.c b/hal/hal_com_phycfg.c index 40f733b..0e12ad4 100644 --- a/hal/hal_com_phycfg.c +++ b/hal/hal_com_phycfg.c @@ -44,7 +44,7 @@ #define PG_TXPWR_SRC_DEF 2 #define PG_TXPWR_SRC_NUM 3 -const char *const _pg_txpwr_src_str[] = { +static const char *const _pg_txpwr_src_str[] = { "PG_DATA", "IC_DEF", "DEF", @@ -225,7 +225,7 @@ void dump_pg_txpwr_info_5g(void *sel, TxPowerInfo5G *txpwr_info, u8 rfpath_num, RTW_PRINT_SEL(sel, "\n"); } -const struct map_t pg_txpwr_def_info = +static const struct map_t pg_txpwr_def_info = MAP_ENT(0xB8, 1, 0xFF , MAPSEG_ARRAY_ENT(0x10, 168, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x24, 0xEE, 0xEE, 0xEE, 0xEE, @@ -570,7 +570,7 @@ static inline void hal_init_pg_txpwr_info_5g(_adapter *adapter, TxPowerInfo5G *p #define LOAD_PG_TXPWR_WARN_COND(_txpwr_src) (_txpwr_src > PG_TXPWR_SRC_PG_DATA) #endif -u16 hal_load_pg_txpwr_info_path_2g( +static u16 hal_load_pg_txpwr_info_path_2g( _adapter *adapter, TxPowerInfo24G *pwr_info, u32 path, @@ -700,7 +700,7 @@ exit: return offset; } -u16 hal_load_pg_txpwr_info_path_5g( +static u16 hal_load_pg_txpwr_info_path_5g( _adapter *adapter, TxPowerInfo5G *pwr_info, u32 path, @@ -861,7 +861,7 @@ exit: return offset; } -void hal_load_pg_txpwr_info( +static void hal_load_pg_txpwr_info( _adapter *adapter, TxPowerInfo24G *pwr_info_2g, TxPowerInfo5G *pwr_info_5g, @@ -1208,7 +1208,7 @@ void dump_hal_txpwr_info_5g(void *sel, _adapter *adapter, u8 rfpath_num, u8 max_ * * Return dBm or -1 for undefined */ -s8 rtw_regsty_get_target_tx_power( +static s8 rtw_regsty_get_target_tx_power( IN PADAPTER Adapter, IN u8 Band, IN u8 RfPath, @@ -1252,7 +1252,7 @@ s8 rtw_regsty_get_target_tx_power( return value; } -bool rtw_regsty_chk_target_tx_power_valid(_adapter *adapter) +static bool rtw_regsty_chk_target_tx_power_valid(_adapter *adapter) { struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter); HAL_DATA_TYPE *hal_data = GET_HAL_DATA(adapter); @@ -1333,7 +1333,7 @@ PHY_GetTxPowerByRateBase( return value; } -VOID +static VOID phy_SetTxPowerByRateBase( IN PADAPTER Adapter, IN u8 Band, @@ -1456,7 +1456,7 @@ static void phy_txpwr_by_rate_chk_for_path_dup(_adapter *adapter) } } -VOID +static VOID phy_StoreTxPowerByRateBase( IN PADAPTER pAdapter ) @@ -1898,7 +1898,7 @@ PHY_GetRateValuesOfTxPowerByRate( }; } -void +static void PHY_StoreTxPowerByRateNew( IN PADAPTER pAdapter, IN u32 Band, @@ -1982,7 +1982,7 @@ phy_store_tx_power_by_rate( } -VOID +static VOID phy_ConvertTxPowerByRateInDbmToRelativeValues( IN PADAPTER pAdapter ) @@ -2114,11 +2114,7 @@ exit: return; } -BOOLEAN -phy_GetChnlIndex( - IN u8 Channel, - OUT u8 *ChannelIdx -) +static BOOLEAN phy_GetChnlIndex(u8 Channel, u8 *ChannelIdx) { u8 i = 0; BOOLEAN bIn24G = _TRUE; @@ -2704,7 +2700,7 @@ PHY_SetTxPowerByRate( u8 rateIndex = PHY_GetRateIndexOfTxPowerByRate(Rate); if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) { - RTW_INFO("Invalid band %d in %s\n", Band, __FUNCTION__); + RTW_INFO("Invalid band %d in %s\n", Band, __FUNCTION__); return; } if (RFPath > ODM_RF_PATH_D) { @@ -2790,10 +2786,7 @@ PHY_SetTxPowerIndexByRateArray( } } -s8 -phy_GetWorldWideLimit( - s8 *LimitTable -) +static s8 phy_GetWorldWideLimit(s8 *LimitTable) { s8 min = LimitTable[0]; u8 i = 0; @@ -2806,11 +2799,7 @@ phy_GetWorldWideLimit( return min; } -s8 -phy_GetChannelIndexOfTxPowerLimit( - IN u8 Band, - IN u8 Channel -) +static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Band, u8 Channel) { s8 channelIndex = -1; u8 i = 0; @@ -3292,11 +3281,7 @@ PHY_GetTxPowerLimitOriginal( } #endif - -VOID -phy_CrossReferenceHTAndVHTTxPowerLimit( - IN PADAPTER pAdapter -) +static void phy_CrossReferenceHTAndVHTTxPowerLimit(PADAPTER pAdapter) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); u8 regulation, bw, channel, rs, ref_rs; @@ -4373,11 +4358,7 @@ phy_ConfigBBWithParaFile( return rtStatus; } -VOID -phy_DecryptBBPgParaFile( - PADAPTER Adapter, - char *buffer -) +static void phy_DecryptBBPgParaFile(PADAPTER Adapter, char *buffer) { u32 i = 0, j = 0; u8 map[95] = {0}; @@ -4411,11 +4392,7 @@ phy_DecryptBBPgParaFile( } } -int -phy_ParseBBPgParaFile( - PADAPTER Adapter, - char *buffer -) +static int phy_ParseBBPgParaFile(PADAPTER Adapter, char *buffer) { int rtStatus = _SUCCESS; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); @@ -4921,8 +4898,7 @@ PHY_ConfigRFWithParaFile( return rtStatus; } -VOID -initDeltaSwingIndexTables( +static void initDeltaSwingIndexTables( PADAPTER Adapter, char *Band, char *Path, @@ -5109,8 +5085,7 @@ PHY_ConfigRFWithTxPwrTrackParaFile( return rtStatus; } -int -phy_ParsePowerLimitTableFile( +static int phy_ParsePowerLimitTableFile( PADAPTER Adapter, char *buffer ) diff --git a/hal/phydm/hal8188erateadaptive.c b/hal/phydm/hal8188erateadaptive.c index 8cf465f..9089cde 100644 --- a/hal/phydm/hal8188erateadaptive.c +++ b/hal/phydm/hal8188erateadaptive.c @@ -27,29 +27,13 @@ static u8 RETRY_PENALTY[PERENTRY][RETRYSIZE + 1] = {{5, 4, 3, 2, 0, 3}, /* 92 , {6, 5, 4, 3, 0, 4}, /* 86 , idx=1 */ {6, 5, 4, 2, 0, 4}, /* 81 , idx=2 */ {8, 7, 6, 4, 0, 6}, /* 75 , idx=3 */ -#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \ - ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE)) - {10, 9, 7, 6, 0, 8},/*71 , idx=4*/ - {10, 9, 7, 4, 0, 8},/*66 , idx=5*/ -#else {10, 9, 8, 6, 0, 8}, /* 71 , idx=4 */ {10, 9, 8, 4, 0, 8}, /* 66 , idx=5 */ -#endif {10, 9, 8, 2, 0, 8}, /* 62 , idx=6 */ {10, 9, 8, 0, 0, 8}, /* 59 , idx=7 */ {18, 17, 16, 8, 0, 16}, /* 53 , idx=8 */ {26, 25, 24, 16, 0, 24}, /* 50 , idx=9 */ {34, 33, 32, 24, 0, 32}, /* 47 , idx=0x0a */ - /* {34,33,32,16,0,32}, */ /* 43 , idx=0x0b */ - /* {34,33,32,8,0,32}, */ /* 40 , idx=0x0c */ - /* {34,33,28,8,0,32}, */ /* 37 , idx=0x0d */ - /* {34,33,20,8,0,32}, */ /* 32 , idx=0x0e */ - /* {34,32,24,8,0,32}, */ /* 26 , idx=0x0f */ - /* {49,48,32,16,0,48}, */ /* 20 , idx=0x10 */ - /* {49,48,24,0,0,48}, */ /* 17 , idx=0x11 */ - /* {49,47,16,16,0,48}, */ /* 15 , idx=0x12 */ - /* {49,44,16,16,0,48}, */ /* 12 , idx=0x13 */ - /* {49,40,16,0,0,48}, */ /* 9 , idx=0x14 */ {34, 31, 28, 20, 0, 32}, /* 43 , idx=0x0b */ {34, 31, 27, 18, 0, 32}, /* 40 , idx=0x0c */ {34, 31, 26, 16, 0, 32}, /* 37 , idx=0x0d */ @@ -58,13 +42,8 @@ static u8 RETRY_PENALTY[PERENTRY][RETRYSIZE + 1] = {{5, 4, 3, 2, 0, 3}, /* 92 , {49, 46, 40, 16, 0, 48}, /* 20 , idx=0x10 */ {49, 45, 32, 0, 0, 48}, /* 17 , idx=0x11 */ {49, 45, 22, 18, 0, 48}, /* 15 , idx=0x12 */ -#if (DM_ODM_SUPPORT_TYPE == ODM_AP) - {49, 40, 28, 18, 0, 48}, /* 12 , idx=0x13 */ - {49, 34, 20, 16, 0, 48}, /* 9 , idx=0x14 */ -#else {49, 40, 24, 16, 0, 48}, /* 12 , idx=0x13 */ {49, 32, 18, 12, 0, 48}, /* 9 , idx=0x14 */ -#endif {49, 22, 18, 14, 0, 48}, /* 6 , idx=0x15 */ {49, 16, 16, 0, 0, 48} };/* 3 */ /* 3, idx=0x16 */ @@ -1177,7 +1156,7 @@ odm_ra_set_tx_rpt_time( void odm_ra_tx_rpt2_handle_8188e(struct PHY_DM_STRUCT *p_dm_odm, - u8 *tx_rpt_buf, u16 tx_rpt_len, + u8 *tx_rpt_buf, __le16 tx_rpt_len, u32 mac_id_valid_entry0, u32 mac_id_valid_entry1) { @@ -1190,7 +1169,7 @@ void odm_ra_tx_rpt2_handle_8188e(struct PHY_DM_STRUCT *p_dm_odm, ODM_RT_TRACE(p_dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("=====>odm_ra_tx_rpt2_handle_8188e(): valid0=%d valid1=%d BufferLength=%d\n", mac_id_valid_entry0, mac_id_valid_entry1, tx_rpt_len)); - item_num = tx_rpt_len >> 3; + item_num = le16_to_cpu(tx_rpt_len) >> 3; p_buffer = tx_rpt_buf; do { @@ -1202,8 +1181,6 @@ void odm_ra_tx_rpt2_handle_8188e(struct PHY_DM_STRUCT *p_dm_odm, p_ra_info = &(p_dm_odm->ra_info[mac_id]); if (valid) { - - p_ra_info->RTY[0] = (u16)GET_TX_REPORT_TYPE1_RERTY_0(p_buffer); p_ra_info->RTY[1] = (u16)GET_TX_REPORT_TYPE1_RERTY_1(p_buffer); p_ra_info->RTY[2] = (u16)GET_TX_REPORT_TYPE1_RERTY_2(p_buffer); @@ -1264,16 +1241,6 @@ void odm_ra_tx_rpt2_handle_8188e(struct PHY_DM_STRUCT *p_dm_odm, #else odm_rate_decision_8188e(p_dm_odm, p_ra_info); #endif - -#if (DM_ODM_SUPPORT_TYPE & ODM_AP) - extern void rtl8188e_set_station_tx_rate_info(struct PHY_DM_STRUCT *, struct _odm_ra_info_ *, int); - rtl8188e_set_station_tx_rate_info(p_dm_odm, p_ra_info, mac_id); -#ifdef DETECT_STA_EXISTANCE - void rtl8188e_detect_sta_existance(struct PHY_DM_STRUCT *p_dm_odm, struct _odm_ra_info_ *p_ra_info, int mac_id); - rtl8188e_detect_sta_existance(p_dm_odm, p_ra_info, mac_id); -#endif -#endif - ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("macid=%d R0=%d R1=%d R2=%d R3=%d R4=%d drop=%d valid0=%x rate_id=%d SGI=%d\n", mac_id, @@ -1401,13 +1368,11 @@ void odm_ra_tx_rpt2_handle_8188e( struct PHY_DM_STRUCT *p_dm_odm, u8 *tx_rpt_buf, - u16 tx_rpt_len, + __le16 tx_rpt_len, u32 mac_id_valid_entry0, u32 mac_id_valid_entry1 ) { - return; } - #endif diff --git a/hal/phydm/hal8188erateadaptive.h b/hal/phydm/hal8188erateadaptive.h index 14bc70a..e42b1ed 100644 --- a/hal/phydm/hal8188erateadaptive.h +++ b/hal/phydm/hal8188erateadaptive.h @@ -96,7 +96,7 @@ void odm_ra_tx_rpt2_handle_8188e( struct PHY_DM_STRUCT *p_dm_odm, u8 *tx_rpt_buf, - u16 tx_rpt_len, + __le16 tx_rpt_len, u32 mac_id_valid_entry0, u32 mac_id_valid_entry1 ); diff --git a/hal/rtl8188e_phycfg.c b/hal/rtl8188e_phycfg.c index ca22e2e..f8ba0f1 100644 --- a/hal/rtl8188e_phycfg.c +++ b/hal/rtl8188e_phycfg.c @@ -1102,7 +1102,7 @@ rtl8188e_PHY_ConfigRFWithParaFile( * **************************************** */ #define HighPowerRadioAArrayLen 22 /* This is for High power PA */ -u32 Rtl8192S_HighPower_RadioA_Array[HighPowerRadioAArrayLen] = { +static u32 Rtl8192S_HighPower_RadioA_Array[HighPowerRadioAArrayLen] = { 0x013, 0x00029ea4, 0x013, 0x00025e74, 0x013, 0x00020ea4, @@ -1384,7 +1384,7 @@ PHY_SetTxPowerIndex_8188E( RTW_INFO("Invalid RFPath!!\n"); } -u8 +static u8 phy_GetCurrentTxNum_8188E( IN PADAPTER pAdapter, IN u8 Rate @@ -1402,7 +1402,7 @@ phy_GetCurrentTxNum_8188E( return TxNum; } -s8 tx_power_extra_bias( +static s8 tx_power_extra_bias( IN u8 RFPath, IN u8 Rate, IN CHANNEL_WIDTH BandWidth, @@ -1477,7 +1477,7 @@ PHY_UpdateTxPowerDbm8188E( return _TRUE; } -VOID +static void PHY_ScanOperationBackup8188E( IN PADAPTER Adapter, IN u8 Operation @@ -1505,7 +1505,8 @@ PHY_ScanOperationBackup8188E( } #endif } -void + +static void phy_SpurCalibration_8188E( IN PADAPTER Adapter ) @@ -1973,13 +1974,8 @@ _PHY_DumpRFReg(IN PADAPTER pAdapter) * To dump all Tx FIFO LLT related link-list table. * Added by Roger, 2009.03.10. * */ -VOID -DumpBBDbgPort_92CU( - IN PADAPTER Adapter -) +static void DumpBBDbgPort_92CU(PADAPTER Adapter) { - - phy_set_bb_reg(Adapter, 0x0908, 0xffff, 0x0000); phy_set_bb_reg(Adapter, 0x0908, 0xffff, 0x0803); @@ -1993,8 +1989,6 @@ DumpBBDbgPort_92CU( phy_set_bb_reg(Adapter, 0x0908, 0xffff, 0x0100); phy_set_bb_reg(Adapter, 0x0a28, 0x00ff0000, 0x00150000); - - } #endif diff --git a/hal/usb_ops_linux.c b/hal/usb_ops_linux.c index 5724684..db3e0cc 100644 --- a/hal/usb_ops_linux.c +++ b/hal/usb_ops_linux.c @@ -167,9 +167,10 @@ int recvbuf2recvframe(PADAPTER padapter, void *ptr) } - pkt_offset = RXDESC_SIZE + pattrib->drvinfo_sz + pattrib->shift_sz + pattrib->pkt_len; + pkt_offset = RXDESC_SIZE + pattrib->drvinfo_sz + + pattrib->shift_sz + le16_to_cpu(pattrib->pkt_len); - if ((pattrib->pkt_len <= 0) || (pkt_offset > transfer_len)) { + if ((le16_to_cpu(pattrib->pkt_len) <= 0) || (pkt_offset > transfer_len)) { RTW_INFO("%s()-%d: RX Warning!,pkt_len<=0 or pkt_offset> transfoer_len\n", __FUNCTION__, __LINE__); rtw_free_recvframe(precvframe, pfree_recv_queue); goto _exit_recvbuf2recvframe; @@ -218,14 +219,12 @@ int recvbuf2recvframe(PADAPTER padapter, void *ptr) &pHalData->odmpriv, precvframe->u.hdr.rx_data, pattrib->pkt_len, - pattrib->MacIDValidEntry[0], - pattrib->MacIDValidEntry[1] - ); - + le32_to_cpu(pattrib->MacIDValidEntry[0]), + le32_to_cpu(pattrib->MacIDValidEntry[1])); } else if (pattrib->pkt_rpt_type == HIS_REPORT) { /* RTW_INFO("%s , rx USB HISR\n",__FUNCTION__); */ #ifdef CONFIG_SUPPORT_USB_INT - interrupt_handler_8188eu(padapter, pattrib->pkt_len, precvframe->u.hdr.rx_data); + interrupt_handler_8188eu(padapter, le16_to_cpu(pattrib->pkt_len), precvframe->u.hdr.rx_data); #endif } rtw_free_recvframe(precvframe, pfree_recv_queue); diff --git a/include/HalVerDef.h b/include/HalVerDef.h index a33b4c5..b157906 100644 --- a/include/HalVerDef.h +++ b/include/HalVerDef.h @@ -96,12 +96,12 @@ typedef struct tag_HAL_VERSION { * HAL_VERSION VersionID; */ /* Get element */ -#define GET_CVID_IC_TYPE(version) ((HAL_IC_TYPE_E)(((HAL_VERSION)version).ICType)) -#define GET_CVID_CHIP_TYPE(version) ((HAL_CHIP_TYPE_E)(((HAL_VERSION)version).ChipType)) -#define GET_CVID_RF_TYPE(version) ((HAL_RF_TYPE_E)(((HAL_VERSION)version).RFType)) -#define GET_CVID_MANUFACTUER(version) ((HAL_VENDOR_E)(((HAL_VERSION)version).VendorType)) -#define GET_CVID_CUT_VERSION(version) ((HAL_CUT_VERSION_E)(((HAL_VERSION)version).CUTVersion)) -#define GET_CVID_ROM_VERSION(version) ((((HAL_VERSION)version).ROMVer) & ROM_VERSION_MASK) +#define GET_CVID_IC_TYPE(version) (((version).ICType)) +#define GET_CVID_CHIP_TYPE(version) (((version).ChipType)) +#define GET_CVID_RF_TYPE(version) (((version).RFType)) +#define GET_CVID_MANUFACTUER(version) (((version).VendorType)) +#define GET_CVID_CUT_VERSION(version) (((version).CUTVersion)) +#define GET_CVID_ROM_VERSION(version) (((version).ROMVer) & ROM_VERSION_MASK) /* ---------------------------------------------------------------------------- * Common Macro. -- @@ -109,22 +109,16 @@ typedef struct tag_HAL_VERSION { * HAL_VERSION VersionID */ /* HAL_IC_TYPE_E */ -#if 0 - #define IS_81XXC(version) (((GET_CVID_IC_TYPE(version) == CHIP_8192C) || (GET_CVID_IC_TYPE(version) == CHIP_8188C)) ? TRUE : FALSE) - #define IS_8723_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8723A) ? TRUE : FALSE) - #define IS_92D(version) ((GET_CVID_IC_TYPE(version) == CHIP_8192D) ? TRUE : FALSE) -#endif - -#define IS_8188E(version) ((GET_CVID_IC_TYPE(version) == CHIP_8188E) ? TRUE : FALSE) -#define IS_8188F(version) ((GET_CVID_IC_TYPE(version) == CHIP_8188F) ? TRUE : FALSE) -#define IS_8192E(version) ((GET_CVID_IC_TYPE(version) == CHIP_8192E) ? TRUE : FALSE) +#define IS_8188E(version) ((GET_CVID_IC_TYPE(version) == CHIP_8188E) ? TRUE : FALSE) +#define IS_8188F(version) ((GET_CVID_IC_TYPE(version) == CHIP_8188F) ? TRUE : FALSE) +#define IS_8192E(version) ((GET_CVID_IC_TYPE(version) == CHIP_8192E) ? TRUE : FALSE) #define IS_8812_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8812) ? TRUE : FALSE) #define IS_8821_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8821) ? TRUE : FALSE) -#define IS_8814A_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8814A) ? TRUE : FALSE) -#define IS_8723B_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8723B) ? TRUE : FALSE) -#define IS_8703B_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8703B) ? TRUE : FALSE) -#define IS_8822B_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8822B) ? TRUE : FALSE) -#define IS_8821C_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8821C) ? TRUE : FALSE) +#define IS_8814A_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8814A) ? TRUE : FALSE) +#define IS_8723B_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8723B) ? TRUE : FALSE) +#define IS_8703B_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8703B) ? TRUE : FALSE) +#define IS_8822B_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8822B) ? TRUE : FALSE) +#define IS_8821C_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8821C) ? TRUE : FALSE) #define IS_8723D_SERIES(version)\ ((GET_CVID_IC_TYPE(version) == CHIP_8723D) ? TRUE : FALSE) /* HAL_CHIP_TYPE_E */ @@ -132,15 +126,15 @@ typedef struct tag_HAL_VERSION { #define IS_NORMAL_CHIP(version) ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? TRUE : FALSE) /* HAL_CUT_VERSION_E */ -#define IS_A_CUT(version) ((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? TRUE : FALSE) -#define IS_B_CUT(version) ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? TRUE : FALSE) -#define IS_C_CUT(version) ((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? TRUE : FALSE) -#define IS_D_CUT(version) ((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? TRUE : FALSE) -#define IS_E_CUT(version) ((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? TRUE : FALSE) -#define IS_F_CUT(version) ((GET_CVID_CUT_VERSION(version) == F_CUT_VERSION) ? TRUE : FALSE) -#define IS_I_CUT(version) ((GET_CVID_CUT_VERSION(version) == I_CUT_VERSION) ? TRUE : FALSE) -#define IS_J_CUT(version) ((GET_CVID_CUT_VERSION(version) == J_CUT_VERSION) ? TRUE : FALSE) -#define IS_K_CUT(version) ((GET_CVID_CUT_VERSION(version) == K_CUT_VERSION) ? TRUE : FALSE) +#define IS_A_CUT(version) ((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? TRUE : FALSE) +#define IS_B_CUT(version) ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? TRUE : FALSE) +#define IS_C_CUT(version) ((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? TRUE : FALSE) +#define IS_D_CUT(version) ((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? TRUE : FALSE) +#define IS_E_CUT(version) ((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? TRUE : FALSE) +#define IS_F_CUT(version) ((GET_CVID_CUT_VERSION(version) == F_CUT_VERSION) ? TRUE : FALSE) +#define IS_I_CUT(version) ((GET_CVID_CUT_VERSION(version) == I_CUT_VERSION) ? TRUE : FALSE) +#define IS_J_CUT(version) ((GET_CVID_CUT_VERSION(version) == J_CUT_VERSION) ? TRUE : FALSE) +#define IS_K_CUT(version) ((GET_CVID_CUT_VERSION(version) == K_CUT_VERSION) ? TRUE : FALSE) /* HAL_VENDOR_E */ #define IS_CHIP_VENDOR_TSMC(version) ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? TRUE : FALSE) @@ -160,24 +154,6 @@ typedef struct tag_HAL_VERSION { /* ---------------------------------------------------------------------------- * Chip version Macro. -- * ---------------------------------------------------------------------------- */ -#if 0 - #define IS_81XXC_TEST_CHIP(version) ((IS_81XXC(version) && (!IS_NORMAL_CHIP(version))) ? TRUE : FALSE) - - #define IS_92C_SERIAL(version) ((IS_81XXC(version) && IS_2T2R(version)) ? TRUE : FALSE) - #define IS_81xxC_VENDOR_UMC_A_CUT(version) (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? (IS_A_CUT(version) ? TRUE : FALSE) : FALSE) : FALSE) - #define IS_81xxC_VENDOR_UMC_B_CUT(version) (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? (IS_B_CUT(version) ? TRUE : FALSE) : FALSE) : FALSE) - #define IS_81xxC_VENDOR_UMC_C_CUT(version) (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? (IS_C_CUT(version) ? TRUE : FALSE) : FALSE) : FALSE) - - #define IS_NORMAL_CHIP92D(version) ((IS_92D(version)) ? ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? TRUE : FALSE) : FALSE) - - #define IS_92D_SINGLEPHY(version) ((IS_92D(version)) ? (IS_2T2R(version) ? TRUE : FALSE) : FALSE) - #define IS_92D_C_CUT(version) ((IS_92D(version)) ? (IS_C_CUT(version) ? TRUE : FALSE) : FALSE) - #define IS_92D_D_CUT(version) ((IS_92D(version)) ? (IS_D_CUT(version) ? TRUE : FALSE) : FALSE) - #define IS_92D_E_CUT(version) ((IS_92D(version)) ? (IS_E_CUT(version) ? TRUE : FALSE) : FALSE) - - #define IS_8723A_A_CUT(version) ((IS_8723_SERIES(version)) ? (IS_A_CUT(version) ? TRUE : FALSE) : FALSE) - #define IS_8723A_B_CUT(version) ((IS_8723_SERIES(version)) ? (IS_B_CUT(version) ? TRUE : FALSE) : FALSE) -#endif #define IS_VENDOR_8188E_I_CUT_SERIES(_Adapter) ((IS_8188E(GET_HAL_DATA(_Adapter)->version_id)) ? ((GET_CVID_CUT_VERSION(GET_HAL_DATA(_Adapter)->version_id) >= I_CUT_VERSION) ? TRUE : FALSE) : FALSE) #define IS_VENDOR_8812A_TEST_CHIP(_Adapter) ((IS_8812_SERIES(GET_HAL_DATA(_Adapter)->version_id)) ? ((IS_NORMAL_CHIP(GET_HAL_DATA(_Adapter)->version_id)) ? FALSE : TRUE) : FALSE) #define IS_VENDOR_8812A_MP_CHIP(_Adapter) ((IS_8812_SERIES(GET_HAL_DATA(_Adapter)->version_id)) ? ((IS_NORMAL_CHIP(GET_HAL_DATA(_Adapter)->version_id)) ? TRUE : FALSE) : FALSE) diff --git a/include/hal_data.h b/include/hal_data.h index c69db7f..17fd4c9 100755 --- a/include/hal_data.h +++ b/include/hal_data.h @@ -758,10 +758,17 @@ typedef struct hal_com_data { u8 not_xmitframe_fw_dl; /*not use xmitframe to download fw*/ } HAL_DATA_COMMON, *PHAL_DATA_COMMON; +#ifdef SUPPORT_HW_RFOFF_DETECTED + int rtw_hw_suspend(_adapter *padapter); + int rtw_hw_resume(_adapter *padapter); +#endif +#ifdef CONFIG_GLOBAL_UI_PID +extern int ui_pid[3]; +#endif typedef struct hal_com_data HAL_DATA_TYPE, *PHAL_DATA_TYPE; -#define GET_HAL_DATA(__pAdapter) ((HAL_DATA_TYPE *)((__pAdapter)->HalData)) +#define GET_HAL_DATA(__pAdapter) ((HAL_DATA_TYPE *)((__pAdapter)->HalData)) #define GET_HAL_SPEC(__pAdapter) (&(GET_HAL_DATA((__pAdapter))->hal_spec)) #define GET_ODM(__pAdapter) (&(GET_HAL_DATA((__pAdapter))->odmpriv)) diff --git a/include/ieee80211.h b/include/ieee80211.h index 6d0aaca..8b09774 100644 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -1292,7 +1292,7 @@ enum ieee80211_state { #define IP_FMT "%d.%d.%d.%d" #define IP_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3] #define PORT_FMT "%u" -#define PORT_ARG(x) ntohs(*((u16 *)(x))) +#define PORT_ARG(x) ntohs(*((__be16 *)(x))) extern __inline int is_multicast_mac_addr(const u8 *addr) { diff --git a/include/ieee80211_ext.h b/include/ieee80211_ext.h index 07a8f74..f0d28fd 100644 --- a/include/ieee80211_ext.h +++ b/include/ieee80211_ext.h @@ -183,42 +183,42 @@ struct ieee80211_mgmt { u16 seq_ctrl; union { struct { - u16 auth_alg; - u16 auth_transaction; - u16 status_code; + __le16 auth_alg; + __le16 auth_transaction; + __le16 status_code; /* possibly followed by Challenge text */ u8 variable[0]; } __attribute__((packed)) auth; struct { - u16 reason_code; + __le16 reason_code; } __attribute__((packed)) deauth; struct { - u16 capab_info; - u16 listen_interval; + __le16 capab_info; + __le16 listen_interval; /* followed by SSID and Supported rates */ u8 variable[0]; } __attribute__((packed)) assoc_req; struct { - u16 capab_info; - u16 status_code; - u16 aid; + __le16 capab_info; + __le16 status_code; + __le16 aid; /* followed by Supported rates */ u8 variable[0]; } __attribute__((packed)) assoc_resp, reassoc_resp; struct { - u16 capab_info; - u16 listen_interval; + __le16 capab_info; + __le16 listen_interval; u8 current_ap[6]; /* followed by SSID and Supported rates */ u8 variable[0]; } __attribute__((packed)) reassoc_req; struct { - u16 reason_code; + __le16 reason_code; } __attribute__((packed)) disassoc; struct { __le64 timestamp; - u16 beacon_int; - u16 capab_info; + __le16 beacon_int; + __le16 capab_info; /* followed by some of SSID, Supported rates, * FH Params, DS Params, CF Params, IBSS Params, TIM */ u8 variable[0]; @@ -229,8 +229,8 @@ struct ieee80211_mgmt { } __attribute__((packed)) probe_req; struct { __le64 timestamp; - u16 beacon_int; - u16 capab_info; + __le16 beacon_int; + __le16 capab_info; /* followed by some of SSID, Supported rates, * FH Params, DS Params, CF Params, IBSS Params */ u8 variable[0]; @@ -247,28 +247,28 @@ struct ieee80211_mgmt { struct { u8 action_code; u8 dialog_token; - u16 capab; - u16 timeout; - u16 start_seq_num; + __le16 capab; + __le16 timeout; + __le16 start_seq_num; } __attribute__((packed)) addba_req; struct { u8 action_code; u8 dialog_token; - u16 status; - u16 capab; - u16 timeout; + __le16 status; + __le16 capab; + __le16 timeout; } __attribute__((packed)) addba_resp; struct { u8 action_code; - u16 params; - u16 reason_code; + __le16 params; + __le16 reason_code; } __attribute__((packed)) delba; struct { u8 action_code; /* capab_info for open and confirm, * reason for close */ - u16 aux; + ___le16 aux; /* Followed in plink_confirm by status * code, AID and supported rates, * and directly by supported rates in diff --git a/include/rtw_iol.h b/include/rtw_iol.h index b68a525..778e32e 100644 --- a/include/rtw_iol.h +++ b/include/rtw_iol.h @@ -37,9 +37,9 @@ int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame); struct ioreg_cfg { u8 length; u8 cmd_id; - u16 address; - u32 data; - u32 mask; + __le16 address; + __le32 data; + __le32 mask; }; enum ioreg_cmd { IOREG_CMD_LLT = 0x01, @@ -79,8 +79,8 @@ struct cmd_cmp { typedef struct _io_offload_cmd { u8 rsvd0; u8 cmd; - u16 address; - u32 value; + __le16 address; + __le32 value; } IO_OFFLOAD_CMD, IOL_CMD; #define IOL_CMD_LLT 0x00 diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h index a0ae202..3fd7512 100644 --- a/include/rtw_mlme.h +++ b/include/rtw_mlme.h @@ -1170,6 +1170,9 @@ struct sta_media_status_rpt_cmd_parm { void rtw_sta_media_status_rpt(_adapter *adapter, struct sta_info *sta, bool connected); u8 rtw_sta_media_status_rpt_cmd(_adapter *adapter, struct sta_info *sta, bool connected); void rtw_sta_media_status_rpt_cmd_hdl(_adapter *adapter, struct sta_media_status_rpt_cmd_parm *parm); +void rtw_indicate_wx_assoc_event(_adapter *padapter); +void rtw_indicate_wx_disassoc_event(_adapter *padapter); +void indicate_wx_scan_complete_event(_adapter *padapter); #ifdef CONFIG_INTEL_PROXIM void rtw_proxim_enable(_adapter *padapter); diff --git a/include/rtw_recv.h b/include/rtw_recv.h index ec48df2..4150c97 100644 --- a/include/rtw_recv.h +++ b/include/rtw_recv.h @@ -629,17 +629,14 @@ __inline static u8 *recvframe_pull(union recv_frame *precvframe, sint sz) } -__inline static u8 *recvframe_put(union recv_frame *precvframe, sint sz) +__inline static u8 *recvframe_put(union recv_frame *precvframe, __le16 le_sz) { - /* rx_tai += sz; move rx_tail sz bytes hereafter */ - + s16 sz = le16_to_cpu(le_sz); /* used for append sz bytes from ptr to rx_tail, update rx_tail and return the updated rx_tail to the caller */ /* after putting, rx_tail must be still larger than rx_end. */ unsigned char *prev_rx_tail; - /* RTW_INFO("recvframe_put: len=%d\n", sz); */ - - if (precvframe == NULL) + if (!precvframe) return NULL; prev_rx_tail = precvframe->u.hdr.rx_tail; @@ -654,7 +651,6 @@ __inline static u8 *recvframe_put(union recv_frame *precvframe, sint sz) precvframe->u.hdr.len += sz; return precvframe->u.hdr.rx_tail; - } diff --git a/include/usb_osintf.h b/include/usb_osintf.h index 9c39520..92e30dd 100644 --- a/include/usb_osintf.h +++ b/include/usb_osintf.h @@ -26,6 +26,8 @@ u8 usbvendorrequest(struct dvobj_priv *pdvobjpriv, RT_USB_BREQUEST brequest, RT_USB_WVALUE wvalue, u8 windex, void *data, u8 datalen, u8 isdirectionin); - +void nat25_db_expire(_adapter *priv); +int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method); +int nat25_handle_frame(_adapter *priv, struct sk_buff *skb); #endif diff --git a/include/wifi.h b/include/wifi.h index 469720f..aaeb5fe 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -303,7 +303,7 @@ enum WIFI_REG_DOMAIN { *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \ } while (0) -#define GetMFrag(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_MORE_FRAG_)) != 0) +#define GetMFrag(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf)) & (_MORE_FRAG_)) != 0) #define ClearMFrag(pbuf) \ do { \ @@ -327,7 +327,7 @@ enum WIFI_REG_DOMAIN { *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_); \ } while (0) -#define GetPwrMgt(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_PWRMGT_)) != 0) +#define GetPwrMgt(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf)) & (_PWRMGT_)) != 0) #define ClearPwrMgt(pbuf) \ do { \ @@ -339,7 +339,7 @@ enum WIFI_REG_DOMAIN { *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_); \ } while (0) -#define GetMData(pbuf) (((*(__le16 *)(pbuf)) & le16_to_cpu(_MORE_DATA_)) != 0) +#define GetMData(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf)) & (_MORE_DATA_)) != 0) #define ClearMData(pbuf) \ do { \ @@ -359,7 +359,7 @@ enum WIFI_REG_DOMAIN { } while (0) -#define GetOrder(pbuf) (((*(__le16 *)(pbuf)) & le16_to_cpu(_ORDER_)) != 0) +#define GetOrder(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf)) & (_ORDER_)) != 0) #define GetFrameType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2))) @@ -388,7 +388,7 @@ enum WIFI_REG_DOMAIN { #define SetFragNum(pbuf, num) \ do { \ *(__le16 *)((SIZE_PTR)(pbuf) + 22) = \ - ((*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) & cpu_to_le16(~(0x000f))) | \ + ((*(__le16 *)((SIZE_PTR)(pbuf) + 22)) & cpu_to_le16(~(0x000f))) | \ cpu_to_le16(0x0f & (num)); \ } while (0) @@ -410,7 +410,7 @@ enum WIFI_REG_DOMAIN { *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf); \ } while (0) -#define GetPriority(pbuf) ((le16_to_cpu(*(unsigned short *)(pbuf))) & 0xf) +#define GetPriority(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf) #define SetEOSP(pbuf, eosp) \ do { \ @@ -422,18 +422,18 @@ enum WIFI_REG_DOMAIN { *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5); \ } while (0) -#define GetAckpolicy(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 5) & 0x3) +#define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3) -#define GetAMsdu(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 7) & 0x1) +#define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1) #define SetAMsdu(pbuf, amsdu) \ do { \ *(__le16 *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7); \ } while (0) -#define GetAid(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 2)) & 0x3fff) +#define GetAid(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + 2)) & 0x3fff) -#define GetTid(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + (((GetToDs(pbuf)<<1) | GetFrDs(pbuf)) == 3 ? 30 : 24))) & 0x000f) +#define GetTid(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + (((GetToDs(pbuf)<<1) | GetFrDs(pbuf)) == 3 ? 30 : 24))) & 0x000f) #define GetAddr1Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 4)) diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index 0358144..3f8100d 100644 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -187,35 +187,35 @@ static struct ieee80211_channel rtw_5ghz_a_channels[] = { }; -void rtw_2g_channels_init(struct ieee80211_channel *channels) +static void rtw_2g_channels_init(struct ieee80211_channel *channels) { _rtw_memcpy((void *)channels, (void *)rtw_2ghz_channels, sizeof(struct ieee80211_channel) * RTW_2G_CHANNELS_NUM ); } -void rtw_5g_channels_init(struct ieee80211_channel *channels) +static void rtw_5g_channels_init(struct ieee80211_channel *channels) { _rtw_memcpy((void *)channels, (void *)rtw_5ghz_a_channels, sizeof(struct ieee80211_channel) * RTW_5G_CHANNELS_NUM ); } -void rtw_2g_rates_init(struct ieee80211_rate *rates) +static void rtw_2g_rates_init(struct ieee80211_rate *rates) { _rtw_memcpy(rates, rtw_g_rates, sizeof(struct ieee80211_rate) * RTW_G_RATES_NUM ); } -void rtw_5g_rates_init(struct ieee80211_rate *rates) +static void rtw_5g_rates_init(struct ieee80211_rate *rates) { _rtw_memcpy(rates, rtw_a_rates, sizeof(struct ieee80211_rate) * RTW_A_RATES_NUM ); } -struct ieee80211_supported_band *rtw_spt_band_alloc( +static struct ieee80211_supported_band *rtw_spt_band_alloc( enum nl80211_band band ) { @@ -260,7 +260,7 @@ exit: return spt_band; } -void rtw_spt_band_free(struct ieee80211_supported_band *spt_band) +static void rtw_spt_band_free(struct ieee80211_supported_band *spt_band) { u32 size = 0; @@ -415,9 +415,8 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net size_t buf_size = MAX_BSSINFO_LEN; size_t len, bssinf_len = 0; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - struct wireless_dev *wdev = padapter->rtw_wdev; struct wiphy *wiphy = wdev->wiphy; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -453,13 +452,10 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net freq = rtw_ch2freq(channel); notify_channel = ieee80211_get_channel(wiphy, freq); - if (0) - notify_timestamp = le64_to_cpu(*(u64 *)rtw_get_timestampe_from_ie(pnetwork->network.IEs)); - else - notify_timestamp = rtw_get_systime_us(); + notify_timestamp = rtw_get_systime_us(); - notify_interval = le16_to_cpu(*(u16 *)rtw_get_beacon_interval_from_ie(pnetwork->network.IEs)); - notify_capability = le16_to_cpu(*(u16 *)rtw_get_capability_from_ie(pnetwork->network.IEs)); + notify_interval = le16_to_cpu(*(__le16 *)rtw_get_beacon_interval_from_ie(pnetwork->network.IEs)); + notify_capability = le16_to_cpu(*(__le16 *)rtw_get_capability_from_ie(pnetwork->network.IEs)); notify_ie = pnetwork->network.IEs + _FIXED_IE_LENGTH_; notify_ielen = pnetwork->network.IELength - _FIXED_IE_LENGTH_; @@ -472,17 +468,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net notify_signal = 100 * translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength); /* dbm */ } -#if 0 - RTW_INFO("bssid: "MAC_FMT"\n", MAC_ARG(pnetwork->network.MacAddress)); - RTW_INFO("Channel: %d(%d)\n", channel, freq); - RTW_INFO("Capability: %X\n", notify_capability); - RTW_INFO("Beacon interval: %d\n", notify_interval); - RTW_INFO("Signal: %d\n", notify_signal); - RTW_INFO("notify_timestamp: %llu\n", notify_timestamp); -#endif - /* pbuf = buf; */ - pwlanhdr = (struct rtw_ieee80211_hdr *)pbuf; fctrl = &(pwlanhdr->frame_ctl); *(fctrl) = 0; @@ -505,7 +491,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net /* pbuf += sizeof(struct rtw_ieee80211_hdr_3addr); */ len = sizeof(struct rtw_ieee80211_hdr_3addr); _rtw_memcpy((pbuf + len), pnetwork->network.IEs, pnetwork->network.IELength); - *((u64 *)(pbuf + len)) = cpu_to_le64(notify_timestamp); + *((__le64 *)(pbuf + len)) = cpu_to_le64(notify_timestamp); len += pnetwork->network.IELength; @@ -745,7 +731,7 @@ check_bss: struct ieee80211_channel *notify_channel; u32 freq; u16 channel = cur_network->network.Configuration.DSConfig; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) struct cfg80211_roam_info roam_info = {}; #endif @@ -754,7 +740,7 @@ check_bss: #endif RTW_INFO(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(4, 12, 0)) roam_info.channel = notify_channel; roam_info.bssid = cur_network->network.MacAddress; roam_info.req_ie = @@ -1268,7 +1254,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param #ifdef CONFIG_RTW_80211R psta->ft_pairwise_key_installed = _TRUE; #endif - /* DEBUG_ERR((" param->u.crypt.key_len=%d\n",param->u.crypt.key_len)); */ + /* DEBUG_ERR((" param->u.crypt.key_len=%d\n", param->u.crypt.key_len)); */ RTW_INFO(" ~~~~set sta key:unicastkey\n"); rtw_setstakey_cmd(padapter, psta, UNICAST_KEY, _TRUE); @@ -2009,7 +1995,7 @@ void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork) } /* if target wps scan ongoing, target_ssid is filled */ -int rtw_cfg80211_is_target_wps_scan(struct cfg80211_scan_request *scan_req, struct cfg80211_ssid *target_ssid) +static int rtw_cfg80211_is_target_wps_scan(struct cfg80211_scan_request *scan_req, struct cfg80211_ssid *target_ssid) { int ret = 0; @@ -3687,9 +3673,9 @@ static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_de /* Check if this ia a Wireless Distribution System (WDS) frame * which has 4 MAC addresses */ - if (dot11_hdr->frame_ctl & 0x0080) + if (le16_to_cpu(dot11_hdr->frame_ctl) & 0x0080) qos_len = 2; - if ((dot11_hdr->frame_ctl & 0x0300) == 0x0300) + if ((le16_to_cpu(dot11_hdr->frame_ctl) & 0x0300) == 0x0300) dot11_hdr_len += 6; memcpy(dst_mac_addr, dot11_hdr->addr1, sizeof(dst_mac_addr)); @@ -3848,7 +3834,7 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct ne mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; strncpy(mon_ndev->name, name, IFNAMSIZ); mon_ndev->name[IFNAMSIZ - 1] = 0; -#if (LINUX_VERSION_CODE>=KERNEL_VERSION(4,11,9)) +#if (LINUX_VERSION_CODE>=KERNEL_VERSION(4, 11, 9)) mon_ndev->needs_free_netdev = false; mon_ndev->priv_destructor = rtw_ndev_destructor; #else @@ -3902,20 +3888,20 @@ out: return ret; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) static struct wireless_dev * -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) static struct net_device * #else static int #endif cfg80211_rtw_add_virtual_intf(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)) const char *name, #else char *name, #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) unsigned char name_assign_type, #endif enum nl80211_iftype type, @@ -4422,7 +4408,7 @@ static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *n return 0; } -struct sta_info *rtw_sta_info_get_by_idx(const int idx, struct sta_priv *pstapriv) +static struct sta_info *rtw_sta_info_get_by_idx(const int idx, struct sta_priv *pstapriv) { @@ -4665,7 +4651,7 @@ void rtw_cfg80211_rx_probe_request(_adapter *adapter, union recv_frame *rframe) RTW_INFO("RTW_Rx: probe request, ch=%d(%d)\n", ch, sch); #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) rtw_cfg80211_rx_mgmt(wdev, freq, 0, frame, frame_len, GFP_ATOMIC); #else cfg80211_rx_action(adapter->pnetdev, freq, frame, frame_len, GFP_ATOMIC); @@ -4820,7 +4806,7 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; u8 action = P2P_PUB_ACTION_ACTION; u8 dialogToken = 1; - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_PROVISION_DISC_REQ; u32 p2pielen = 0; #ifdef CONFIG_WFD @@ -4831,15 +4817,14 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - struct wifidirect_info *pwdinfo = &(padapter->wdinfo); u8 *frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr)); size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr); - + __be16 be_tmp; RTW_INFO("[%s] In\n", __FUNCTION__); @@ -4850,8 +4835,8 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, pwdinfo->tx_prov_disc_info.wps_config_method_request = WPS_CM_PUSH_BUTTON; rtw_get_wps_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, wpsie, &wpsielen); - rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_DEVICE_PWID, (u8 *) &wps_devicepassword_id, &wps_devicepassword_id_len); - wps_devicepassword_id = be16_to_cpu(wps_devicepassword_id); + rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_DEVICE_PWID, (u8 *)&be_tmp, &wps_devicepassword_id_len); + wps_devicepassword_id = be16_to_cpu(be_tmp); switch (wps_devicepassword_id) { case WPS_DPID_PIN: @@ -4874,15 +4859,11 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, break; } - if (rtw_get_p2p_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, p2p_ie, &p2p_ielen)) { - rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, devinfo_content, &devinfo_contentlen); rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&capability, &capability_len); - } - /* start to build provision_request frame */ _rtw_memset(wpsie, 0, sizeof(wpsie)); _rtw_memset(p2p_ie, 0, sizeof(p2p_ie)); @@ -4892,7 +4873,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, if (pmgntframe == NULL) return; - /* update attribute */ pattrib = &pmgntframe->attrib; update_mgntframe_attrib(padapter, pattrib); @@ -4976,16 +4956,16 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, wpsielen = 0; /* WPS OUI */ - *(u32 *)(wpsie) = cpu_to_be32(WPSOUI); + *(__be32 *)(wpsie) = cpu_to_be32(WPSOUI); wpsielen += 4; /* WPS version */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); wpsielen += 2; /* Value: */ @@ -4993,15 +4973,15 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, /* Config Method */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_CONF_METHOD); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_CONF_METHOD); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); wpsielen += 2; /* Value: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->tx_prov_disc_info.wps_config_method_request); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->tx_prov_disc_info.wps_config_method_request); wpsielen += 2; pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen); @@ -6309,7 +6289,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu wps_ie = rtw_get_wps_ie(buf, len, NULL, &wps_ielen); if (wps_ie) { uint attr_contentlen = 0; - u16 uconfig_method, *puconfig_method = NULL; + __be16 uconfig_method, *puconfig_method = NULL; #ifdef CONFIG_DEBUG_CFG80211 RTW_INFO("probe_resp_wps_ielen=%d\n", wps_ielen); @@ -6342,7 +6322,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu } /* add PUSH_BUTTON config_method by driver self in wpsie of probe_resp at GO Mode */ - puconfig_method = (u16 *)rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_CONF_METHOD , NULL, &attr_contentlen); + puconfig_method = (__be16 *)rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_CONF_METHOD , NULL, &attr_contentlen); if (puconfig_method != NULL) { /* struct registry_priv *pregistrypriv = &padapter->registrypriv; */ struct wireless_dev *wdev = padapter->rtw_wdev; @@ -6354,8 +6334,7 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) /* for WIFI-DIRECT LOGO 4.2.2, AUTO GO can't set PUSH_BUTTON flags */ if (wdev->iftype == NL80211_IFTYPE_P2P_GO) { - uconfig_method = WPS_CM_PUSH_BUTTON; - uconfig_method = cpu_to_be16(uconfig_method); + uconfig_method = cpu_to_be16(WPS_CM_PUSH_BUTTON); *puconfig_method &= ~uconfig_method; } @@ -6376,16 +6355,17 @@ static int rtw_cfg80211_set_probe_resp_wpsp2pie(struct net_device *net, char *bu u8 is_GO = _FALSE; u32 attr_contentlen = 0; u16 cap_attr = 0; + __le16 le_tmp; #ifdef CONFIG_DEBUG_CFG80211 RTW_INFO("probe_resp_p2p_ielen=%d\n", p2p_ielen); #endif /* Check P2P Capability ATTR */ - if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&cap_attr, (uint *) &attr_contentlen)) { + if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_CAPABILITY, (u8 *)&le_tmp, (uint *)&attr_contentlen)) { u8 grp_cap = 0; /* RTW_INFO( "[%s] Got P2P Capability Attr!!\n", __FUNCTION__ ); */ - cap_attr = le16_to_cpu(cap_attr); + cap_attr = le16_to_cpu(le_tmp); grp_cap = (u8)((cap_attr >> 8) & 0xff); is_GO = (grp_cap & BIT(0)) ? _TRUE : _FALSE; @@ -6647,12 +6627,17 @@ static void rtw_cfg80211_init_ht_capab(_adapter *padapter, struct ieee80211_sta_ RTW_INFO("%s, error rf_type=%d\n", __func__, rf_type); }; - ht_cap->mcs.rx_highest = rtw_mcs_rate(rf_type - , hal_is_bw_support(padapter, CHANNEL_WIDTH_40) - , hal_is_bw_support(padapter, CHANNEL_WIDTH_40) ? ht_cap->cap & IEEE80211_HT_CAP_SGI_40 : ht_cap->cap & IEEE80211_HT_CAP_SGI_20 - , ht_cap->mcs.rx_mask - ); + ht_cap->mcs.rx_highest = + cpu_to_le16(rtw_mcs_rate(rf_type, + hal_is_bw_support(padapter, + CHANNEL_WIDTH_40), + hal_is_bw_support(padapter, + CHANNEL_WIDTH_40) ? + ht_cap->cap & IEEE80211_HT_CAP_SGI_40 : + ht_cap->cap & IEEE80211_HT_CAP_SGI_20, + ht_cap->mcs.rx_mask)); } + void rtw_cfg80211_init_wdev_data(_adapter *padapter) { #ifdef CONFIG_CONCURRENT_MODE @@ -6694,7 +6679,7 @@ void rtw_cfg80211_init_wiphy(_adapter *padapter) } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) -struct ieee80211_iface_limit rtw_limits[] = { +static struct ieee80211_iface_limit rtw_limits[] = { { .max = 2, .types = BIT(NL80211_IFTYPE_STATION) @@ -6719,7 +6704,7 @@ struct ieee80211_iface_limit rtw_limits[] = { #endif }; -struct ieee80211_iface_combination rtw_combinations[] = { +static struct ieee80211_iface_combination rtw_combinations[] = { { .limits = rtw_limits, .n_limits = ARRAY_SIZE(rtw_limits), @@ -6809,7 +6794,7 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) #endif #if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; #else // kernel >= 4.12 wiphy->max_sched_scan_reqs = 1; diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index 112a264..cc590f6 100644 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "../../hal/phydm/phydm_precomp.h" #ifdef RTW_HALMAC #include "../../hal/hal_halmac.h" @@ -43,10 +44,6 @@ extern int rtw_ht_enable; #define MAX_CUSTOM_LEN 64 #define RATE_COUNT 4 -#ifdef CONFIG_GLOBAL_UI_PID -extern int ui_pid[3]; -#endif - /* combo scan */ #define WEXT_CSCAN_AMOUNT 9 #define WEXT_CSCAN_BUF_LEN 360 @@ -66,7 +63,7 @@ extern u8 str_2char2num(u8 hch, u8 lch); extern void macstr2num(u8 *dst, u8 *src); extern u8 convert_ip_addr(u8 hch, u8 mch, u8 lch); -u32 rtw_rates[] = {1000000, 2000000, 5500000, 11000000, +static u32 rtw_rates[] = {1000000, 2000000, 5500000, 11000000, 6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000}; static const char *const iw_operation_mode[] = { @@ -512,11 +509,12 @@ static inline char *iwe_stream_rate_process(_adapter *padapter, p = rtw_get_ie(&pnetwork->network.IEs[ie_offset], _HT_CAPABILITY_IE_, &ht_ielen, pnetwork->network.IELength - ie_offset); if (p && ht_ielen > 0) { struct rtw_ieee80211_ht_cap *pht_capie; + ht_cap = _TRUE; pht_capie = (struct rtw_ieee80211_ht_cap *)(p + 2); _rtw_memcpy(&mcs_rate , pht_capie->supp_mcs_set, 2); - bw_40MHz = (pht_capie->cap_info & IEEE80211_HT_CAP_SUP_WIDTH) ? 1 : 0; - short_GI = (pht_capie->cap_info & (IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40)) ? 1 : 0; + bw_40MHz = (le16_to_cpu(pht_capie->cap_info) & IEEE80211_HT_CAP_SUP_WIDTH) ? 1 : 0; + short_GI = (le16_to_cpu(pht_capie->cap_info) & (IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40)) ? 1 : 0; } #ifdef CONFIG_80211AC_VHT @@ -813,19 +811,18 @@ static char *translate_scan(_adapter *padapter, { struct iw_event iwe; u16 cap = 0; - _rtw_memset(&iwe, 0, sizeof(iwe)); + __le16 le_tmp; + _rtw_memset(&iwe, 0, sizeof(iwe)); if (_FALSE == search_p2p_wfd_ie(padapter, info, pnetwork, start, stop)) return start; start = iwe_stream_mac_addr_proess(padapter, info, pnetwork, start, stop, &iwe); start = iwe_stream_essid_proess(padapter, info, pnetwork, start, stop, &iwe); start = iwe_stream_protocol_process(padapter, info, pnetwork, start, stop, &iwe); - if (pnetwork->network.Reserved[0] == 2) /* Probe Request */ - cap = 0; - else { - _rtw_memcpy((u8 *)&cap, rtw_get_capability_from_ie(pnetwork->network.IEs), 2); - cap = le16_to_cpu(cap); + if (pnetwork->network.Reserved[0] != 2) { /* Probe Request */ + _rtw_memcpy((u8 *)&le_tmp, rtw_get_capability_from_ie(pnetwork->network.IEs), 2); + cap = le16_to_cpu(le_tmp); } start = iwe_stream_mode_process(padapter, info, pnetwork, start, stop, &iwe, cap); @@ -2366,9 +2363,9 @@ static int rtw_wx_set_mlme(struct net_device *dev, if (mlme == NULL) return -1; - RTW_INFO("%s\n", __FUNCTION__); + RTW_INFO("%s\n", __func__); - reason = cpu_to_le16(mlme->reason_code); + reason = mlme->reason_code; RTW_INFO("%s, cmd=%d, reason=%d\n", __FUNCTION__, mlme->cmd, reason); @@ -4067,11 +4064,10 @@ static void rtw_dbg_mode_hdl(_adapter *padapter, u32 id, u8 *pdata, u32 len) value = prfreg->value; rtw_hal_write_rfreg(padapter, path, offset, 0xffffffff, value); - break; case GEN_MP_IOCTL_SUBCODE(TRIGGER_GPIO): RTW_INFO("==> trigger gpio 0\n"); - rtw_hal_set_hwreg(padapter, HW_VAR_TRIGGER_GPIO_0, 0); + rtw_hal_set_hwreg(padapter, HW_VAR_TRIGGER_GPIO_0, NULL); break; #ifdef CONFIG_BT_COEXIST case GEN_MP_IOCTL_SUBCODE(SET_DM_BT): @@ -4092,8 +4088,8 @@ static void rtw_dbg_mode_hdl(_adapter *padapter, u32 id, u8 *pdata, u32 len) default: break; } - } + #ifdef MP_IOCTL_HDL static int rtw_mp_ioctl_hdl(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -4804,7 +4800,8 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, _queue *queue = &(pmlmepriv->scanned_queue); struct wlan_network *pnetwork = NULL; u8 blnMatch = 0; - u16 attr_content = 0; + u16 attr_content; + __be16 be_tmp; uint attr_contentlen = 0; u8 attr_content_str[P2P_PRIVATE_IOCTL_SET_LEN] = { 0x00 }; @@ -4835,19 +4832,16 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev, wpsie = rtw_get_wps_ie_from_scan_queue(&pnetwork->network.IEs[0], pnetwork->network.IELength, NULL, &wpsie_len, pnetwork->network.Reserved[0]); if (wpsie) { - rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_CONF_METHOD, (u8 *)&attr_content, &attr_contentlen); + rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_CONF_METHOD, (u8 *)&be_tmp, &attr_contentlen); if (attr_contentlen) { - attr_content = be16_to_cpu(attr_content); + attr_content = be16_to_cpu(be_tmp); sprintf(attr_content_str, "\n\nM=%.4d", attr_content); blnMatch = 1; } } - break; } - plist = get_next(plist); - } _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); @@ -5055,10 +5049,11 @@ static int rtw_p2p_get_device_type(struct net_device *dev, if (wpsie) { rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_PRIMARY_DEV_TYPE, dev_type, &dev_type_len); if (dev_type_len) { - u16 type = 0; + u16 type; + __be16 be_tmp; - _rtw_memcpy(&type, dev_type, 2); - type = be16_to_cpu(type); + _rtw_memcpy(&be_tmp, dev_type, 2); + type = be16_to_cpu(be_tmp); sprintf(dev_type_str, "\n\nN=%.2d", type); blnMatch = 1; } @@ -6264,11 +6259,8 @@ static int rtw_p2p_get(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; - #ifdef CONFIG_P2P - _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct iw_point *pdata = &wrqu->data; @@ -6276,34 +6268,34 @@ static int rtw_p2p_get(struct net_device *dev, struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; if (padapter->bShowGetP2PState) - RTW_INFO("[%s] extra = %s\n", __FUNCTION__, (char *) wrqu->data.pointer); + RTW_INFO("[%s] extra = %s\n", __func__, (char *)wrqu->data.pointer); - if (_rtw_memcmp(wrqu->data.pointer, "status", 6)) + if (_rtw_memcmp((__force void *)wrqu->data.pointer, "status", 6)) rtw_p2p_get_status(dev, info, wrqu, extra); - else if (_rtw_memcmp(wrqu->data.pointer, "role", 4)) + else if (_rtw_memcmp((__force void *)wrqu->data.pointer, "role", 4)) rtw_p2p_get_role(dev, info, wrqu, extra); - else if (_rtw_memcmp(wrqu->data.pointer, "peer_ifa", 8)) + else if (_rtw_memcmp((__force void *)wrqu->data.pointer, "peer_ifa", 8)) rtw_p2p_get_peer_ifaddr(dev, info, wrqu, extra); - else if (_rtw_memcmp(wrqu->data.pointer, "req_cm", 6)) + else if (_rtw_memcmp((__force void *)wrqu->data.pointer, "req_cm", 6)) rtw_p2p_get_req_cm(dev, info, wrqu, extra); - else if (_rtw_memcmp(wrqu->data.pointer, "peer_deva", 9)) { + else if (_rtw_memcmp((__force void *)wrqu->data.pointer, "peer_deva", 9)) { /* Get the P2P device address when receiving the provision discovery request frame. */ rtw_p2p_get_peer_devaddr(dev, info, wrqu, extra); - } else if (_rtw_memcmp(wrqu->data.pointer, "group_id", 8)) + } else if (_rtw_memcmp((__force void *)wrqu->data.pointer, "group_id", 8)) rtw_p2p_get_groupid(dev, info, wrqu, extra); - else if (_rtw_memcmp(wrqu->data.pointer, "inv_peer_deva", 13)) { + else if (_rtw_memcmp((__force void *)wrqu->data.pointer, "inv_peer_deva", 13)) { /* Get the P2P device address when receiving the P2P Invitation request frame. */ rtw_p2p_get_peer_devaddr_by_invitation(dev, info, wrqu, extra); - } else if (_rtw_memcmp(wrqu->data.pointer, "op_ch", 5)) + } else if (_rtw_memcmp((__force void *)wrqu->data.pointer, "op_ch", 5)) rtw_p2p_get_op_ch(dev, info, wrqu, extra); #ifdef CONFIG_WFD if (hal_chk_wl_func(padapter, WL_FUNC_MIRACAST)) { - if (_rtw_memcmp(wrqu->data.pointer, "peer_port", 9)) + if (_rtw_memcmp((__force void *)wrqu->data.pointer, "peer_port", 9)) rtw_p2p_get_peer_wfd_port(dev, info, wrqu, extra); - else if (_rtw_memcmp(wrqu->data.pointer, "wfd_sa", 6)) + else if (_rtw_memcmp((__force void *)wrqu->data.pointer, "wfd_sa", 6)) rtw_p2p_get_peer_wfd_session_available(dev, info, wrqu, extra); - else if (_rtw_memcmp(wrqu->data.pointer, "wfd_pc", 6)) + else if (_rtw_memcmp((__force void *)wrqu->data.pointer, "wfd_pc", 6)) rtw_p2p_get_peer_wfd_preferred_connection(dev, info, wrqu, extra); } #endif /* CONFIG_WFD */ @@ -9026,7 +9018,7 @@ static int rtw_mp_efuse_get(struct net_device *dev, struct pwrctrl_priv *pwrctrlpriv ; u8 *data = NULL; u8 *rawdata = NULL; - char *pch, *ptmp, *token, *tmp[3] = {0x00, 0x00, 0x00}; + char *pch, *ptmp, *token, *tmp[3] = {NULL, NULL, NULL}; u16 i = 0, j = 0, mapLen = 0, addr = 0, cnts = 0; u16 max_available_len = 0, raw_cursize = 0, raw_maxsize = 0; u16 mask_len; @@ -9689,7 +9681,7 @@ static int rtw_mp_efuse_set(struct net_device *dev, u8 *ShadowMapBT = NULL; u8 *ShadowMapWiFi = NULL; u8 *setrawdata = NULL; - char *pch, *ptmp, *token, *tmp[3] = {0x00, 0x00, 0x00}; + char *pch, *ptmp, *token, *tmp[3] = {NULL, NULL, NULL}; u16 addr = 0xFF, cnts = 0, BTStatus = 0 , max_available_len = 0; u16 wifimaplen; int err; diff --git a/os_dep/mlme_linux.c b/os_dep/mlme_linux.c index bc60b0e..8a2d04d 100644 --- a/os_dep/mlme_linux.c +++ b/os_dep/mlme_linux.c @@ -22,7 +22,7 @@ #define _MLME_OSDEP_C_ #include - +#include #ifdef RTK_DMP_PLATFORM void Linkup_workitem_callback(struct work_struct *work) @@ -187,9 +187,6 @@ void rtw_init_mlme_timer(_adapter *padapter) } -extern void rtw_indicate_wx_assoc_event(_adapter *padapter); -extern void rtw_indicate_wx_disassoc_event(_adapter *padapter); - void rtw_os_indicate_connect(_adapter *adapter) { struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 29c7af2..39de2c2 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -108,12 +108,12 @@ int rtw_uapsd_acbe_en = 0; int rtw_uapsd_acvi_en = 0; int rtw_uapsd_acvo_en = 0; #if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) - int rtw_pwrtrim_enable = 2; /* disable kfree , rename to power trim disable */ + static int rtw_pwrtrim_enable = 2; /* disable kfree , rename to power trim disable */ #else - int rtw_pwrtrim_enable = 0; /* Default Enalbe power trim by efuse config */ + static int rtw_pwrtrim_enable = 0; /* Default Enalbe power trim by efuse config */ #endif -uint rtw_tx_bw_mode = 0x21; +static uint rtw_tx_bw_mode = 0x21; module_param(rtw_tx_bw_mode, uint, 0644); MODULE_PARM_DESC(rtw_tx_bw_mode, "The max tx bw for 2.4G and 5G. format is the same as rtw_bw_mode"); @@ -124,22 +124,22 @@ int rtw_ht_enable = 1; * 0x21 means enable 2.4G 40MHz & 5G 80MHz */ int rtw_bw_mode = 0x21; int rtw_ampdu_enable = 1;/* for enable tx_ampdu , */ /* 0: disable, 0x1:enable */ -int rtw_rx_stbc = 1;/* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */ +static int rtw_rx_stbc = 1;/* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */ #if (defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B)) && defined(CONFIG_PCI_HCI) -int rtw_ampdu_amsdu = 2;/* 0: disabled, 1:enabled, 2:auto . There is an IOT issu with DLINK DIR-629 when the flag turn on */ +static int rtw_ampdu_amsdu = 2;/* 0: disabled, 1:enabled, 2:auto . There is an IOT issu with DLINK DIR-629 when the flag turn on */ #else -int rtw_ampdu_amsdu = 0;/* 0: disabled, 1:enabled, 2:auto . There is an IOT issu with DLINK DIR-629 when the flag turn on */ +static int rtw_ampdu_amsdu = 0;/* 0: disabled, 1:enabled, 2:auto . There is an IOT issu with DLINK DIR-629 when the flag turn on */ #endif /* Short GI support Bit Map * BIT0 - 20MHz, 0: non-support, 1: support * BIT1 - 40MHz, 0: non-support, 1: support * BIT2 - 80MHz, 0: non-support, 1: support * BIT3 - 160MHz, 0: non-support, 1: support */ -int rtw_short_gi = 0xf; +static int rtw_short_gi = 0xf; /* BIT0: Enable VHT LDPC Rx, BIT1: Enable VHT LDPC Tx, BIT4: Enable HT LDPC Rx, BIT5: Enable HT LDPC Tx */ -int rtw_ldpc_cap = 0x33; +static int rtw_ldpc_cap = 0x33; /* BIT0: Enable VHT STBC Rx, BIT1: Enable VHT STBC Tx, BIT4: Enable HT STBC Rx, BIT5: Enable HT STBC Tx */ -int rtw_stbc_cap = 0x13; +static int rtw_stbc_cap = 0x13; /* * BIT0: Enable VHT SU Beamformer * BIT1: Enable VHT SU Beamformee @@ -148,52 +148,52 @@ int rtw_stbc_cap = 0x13; * BIT4: Enable HT Beamformer * BIT5: Enable HT Beamformee */ -int rtw_beamform_cap = BIT(1) | BIT(3); -int rtw_bfer_rf_number = 0; /*BeamformerCapRfNum Rf path number, 0 for auto, others for manual*/ -int rtw_bfee_rf_number = 0; /*BeamformeeCapRfNum Rf path number, 0 for auto, others for manual*/ +static int rtw_beamform_cap = BIT(1) | BIT(3); +static int rtw_bfer_rf_number = 0; /*BeamformerCapRfNum Rf path number, 0 for auto, others for manual*/ +static int rtw_bfee_rf_number = 0; /*BeamformeeCapRfNum Rf path number, 0 for auto, others for manual*/ #endif /* CONFIG_80211N_HT */ #ifdef CONFIG_80211AC_VHT -int rtw_vht_enable = 1; /* 0:disable, 1:enable, 2:force auto enable */ +static int rtw_vht_enable = 1; /* 0:disable, 1:enable, 2:force auto enable */ module_param(rtw_vht_enable, int, 0644); -int rtw_ampdu_factor = 7; +static int rtw_ampdu_factor = 7; -uint rtw_vht_rx_mcs_map = 0xaaaa; +static uint rtw_vht_rx_mcs_map = 0xaaaa; module_param(rtw_vht_rx_mcs_map, uint, 0644); MODULE_PARM_DESC(rtw_vht_rx_mcs_map, "VHT RX MCS map"); #endif /* CONFIG_80211AC_VHT */ -int rtw_lowrate_two_xmit = 1;/* Use 2 path Tx to transmit MCS0~7 and legacy mode */ +static int rtw_lowrate_two_xmit = 1;/* Use 2 path Tx to transmit MCS0~7 and legacy mode */ -int rtw_rf_config = RF_TYPE_AUTO; +static int rtw_rf_config = RF_TYPE_AUTO; module_param(rtw_rf_config, int, 0644); /* 0: not check in watch dog, 1: check in watch dog */ -int rtw_check_hw_status = 0; +static int rtw_check_hw_status = 0; -int rtw_low_power = 0; +static int rtw_low_power = 0; #ifdef CONFIG_WIFI_TEST - int rtw_wifi_spec = 1;/* for wifi test */ + static int rtw_wifi_spec = 1;/* for wifi test */ #else - int rtw_wifi_spec = 0; + static int rtw_wifi_spec = 0; #endif #ifdef CONFIG_DEFAULT_PATTERNS_EN - bool rtw_support_default_patterns = _TRUE; + static bool rtw_support_default_patterns = _TRUE; #else - bool rtw_support_default_patterns = _FALSE; + static bool rtw_support_default_patterns = _FALSE; #endif -int rtw_special_rf_path = 0; /* 0: 2T2R ,1: only turn on path A 1T1R */ +static int rtw_special_rf_path = 0; /* 0: 2T2R ,1: only turn on path A 1T1R */ -char rtw_country_unspecified[] = {0xFF, 0xFF, 0x00}; -char *rtw_country_code = rtw_country_unspecified; +static char rtw_country_unspecified[] = {0xFF, 0xFF, 0x00}; +static char *rtw_country_code = rtw_country_unspecified; module_param(rtw_country_code, charp, 0644); MODULE_PARM_DESC(rtw_country_code, "The default country code (in alpha2)"); -int rtw_channel_plan = RTW_CHPLAN_MAX; +static int rtw_channel_plan = RTW_CHPLAN_MAX; module_param(rtw_channel_plan, int, 0644); MODULE_PARM_DESC(rtw_channel_plan, "The default chplan ID when rtw_alpha2 is not specified or valid"); @@ -205,54 +205,54 @@ MODULE_PARM_DESC(rtw_excl_chs, "exclusive channel array"); /*if concurrent softap + p2p(GO) is needed, this param lets p2p response full channel list. But Softap must be SHUT DOWN once P2P decide to set up connection and become a GO.*/ #ifdef CONFIG_FULL_CH_IN_P2P_HANDSHAKE - int rtw_full_ch_in_p2p_handshake = 1; /* reply full channel list*/ + static int rtw_full_ch_in_p2p_handshake = 1; /* reply full channel list*/ #else - int rtw_full_ch_in_p2p_handshake = 0; /* reply only softap channel*/ + static int rtw_full_ch_in_p2p_handshake = 0; /* reply only softap channel*/ #endif #ifdef CONFIG_BT_COEXIST -int rtw_btcoex_enable = 2; +static int rtw_btcoex_enable = 2; module_param(rtw_btcoex_enable, int, 0644); MODULE_PARM_DESC(rtw_btcoex_enable, "BT co-existence on/off, 0:off, 1:on, 2:by efuse"); -int rtw_ant_num = 0; +static int rtw_ant_num = 0; module_param(rtw_ant_num, int, 0644); MODULE_PARM_DESC(rtw_ant_num, "Antenna number setting, 0:by efuse"); -int rtw_bt_iso = 2;/* 0:Low, 1:High, 2:From Efuse */ -int rtw_bt_sco = 3;/* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter, 4.Busy, 5.OtherBusy */ -int rtw_bt_ampdu = 1 ; /* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */ +static int rtw_bt_iso = 2;/* 0:Low, 1:High, 2:From Efuse */ +static int rtw_bt_sco = 3;/* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter, 4.Busy, 5.OtherBusy */ +static int rtw_bt_ampdu = 1 ; /* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */ #endif /* CONFIG_BT_COEXIST */ -int rtw_AcceptAddbaReq = _TRUE;/* 0:Reject AP's Add BA req, 1:Accept AP's Add BA req. */ +static int rtw_AcceptAddbaReq = _TRUE;/* 0:Reject AP's Add BA req, 1:Accept AP's Add BA req. */ -int rtw_antdiv_cfg = 2; /* 0:OFF , 1:ON, 2:decide by Efuse config */ -int rtw_antdiv_type = 0 +static int rtw_antdiv_cfg = 2; /* 0:OFF , 1:ON, 2:decide by Efuse config */ +static int rtw_antdiv_type = 0 ; /* 0:decide by efuse 1: for 88EE, 1Tx and 1RxCG are diversity.(2 Ant with SPDT), 2: for 88EE, 1Tx and 2Rx are diversity.( 2 Ant, Tx and RxCG are both on aux port, RxCS is on main port ), 3: for 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) */ -int rtw_drv_ant_band_switch = 1; /* 0:OFF , 1:ON, Driver control antenna band switch*/ +static int rtw_drv_ant_band_switch = 1; /* 0:OFF , 1:ON, Driver control antenna band switch*/ /* 0: doesn't switch, 1: switch from usb2.0 to usb 3.0 2: switch from usb3.0 to usb 2.0 */ -int rtw_switch_usb_mode = 0; +static int rtw_switch_usb_mode = 0; #ifdef CONFIG_USB_AUTOSUSPEND -int rtw_enusbss = 1;/* 0:disable,1:enable */ +static int rtw_enusbss = 1;/* 0:disable,1:enable */ #else -int rtw_enusbss = 0;/* 0:disable,1:enable */ +static int rtw_enusbss = 0;/* 0:disable,1:enable */ #endif -int rtw_hwpdn_mode = 2; /* 0:disable,1:enable,2: by EFUSE config */ +static int rtw_hwpdn_mode = 2; /* 0:disable,1:enable,2: by EFUSE config */ #ifdef CONFIG_HW_PWRP_DETECTION -int rtw_hwpwrp_detect = 1; +static int rtw_hwpwrp_detect = 1; #else -int rtw_hwpwrp_detect = 0; /* HW power ping detect 0:disable , 1:enable */ +static int rtw_hwpwrp_detect = 0; /* HW power ping detect 0:disable , 1:enable */ #endif #ifdef CONFIG_USB_HCI -int rtw_hw_wps_pbc = 1; +static int rtw_hw_wps_pbc = 1; #else -int rtw_hw_wps_pbc = 0; +static int rtw_hw_wps_pbc = 0; #endif #ifdef CONFIG_TX_MCAST2UNI @@ -260,45 +260,45 @@ int rtw_mc2u_disable = 0; #endif /* CONFIG_TX_MCAST2UNI */ #ifdef CONFIG_80211D -int rtw_80211d = 0; +static int rtw_80211d = 0; #endif #ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV -int rtw_force_ant = 2;/* 0 :normal, 1:Main ant, 2:Aux ant */ -int rtw_force_igi = 0; /* 0 :normal */ +static int rtw_force_ant = 2;/* 0 :normal, 1:Main ant, 2:Aux ant */ +static int rtw_force_igi = 0; /* 0 :normal */ module_param(rtw_force_ant, int, 0644); module_param(rtw_force_igi, int, 0644); #endif -int rtw_force_igi_lb = CONFIG_RTW_FORCE_IGI_LB; +static int rtw_force_igi_lb = CONFIG_RTW_FORCE_IGI_LB; module_param(rtw_force_igi_lb, int, 0644); MODULE_PARM_DESC(rtw_force_igi_lb, "force IGI low-bound, 0:no specified"); #ifdef CONFIG_QOS_OPTIMIZATION -int rtw_qos_opt_enable = 1; /* 0: disable,1:enable */ +static int rtw_qos_opt_enable = 1; /* 0: disable,1:enable */ #else -int rtw_qos_opt_enable = 0; /* 0: disable,1:enable */ +static int rtw_qos_opt_enable = 0; /* 0: disable,1:enable */ #endif module_param(rtw_qos_opt_enable, int, 0644); #ifdef CONFIG_AUTO_CHNL_SEL_NHM -int rtw_acs_mode = 1; /*0:disable, 1:enable*/ +static int rtw_acs_mode = 1; /*0:disable, 1:enable*/ module_param(rtw_acs_mode, int, 0644); -int rtw_acs_auto_scan = 0; /*0:disable, 1:enable*/ +static int rtw_acs_auto_scan = 0; /*0:disable, 1:enable*/ module_param(rtw_acs_auto_scan, int, 0644); #endif -char *ifname = "wlan%d"; +static char *ifname = "wlan%d"; module_param(ifname, charp, 0644); MODULE_PARM_DESC(ifname, "The default name to allocate for first interface"); -char *if2name = "wlan%d"; +static char *if2name = "wlan%d"; module_param(if2name, charp, 0644); MODULE_PARM_DESC(if2name, "The default name to allocate for second interface"); -char *rtw_initmac = 0; /* temp mac address if users want to use instead of the mac address in Efuse */ +char *rtw_initmac = NULL; /* temp mac address if users want to use instead of the mac address in Efuse */ #ifdef CONFIG_CONCURRENT_MODE @@ -362,34 +362,34 @@ module_param(rtw_check_hw_status, int, 0644); module_param(rtw_early_mode, int, 0644); #endif #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE -char *rtw_adaptor_info_caching_file_path = "/data/misc/wifi/rtw_cache"; +static char *rtw_adaptor_info_caching_file_path = "/data/misc/wifi/rtw_cache"; module_param(rtw_adaptor_info_caching_file_path, charp, 0644); MODULE_PARM_DESC(rtw_adaptor_info_caching_file_path, "The path of adapter info cache file"); #endif /* CONFIG_ADAPTOR_INFO_CACHING_FILE */ #ifdef CONFIG_LAYER2_ROAMING -uint rtw_max_roaming_times = 2; +static uint rtw_max_roaming_times = 2; module_param(rtw_max_roaming_times, uint, 0644); MODULE_PARM_DESC(rtw_max_roaming_times, "The max roaming times to try"); #endif /* CONFIG_LAYER2_ROAMING */ #ifdef CONFIG_IOL -int rtw_fw_iol = 1; +static int rtw_fw_iol = 1; module_param(rtw_fw_iol, int, 0644); MODULE_PARM_DESC(rtw_fw_iol, "FW IOL. 0:Disable, 1:enable, 2:by usb speed"); #endif /* CONFIG_IOL */ #ifdef CONFIG_FILE_FWIMG -char *rtw_fw_file_path = "/system/etc/firmware/rtlwifi/FW_NIC.BIN"; +static char *rtw_fw_file_path = "/system/etc/firmware/rtlwifi/FW_NIC.BIN"; module_param(rtw_fw_file_path, charp, 0644); MODULE_PARM_DESC(rtw_fw_file_path, "The path of fw image"); -char *rtw_fw_wow_file_path = "/system/etc/firmware/rtlwifi/FW_WoWLAN.BIN"; +static char *rtw_fw_wow_file_path = "/system/etc/firmware/rtlwifi/FW_WoWLAN.BIN"; module_param(rtw_fw_wow_file_path, charp, 0644); MODULE_PARM_DESC(rtw_fw_wow_file_path, "The path of fw for Wake on Wireless image"); #ifdef CONFIG_MP_INCLUDED -char *rtw_fw_mp_bt_file_path = ""; +static char *rtw_fw_mp_bt_file_path = ""; module_param(rtw_fw_mp_bt_file_path, charp, 0644); MODULE_PARM_DESC(rtw_fw_mp_bt_file_path, "The path of fw for MP-BT image"); #endif /* CONFIG_MP_INCLUDED */ @@ -404,106 +404,105 @@ module_param(rtw_80211d, int, 0644); MODULE_PARM_DESC(rtw_80211d, "Enable 802.11d mechanism"); #endif -uint rtw_notch_filter = RTW_NOTCH_FILTER; +static uint rtw_notch_filter = RTW_NOTCH_FILTER; module_param(rtw_notch_filter, uint, 0644); MODULE_PARM_DESC(rtw_notch_filter, "0:Disable, 1:Enable, 2:Enable only for P2P"); -uint rtw_hiq_filter = CONFIG_RTW_HIQ_FILTER; +static uint rtw_hiq_filter = CONFIG_RTW_HIQ_FILTER; module_param(rtw_hiq_filter, uint, 0644); MODULE_PARM_DESC(rtw_hiq_filter, "0:allow all, 1:allow special, 2:deny all"); -uint rtw_adaptivity_en = CONFIG_RTW_ADAPTIVITY_EN; +static uint rtw_adaptivity_en = CONFIG_RTW_ADAPTIVITY_EN; module_param(rtw_adaptivity_en, uint, 0644); MODULE_PARM_DESC(rtw_adaptivity_en, "0:disable, 1:enable"); -uint rtw_adaptivity_mode = CONFIG_RTW_ADAPTIVITY_MODE; +static uint rtw_adaptivity_mode = CONFIG_RTW_ADAPTIVITY_MODE; module_param(rtw_adaptivity_mode, uint, 0644); MODULE_PARM_DESC(rtw_adaptivity_mode, "0:normal, 1:carrier sense"); -uint rtw_adaptivity_dml = CONFIG_RTW_ADAPTIVITY_DML; +static uint rtw_adaptivity_dml = CONFIG_RTW_ADAPTIVITY_DML; module_param(rtw_adaptivity_dml, uint, 0644); MODULE_PARM_DESC(rtw_adaptivity_dml, "0:disable, 1:enable"); -uint rtw_adaptivity_dc_backoff = CONFIG_RTW_ADAPTIVITY_DC_BACKOFF; +static uint rtw_adaptivity_dc_backoff = CONFIG_RTW_ADAPTIVITY_DC_BACKOFF; module_param(rtw_adaptivity_dc_backoff, uint, 0644); MODULE_PARM_DESC(rtw_adaptivity_dc_backoff, "DC backoff for Adaptivity"); -int rtw_adaptivity_th_l2h_ini = CONFIG_RTW_ADAPTIVITY_TH_L2H_INI; +static int rtw_adaptivity_th_l2h_ini = CONFIG_RTW_ADAPTIVITY_TH_L2H_INI; module_param(rtw_adaptivity_th_l2h_ini, int, 0644); MODULE_PARM_DESC(rtw_adaptivity_th_l2h_ini, "th_l2h_ini for Adaptivity"); -int rtw_adaptivity_th_edcca_hl_diff = CONFIG_RTW_ADAPTIVITY_TH_EDCCA_HL_DIFF; +static int rtw_adaptivity_th_edcca_hl_diff = CONFIG_RTW_ADAPTIVITY_TH_EDCCA_HL_DIFF; module_param(rtw_adaptivity_th_edcca_hl_diff, int, 0644); MODULE_PARM_DESC(rtw_adaptivity_th_edcca_hl_diff, "th_edcca_hl_diff for Adaptivity"); #ifdef CONFIG_DFS_MASTER -uint rtw_dfs_region_domain = CONFIG_RTW_DFS_REGION_DOMAIN; +static uint rtw_dfs_region_domain = CONFIG_RTW_DFS_REGION_DOMAIN; module_param(rtw_dfs_region_domain, uint, 0644); MODULE_PARM_DESC(rtw_dfs_region_domain, "0:UNKNOWN, 1:FCC, 2:MKK, 3:ETSI"); #endif -uint rtw_amplifier_type_2g = CONFIG_RTW_AMPLIFIER_TYPE_2G; +static uint rtw_amplifier_type_2g = CONFIG_RTW_AMPLIFIER_TYPE_2G; module_param(rtw_amplifier_type_2g, uint, 0644); MODULE_PARM_DESC(rtw_amplifier_type_2g, "BIT3:2G ext-PA, BIT4:2G ext-LNA"); -uint rtw_amplifier_type_5g = CONFIG_RTW_AMPLIFIER_TYPE_5G; +static uint rtw_amplifier_type_5g = CONFIG_RTW_AMPLIFIER_TYPE_5G; module_param(rtw_amplifier_type_5g, uint, 0644); MODULE_PARM_DESC(rtw_amplifier_type_5g, "BIT6:5G ext-PA, BIT7:5G ext-LNA"); -uint rtw_RFE_type = CONFIG_RTW_RFE_TYPE; +static uint rtw_RFE_type = CONFIG_RTW_RFE_TYPE; module_param(rtw_RFE_type, uint, 0644); MODULE_PARM_DESC(rtw_RFE_type, "default init value:64"); -uint rtw_powertracking_type = 64; +static uint rtw_powertracking_type = 64; module_param(rtw_powertracking_type, uint, 0644); MODULE_PARM_DESC(rtw_powertracking_type, "default init value:64"); -uint rtw_GLNA_type = CONFIG_RTW_GLNA_TYPE; +static uint rtw_GLNA_type = CONFIG_RTW_GLNA_TYPE; module_param(rtw_GLNA_type, uint, 0644); MODULE_PARM_DESC(rtw_GLNA_type, "default init value:0"); -uint rtw_TxBBSwing_2G = 0xFF; +static uint rtw_TxBBSwing_2G = 0xFF; module_param(rtw_TxBBSwing_2G, uint, 0644); MODULE_PARM_DESC(rtw_TxBBSwing_2G, "default init value:0xFF"); -uint rtw_TxBBSwing_5G = 0xFF; +static uint rtw_TxBBSwing_5G = 0xFF; module_param(rtw_TxBBSwing_5G, uint, 0644); MODULE_PARM_DESC(rtw_TxBBSwing_5G, "default init value:0xFF"); -uint rtw_OffEfuseMask = 0; +static uint rtw_OffEfuseMask = 0; module_param(rtw_OffEfuseMask, uint, 0644); MODULE_PARM_DESC(rtw_OffEfuseMask, "default open Efuse Mask value:0"); -uint rtw_FileMaskEfuse = 0; +static uint rtw_FileMaskEfuse = 0; module_param(rtw_FileMaskEfuse, uint, 0644); MODULE_PARM_DESC(rtw_FileMaskEfuse, "default drv Mask Efuse value:0"); -uint rtw_rxgain_offset_2g = 0; +static uint rtw_rxgain_offset_2g = 0; module_param(rtw_rxgain_offset_2g, uint, 0644); MODULE_PARM_DESC(rtw_rxgain_offset_2g, "default RF Gain 2G Offset value:0"); -uint rtw_rxgain_offset_5gl = 0; +static uint rtw_rxgain_offset_5gl = 0; module_param(rtw_rxgain_offset_5gl, uint, 0644); MODULE_PARM_DESC(rtw_rxgain_offset_5gl, "default RF Gain 5GL Offset value:0"); -uint rtw_rxgain_offset_5gm = 0; +static uint rtw_rxgain_offset_5gm = 0; module_param(rtw_rxgain_offset_5gm, uint, 0644); MODULE_PARM_DESC(rtw_rxgain_offset_5gm, "default RF Gain 5GM Offset value:0"); -uint rtw_rxgain_offset_5gh = 0; +static uint rtw_rxgain_offset_5gh = 0; module_param(rtw_rxgain_offset_5gh, uint, 0644); MODULE_PARM_DESC(rtw_rxgain_offset_5gm, "default RF Gain 5GL Offset value:0"); - -uint rtw_pll_ref_clk_sel = CONFIG_RTW_PLL_REF_CLK_SEL; +static uint rtw_pll_ref_clk_sel = CONFIG_RTW_PLL_REF_CLK_SEL; module_param(rtw_pll_ref_clk_sel, uint, 0644); MODULE_PARM_DESC(rtw_pll_ref_clk_sel, "force pll_ref_clk_sel, 0xF:use autoload value"); -int rtw_tx_pwr_by_rate = CONFIG_TXPWR_BY_RATE_EN; +static int rtw_tx_pwr_by_rate = CONFIG_TXPWR_BY_RATE_EN; module_param(rtw_tx_pwr_by_rate, int, 0644); MODULE_PARM_DESC(rtw_tx_pwr_by_rate, "0:Disable, 1:Enable, 2: Depend on efuse"); -int rtw_tx_pwr_lmt_enable = CONFIG_TXPWR_LIMIT_EN; +static int rtw_tx_pwr_lmt_enable = CONFIG_TXPWR_LIMIT_EN; module_param(rtw_tx_pwr_lmt_enable, int, 0644); MODULE_PARM_DESC(rtw_tx_pwr_lmt_enable, "0:Disable, 1:Enable, 2: Depend on efuse"); @@ -561,10 +560,10 @@ MODULE_PARM_DESC(rtw_phy_file_path, "The path of phy parameter"); * BIT4 - RF, 0: non-support, 1: support * BIT5 - RF_TXPWR_TRACK, 0: non-support, 1: support * BIT6 - RF_TXPWR_LMT, 0: non-support, 1: support */ -int rtw_load_phy_file = (BIT2 | BIT6); +static int rtw_load_phy_file = (BIT2 | BIT6); module_param(rtw_load_phy_file, int, 0644); MODULE_PARM_DESC(rtw_load_phy_file, "PHY File Bit Map"); -int rtw_decrypt_phy_file = 0; +static int rtw_decrypt_phy_file = 0; module_param(rtw_decrypt_phy_file, int, 0644); MODULE_PARM_DESC(rtw_decrypt_phy_file, "Enable Decrypt PHY File"); #endif @@ -588,22 +587,22 @@ extern int rtw_sdio_set_power(int on); #ifdef CONFIG_MCC_MODE /* enable MCC mode or not */ -int rtw_en_mcc = 1; +static int rtw_en_mcc = 1; /* can referece following value before insmod driver */ -int rtw_mcc_ap_bw20_target_tx_tp = MCC_AP_BW20_TARGET_TX_TP; -int rtw_mcc_ap_bw40_target_tx_tp = MCC_AP_BW40_TARGET_TX_TP; -int rtw_mcc_ap_bw80_target_tx_tp = MCC_AP_BW80_TARGET_TX_TP; -int rtw_mcc_sta_bw20_target_tx_tp = MCC_STA_BW20_TARGET_TX_TP; -int rtw_mcc_sta_bw40_target_tx_tp = MCC_STA_BW40_TARGET_TX_TP; -int rtw_mcc_sta_bw80_target_tx_tp = MCC_STA_BW80_TARGET_TX_TP; -int rtw_mcc_single_tx_cri = MCC_SINGLE_TX_CRITERIA; -int rtw_mcc_policy_table_idx = 0; -int rtw_mcc_duration = 0; -int rtw_mcc_tsf_sync_offset = 0; -int rtw_mcc_start_time_offset = 0; -int rtw_mcc_interval = 0; -int rtw_mcc_guard_offset0 = -1; -int rtw_mcc_guard_offset1 = -1; +static int rtw_mcc_ap_bw20_target_tx_tp = MCC_AP_BW20_TARGET_TX_TP; +static int rtw_mcc_ap_bw40_target_tx_tp = MCC_AP_BW40_TARGET_TX_TP; +static int rtw_mcc_ap_bw80_target_tx_tp = MCC_AP_BW80_TARGET_TX_TP; +static int rtw_mcc_sta_bw20_target_tx_tp = MCC_STA_BW20_TARGET_TX_TP; +static int rtw_mcc_sta_bw40_target_tx_tp = MCC_STA_BW40_TARGET_TX_TP; +static int rtw_mcc_sta_bw80_target_tx_tp = MCC_STA_BW80_TARGET_TX_TP; +static int rtw_mcc_single_tx_cri = MCC_SINGLE_TX_CRITERIA; +static int rtw_mcc_policy_table_idx = 0; +static int rtw_mcc_duration = 0; +static int rtw_mcc_tsf_sync_offset = 0; +static int rtw_mcc_start_time_offset = 0; +static int rtw_mcc_interval = 0; +static int rtw_mcc_guard_offset0 = -1; +static int rtw_mcc_guard_offset1 = -1; module_param(rtw_en_mcc, int, 0644); module_param(rtw_mcc_single_tx_cri, int, 0644); module_param(rtw_mcc_ap_bw20_target_tx_tp, int, 0644); @@ -624,17 +623,17 @@ module_param(rtw_mcc_guard_offset1, int, 0644); #ifdef CONFIG_RTW_NAPI /*following setting should define NAPI in Makefile enable napi only = 1, disable napi = 0*/ -int rtw_en_napi = 1; +static int rtw_en_napi = 1; module_param(rtw_en_napi, int, 0644); #ifdef CONFIG_RTW_GRO /*following setting should define GRO in Makefile enable gro = 1, disable gro = 0*/ -int rtw_en_gro = 1; +static int rtw_en_gro = 1; module_param(rtw_en_gro, int, 0644); #endif /* CONFIG_RTW_GRO */ #endif /* CONFIG_RTW_NAPI */ -void rtw_regsty_load_target_tx_power(struct registry_priv *regsty) +static void rtw_regsty_load_target_tx_power(struct registry_priv *regsty) { int path, rs; int *target_tx_pwr; @@ -1047,7 +1046,7 @@ static struct net_device_stats *rtw_net_get_stats(struct net_device *pnetdev) static const u16 rtw_1d_to_queue[8] = { 2, 3, 3, 2, 1, 1, 0, 0 }; /* Given a data frame determine the 802.1p/1d tag to use. */ -unsigned int rtw_classify8021d(struct sk_buff *skb) +static unsigned int rtw_classify8021d(struct sk_buff *skb) { unsigned int dscp; @@ -1096,7 +1095,7 @@ u16 rtw_recv_select_queue(struct sk_buff *skb) { struct iphdr *piphdr; unsigned int dscp; - u16 eth_type; + __be16 eth_type; u32 priority; u8 *pdata = skb->data; @@ -1104,20 +1103,15 @@ u16 rtw_recv_select_queue(struct sk_buff *skb) switch (eth_type) { case htons(ETH_P_IP): - piphdr = (struct iphdr *)(pdata + ETH_HLEN); - dscp = piphdr->tos & 0xfc; - priority = dscp >> 5; - break; default: priority = 0; } return rtw_1d_to_queue[priority]; - } #endif @@ -1173,8 +1167,7 @@ void rtw_ndev_notifier_unregister(void) unregister_netdevice_notifier(&rtw_ndev_notifier); } - -int rtw_ndev_init(struct net_device *dev) +static int rtw_ndev_init(struct net_device *dev) { _adapter *adapter = rtw_netdev_priv(dev); @@ -1187,7 +1180,7 @@ int rtw_ndev_init(struct net_device *dev) return 0; } -void rtw_ndev_uninit(struct net_device *dev) +static void rtw_ndev_uninit(struct net_device *dev) { _adapter *adapter = rtw_netdev_priv(dev); @@ -1258,7 +1251,7 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) return 0; } -void rtw_hook_if_ops(struct net_device *ndev) +static void rtw_hook_if_ops(struct net_device *ndev) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) ndev->netdev_ops = &rtw_netdev_ops; @@ -1323,7 +1316,7 @@ struct net_device *rtw_init_netdev(_adapter *old_padapter) return pnetdev; } -int rtw_os_ndev_alloc(_adapter *adapter) +static int rtw_os_ndev_alloc(_adapter *adapter) { int ret = _FAIL; struct net_device *ndev = NULL; @@ -1371,7 +1364,7 @@ void rtw_os_ndev_free(_adapter *adapter) } } -int rtw_os_ndev_register(_adapter *adapter, const char *name) +static int rtw_os_ndev_register(_adapter *adapter, const char *name) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); int ret = _SUCCESS; @@ -1506,7 +1499,7 @@ void rtw_os_ndev_deinit(_adapter *adapter) rtw_os_ndev_free(adapter); } -int rtw_os_ndevs_alloc(struct dvobj_priv *dvobj) +static int rtw_os_ndevs_alloc(struct dvobj_priv *dvobj) { int i, status = _SUCCESS; _adapter *adapter; @@ -1559,7 +1552,7 @@ exit: return status; } -void rtw_os_ndevs_free(struct dvobj_priv *dvobj) +static void rtw_os_ndevs_free(struct dvobj_priv *dvobj) { int i; _adapter *adapter = NULL; @@ -2596,7 +2589,7 @@ void rtw_drv_del_vir_ifaces(_adapter *primary_padapter) #endif /*end of CONFIG_CONCURRENT_MODE*/ -int rtw_os_ndevs_register(struct dvobj_priv *dvobj) +static int rtw_os_ndevs_register(struct dvobj_priv *dvobj) { int i, status = _SUCCESS; struct registry_priv *regsty = dvobj_to_regsty(dvobj); @@ -2935,7 +2928,7 @@ int netdev_open(struct net_device *pnetdev) } #ifdef CONFIG_IPS -int ips_netdrv_open(_adapter *padapter) +static int ips_netdrv_open(_adapter *padapter) { int status = _SUCCESS; /* struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); */ @@ -3026,16 +3019,13 @@ void rtw_ips_dev_unload(_adapter *padapter) #endif /* #ifdef DBG_CONFIG_ERROR_DETECT */ #endif /* defined(CONFIG_SWLPS_IN_IPS) || defined(CONFIG_FWLPS_IN_IPS) */ { - rtw_hal_set_hwreg(padapter, HW_VAR_FIFO_CLEARN_UP, 0); + rtw_hal_set_hwreg(padapter, HW_VAR_FIFO_CLEARN_UP, NULL); rtw_intf_stop(padapter); } - if (!rtw_is_surprise_removed(padapter)) rtw_hal_deinit(padapter); - } - int pm_netdev_open(struct net_device *pnetdev, u8 bnormal) { int status = 0; @@ -3161,10 +3151,9 @@ static int netdev_close(struct net_device *pnetdev) RTW_INFO("-871x_drv - drv_close, bup=%d\n", padapter->bup); return 0; - } -int pm_netdev_close(struct net_device *pnetdev, u8 bnormal) +static int pm_netdev_close(struct net_device *pnetdev, u8 bnormal) { int status = 0; @@ -3847,7 +3836,7 @@ int rtw_suspend_ap_wow(_adapter *padapter) #endif /* #ifdef CONFIG_AP_WOWLAN */ -int rtw_suspend_normal(_adapter *padapter) +static int rtw_suspend_normal(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); @@ -4258,7 +4247,7 @@ exit: } #endif /* #ifdef CONFIG_APWOWLAN */ -void rtw_mi_resume_process_normal(_adapter *padapter) +static void rtw_mi_resume_process_normal(_adapter *padapter) { int i; _adapter *iface; @@ -4287,13 +4276,12 @@ void rtw_mi_resume_process_normal(_adapter *padapter) } } -int rtw_resume_process_normal(_adapter *padapter) +static int rtw_resume_process_normal(_adapter *padapter) { struct net_device *pnetdev; struct pwrctrl_priv *pwrpriv; struct dvobj_priv *psdpriv; struct debug_priv *pdbgpriv; - int ret = _SUCCESS; if (!padapter) { diff --git a/os_dep/recv_linux.c b/os_dep/recv_linux.c index e34b1ef..167f408 100644 --- a/os_dep/recv_linux.c +++ b/os_dep/recv_linux.c @@ -20,6 +20,7 @@ #define _RECV_OSDEP_C_ #include +#include int rtw_os_recvframe_duplicate_skb(_adapter *padapter, union recv_frame *pcloneframe, _pkt *pskb) { @@ -456,7 +457,6 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, struct rx_pkt_attri if (br_port && (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE) == _TRUE)) { - int nat25_handle_frame(_adapter *priv, struct sk_buff *skb); if (nat25_handle_frame(padapter, pkt) == -1) { /* priv->ext_stats.rx_data_drops++; */ /* DEBUG_ERR("RX DROP: nat25_handle_frame fail!\n"); */ diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index a1bff0e..6cdcce6 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -150,7 +150,8 @@ static struct usb_device_id rtw_usb_id_tbl[] = { /*=== Customer ID ===*/ /****** 8188EUS ********/ {USB_DEVICE(0x07B8, 0x8179), .driver_info = RTL8188E}, /* Abocom - Abocom */ - {USB_DEVICE(0x2357, 0x010C), .driver_info = RTL8188E}, /* TPLINK - TPLINK */ + {USB_DEVICE(0x2001, 0x331B), .driver_info = RTL8188E}, /* D-Link DWA-121 rev B1 */ + {USB_DEVICE(0x2357, 0x010C), .driver_info = RTL8188E}, /* TPLINK - TPLINK */ #endif #ifdef CONFIG_RTL8812A @@ -257,7 +258,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { MODULE_DEVICE_TABLE(usb, rtw_usb_id_tbl); -int const rtw_usb_id_len = sizeof(rtw_usb_id_tbl) / sizeof(struct usb_device_id); +static int const rtw_usb_id_len = sizeof(rtw_usb_id_tbl) / sizeof(struct usb_device_id); static struct specific_device_id specific_device_id_tbl[] = { {.idVendor = USB_VENDER_ID_REALTEK, .idProduct = 0x8177, .flags = SPEC_DEV_ID_DISABLE_HT}, /* 8188cu 1*1 dongole, (b/g mode only) */ @@ -278,7 +279,7 @@ struct rtw_usb_drv { u8 hw_type; }; -struct rtw_usb_drv usb_drv = { +static struct rtw_usb_drv usb_drv = { .usbdrv.name = (char *)DRV_NAME, .usbdrv.probe = rtw_drv_init, .usbdrv.disconnect = rtw_dev_remove, @@ -892,7 +893,7 @@ exit: return ret; } -int rtw_resume_process(_adapter *padapter) +static int rtw_resume_process(_adapter *padapter) { int ret, pm_cnt = 0; struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); @@ -1141,9 +1142,9 @@ extern void rtd2885_wlan_netlink_sendMsg(char *action_string, char *name); * We accept the new device by returning 0. */ -_adapter *rtw_sw_export = NULL; +static _adapter *rtw_sw_export = NULL; -_adapter *rtw_usb_primary_adapter_init(struct dvobj_priv *dvobj, +static _adapter *rtw_usb_primary_adapter_init(struct dvobj_priv *dvobj, struct usb_interface *pusb_intf) { _adapter *padapter = NULL;