rtl8188eu: Change C90 comments to kernel form for files in core/

This commit also includes some sparse fixes for endian issues.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-07-09 17:38:46 -05:00
parent fb786d0283
commit d2c90ee304
24 changed files with 4667 additions and 5077 deletions

File diff suppressed because it is too large Load diff

View file

@ -49,7 +49,7 @@
#ifdef CONFIG_BR_EXT #ifdef CONFIG_BR_EXT
//#define BR_EXT_DEBUG /* define BR_EXT_DEBUG */
#define NAT25_IPV4 01 #define NAT25_IPV4 01
#define NAT25_IPV6 02 #define NAT25_IPV6 02
@ -62,7 +62,7 @@
#define MAGIC_CODE 0x8186 #define MAGIC_CODE 0x8186
#define MAGIC_CODE_LEN 2 #define MAGIC_CODE_LEN 2
#define WAIT_TIME_PPPOE 5 // waiting time for pppoe server in sec #define WAIT_TIME_PPPOE 5 /* waiting time for pppoe server in sec */
/*----------------------------------------------------------------- /*-----------------------------------------------------------------
How database records network address: How database records network address:
@ -76,7 +76,7 @@
-----------------------------------------------------------------*/ -----------------------------------------------------------------*/
//Find a tag in pppoe frame and return the pointer /* Find a tag in pppoe frame and return the pointer */
static __inline__ unsigned char *__nat25_find_pppoe_tag(struct pppoe_hdr *ph, unsigned short type) static __inline__ unsigned char *__nat25_find_pppoe_tag(struct pppoe_hdr *ph, unsigned short type)
{ {
unsigned char *cur_ptr, *start_ptr; unsigned char *cur_ptr, *start_ptr;
@ -84,7 +84,7 @@ static __inline__ unsigned char *__nat25_find_pppoe_tag(struct pppoe_hdr *ph, un
start_ptr = cur_ptr = (unsigned char *)ph->tag; start_ptr = cur_ptr = (unsigned char *)ph->tag;
while ((cur_ptr - start_ptr) < ntohs(ph->length)) { while ((cur_ptr - start_ptr) < ntohs(ph->length)) {
// prevent un-alignment access /* prevent un-alignment access */
tagType = (unsigned short)((cur_ptr[0] << 8) + cur_ptr[1]); tagType = (unsigned short)((cur_ptr[0] << 8) + cur_ptr[1]);
tagLen = (unsigned short)((cur_ptr[2] << 8) + cur_ptr[3]); tagLen = (unsigned short)((cur_ptr[2] << 8) + cur_ptr[3]);
if (tagType == type) if (tagType == type)
@ -107,7 +107,7 @@ static __inline__ int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_ta
} }
skb_put(skb, data_len); skb_put(skb, data_len);
// have a room for new tag /* have a room for new tag */
memmove(((unsigned char *)ph->tag + data_len), (unsigned char *)ph->tag, ntohs(ph->length)); memmove(((unsigned char *)ph->tag + data_len), (unsigned char *)ph->tag, ntohs(ph->length));
ph->length = htons(ntohs(ph->length) + data_len); ph->length = htons(ntohs(ph->length) + data_len);
memcpy((unsigned char *)ph->tag, tag, data_len); memcpy((unsigned char *)ph->tag, tag, data_len);
@ -307,8 +307,8 @@ static void convert_ipv6_mac_to_mc(struct sk_buff *skb)
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN); struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
unsigned char *dst_mac = skb->data; unsigned char *dst_mac = skb->data;
//dst_mac[0] = 0xff; /* dst_mac[0] = 0xff; */
//dst_mac[1] = 0xff; /* dst_mac[1] = 0xff; */
/*modified by qinjunjie,ipv6 multicast address ix 0x33-33-xx-xx-xx-xx*/ /*modified by qinjunjie,ipv6 multicast address ix 0x33-33-xx-xx-xx-xx*/
dst_mac[0] = 0x33; dst_mac[0] = 0x33;
dst_mac[1] = 0x33; dst_mac[1] = 0x33;
@ -385,9 +385,9 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
static __inline__ void __network_hash_link(_adapter *priv, static __inline__ void __network_hash_link(_adapter *priv,
struct nat25_network_db_entry *ent, int hash) struct nat25_network_db_entry *ent, int hash)
{ {
// Caller must _enter_critical_bh already! /* Caller must _enter_critical_bh already! */
//_irqL irqL; /* _irqL irqL; */
//_enter_critical_bh(&priv->br_ext_lock, &irqL); /* _enter_critical_bh(&priv->br_ext_lock, &irqL); */
ent->next_hash = priv->nethash[hash]; ent->next_hash = priv->nethash[hash];
if (ent->next_hash != NULL) if (ent->next_hash != NULL)
@ -395,15 +395,15 @@ static __inline__ void __network_hash_link(_adapter *priv,
priv->nethash[hash] = ent; priv->nethash[hash] = ent;
ent->pprev_hash = &priv->nethash[hash]; ent->pprev_hash = &priv->nethash[hash];
//_exit_critical_bh(&priv->br_ext_lock, &irqL); /* _exit_critical_bh(&priv->br_ext_lock, &irqL); */
} }
static __inline__ void __network_hash_unlink(struct nat25_network_db_entry *ent) static __inline__ void __network_hash_unlink(struct nat25_network_db_entry *ent)
{ {
// Caller must _enter_critical_bh already! /* Caller must _enter_critical_bh already! */
//_irqL irqL; /* _irqL irqL; */
//_enter_critical_bh(&priv->br_ext_lock, &irqL); /* _enter_critical_bh(&priv->br_ext_lock, &irqL); */
*(ent->pprev_hash) = ent->next_hash; *(ent->pprev_hash) = ent->next_hash;
if (ent->next_hash != NULL) if (ent->next_hash != NULL)
@ -411,7 +411,7 @@ static __inline__ void __network_hash_unlink(struct nat25_network_db_entry *ent)
ent->next_hash = NULL; ent->next_hash = NULL;
ent->pprev_hash = NULL; ent->pprev_hash = NULL;
//_exit_critical_bh(&priv->br_ext_lock, &irqL); /* _exit_critical_bh(&priv->br_ext_lock, &irqL); */
} }
@ -429,7 +429,7 @@ static int __nat25_db_network_lookup_and_replace(_adapter *priv,
{ {
if (!__nat25_has_expired(priv, db)) if (!__nat25_has_expired(priv, db))
{ {
// replace the destination mac address /* replace the destination mac address */
memcpy(skb->data, db->macAddr, ETH_ALEN); memcpy(skb->data, db->macAddr, ETH_ALEN);
atomic_inc(&db->use_count); atomic_inc(&db->use_count);
@ -658,7 +658,7 @@ void nat25_db_expire(_adapter *priv)
_irqL irqL; _irqL irqL;
_enter_critical_bh(&priv->br_ext_lock, &irqL); _enter_critical_bh(&priv->br_ext_lock, &irqL);
//if (!priv->ethBrExtInfo.nat25_disable) /* if (!priv->ethBrExtInfo.nat25_disable) */
{ {
for (i=0; i<NAT25_HASH_SIZE; i++) for (i=0; i<NAT25_HASH_SIZE; i++)
{ {
@ -777,6 +777,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
{ {
unsigned short protocol; unsigned short protocol;
unsigned char networkAddr[MAX_NETWORK_ADDR_LEN]; unsigned char networkAddr[MAX_NETWORK_ADDR_LEN];
unsigned int tmp;
if (skb == NULL) if (skb == NULL)
return -1; return -1;
@ -784,12 +785,12 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
if ((method <= NAT25_MIN) || (method >= NAT25_MAX)) if ((method <= NAT25_MIN) || (method >= NAT25_MAX))
return -1; return -1;
protocol = *((unsigned short *)(skb->data + 2 * ETH_ALEN)); protocol = be16_to_cpu(*((__be16 *)(skb->data + 2 * ETH_ALEN)));
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Handle IP frame */ /* Handle IP frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/
if (protocol == __constant_htons(ETH_P_IP)) if (protocol == ETH_P_IP)
{ {
struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN); struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN);
@ -806,13 +807,14 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
case NAT25_INSERT: case NAT25_INSERT:
{ {
//some muticast with source IP is all zero, maybe other case is illegal /* some muticast with source IP is all zero, maybe other case is illegal */
//in class A, B, C, host address is all zero or all one is illegal /* in class A, B, C, host address is all zero or all one is illegal */
if (iph->saddr == 0) if (iph->saddr == 0)
return 0; return 0;
DEBUG_INFO("NAT25: Insert IP, SA=%08x, DA=%08x\n", iph->saddr, iph->daddr); tmp = be32_to_cpu(iph->saddr);
__nat25_generate_ipv4_network_addr(networkAddr, &iph->saddr); DEBUG_INFO("NAT25: Insert IP, SA=%08x, DA=%08x\n", tmp, iph->daddr);
//record source IP address and , source mac address into db __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); __nat25_db_network_insert(priv, skb->data+ETH_ALEN, networkAddr);
__nat25_db_print(priv); __nat25_db_print(priv);
@ -830,16 +832,17 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
(OPMODE & WIFI_ADHOC_STATE))) (OPMODE & WIFI_ADHOC_STATE)))
#endif #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 (!__nat25_db_network_lookup_and_replace(priv, skb, networkAddr)) {
if (*((unsigned char *)&iph->daddr + 3) == 0xff) { if (*((unsigned char *)&iph->daddr + 3) == 0xff) {
// L2 is unicast but L3 is broadcast, make L2 bacome broadcast /* L2 is unicast but L3 is broadcast, make L2 bacome broadcast */
DEBUG_INFO("NAT25: Set DA as boardcast\n"); DEBUG_INFO("NAT25: Set DA as boardcast\n");
memset(skb->data, 0xff, ETH_ALEN); memset(skb->data, 0xff, ETH_ALEN);
} }
else { else {
// forward unknow IP packet to upper TCP/IP /* forward unknow IP packet to upper TCP/IP */
DEBUG_INFO("NAT25: Replace DA with BR's MAC\n"); DEBUG_INFO("NAT25: Replace DA with BR's MAC\n");
if ( (*(u32 *)priv->br_mac) == 0 && (*(u16 *)(priv->br_mac+4)) == 0 ) { if ( (*(u32 *)priv->br_mac) == 0 && (*(u16 *)(priv->br_mac+4)) == 0 ) {
printk("Re-init netdev_br_init() due to br_mac==0!\n"); printk("Re-init netdev_br_init() due to br_mac==0!\n");
@ -860,7 +863,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Handle ARP frame */ /* Handle ARP frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/
else if (protocol == __constant_htons(ETH_P_ARP)) else if (protocol == ETH_P_ARP)
{ {
struct arphdr *arp = (struct arphdr *)(skb->data + ETH_HLEN); struct arphdr *arp = (struct arphdr *)(skb->data + ETH_HLEN);
unsigned char *arp_ptr = (unsigned char *)(arp + 1); unsigned char *arp_ptr = (unsigned char *)(arp + 1);
@ -868,21 +871,21 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
if (arp->ar_pro != __constant_htons(ETH_P_IP)) 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; return -1;
} }
switch (method) switch (method)
{ {
case NAT25_CHECK: case NAT25_CHECK:
return 0; // skb_copy for all ARP frame return 0; /* skb_copy for all ARP frame */
case NAT25_INSERT: case NAT25_INSERT:
{ {
DEBUG_INFO("NAT25: Insert ARP, MAC=%02x%02x%02x%02x%02x%02x\n", arp_ptr[0], DEBUG_INFO("NAT25: Insert ARP, MAC=%02x%02x%02x%02x%02x%02x\n", arp_ptr[0],
arp_ptr[1], arp_ptr[2], arp_ptr[3], arp_ptr[4], arp_ptr[5]); arp_ptr[1], arp_ptr[2], arp_ptr[3], arp_ptr[4], arp_ptr[5]);
// change to ARP sender mac address to wlan STA address /* change to ARP sender mac address to wlan STA address */
memcpy(arp_ptr, GET_MY_HWADDR(priv), ETH_ALEN); memcpy(arp_ptr, GET_MY_HWADDR(priv), ETH_ALEN);
arp_ptr += arp->ar_hln; arp_ptr += arp->ar_hln;
@ -909,7 +912,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr); __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
// change to ARP target mac address to Lookup result /* change to ARP target mac address to Lookup result */
arp_ptr = (unsigned char *)(arp + 1); arp_ptr = (unsigned char *)(arp + 1);
arp_ptr += (arp->ar_hln + arp->ar_pln); arp_ptr += (arp->ar_hln + arp->ar_pln);
memcpy(arp_ptr, skb->data, ETH_ALEN); memcpy(arp_ptr, skb->data, ETH_ALEN);
@ -924,8 +927,8 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Handle IPX and Apple Talk frame */ /* Handle IPX and Apple Talk frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/
else if ((protocol == __constant_htons(ETH_P_IPX)) || else if ((protocol == ETH_P_IPX) ||
(protocol <= __constant_htons(ETH_FRAME_LEN))) (protocol <= ETH_FRAME_LEN))
{ {
unsigned char ipx_header[2] = {0xFF, 0xFF}; unsigned char ipx_header[2] = {0xFF, 0xFF};
struct ipxhdr *ipx = NULL; struct ipxhdr *ipx = NULL;
@ -933,12 +936,12 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
struct ddpehdr *ddp = NULL; struct ddpehdr *ddp = NULL;
unsigned char *framePtr = skb->data + ETH_HLEN; unsigned char *framePtr = skb->data + ETH_HLEN;
if (protocol == __constant_htons(ETH_P_IPX)) if (protocol == ETH_P_IPX)
{ {
DEBUG_INFO("NAT25: Protocol=IPX (Ethernet II)\n"); DEBUG_INFO("NAT25: Protocol=IPX (Ethernet II)\n");
ipx = (struct ipxhdr *)framePtr; ipx = (struct ipxhdr *)framePtr;
} }
else if (protocol <= __constant_htons(ETH_FRAME_LEN)) else if (protocol <= ETH_FRAME_LEN)
{ {
if (!memcmp(ipx_header, framePtr, 2)) if (!memcmp(ipx_header, framePtr, 2))
{ {
@ -952,28 +955,28 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
if (*framePtr == snap_8022_type) if (*framePtr == snap_8022_type)
{ {
unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; // IPX SNAP ID unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; /* IPX SNAP ID */
unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; // Apple Talk AARP SNAP ID unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; /* Apple Talk AARP SNAP ID */
unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; // Apple Talk DDP SNAP ID unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; /* Apple Talk DDP SNAP ID */
framePtr += 3; // eliminate the 802.2 header framePtr += 3; /* eliminate the 802.2 header */
if (!memcmp(ipx_snap_id, framePtr, 5)) if (!memcmp(ipx_snap_id, framePtr, 5))
{ {
framePtr += 5; // eliminate the SNAP header framePtr += 5; /* eliminate the SNAP header */
DEBUG_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n"); DEBUG_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n");
ipx = (struct ipxhdr *)framePtr; ipx = (struct ipxhdr *)framePtr;
} }
else if (!memcmp(aarp_snap_id, framePtr, 5)) else if (!memcmp(aarp_snap_id, framePtr, 5))
{ {
framePtr += 5; // eliminate the SNAP header framePtr += 5; /* eliminate the SNAP header */
ea = (struct elapaarp *)framePtr; ea = (struct elapaarp *)framePtr;
} }
else if (!memcmp(ddp_snap_id, framePtr, 5)) else if (!memcmp(ddp_snap_id, framePtr, 5))
{ {
framePtr += 5; // eliminate the SNAP header framePtr += 5; /* eliminate the SNAP header */
ddp = (struct ddpehdr *)framePtr; ddp = (struct ddpehdr *)framePtr;
} }
@ -986,7 +989,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
} }
else if (*framePtr == ipx_8022_type) else if (*framePtr == ipx_8022_type)
{ {
framePtr += 3; // eliminate the 802.2 header framePtr += 3; /* eliminate the 802.2 header */
if (!memcmp(ipx_header, framePtr, 2)) if (!memcmp(ipx_header, framePtr, 2))
{ {
@ -1042,7 +1045,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
__nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock); __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
// change IPX source node addr to wlan STA address /* change IPX source node addr to wlan STA address */
memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN); memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
} }
else else
@ -1066,7 +1069,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr); __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
// replace IPX destination node addr with Lookup destination MAC addr /* replace IPX destination node addr with Lookup destination MAC addr */
memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN); memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
} }
else else
@ -1100,7 +1103,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
case NAT25_INSERT: case NAT25_INSERT:
{ {
// change to AARP source mac address to wlan STA address /* change to AARP source mac address to wlan STA address */
memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN); memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
DEBUG_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n", DEBUG_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
@ -1129,7 +1132,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
__nat25_db_network_lookup_and_replace(priv, skb, networkAddr); __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
// change to AARP destination mac address to Lookup result /* change to AARP destination mac address to Lookup result */
memcpy(ea->hw_dst, skb->data, ETH_ALEN); memcpy(ea->hw_dst, skb->data, ETH_ALEN);
} }
return 0; return 0;
@ -1188,8 +1191,8 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Handle PPPoE frame */ /* Handle PPPoE frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/
else if ((protocol == __constant_htons(ETH_P_PPP_DISC)) || else if ((protocol == ETH_P_PPP_DISC) ||
(protocol == __constant_htons(ETH_P_PPP_SES))) (protocol == ETH_P_PPP_SES))
{ {
struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN); struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
unsigned short *pMagic; unsigned short *pMagic;
@ -1202,7 +1205,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
return 1; return 1;
case NAT25_INSERT: case NAT25_INSERT:
if (ph->sid == 0) // Discovery phase according to tag if (ph->sid == 0) /* Discovery phase according to tag */
{ {
if (ph->code == PADI_CODE || ph->code == PADR_CODE) if (ph->code == PADI_CODE || ph->code == PADR_CODE)
{ {
@ -1213,7 +1216,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
tag = (struct pppoe_tag *)tag_buf; tag = (struct pppoe_tag *)tag_buf;
pOldTag = (struct pppoe_tag *)__nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID)); pOldTag = (struct pppoe_tag *)__nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID));
if (pOldTag) { // if SID existed, copy old value and delete it if (pOldTag) { /* if SID existed, copy old value and delete it */
old_tag_len = ntohs(pOldTag->tag_len); old_tag_len = ntohs(pOldTag->tag_len);
if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf)) { if (old_tag_len+TAG_HDR_LEN+MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN > sizeof(tag_buf)) {
DEBUG_ERR("SID tag length too long!\n"); DEBUG_ERR("SID tag length too long!\n");
@ -1233,19 +1236,19 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
tag->tag_type = PTT_RELAY_SID; tag->tag_type = PTT_RELAY_SID;
tag->tag_len = htons(MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN+old_tag_len); tag->tag_len = htons(MAGIC_CODE_LEN+RTL_RELAY_TAG_LEN+old_tag_len);
// insert the magic_code+client mac in relay tag /* insert the magic_code+client mac in relay tag */
pMagic = (unsigned short *)tag->tag_data; pMagic = (unsigned short *)tag->tag_data;
*pMagic = htons(MAGIC_CODE); *pMagic = htons(MAGIC_CODE);
memcpy(tag->tag_data+MAGIC_CODE_LEN, skb->data+ETH_ALEN, ETH_ALEN); memcpy(tag->tag_data+MAGIC_CODE_LEN, skb->data+ETH_ALEN, ETH_ALEN);
//Add relay tag /* Add relay tag */
if (__nat25_add_pppoe_tag(skb, tag) < 0) if (__nat25_add_pppoe_tag(skb, tag) < 0)
return -1; return -1;
DEBUG_INFO("NAT25: Insert PPPoE, forward %s packet\n", DEBUG_INFO("NAT25: Insert PPPoE, forward %s packet\n",
(ph->code == PADI_CODE ? "PADI" : "PADR")); (ph->code == PADI_CODE ? "PADI" : "PADR"));
} }
else { // not add relay tag else { /* not add relay tag */
if (priv->pppoe_connection_in_progress && if (priv->pppoe_connection_in_progress &&
memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) { memcmp(skb->data+ETH_ALEN, priv->pppoe_addr, ETH_ALEN)) {
DEBUG_ERR("Discard PPPoE packet due to another PPPoE connection is in progress!\n"); DEBUG_ERR("Discard PPPoE packet due to another PPPoE connection is in progress!\n");
@ -1261,7 +1264,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
else else
return -1; return -1;
} }
else // session phase else /* session phase */
{ {
DEBUG_INFO("NAT25: Insert PPPoE, insert session packet to %s\n", skb->dev->name); DEBUG_INFO("NAT25: Insert PPPoE, insert session packet to %s\n", skb->dev->name);
@ -1324,7 +1327,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
DEBUG_INFO("NAT25: Lookup PPPoE, forward %s Packet from %s\n", DEBUG_INFO("NAT25: Lookup PPPoE, forward %s Packet from %s\n",
(ph->code == PADO_CODE ? "PADO" : "PADS"), skb->dev->name); (ph->code == PADO_CODE ? "PADO" : "PADS"), skb->dev->name);
} }
else { // not add relay tag else { /* not add relay tag */
if (!priv->pppoe_connection_in_progress) { if (!priv->pppoe_connection_in_progress) {
DEBUG_ERR("Discard PPPoE packet due to no connection in progresss!\n"); DEBUG_ERR("Discard PPPoE packet due to no connection in progresss!\n");
return -1; return -1;
@ -1357,7 +1360,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Handle EAP frame */ /* Handle EAP frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/
else if (protocol == __constant_htons(0x888e)) else if (protocol == 0x888e)
{ {
switch (method) switch (method)
{ {
@ -1378,8 +1381,8 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Handle C-Media proprietary frame */ /* Handle C-Media proprietary frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/
else if ((protocol == __constant_htons(0xe2ae)) || else if ((protocol == 0xe2ae) ||
(protocol == __constant_htons(0xe2af))) (protocol == 0xe2af))
{ {
switch (method) switch (method)
{ {
@ -1401,7 +1404,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
/* Handle IPV6 frame */ /* Handle IPV6 frame */
/*---------------------------------------------------*/ /*---------------------------------------------------*/
#ifdef CL_IPV6_PASS #ifdef CL_IPV6_PASS
else if (protocol == __constant_htons(ETH_P_IPV6)) else if (protocol == ETH_P_IPV6)
{ {
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN); struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + ETH_HLEN);
@ -1470,7 +1473,7 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
return -1; return -1;
} }
} }
#endif // CL_IPV6_PASS #endif /* CL_IPV6_PASS */
return -1; return -1;
} }
@ -1501,8 +1504,10 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
{ {
int is_vlan_tag=0, i, retval=0; int is_vlan_tag=0, i, retval=0;
unsigned short vlan_hdr=0; unsigned short vlan_hdr=0;
unsigned short protocol;
if (*((unsigned short *)(skb->data+ETH_ALEN*2)) == __constant_htons(ETH_P_8021Q)) { protocol = be16_to_cpu(*((__be16 *)(skb->data + 2 * ETH_ALEN)));
if (protocol == ETH_P_8021Q) {
is_vlan_tag = 1; is_vlan_tag = 1;
vlan_hdr = *((unsigned short *)(skb->data+ETH_ALEN*2+2)); vlan_hdr = *((unsigned short *)(skb->data+ETH_ALEN*2+2));
for (i=0; i<6; i++) for (i=0; i<6; i++)
@ -1520,24 +1525,22 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
* corresponding network protocol is NOT support. * corresponding network protocol is NOT support.
*/ */
if (!priv->ethBrExtInfo.nat25sc_disable && if (!priv->ethBrExtInfo.nat25sc_disable &&
(*((unsigned short *)(skb->data+ETH_ALEN*2)) == __constant_htons(ETH_P_IP)) && (be16_to_cpu(*((__be16 *)(skb->data+ETH_ALEN*2))) == ETH_P_IP) &&
!memcmp(priv->scdb_ip, skb->data+ETH_HLEN+16, 4)) { !memcmp(priv->scdb_ip, skb->data+ETH_HLEN+16, 4)) {
memcpy(skb->data, priv->scdb_mac, ETH_ALEN); memcpy(skb->data, priv->scdb_mac, ETH_ALEN);
_exit_critical_bh(&priv->br_ext_lock, &irqL); _exit_critical_bh(&priv->br_ext_lock, &irqL);
} } else {
else {
_exit_critical_bh(&priv->br_ext_lock, &irqL); _exit_critical_bh(&priv->br_ext_lock, &irqL);
retval = nat25_db_handle(priv, skb, NAT25_LOOKUP); retval = nat25_db_handle(priv, skb, NAT25_LOOKUP);
} }
} } else {
else { if (((be16_to_cpu(*((__be16 *)(skb->data+ETH_ALEN*2))) == ETH_P_IP) &&
if (((*((unsigned short *)(skb->data+ETH_ALEN*2)) == __constant_htons(ETH_P_IP)) && !memcmp(priv->br_ip, skb->data+ETH_HLEN+16, 4)) ||
!memcmp(priv->br_ip, skb->data+ETH_HLEN+16, 4)) || ((be16_to_cpu(*((__be16 *)(skb->data+ETH_ALEN*2))) == ETH_P_ARP) &&
((*((unsigned short *)(skb->data+ETH_ALEN*2)) == __constant_htons(ETH_P_ARP)) && !memcmp(priv->br_ip, skb->data+ETH_HLEN+24, 4))) {
!memcmp(priv->br_ip, skb->data+ETH_HLEN+24, 4))) { /* for traffic to upper TCP/IP */
// for traffic to upper TCP/IP
retval = nat25_db_handle(priv, skb, NAT25_LOOKUP); retval = nat25_db_handle(priv, skb, NAT25_LOOKUP);
} }
} }
@ -1551,7 +1554,7 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
} }
if (retval == -1) { if (retval == -1) {
//DEBUG_ERR("NAT25: Lookup fail!\n"); /* DEBUG_ERR("NAT25: Lookup fail!\n"); */
return -1; return -1;
} }
} }
@ -1590,34 +1593,33 @@ void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb)
if (!priv->ethBrExtInfo.dhcp_bcst_disable) if (!priv->ethBrExtInfo.dhcp_bcst_disable)
{ {
unsigned short protocol = *((unsigned short *)(skb->data + 2 * ETH_ALEN)); __be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN));
if (protocol == __constant_htons(ETH_P_IP)) // IP if (protocol == __constant_htons(ETH_P_IP)) /* IP */
{ {
struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN); struct iphdr* iph = (struct iphdr *)(skb->data + ETH_HLEN);
if (iph->protocol == IPPROTO_UDP) // UDP if (iph->protocol == IPPROTO_UDP) /* UDP */
{ {
struct udphdr *udph = (struct udphdr *)((SIZE_PTR)iph + (iph->ihl << 2)); struct udphdr *udph = (struct udphdr *)((SIZE_PTR)iph + (iph->ihl << 2));
if ((udph->source == __constant_htons(CLIENT_PORT)) if ((udph->source == __constant_htons(CLIENT_PORT)) &&
&& (udph->dest == __constant_htons(SERVER_PORT))) // DHCP request (udph->dest == __constant_htons(SERVER_PORT))) { /* DHCP request */
{
struct dhcpMessage *dhcph = struct dhcpMessage *dhcph =
(struct dhcpMessage *)((SIZE_PTR)udph + sizeof(struct udphdr)); (struct dhcpMessage *)((SIZE_PTR)udph + sizeof(struct udphdr));
u32 cookie = be32_to_cpu((__be32)dhcph->cookie);
if (dhcph->cookie == __constant_htonl(DHCP_MAGIC)) // match magic word if (cookie == DHCP_MAGIC) { /* match magic word */
{ if (!(dhcph->flags & htons(BROADCAST_FLAG))) /* if not broadcast */
if (!(dhcph->flags & htons(BROADCAST_FLAG))) // if not broadcast
{ {
register int sum = 0; register int sum = 0;
DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n"); DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n");
// or BROADCAST flag /* or BROADCAST flag */
dhcph->flags |= htons(BROADCAST_FLAG); dhcph->flags |= htons(BROADCAST_FLAG);
// recalculate checksum /* recalculate checksum */
sum = ~(udph->check) & 0xffff; sum = ~(udph->check) & 0xffff;
sum += dhcph->flags; sum += be16_to_cpu(dhcph->flags);
while (sum >> 16) while (sum >> 16)
sum = (sum & 0xffff) + (sum >> 16); sum = (sum & 0xffff) + (sum >> 16);
udph->check = ~sum; udph->check = ~sum;
@ -1636,8 +1638,8 @@ void *scdb_findEntry(_adapter *priv, unsigned char *macAddr,
unsigned char networkAddr[MAX_NETWORK_ADDR_LEN]; unsigned char networkAddr[MAX_NETWORK_ADDR_LEN];
struct nat25_network_db_entry *db; struct nat25_network_db_entry *db;
int hash; int hash;
//_irqL irqL; /* _irqL irqL; */
//_enter_critical_bh(&priv->br_ext_lock, &irqL); /* _enter_critical_bh(&priv->br_ext_lock, &irqL); */
__nat25_generate_ipv4_network_addr(networkAddr, (unsigned int *)ipAddr); __nat25_generate_ipv4_network_addr(networkAddr, (unsigned int *)ipAddr);
hash = __nat25_network_hash(networkAddr); hash = __nat25_network_hash(networkAddr);
@ -1645,15 +1647,15 @@ void *scdb_findEntry(_adapter *priv, unsigned char *macAddr,
while (db != NULL) while (db != NULL)
{ {
if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) { if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
//_exit_critical_bh(&priv->br_ext_lock, &irqL); /* _exit_critical_bh(&priv->br_ext_lock, &irqL); */
return (void *)db; return (void *)db;
} }
db = db->next_hash; db = db->next_hash;
} }
//_exit_critical_bh(&priv->br_ext_lock, &irqL); /* _exit_critical_bh(&priv->br_ext_lock, &irqL); */
return NULL; return NULL;
} }
#endif // CONFIG_BR_EXT #endif /* CONFIG_BR_EXT */

View file

@ -27,12 +27,12 @@
#include <mlme_osdep.h> #include <mlme_osdep.h>
#ifdef CONFIG_BR_EXT #ifdef CONFIG_BR_EXT
#include <rtw_br_ext.h> #include <rtw_br_ext.h>
#endif //CONFIG_BR_EXT #endif /* CONFIG_BR_EXT */
#include <rtw_mlme_ext.h> #include <rtw_mlme_ext.h>
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
#include <rtl8723a_hal.h> #include <rtl8723a_hal.h>
#endif // CONFIG_BT_COEXIST #endif /* CONFIG_BT_COEXIST */
/* /*
Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
@ -46,13 +46,13 @@ sint _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv)
_func_enter_; _func_enter_;
_rtw_init_sema(&(pcmdpriv->cmd_queue_sema), 0); _rtw_init_sema(&(pcmdpriv->cmd_queue_sema), 0);
//_rtw_init_sema(&(pcmdpriv->cmd_done_sema), 0); /* _rtw_init_sema(&(pcmdpriv->cmd_done_sema), 0); */
_rtw_init_sema(&(pcmdpriv->terminate_cmdthread_sema), 0); _rtw_init_sema(&(pcmdpriv->terminate_cmdthread_sema), 0);
_rtw_init_queue(&(pcmdpriv->cmd_queue)); _rtw_init_queue(&(pcmdpriv->cmd_queue));
//allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
pcmdpriv->cmd_seq = 1; pcmdpriv->cmd_seq = 1;
@ -100,7 +100,7 @@ _func_enter_;
pevtpriv->cmdevt_parm = NULL; pevtpriv->cmdevt_parm = NULL;
#endif #endif
//allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
ATOMIC_SET(&pevtpriv->event_seq, 0); ATOMIC_SET(&pevtpriv->event_seq, 0);
pevtpriv->evt_done_cnt = 0; pevtpriv->evt_done_cnt = 0;
@ -136,13 +136,13 @@ _func_enter_;
} }
MmBuildMdlForNonPagedPool(pevtpriv->pc2h_mdl); MmBuildMdlForNonPagedPool(pevtpriv->pc2h_mdl);
#endif #endif
#endif //end of CONFIG_SDIO_HCI #endif /* end of CONFIG_SDIO_HCI */
_rtw_init_queue(&(pevtpriv->evt_queue)); _rtw_init_queue(&(pevtpriv->evt_queue));
exit: exit:
#endif //end of CONFIG_EVENT_THREAD_MODE #endif /* end of CONFIG_EVENT_THREAD_MODE */
#ifdef CONFIG_C2H_WK #ifdef CONFIG_C2H_WK
_init_workitem(&pevtpriv->c2h_wk, c2h_wk_callback, NULL); _init_workitem(&pevtpriv->c2h_wk, c2h_wk_callback, NULL);
@ -197,7 +197,7 @@ _func_enter_;
if (pcmdpriv){ if (pcmdpriv){
_rtw_spinlock_free(&(pcmdpriv->cmd_queue.lock)); _rtw_spinlock_free(&(pcmdpriv->cmd_queue.lock));
_rtw_free_sema(&(pcmdpriv->cmd_queue_sema)); _rtw_free_sema(&(pcmdpriv->cmd_queue_sema));
//_rtw_free_sema(&(pcmdpriv->cmd_done_sema)); /* _rtw_free_sema(&(pcmdpriv->cmd_done_sema)); */
_rtw_free_sema(&(pcmdpriv->terminate_cmdthread_sema)); _rtw_free_sema(&(pcmdpriv->terminate_cmdthread_sema));
if (pcmdpriv->cmd_allocated_buf) if (pcmdpriv->cmd_allocated_buf)
@ -228,12 +228,12 @@ _func_enter_;
if (obj == NULL) if (obj == NULL)
goto exit; goto exit;
//_enter_critical_bh(&queue->lock, &irqL); /* _enter_critical_bh(&queue->lock, &irqL); */
_enter_critical(&queue->lock, &irqL); _enter_critical(&queue->lock, &irqL);
rtw_list_insert_tail(&obj->list, &queue->queue); rtw_list_insert_tail(&obj->list, &queue->queue);
//_exit_critical_bh(&queue->lock, &irqL); /* _exit_critical_bh(&queue->lock, &irqL); */
_exit_critical(&queue->lock, &irqL); _exit_critical(&queue->lock, &irqL);
exit: exit:
@ -250,7 +250,7 @@ struct cmd_obj *_rtw_dequeue_cmd(_queue *queue)
_func_enter_; _func_enter_;
//_enter_critical_bh(&(queue->lock), &irqL); /* _enter_critical_bh(&(queue->lock), &irqL); */
_enter_critical(&queue->lock, &irqL); _enter_critical(&queue->lock, &irqL);
if (rtw_is_list_empty(&(queue->queue))) if (rtw_is_list_empty(&(queue->queue)))
obj = NULL; obj = NULL;
@ -260,7 +260,7 @@ _func_enter_;
rtw_list_delete(&obj->list); rtw_list_delete(&obj->list);
} }
//_exit_critical_bh(&(queue->lock), &irqL); /* _exit_critical_bh(&(queue->lock), &irqL); */
_exit_critical(&queue->lock, &irqL); _exit_critical(&queue->lock, &irqL);
_func_exit_; _func_exit_;
@ -305,10 +305,10 @@ _func_exit_;
int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj); int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj);
int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
{ {
u8 bAllow = false; //set to true to allow enqueuing cmd when hw_init_completed is false u8 bAllow = false; /* set to true to allow enqueuing cmd when hw_init_completed is false */
#ifdef SUPPORT_HW_RFOFF_DETECTED #ifdef SUPPORT_HW_RFOFF_DETECTED
//To decide allow or not /* To decide allow or not */
if ( (pcmdpriv->padapter->pwrctrlpriv.bHWPwrPindetect) if ( (pcmdpriv->padapter->pwrctrlpriv.bHWPwrPindetect)
&&(!pcmdpriv->padapter->registrypriv.usbss_enable) &&(!pcmdpriv->padapter->registrypriv.usbss_enable)
) )
@ -318,7 +318,7 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
struct drvextra_cmd_parm *pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)cmd_obj->parmbuf; struct drvextra_cmd_parm *pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)cmd_obj->parmbuf;
if (pdrvextra_cmd_parm->ec_id == POWER_SAVING_CTRL_WK_CID) if (pdrvextra_cmd_parm->ec_id == POWER_SAVING_CTRL_WK_CID)
{ {
//DBG_88E("==>enqueue POWER_SAVING_CTRL_WK_CID\n"); /* DBG_88E("==>enqueue POWER_SAVING_CTRL_WK_CID\n"); */
bAllow = true; bAllow = true;
} }
} }
@ -329,14 +329,14 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
bAllow = true; bAllow = true;
if ( (pcmdpriv->padapter->hw_init_completed ==false && bAllow == false) if ( (pcmdpriv->padapter->hw_init_completed ==false && bAllow == false)
|| pcmdpriv->cmdthd_running== false //com_thread not running || pcmdpriv->cmdthd_running== false /* com_thread not running */
) )
{ {
//DBG_88E("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __func__, /* DBG_88E("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __func__, */
// cmd_obj->cmdcode, /* cmd_obj->cmdcode, */
// pcmdpriv->padapter->hw_init_completed, /* pcmdpriv->padapter->hw_init_completed, */
// pcmdpriv->cmdthd_running /* pcmdpriv->cmdthd_running */
//); /* */
return _FAIL; return _FAIL;
} }
@ -396,7 +396,7 @@ void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv)
{ {
_func_enter_; _func_enter_;
pcmdpriv->cmd_done_cnt++; pcmdpriv->cmd_done_cnt++;
//_rtw_up_sema(&(pcmdpriv->cmd_done_sema)); /* _rtw_up_sema(&(pcmdpriv->cmd_done_sema)); */
_func_exit_; _func_exit_;
} }
@ -406,7 +406,7 @@ _func_enter_;
if ((pcmd->cmdcode!=_JoinBss_CMD_) &&(pcmd->cmdcode!= _CreateBss_CMD_)) if ((pcmd->cmdcode!=_JoinBss_CMD_) &&(pcmd->cmdcode!= _CreateBss_CMD_))
{ {
//free parmbuf in cmd_obj /* free parmbuf in cmd_obj */
rtw_mfree((unsigned char*)pcmd->parmbuf, pcmd->cmdsz); rtw_mfree((unsigned char*)pcmd->parmbuf, pcmd->cmdsz);
} }
@ -414,12 +414,12 @@ _func_enter_;
{ {
if (pcmd->rspsz!= 0) if (pcmd->rspsz!= 0)
{ {
//free rsp in cmd_obj /* free rsp in cmd_obj */
rtw_mfree((unsigned char*)pcmd->rsp, pcmd->rspsz); rtw_mfree((unsigned char*)pcmd->rsp, pcmd->rspsz);
} }
} }
//free cmd_obj /* free cmd_obj */
rtw_mfree((unsigned char*)pcmd, sizeof(struct cmd_obj)); rtw_mfree((unsigned char*)pcmd, sizeof(struct cmd_obj));
_func_exit_; _func_exit_;
@ -490,7 +490,7 @@ _next:
pcmdpriv->cmd_issued_cnt++; pcmdpriv->cmd_issued_cnt++;
pcmd->cmdsz = _RND4((pcmd->cmdsz));//_RND4 pcmd->cmdsz = _RND4((pcmd->cmdsz));/* _RND4 */
_rtw_memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz); _rtw_memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);
@ -515,7 +515,7 @@ _next:
post_process: post_process:
//call callback function for post-processed /* call callback function for post-processed */
if (pcmd->cmdcode <= (sizeof(rtw_cmd_callback) /sizeof(struct _cmd_callback))) if (pcmd->cmdcode <= (sizeof(rtw_cmd_callback) /sizeof(struct _cmd_callback)))
{ {
pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback; pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback;
@ -526,8 +526,8 @@ post_process:
} }
else else
{ {
//todo: !!! fill rsp_buf to pcmd->rsp if (pcmd->rsp!=NULL) /* todo: !!! fill rsp_buf to pcmd->rsp if (pcmd->rsp!=NULL) */
pcmd_callback(pcmd->padapter, pcmd);//need conider that free cmd_obj in rtw_cmd_callback pcmd_callback(pcmd->padapter, pcmd);/* need conider that free cmd_obj in rtw_cmd_callback */
} }
} }
else else
@ -544,13 +544,13 @@ post_process:
pcmdpriv->cmdthd_running=false; pcmdpriv->cmdthd_running=false;
// free all cmd_obj resources /* free all cmd_obj resources */
do{ do{
pcmd = rtw_dequeue_cmd(pcmdpriv); pcmd = rtw_dequeue_cmd(pcmdpriv);
if (pcmd==NULL) if (pcmd==NULL)
break; break;
//DBG_88E("%s: leaving... drop cmdcode:%u\n", __func__, pcmd->cmdcode); /* DBG_88E("%s: leaving... drop cmdcode:%u\n", __func__, pcmd->cmdcode); */
rtw_free_cmd_obj(pcmd); rtw_free_cmd_obj(pcmd);
}while (1); }while (1);
@ -586,7 +586,7 @@ _func_enter_;
_exit_critical_bh(&queue->lock, &irqL); _exit_critical_bh(&queue->lock, &irqL);
//rtw_evt_notify_isr(pevtpriv); /* rtw_evt_notify_isr(pevtpriv); */
exit: exit:
@ -695,7 +695,7 @@ u8 rtw_sitesurvey_cmd(_adapter *padapter, NDIS_802_11_SSID *ssid, int ssid_num,
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo= &(padapter->wdinfo); struct wifidirect_info *pwdinfo= &(padapter->wdinfo);
#endif //CONFIG_P2P #endif /* CONFIG_P2P */
_func_enter_; _func_enter_;
@ -709,7 +709,7 @@ _func_enter_;
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
p2p_ps_wk_cmd(padapter, P2P_PS_SCAN, 1); p2p_ps_wk_cmd(padapter, P2P_PS_SCAN, 1);
} }
#endif //CONFIG_P2P_PS #endif /* CONFIG_P2P_PS */
ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
if (ph2c == NULL) if (ph2c == NULL)
@ -770,12 +770,12 @@ _func_enter_;
if ((padapter->pbuddy_adapter->mlmeextpriv.mlmext_info.state&0x03) == WIFI_FW_AP_STATE) if ((padapter->pbuddy_adapter->mlmeextpriv.mlmext_info.state&0x03) == WIFI_FW_AP_STATE)
_set_timer(&pmlmepriv->scan_to_timer, SURVEY_TO * ( 38 + ( 38 / RTW_SCAN_NUM_OF_CH ) * RTW_STAY_AP_CH_MILLISECOND ) + 1000 ); _set_timer(&pmlmepriv->scan_to_timer, SURVEY_TO * ( 38 + ( 38 / RTW_SCAN_NUM_OF_CH ) * RTW_STAY_AP_CH_MILLISECOND ) + 1000 );
else else
#endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE #endif /* CONFIG_STA_MODE_SCAN_UNDER_AP_MODE */
_set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT); _set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT);
rtw_led_control(padapter, LED_CTL_SITE_SURVEY); rtw_led_control(padapter, LED_CTL_SITE_SURVEY);
pmlmepriv->scan_interval = SCAN_INTERVAL;// 30*2 sec = 60sec pmlmepriv->scan_interval = SCAN_INTERVAL;/* 30*2 sec = 60sec */
} else { } else {
_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
} }
@ -810,7 +810,7 @@ _func_enter_;
init_h2fwcmd_w_parm_no_rsp(ph2c, pbsetdataratepara, GEN_CMD_CODE(_SetDataRate)); init_h2fwcmd_w_parm_no_rsp(ph2c, pbsetdataratepara, GEN_CMD_CODE(_SetDataRate));
#ifdef MP_FIRMWARE_OFFLOAD #ifdef MP_FIRMWARE_OFFLOAD
pbsetdataratepara->curr_rateidx = *(u32*)rateset; pbsetdataratepara->curr_rateidx = *(u32*)rateset;
// _rtw_memcpy(pbsetdataratepara, rateset, sizeof(u32)); /* _rtw_memcpy(pbsetdataratepara, rateset, sizeof(u32)); */
#else #else
pbsetdataratepara->mac_id = 5; pbsetdataratepara->mac_id = 5;
_rtw_memcpy(pbsetdataratepara->datarates, rateset, NumRates); _rtw_memcpy(pbsetdataratepara->datarates, rateset, NumRates);
@ -870,8 +870,8 @@ u8 rtw_setphy_cmd(_adapter *padapter, u8 modem, u8 ch)
struct cmd_obj* ph2c; struct cmd_obj* ph2c;
struct setphy_parm* psetphypara; struct setphy_parm* psetphypara;
struct cmd_priv *pcmdpriv=&padapter->cmdpriv; struct cmd_priv *pcmdpriv=&padapter->cmdpriv;
// struct mlme_priv *pmlmepriv = &padapter->mlmepriv; /* struct mlme_priv *pmlmepriv = &padapter->mlmepriv; */
// struct registry_priv* pregistry_priv = &padapter->registrypriv; /* struct registry_priv* pregistry_priv = &padapter->registrypriv; */
u8 res=_SUCCESS; u8 res=_SUCCESS;
_func_enter_; _func_enter_;
@ -1102,7 +1102,7 @@ _func_enter_;
pdev_network->Length = pcmd->cmdsz; pdev_network->Length = pcmd->cmdsz;
#ifdef CONFIG_RTL8712 #ifdef CONFIG_RTL8712
//notes: translate IELength & Length after assign the Length to cmdsz; /* notes: translate IELength & Length after assign the Length to cmdsz; */
pdev_network->Length = cpu_to_le32(pcmd->cmdsz); pdev_network->Length = cpu_to_le32(pcmd->cmdsz);
pdev_network->IELength = cpu_to_le32(pdev_network->IELength); pdev_network->IELength = cpu_to_le32(pdev_network->IELength);
pdev_network->Ssid.SsidLength = cpu_to_le32(pdev_network->Ssid.SsidLength); pdev_network->Ssid.SsidLength = cpu_to_le32(pdev_network->Ssid.SsidLength);
@ -1160,7 +1160,7 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network* pnetwork)
struct registry_priv *pregistrypriv = &padapter->registrypriv; struct registry_priv *pregistrypriv = &padapter->registrypriv;
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
struct ht_priv *phtpriv = &pmlmepriv->htpriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv;
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode = pnetwork->network.InfrastructureMode; NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode = pnetwork->network.InfrastructureMode;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
@ -1181,19 +1181,11 @@ _func_enter_;
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n"));
goto exit; goto exit;
} }
/* // for IEs is pointer /* for IEs is fix buf size */
t_len = sizeof (ULONG) + sizeof (NDIS_802_11_MAC_ADDRESS) + 2 +
sizeof (NDIS_802_11_SSID) + sizeof (ULONG) +
sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) +
sizeof (NDIS_802_11_CONFIGURATION) +
sizeof (NDIS_802_11_NETWORK_INFRASTRUCTURE) +
sizeof (NDIS_802_11_RATES_EX)+ sizeof(WLAN_PHY_INFO)+ sizeof (ULONG) + MAX_IE_SZ;
*/
//for IEs is fix buf size
t_len = sizeof(WLAN_BSSID_EX); t_len = sizeof(WLAN_BSSID_EX);
//for hidden ap to set fw_state here /* for hidden ap to set fw_state here */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) != true) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) != true)
{ {
switch (ndis_network_mode) switch (ndis_network_mode)
@ -1240,10 +1232,10 @@ _func_enter_;
} }
psecnetwork->IELength = 0; psecnetwork->IELength = 0;
// Added by Albert 2009/02/18 /* Added by Albert 2009/02/18 */
// If the the driver wants to use the bssid to create the connection. /* If the the driver wants to use the bssid to create the connection. */
// If not, we have to copy the connecting AP's MAC address to it so that /* If not, we have to copy the connecting AP's MAC address to it so that */
// the driver just has the bssid information for PMKIDList searching. /* the driver just has the bssid information for PMKIDList searching. */
if ( pmlmepriv->assoc_by_bssid == false ) if ( pmlmepriv->assoc_by_bssid == false )
{ {
@ -1264,11 +1256,11 @@ _func_enter_;
if (psecnetwork->IELength != tmp_len) if (psecnetwork->IELength != tmp_len)
{ {
psecnetwork->IELength = tmp_len; psecnetwork->IELength = tmp_len;
pqospriv->qos_option = 1; //There is WMM IE in this corresp. beacon pqospriv->qos_option = 1; /* There is WMM IE in this corresp. beacon */
} }
else else
{ {
pqospriv->qos_option = 0;//There is no WMM IE in this corresp. beacon pqospriv->qos_option = 0;/* There is no WMM IE in this corresp. beacon */
} }
} }
@ -1276,14 +1268,14 @@ _func_enter_;
phtpriv->ht_option = false; phtpriv->ht_option = false;
if (pregistrypriv->ht_enable) if (pregistrypriv->ht_enable)
{ {
// Added by Albert 2010/06/23 /* Added by Albert 2010/06/23 */
// For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */
// Especially for Realtek 8192u SoftAP. /* Especially for Realtek 8192u SoftAP. */
if ( ( padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_ ) && if ( ( padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_ ) &&
( padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_ ) && ( padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_ ) &&
( padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_ )) ( padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_ ))
{ {
//rtw_restructure_ht_ie /* rtw_restructure_ht_ie */
rtw_restructure_ht_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0], rtw_restructure_ht_ie(padapter, &pnetwork->network.IEs[0], &psecnetwork->IEs[0],
pnetwork->network.IELength, &psecnetwork->IELength); pnetwork->network.IELength, &psecnetwork->IELength);
} }
@ -1300,10 +1292,10 @@ _func_enter_;
DBG_88E("%s: smart_ps=%d\n", __func__, padapter->pwrctrlpriv.smart_ps); DBG_88E("%s: smart_ps=%d\n", __func__, padapter->pwrctrlpriv.smart_ps);
pcmd->cmdsz = get_WLAN_BSSID_EX_sz(psecnetwork);//get cmdsz before endian conversion pcmd->cmdsz = get_WLAN_BSSID_EX_sz(psecnetwork);/* get cmdsz before endian conversion */
#ifdef CONFIG_RTL8712 #ifdef CONFIG_RTL8712
//wlan_network endian conversion /* wlan_network endian conversion */
psecnetwork->Length = cpu_to_le32(psecnetwork->Length); psecnetwork->Length = cpu_to_le32(psecnetwork->Length);
psecnetwork->Ssid.SsidLength= cpu_to_le32(psecnetwork->Ssid.SsidLength); psecnetwork->Ssid.SsidLength= cpu_to_le32(psecnetwork->Ssid.SsidLength);
psecnetwork->Privacy = cpu_to_le32(psecnetwork->Privacy); psecnetwork->Privacy = cpu_to_le32(psecnetwork->Privacy);
@ -1322,7 +1314,7 @@ _func_enter_;
#endif #endif
_rtw_init_listhead(&pcmd->list); _rtw_init_listhead(&pcmd->list);
pcmd->cmdcode = _JoinBss_CMD_;//GEN_CMD_CODE(_JoinBss) pcmd->cmdcode = _JoinBss_CMD_;/* GEN_CMD_CODE(_JoinBss) */
pcmd->parmbuf = (unsigned char *)psecnetwork; pcmd->parmbuf = (unsigned char *)psecnetwork;
pcmd->rsp = NULL; pcmd->rsp = NULL;
pcmd->rspsz = 0; pcmd->rspsz = 0;
@ -1460,7 +1452,7 @@ _func_enter_;
if (sta->tdls_sta_state&TDLS_LINKED_STATE) if (sta->tdls_sta_state&TDLS_LINKED_STATE)
psetstakey_para->algorithm=(u8)sta->dot118021XPrivacy; psetstakey_para->algorithm=(u8)sta->dot118021XPrivacy;
else else
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
psetstakey_para->algorithm =(unsigned char) psecuritypriv->dot11PrivacyAlgrthm; psetstakey_para->algorithm =(unsigned char) psecuritypriv->dot11PrivacyAlgrthm;
}else{ }else{
GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false); GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false);
@ -1471,13 +1463,13 @@ _func_enter_;
if ((sta->tdls_sta_state&TDLS_LINKED_STATE)==TDLS_LINKED_STATE) if ((sta->tdls_sta_state&TDLS_LINKED_STATE)==TDLS_LINKED_STATE)
_rtw_memcpy(&psetstakey_para->key, sta->tpk.tk, 16); _rtw_memcpy(&psetstakey_para->key, sta->tpk.tk, 16);
else else
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
_rtw_memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16); _rtw_memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16);
} else { } else {
_rtw_memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16); _rtw_memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16);
} }
//jeff: set this becasue at least sw key is ready /* jeff: set this becasue at least sw key is ready */
padapter->securitypriv.busetkipkey=true; padapter->securitypriv.busetkipkey=true;
res = rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, ph2c);
@ -1603,7 +1595,7 @@ _func_enter_;
goto exit; goto exit;
} }
// init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm, GEN_CMD_CODE(_SetRaTable)); /* init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm, GEN_CMD_CODE(_SetRaTable)); */
_rtw_init_listhead(&ph2c->list); _rtw_init_listhead(&ph2c->list);
ph2c->cmdcode =GEN_CMD_CODE(_GetRaTable); ph2c->cmdcode =GEN_CMD_CODE(_GetRaTable);
@ -1695,9 +1687,9 @@ _func_enter_;
init_h2fwcmd_w_parm_no_rsp(ph2c, paddbareq_parm, GEN_CMD_CODE(_AddBAReq)); init_h2fwcmd_w_parm_no_rsp(ph2c, paddbareq_parm, GEN_CMD_CODE(_AddBAReq));
//DBG_88E("rtw_addbareq_cmd, tid=%d\n", tid); /* DBG_88E("rtw_addbareq_cmd, tid=%d\n", tid); */
//rtw_enqueue_cmd(pcmdpriv, ph2c); /* rtw_enqueue_cmd(pcmdpriv, ph2c); */
res = rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, ph2c);
exit: exit:
@ -1741,7 +1733,7 @@ _func_enter_;
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
//rtw_enqueue_cmd(pcmdpriv, ph2c); /* rtw_enqueue_cmd(pcmdpriv, ph2c); */
res = rtw_enqueue_cmd(pcmdpriv, ph2c); res = rtw_enqueue_cmd(pcmdpriv, ph2c);
exit: exit:
@ -1819,13 +1811,13 @@ _func_enter_;
RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_chplan_cmd\n")); RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_chplan_cmd\n"));
//check input parameter /* check input parameter */
if (!rtw_is_channel_plan_valid(chplan)) { if (!rtw_is_channel_plan_valid(chplan)) {
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
//prepare cmd parameter /* prepare cmd parameter */
setChannelPlan_param = (struct SetChannelPlan_param *)rtw_zmalloc(sizeof(struct SetChannelPlan_param)); setChannelPlan_param = (struct SetChannelPlan_param *)rtw_zmalloc(sizeof(struct SetChannelPlan_param));
if (setChannelPlan_param == NULL) { if (setChannelPlan_param == NULL) {
res= _FAIL; res= _FAIL;
@ -1835,7 +1827,7 @@ _func_enter_;
if (enqueue) if (enqueue)
{ {
//need enqueue, prepare cmd_obj and enqueue /* need enqueue, prepare cmd_obj and enqueue */
pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj)); pcmdobj = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
if (pcmdobj == NULL){ if (pcmdobj == NULL){
rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param)); rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param));
@ -1848,14 +1840,14 @@ _func_enter_;
} }
else else
{ {
//no need to enqueue, do the cmd hdl directly and free cmd parameter /* no need to enqueue, do the cmd hdl directly and free cmd parameter */
if ( H2C_SUCCESS !=set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param) ) if ( H2C_SUCCESS !=set_chplan_hdl(padapter, (unsigned char *)setChannelPlan_param) )
res = _FAIL; res = _FAIL;
rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param)); rtw_mfree((u8 *)setChannelPlan_param, sizeof(struct SetChannelPlan_param));
} }
//do something based on res... /* do something based on res... */
if (res == _SUCCESS) if (res == _SUCCESS)
padapter->mlmepriv.ChannelPlan = chplan; padapter->mlmepriv.ChannelPlan = chplan;
@ -1976,7 +1968,7 @@ _func_enter_;
init_h2fwcmd_w_parm_no_rsp(pcmdobj, TDLSoption, GEN_CMD_CODE(_TDLS)); init_h2fwcmd_w_parm_no_rsp(pcmdobj, TDLSoption, GEN_CMD_CODE(_TDLS));
res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); res = rtw_enqueue_cmd(pcmdpriv, pcmdobj);
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
exit: exit:
@ -1999,11 +1991,11 @@ static void traffic_status_watchdog(_adapter *padapter)
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
struct tdls_info *ptdlsinfo = &(padapter->tdlsinfo); struct tdls_info *ptdlsinfo = &(padapter->tdlsinfo);
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
// /* */
// Determine if our traffic is busy now /* Determine if our traffic is busy now */
// /* */
if ((check_fwstate(pmlmepriv, _FW_LINKED)== true) if ((check_fwstate(pmlmepriv, _FW_LINKED)== true)
/*&& !MgntInitAdapterInProgress(pMgntInfo)*/) /*&& !MgntInitAdapterInProgress(pMgntInfo)*/)
{ {
@ -2011,10 +2003,10 @@ static void traffic_status_watchdog(_adapter *padapter)
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
if ( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 50 || if ( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 50 ||
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 50 ) pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 50 )
#else // !CONFIG_BT_COEXIST #else /* !CONFIG_BT_COEXIST */
if ( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 100 || if ( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 100 ||
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 100 ) pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 100 )
#endif // !CONFIG_BT_COEXIST #endif /* !CONFIG_BT_COEXIST */
{ {
bBusyTraffic = true; bBusyTraffic = true;
@ -2024,7 +2016,7 @@ static void traffic_status_watchdog(_adapter *padapter)
bTxBusyTraffic = true; bTxBusyTraffic = true;
} }
// Higher Tx/Rx data. /* Higher Tx/Rx data. */
if ( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 || if ( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000 ) pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000 )
{ {
@ -2050,26 +2042,26 @@ static void traffic_status_watchdog(_adapter *padapter)
pmlmepriv->ftp_lock_flag = 0; pmlmepriv->ftp_lock_flag = 0;
rtw_unlock_suspend(); rtw_unlock_suspend();
} }
#endif //CONFIG_KEEP_FTP_TRANSMIT #endif /* CONFIG_KEEP_FTP_TRANSMIT */
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
#ifdef CONFIG_TDLS_AUTOSETUP #ifdef CONFIG_TDLS_AUTOSETUP
if ( ( ptdlsinfo->watchdog_count % TDLS_WATCHDOG_PERIOD ) == 0 ) //10 * 2sec, periodically sending if ( ( ptdlsinfo->watchdog_count % TDLS_WATCHDOG_PERIOD ) == 0 ) /* 10 * 2sec, periodically sending */
issue_tdls_dis_req( padapter, NULL ); issue_tdls_dis_req( padapter, NULL );
ptdlsinfo->watchdog_count++; ptdlsinfo->watchdog_count++;
#endif //CONFIG_TDLS_AUTOSETUP #endif /* CONFIG_TDLS_AUTOSETUP */
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
if (BT_1Ant(padapter) == false) if (BT_1Ant(padapter) == false)
#endif #endif
{ {
// check traffic for powersaving. /* check traffic for powersaving. */
if ( ((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8 ) || if ( ((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8 ) ||
(pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2) ) (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2) )
{ {
//DBG_88E("Tx = %d, Rx = %d\n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod); /* DBG_88E("Tx = %d, Rx = %d\n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod); */
bEnterPS= false; bEnterPS= false;
} }
else else
@ -2077,7 +2069,7 @@ static void traffic_status_watchdog(_adapter *padapter)
bEnterPS= true; bEnterPS= true;
} }
// LeisurePS only work in infra mode. /* LeisurePS only work in infra mode. */
if (bEnterPS) if (bEnterPS)
{ {
LPS_Enter(padapter); LPS_Enter(padapter);
@ -2087,7 +2079,7 @@ static void traffic_status_watchdog(_adapter *padapter)
LPS_Leave(padapter); LPS_Leave(padapter);
} }
} }
#endif // CONFIG_LPS #endif /* CONFIG_LPS */
} }
else else
{ {
@ -2122,13 +2114,13 @@ void dynamic_chk_wk_hdl(_adapter *padapter, u8 *pbuf, int sz)
expire_timeout_chk(padapter); expire_timeout_chk(padapter);
} }
#endif #endif
#endif //CONFIG_ACTIVE_KEEP_ALIVE_CHECK #endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
#ifdef DBG_CONFIG_ERROR_DETECT #ifdef DBG_CONFIG_ERROR_DETECT
rtw_hal_sreset_xmit_status_check(padapter); rtw_hal_sreset_xmit_status_check(padapter);
#endif #endif
//if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING|_FW_UNDER_SURVEY)==false) /* if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING|_FW_UNDER_SURVEY)==false) */
{ {
linked_status_chk(padapter); linked_status_chk(padapter);
traffic_status_watchdog(padapter); traffic_status_watchdog(padapter);
@ -2136,12 +2128,12 @@ void dynamic_chk_wk_hdl(_adapter *padapter, u8 *pbuf, int sz)
rtw_hal_dm_watchdog(padapter); rtw_hal_dm_watchdog(padapter);
//check_hw_pbc(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); /* check_hw_pbc(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); */
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
// /* */
// BT-Coexist /* BT-Coexist */
// /* */
BT_CoexistMechanism(padapter); BT_CoexistMechanism(padapter);
#endif #endif
} }
@ -2166,26 +2158,26 @@ _func_enter_;
switch (lps_ctrl_type) switch (lps_ctrl_type)
{ {
case LPS_CTRL_SCAN: case LPS_CTRL_SCAN:
//DBG_88E("LPS_CTRL_SCAN\n"); /* DBG_88E("LPS_CTRL_SCAN\n"); */
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
BT_WifiScanNotify(padapter, true); BT_WifiScanNotify(padapter, true);
if (BT_1Ant(padapter) == false) if (BT_1Ant(padapter) == false)
#endif #endif
{ {
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
{ //connect { /* connect */
LPS_Leave(padapter); LPS_Leave(padapter);
} }
} }
break; break;
case LPS_CTRL_JOINBSS: case LPS_CTRL_JOINBSS:
//DBG_88E("LPS_CTRL_JOINBSS\n"); /* DBG_88E("LPS_CTRL_JOINBSS\n"); */
LPS_Leave(padapter); LPS_Leave(padapter);
break; break;
case LPS_CTRL_CONNECT: case LPS_CTRL_CONNECT:
//DBG_88E("LPS_CTRL_CONNECT\n"); /* DBG_88E("LPS_CTRL_CONNECT\n"); */
mstatus = 1;//connect mstatus = 1;/* connect */
// Reset LPS Setting /* Reset LPS Setting */
padapter->pwrctrlpriv.LpsIdleCount = 0; padapter->pwrctrlpriv.LpsIdleCount = 0;
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus)); rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus));
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
@ -2193,8 +2185,8 @@ _func_enter_;
#endif #endif
break; break;
case LPS_CTRL_DISCONNECT: case LPS_CTRL_DISCONNECT:
//DBG_88E("LPS_CTRL_DISCONNECT\n"); /* DBG_88E("LPS_CTRL_DISCONNECT\n"); */
mstatus = 0;//disconnect mstatus = 0;/* disconnect */
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
BT_WifiMediaStatusNotify(padapter, mstatus); BT_WifiMediaStatusNotify(padapter, mstatus);
if (BT_1Ant(padapter) == false) if (BT_1Ant(padapter) == false)
@ -2205,7 +2197,7 @@ _func_enter_;
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus)); rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus));
break; break;
case LPS_CTRL_SPECIAL_PACKET: case LPS_CTRL_SPECIAL_PACKET:
//DBG_88E("LPS_CTRL_SPECIAL_PACKET\n"); /* DBG_88E("LPS_CTRL_SPECIAL_PACKET\n"); */
pwrpriv->DelayLPSLastTimeStamp = rtw_get_current_time(); pwrpriv->DelayLPSLastTimeStamp = rtw_get_current_time();
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
BT_SpecialPacketNotify(padapter); BT_SpecialPacketNotify(padapter);
@ -2216,7 +2208,7 @@ _func_enter_;
} }
break; break;
case LPS_CTRL_LEAVE: case LPS_CTRL_LEAVE:
//DBG_88E("LPS_CTRL_LEAVE\n"); /* DBG_88E("LPS_CTRL_LEAVE\n"); */
#ifdef CONFIG_BT_COEXIST #ifdef CONFIG_BT_COEXIST
BT_LpsLeave(padapter); BT_LpsLeave(padapter);
if (BT_1Ant(padapter) == false) if (BT_1Ant(padapter) == false)
@ -2238,13 +2230,13 @@ u8 rtw_lps_ctrl_wk_cmd(_adapter*padapter, u8 lps_ctrl_type, u8 enqueue)
struct cmd_obj *ph2c; struct cmd_obj *ph2c;
struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct drvextra_cmd_parm *pdrvextra_cmd_parm;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
//struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; /* struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; */
u8 res = _SUCCESS; u8 res = _SUCCESS;
_func_enter_; _func_enter_;
//if (!pwrctrlpriv->bLeisurePs) /* if (!pwrctrlpriv->bLeisurePs) */
// return res; /* return res; */
if (enqueue) if (enqueue)
{ {
@ -2415,8 +2407,8 @@ _func_enter_;
} }
pdrvextra_cmd_parm->ec_id = P2P_PROTO_WK_CID; pdrvextra_cmd_parm->ec_id = P2P_PROTO_WK_CID;
pdrvextra_cmd_parm->type_size = intCmdType; // As the command tppe. pdrvextra_cmd_parm->type_size = intCmdType; /* As the command tppe. */
pdrvextra_cmd_parm->pbuf = NULL; // Must be NULL here pdrvextra_cmd_parm->pbuf = NULL; /* Must be NULL here */
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
@ -2429,7 +2421,7 @@ _func_exit_;
return res; return res;
} }
#endif //CONFIG_P2P #endif /* CONFIG_P2P */
u8 rtw_ps_cmd(_adapter*padapter) u8 rtw_ps_cmd(_adapter*padapter)
{ {
@ -2488,8 +2480,8 @@ static void rtw_chk_hi_queue_hdl(_adapter *padapter)
{ {
u8 val = 0; u8 val = 0;
//while ((rtw_read32(padapter, 0x414)&0x00ffff00)!=0) /* while ((rtw_read32(padapter, 0x414)&0x00ffff00)!=0) */
//while ((rtw_read32(padapter, 0x414)&0x0000ff00)!=0) /* while ((rtw_read32(padapter, 0x414)&0x0000ff00)!=0) */
rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val); rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val);
@ -2512,7 +2504,7 @@ static void rtw_chk_hi_queue_hdl(_adapter *padapter)
update_beacon(padapter, _TIM_IE_, NULL, false); update_beacon(padapter, _TIM_IE_, NULL, false);
} }
else //re check again else /* re check again */
{ {
rtw_chk_hi_queue_cmd(padapter); rtw_chk_hi_queue_cmd(padapter);
} }
@ -2694,22 +2686,22 @@ u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf)
case P2P_PS_WK_CID: case P2P_PS_WK_CID:
p2p_ps_wk_hdl(padapter, pdrvextra_cmd->type_size); p2p_ps_wk_hdl(padapter, pdrvextra_cmd->type_size);
break; break;
#endif // CONFIG_P2P_PS #endif /* CONFIG_P2P_PS */
case P2P_PROTO_WK_CID: case P2P_PROTO_WK_CID:
// Commented by Albert 2011/07/01 /* Commented by Albert 2011/07/01 */
// I used the type_size as the type command /* I used the type_size as the type command */
p2p_protocol_wk_hdl( padapter, pdrvextra_cmd->type_size ); p2p_protocol_wk_hdl( padapter, pdrvextra_cmd->type_size );
break; break;
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
case CHECK_HIQ_WK_CID: case CHECK_HIQ_WK_CID:
rtw_chk_hi_queue_hdl(padapter); rtw_chk_hi_queue_hdl(padapter);
break; break;
#endif //CONFIG_AP_MODE #endif /* CONFIG_AP_MODE */
#ifdef CONFIG_INTEL_WIDI #ifdef CONFIG_INTEL_WIDI
case INTEl_WIDI_WK_CID: case INTEl_WIDI_WK_CID:
intel_widi_wk_hdl(padapter, pdrvextra_cmd->type_size, pdrvextra_cmd->pbuf); intel_widi_wk_hdl(padapter, pdrvextra_cmd->type_size, pdrvextra_cmd->pbuf);
break; break;
#endif //CONFIG_INTEL_WIDI #endif /* CONFIG_INTEL_WIDI */
case C2H_WK_CID: case C2H_WK_CID:
c2h_evt_hdl(padapter, (struct c2h_evt_hdr *)pdrvextra_cmd->pbuf, NULL); c2h_evt_hdl(padapter, (struct c2h_evt_hdr *)pdrvextra_cmd->pbuf, NULL);
@ -2735,8 +2727,8 @@ _func_enter_;
if (pcmd->res == H2C_DROPPED) if (pcmd->res == H2C_DROPPED)
{ {
//TODO: cancel timer and do timeout handler directly... /* TODO: cancel timer and do timeout handler directly... */
//need to make timeout handlerOS independent /* need to make timeout handlerOS independent */
_set_timer(&pmlmepriv->scan_to_timer, 1); _set_timer(&pmlmepriv->scan_to_timer, 1);
} }
else if (pcmd->res != H2C_SUCCESS) { else if (pcmd->res != H2C_SUCCESS) {
@ -2744,7 +2736,7 @@ _func_enter_;
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ********Error: MgntActrtw_set_802_11_bssid_LIST_SCAN Fail ************\n\n.")); RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ********Error: MgntActrtw_set_802_11_bssid_LIST_SCAN Fail ************\n\n."));
} }
// free cmd /* free cmd */
rtw_free_cmd_obj(pcmd); rtw_free_cmd_obj(pcmd);
_func_exit_; _func_exit_;
@ -2767,11 +2759,11 @@ _func_enter_;
goto exit; goto exit;
} }
#ifdef CONFIG_BR_EXT #ifdef CONFIG_BR_EXT
else //clear bridge database else /* clear bridge database */
nat25_db_cleanup(padapter); nat25_db_cleanup(padapter);
#endif //CONFIG_BR_EXT #endif /* CONFIG_BR_EXT */
// free cmd /* free cmd */
rtw_free_cmd_obj(pcmd); rtw_free_cmd_obj(pcmd);
exit: exit:
@ -2788,8 +2780,8 @@ _func_enter_;
if (pcmd->res == H2C_DROPPED) if (pcmd->res == H2C_DROPPED)
{ {
//TODO: cancel timer and do timeout handler directly... /* TODO: cancel timer and do timeout handler directly... */
//need to make timeout handlerOS independent /* need to make timeout handlerOS independent */
_set_timer(&pmlmepriv->assoc_timer, 1); _set_timer(&pmlmepriv->assoc_timer, 1);
} }
else if (pcmd->res != H2C_SUCCESS) else if (pcmd->res != H2C_SUCCESS)
@ -2824,14 +2816,14 @@ _func_enter_;
_cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled); _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled);
#ifdef CONFIG_FW_MLMLE #ifdef CONFIG_FW_MLMLE
//endian_convert /* endian_convert */
pnetwork->Length = le32_to_cpu(pnetwork->Length); pnetwork->Length = le32_to_cpu(pnetwork->Length);
pnetwork->Ssid.SsidLength = le32_to_cpu(pnetwork->Ssid.SsidLength); pnetwork->Ssid.SsidLength = le32_to_cpu(pnetwork->Ssid.SsidLength);
pnetwork->Privacy =le32_to_cpu(pnetwork->Privacy); pnetwork->Privacy =le32_to_cpu(pnetwork->Privacy);
pnetwork->Rssi = le32_to_cpu(pnetwork->Rssi); pnetwork->Rssi = le32_to_cpu(pnetwork->Rssi);
pnetwork->NetworkTypeInUse =le32_to_cpu(pnetwork->NetworkTypeInUse); pnetwork->NetworkTypeInUse =le32_to_cpu(pnetwork->NetworkTypeInUse);
pnetwork->Configuration.ATIMWindow = le32_to_cpu(pnetwork->Configuration.ATIMWindow); pnetwork->Configuration.ATIMWindow = le32_to_cpu(pnetwork->Configuration.ATIMWindow);
//pnetwork->Configuration.BeaconPeriod = le32_to_cpu(pnetwork->Configuration.BeaconPeriod); /* pnetwork->Configuration.BeaconPeriod = le32_to_cpu(pnetwork->Configuration.BeaconPeriod); */
pnetwork->Configuration.DSConfig =le32_to_cpu(pnetwork->Configuration.DSConfig); pnetwork->Configuration.DSConfig =le32_to_cpu(pnetwork->Configuration.DSConfig);
pnetwork->Configuration.FHConfig.DwellTime=le32_to_cpu(pnetwork->Configuration.FHConfig.DwellTime); pnetwork->Configuration.FHConfig.DwellTime=le32_to_cpu(pnetwork->Configuration.FHConfig.DwellTime);
pnetwork->Configuration.FHConfig.HopPattern=le32_to_cpu(pnetwork->Configuration.FHConfig.HopPattern); pnetwork->Configuration.FHConfig.HopPattern=le32_to_cpu(pnetwork->Configuration.FHConfig.HopPattern);
@ -2884,20 +2876,20 @@ _func_enter_;
pnetwork->Length = get_WLAN_BSSID_EX_sz(pnetwork); pnetwork->Length = get_WLAN_BSSID_EX_sz(pnetwork);
_rtw_memcpy(&(pwlan->network), pnetwork, pnetwork->Length); _rtw_memcpy(&(pwlan->network), pnetwork, pnetwork->Length);
//pwlan->fixed = true; /* pwlan->fixed = true; */
//rtw_list_insert_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue); /* rtw_list_insert_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue); */
// copy pdev_network information to pmlmepriv->cur_network /* copy pdev_network information to pmlmepriv->cur_network */
_rtw_memcpy(&tgt_network->network, pnetwork, (get_WLAN_BSSID_EX_sz(pnetwork))); _rtw_memcpy(&tgt_network->network, pnetwork, (get_WLAN_BSSID_EX_sz(pnetwork)));
// reset DSConfig /* reset DSConfig */
//tgt_network->network.Configuration.DSConfig = (u32)rtw_ch2freq(pnetwork->Configuration.DSConfig); /* tgt_network->network.Configuration.DSConfig = (u32)rtw_ch2freq(pnetwork->Configuration.DSConfig); */
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
// we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback) /* we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback) */
} }
@ -2927,16 +2919,11 @@ _func_enter_;
RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nERROR: rtw_setstaKey_cmdrsp_callback => can't get sta_info\n\n")); RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\nERROR: rtw_setstaKey_cmdrsp_callback => can't get sta_info\n\n"));
goto exit; goto exit;
} }
//psta->aid = psta->mac_id = psetstakey_rsp->keyid; //CAM_ID(CAM_ENTRY)
exit: exit:
rtw_free_cmd_obj(pcmd); rtw_free_cmd_obj(pcmd);
_func_exit_; _func_exit_;
} }
void rtw_setassocsta_cmdrsp_callback(_adapter* padapter, struct cmd_obj *pcmd) void rtw_setassocsta_cmdrsp_callback(_adapter* padapter, struct cmd_obj *pcmd)
{ {
_irqL irqL; _irqL irqL;

View file

@ -277,7 +277,7 @@ int proc_get_ht_option(char *page, char **start,
int len = 0; int len = 0;
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
len += snprintf(page + len, count - len, "ht_option=%d\n", pmlmepriv->htpriv.ht_option); len += snprintf(page + len, count - len, "ht_option=%d\n", pmlmepriv->htpriv.ht_option);
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
*eof = 1; *eof = 1;
return len; return len;
} }
@ -329,7 +329,7 @@ int proc_get_ap_info(char *page, char **start,
len += snprintf(page + len, count - len, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); len += snprintf(page + len, count - len, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi);
len += snprintf(page + len, count - len, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable); len += snprintf(page + len, count - len, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable);
len += snprintf(page + len, count - len, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); len += snprintf(page + len, count - len, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap);
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
for (i=0;i<16;i++) for (i=0;i<16;i++)
{ {
@ -532,7 +532,6 @@ int proc_get_rf_reg_dump1(char *page, char **start,
len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path); len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path);
for (i=0;i<0xC0;i++) for (i=0;i<0xC0;i++)
{ {
//value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord);
value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff);
if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i);
len += snprintf(page + len, count - len, " 0x%08x ",value); len += snprintf(page + len, count - len, " 0x%08x ",value);
@ -559,7 +558,6 @@ int proc_get_rf_reg_dump2(char *page, char **start,
len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path); len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path);
for (i=0xC0;i<0x100;i++) for (i=0xC0;i<0x100;i++)
{ {
//value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord);
value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff);
if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i);
len += snprintf(page + len, count - len, " 0x%08x ",value); len += snprintf(page + len, count - len, " 0x%08x ",value);
@ -585,7 +583,6 @@ int proc_get_rf_reg_dump3(char *page, char **start,
len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path); len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path);
for (i=0;i<0xC0;i++) for (i=0;i<0xC0;i++)
{ {
//value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord);
value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff);
if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i);
len += snprintf(page + len, count - len, " 0x%08x ",value); len += snprintf(page + len, count - len, " 0x%08x ",value);
@ -612,7 +609,6 @@ int proc_get_rf_reg_dump4(char *page, char **start,
len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path); len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path);
for (i=0xC0;i<0x100;i++) for (i=0xC0;i<0x100;i++)
{ {
//value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord);
value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff);
if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); if (j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i);
len += snprintf(page + len, count - len, " 0x%08x ",value); len += snprintf(page + len, count - len, " 0x%08x ",value);
@ -825,7 +821,7 @@ int proc_set_ampdu_enable(struct file *file, const char __user *buffer,
return count; return count;
} }
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
int proc_get_two_path_rssi(char *page, char **start, int proc_get_two_path_rssi(char *page, char **start,
off_t offset, int count, off_t offset, int count,
@ -893,7 +889,7 @@ int proc_set_rx_stbc(struct file *file, const char __user *buffer,
return count; return count;
} }
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
int proc_get_rssi_disp(char *page, char **start, int proc_get_rssi_disp(char *page, char **start,
@ -977,48 +973,39 @@ int proc_get_all_sta_info(char *page, char **start,
plist = get_next(plist); plist = get_next(plist);
//if (extra_arg == psta->aid) len += snprintf(page + len, count - len, "sta's macaddr: %pM\n", psta->hwaddr);
{ len += snprintf(page + len, count - len, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self);
len += snprintf(page + len, count - len, "sta's macaddr: %pM\n", psta->hwaddr); len += snprintf(page + len, count - len, "state=0x%x, aid=%d, macid=%d, raid=%d\n", psta->state, psta->aid, psta->mac_id, psta->raid);
len += snprintf(page + len, count - len, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self);
len += snprintf(page + len, count - len, "state=0x%x, aid=%d, macid=%d, raid=%d\n", psta->state, psta->aid, psta->mac_id, psta->raid);
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
len += snprintf(page + len, count - len, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate); len += snprintf(page + len, count - len, "qos_en=%d, ht_en=%d, init_rate=%d\n", psta->qos_option, psta->htpriv.ht_option, psta->init_rate);
len += snprintf(page + len, count - len, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi); len += snprintf(page + len, count - len, "bwmode=%d, ch_offset=%d, sgi=%d\n", psta->htpriv.bwmode, psta->htpriv.ch_offset, psta->htpriv.sgi);
len += snprintf(page + len, count - len, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable); len += snprintf(page + len, count - len, "ampdu_enable = %d\n", psta->htpriv.ampdu_enable);
len += snprintf(page + len, count - len, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); len += snprintf(page + len, count - len, "agg_enable_bitmap=%x, candidate_tid_bitmap=%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap);
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
len += snprintf(page + len, count - len, "sleepq_len=%d\n", psta->sleepq_len); len += snprintf(page + len, count - len, "sleepq_len=%d\n", psta->sleepq_len);
len += snprintf(page + len, count - len, "capability=0x%x\n", psta->capability); len += snprintf(page + len, count - len, "capability=0x%x\n", psta->capability);
len += snprintf(page + len, count - len, "flags=0x%x\n", psta->flags); len += snprintf(page + len, count - len, "flags=0x%x\n", psta->flags);
len += snprintf(page + len, count - len, "wpa_psk=0x%x\n", psta->wpa_psk); len += snprintf(page + len, count - len, "wpa_psk=0x%x\n", psta->wpa_psk);
len += snprintf(page + len, count - len, "wpa2_group_cipher=0x%x\n", psta->wpa2_group_cipher); len += snprintf(page + len, count - len, "wpa2_group_cipher=0x%x\n", psta->wpa2_group_cipher);
len += snprintf(page + len, count - len, "wpa2_pairwise_cipher=0x%x\n", psta->wpa2_pairwise_cipher); len += snprintf(page + len, count - len, "wpa2_pairwise_cipher=0x%x\n", psta->wpa2_pairwise_cipher);
len += snprintf(page + len, count - len, "qos_info=0x%x\n", psta->qos_info); len += snprintf(page + len, count - len, "qos_info=0x%x\n", psta->qos_info);
len += snprintf(page + len, count - len, "dot118021XPrivacy=0x%x\n", psta->dot118021XPrivacy); len += snprintf(page + len, count - len, "dot118021XPrivacy=0x%x\n", psta->dot118021XPrivacy);
for (j=0;j<16;j++) for (j=0;j<16;j++)
{
preorder_ctrl = &psta->recvreorder_ctrl[j];
if (preorder_ctrl->enable)
{ {
preorder_ctrl = &psta->recvreorder_ctrl[j]; len += snprintf(page + len, count - len, "tid=%d, indicate_seq=%d\n", j, preorder_ctrl->indicate_seq);
if (preorder_ctrl->enable)
{
len += snprintf(page + len, count - len, "tid=%d, indicate_seq=%d\n", j, preorder_ctrl->indicate_seq);
}
} }
} }
} }
} }
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
*eof = 1; *eof = 1;
return len; return len;
} }
#endif #endif
#ifdef CONFIG_FIND_BEST_CHANNEL #ifdef CONFIG_FIND_BEST_CHANNEL
@ -1040,7 +1027,7 @@ int proc_get_best_channel(char *page, char **start,
} }
for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) { for (i=0; pmlmeext->channel_set[i].ChannelNum !=0; i++) {
// 2.4G /* 2.4G */
if ( pmlmeext->channel_set[i].ChannelNum == 6 ) { if ( pmlmeext->channel_set[i].ChannelNum == 6 ) {
if ( pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_24G].rx_count ) { if ( pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_24G].rx_count ) {
index_24G = i; index_24G = i;
@ -1048,10 +1035,10 @@ int proc_get_best_channel(char *page, char **start,
} }
} }
// 5G /* 5G */
if ( pmlmeext->channel_set[i].ChannelNum >= 36 if ( pmlmeext->channel_set[i].ChannelNum >= 36
&& pmlmeext->channel_set[i].ChannelNum < 140 ) { && pmlmeext->channel_set[i].ChannelNum < 140 ) {
// Find primary channel /* Find primary channel */
if ( (( pmlmeext->channel_set[i].ChannelNum - 36) % 8 == 0) if ( (( pmlmeext->channel_set[i].ChannelNum - 36) % 8 == 0)
&& (pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_5G].rx_count) ) { && (pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_5G].rx_count) ) {
index_5G = i; index_5G = i;
@ -1061,14 +1048,14 @@ int proc_get_best_channel(char *page, char **start,
if ( pmlmeext->channel_set[i].ChannelNum >= 149 if ( pmlmeext->channel_set[i].ChannelNum >= 149
&& pmlmeext->channel_set[i].ChannelNum < 165) { && pmlmeext->channel_set[i].ChannelNum < 165) {
// find primary channel /* find primary channel */
if ( (( pmlmeext->channel_set[i].ChannelNum - 149) % 8 == 0) if ( (( pmlmeext->channel_set[i].ChannelNum - 149) % 8 == 0)
&& (pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_5G].rx_count) ) { && (pmlmeext->channel_set[i].rx_count < pmlmeext->channel_set[index_5G].rx_count) ) {
index_5G = i; index_5G = i;
best_channel_5G = pmlmeext->channel_set[i].ChannelNum; best_channel_5G = pmlmeext->channel_set[i].ChannelNum;
} }
} }
#if 1 // debug #if 1 /* debug */
len += snprintf(page + len, count - len, "The rx cnt of channel %3d = %d\n", len += snprintf(page + len, count - len, "The rx cnt of channel %3d = %d\n",
pmlmeext->channel_set[i].ChannelNum, pmlmeext->channel_set[i].rx_count); pmlmeext->channel_set[i].ChannelNum, pmlmeext->channel_set[i].rx_count);
#endif #endif

View file

@ -44,10 +44,10 @@ u8 fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN]={0};
u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN]={0}; u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN]={0};
/*------------------------Define local variable------------------------------*/ /*------------------------Define local variable------------------------------*/
//------------------------------------------------------------------------------ /* */
#define REG_EFUSE_CTRL 0x0030 #define REG_EFUSE_CTRL 0x0030
#define EFUSE_CTRL REG_EFUSE_CTRL // E-Fuse Control. #define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */
//------------------------------------------------------------------------------ /* */
bool bool
Efuse_Read1ByteFromFakeContent( Efuse_Read1ByteFromFakeContent(
@ -64,7 +64,6 @@ Efuse_Read1ByteFromFakeContent(
{ {
return false; return false;
} }
//DbgPrint("Read fake content, offset = %d\n", Offset);
if (fakeEfuseBank == 0) if (fakeEfuseBank == 0)
*Value = fakeEfuseContent[Offset]; *Value = fakeEfuseContent[Offset];
else else
@ -157,24 +156,24 @@ u8
Efuse_CalculateWordCnts(u8 word_en) Efuse_CalculateWordCnts(u8 word_en)
{ {
u8 word_cnts = 0; u8 word_cnts = 0;
if (!(word_en & BIT(0))) word_cnts++; // 0 : write enable if (!(word_en & BIT(0))) word_cnts++; /* 0 : write enable */
if (!(word_en & BIT(1))) word_cnts++; if (!(word_en & BIT(1))) word_cnts++;
if (!(word_en & BIT(2))) word_cnts++; if (!(word_en & BIT(2))) word_cnts++;
if (!(word_en & BIT(3))) word_cnts++; if (!(word_en & BIT(3))) word_cnts++;
return word_cnts; return word_cnts;
} }
// /* */
// Description: /* Description: */
// Execute E-Fuse read byte operation. /* Execute E-Fuse read byte operation. */
// Refered from SD1 Richard. /* Refered from SD1 Richard. */
// /* */
// Assumption: /* Assumption: */
// 1. Boot from E-Fuse and successfully auto-load. /* 1. Boot from E-Fuse and successfully auto-load. */
// 2. PASSIVE_LEVEL (USB interface) /* 2. PASSIVE_LEVEL (USB interface) */
// /* */
// Created by Roger, 2008.10.21. /* Created by Roger, 2008.10.21. */
// /* */
void void
ReadEFuseByte( ReadEFuseByte(
PADAPTER Adapter, PADAPTER Adapter,
@ -185,7 +184,6 @@ ReadEFuseByte(
u32 value32; u32 value32;
u8 readbyte; u8 readbyte;
u16 retry; u16 retry;
//u32 start=rtw_get_current_time();
if (bPseudoTest) if (bPseudoTest)
{ {
@ -193,55 +191,53 @@ ReadEFuseByte(
return; return;
} }
//Write Address /* Write Address */
rtw_write8(Adapter, EFUSE_CTRL+1, (_offset & 0xff)); rtw_write8(Adapter, EFUSE_CTRL+1, (_offset & 0xff));
readbyte = rtw_read8(Adapter, EFUSE_CTRL+2); readbyte = rtw_read8(Adapter, EFUSE_CTRL+2);
rtw_write8(Adapter, EFUSE_CTRL+2, ((_offset >> 8) & 0x03) | (readbyte & 0xfc)); rtw_write8(Adapter, EFUSE_CTRL+2, ((_offset >> 8) & 0x03) | (readbyte & 0xfc));
//Write bit 32 0 /* Write bit 32 0 */
readbyte = rtw_read8(Adapter, EFUSE_CTRL+3); readbyte = rtw_read8(Adapter, EFUSE_CTRL+3);
rtw_write8(Adapter, EFUSE_CTRL+3, (readbyte & 0x7f)); rtw_write8(Adapter, EFUSE_CTRL+3, (readbyte & 0x7f));
//Check bit 32 read-ready /* Check bit 32 read-ready */
retry = 0; retry = 0;
value32 = rtw_read32(Adapter, EFUSE_CTRL); value32 = rtw_read32(Adapter, EFUSE_CTRL);
//while (!(((value32 >> 24) & 0xff) & 0x80) && (retry<10))
while (!(((value32 >> 24) & 0xff) & 0x80) && (retry<10000)) while (!(((value32 >> 24) & 0xff) & 0x80) && (retry<10000))
{ {
value32 = rtw_read32(Adapter, EFUSE_CTRL); value32 = rtw_read32(Adapter, EFUSE_CTRL);
retry++; retry++;
} }
// 20100205 Joseph: Add delay suggested by SD1 Victor. /* 20100205 Joseph: Add delay suggested by SD1 Victor. */
// This fix the problem that Efuse read error in high temperature condition. /* This fix the problem that Efuse read error in high temperature condition. */
// Designer says that there shall be some delay after ready bit is set, or the /* Designer says that there shall be some delay after ready bit is set, or the */
// result will always stay on last data we read. /* result will always stay on last data we read. */
rtw_udelay_os(50); rtw_udelay_os(50);
value32 = rtw_read32(Adapter, EFUSE_CTRL); value32 = rtw_read32(Adapter, EFUSE_CTRL);
*pbuf = (u8)(value32 & 0xff); *pbuf = (u8)(value32 & 0xff);
//DBG_88E("ReadEFuseByte _offset:%08u, in %d ms\n",_offset ,rtw_get_passing_time_ms(start));
} }
// /* */
// Description: /* Description: */
// 1. Execute E-Fuse read byte operation according as map offset and /* 1. Execute E-Fuse read byte operation according as map offset and */
// save to E-Fuse table. /* save to E-Fuse table. */
// 2. Refered from SD1 Richard. /* 2. Refered from SD1 Richard. */
// /* */
// Assumption: /* Assumption: */
// 1. Boot from E-Fuse and successfully auto-load. /* 1. Boot from E-Fuse and successfully auto-load. */
// 2. PASSIVE_LEVEL (USB interface) /* 2. PASSIVE_LEVEL (USB interface) */
// /* */
// Created by Roger, 2008.10.21. /* Created by Roger, 2008.10.21. */
// /* */
// 2008/12/12 MH 1. Reorganize code flow and reserve bytes. and add description. /* 2008/12/12 MH 1. Reorganize code flow and reserve bytes. and add description. */
// 2. Add efuse utilization collect. /* 2. Add efuse utilization collect. */
// 2008/12/22 MH Read Efuse must check if we write section 1 data again!!! Sec1 /* 2008/12/22 MH Read Efuse must check if we write section 1 data again!!! Sec1 */
// write addr must be after sec5. /* write addr must be after sec5. */
// /* */
void void
efuse_ReadEFuse( efuse_ReadEFuse(
@ -306,22 +302,22 @@ EFUSE_Read1Byte(
EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false); EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false);
if (Address < contentLen) //E-fuse 512Byte if (Address < contentLen) /* E-fuse 512Byte */
{ {
//Write E-fuse Register address bit0~7 /* Write E-fuse Register address bit0~7 */
temp = Address & 0xFF; temp = Address & 0xFF;
rtw_write8(Adapter, EFUSE_CTRL+1, temp); rtw_write8(Adapter, EFUSE_CTRL+1, temp);
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2);
//Write E-fuse Register address bit8~9 /* Write E-fuse Register address bit8~9 */
temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC);
rtw_write8(Adapter, EFUSE_CTRL+2, temp); rtw_write8(Adapter, EFUSE_CTRL+2, temp);
//Write 0x30[31]=0 /* Write 0x30[31]=0 */
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
temp = Bytetemp & 0x7F; temp = Bytetemp & 0x7F;
rtw_write8(Adapter, EFUSE_CTRL+3, temp); rtw_write8(Adapter, EFUSE_CTRL+3, temp);
//Wait Write-ready (0x30[31]=1) /* Wait Write-ready (0x30[31]=1) */
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
while (!(Bytetemp & 0x80)) while (!(Bytetemp & 0x80))
{ {
@ -374,28 +370,28 @@ EFUSE_Write1Byte(
u32 k=0; u32 k=0;
u16 contentLen=0; u16 contentLen=0;
//RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr=%x Data =%x\n", Address, Value)); /* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr=%x Data =%x\n", Address, Value)); */
EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false); EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI , TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false);
if ( Address < contentLen) //E-fuse 512Byte if ( Address < contentLen) /* E-fuse 512Byte */
{ {
rtw_write8(Adapter, EFUSE_CTRL, Value); rtw_write8(Adapter, EFUSE_CTRL, Value);
//Write E-fuse Register address bit0~7 /* Write E-fuse Register address bit0~7 */
temp = Address & 0xFF; temp = Address & 0xFF;
rtw_write8(Adapter, EFUSE_CTRL+1, temp); rtw_write8(Adapter, EFUSE_CTRL+1, temp);
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2);
//Write E-fuse Register address bit8~9 /* Write E-fuse Register address bit8~9 */
temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC);
rtw_write8(Adapter, EFUSE_CTRL+2, temp); rtw_write8(Adapter, EFUSE_CTRL+2, temp);
//Write 0x30[31]=1 /* Write 0x30[31]=1 */
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
temp = Bytetemp | 0x80; temp = Bytetemp | 0x80;
rtw_write8(Adapter, EFUSE_CTRL+3, temp); rtw_write8(Adapter, EFUSE_CTRL+3, temp);
//Wait Write-ready (0x30[31]=0) /* Wait Write-ready (0x30[31]=0) */
Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
while (Bytetemp & 0x80) while (Bytetemp & 0x80)
{ {
@ -426,13 +422,13 @@ efuse_OneByteRead(
bResult = Efuse_Read1ByteFromFakeContent(pAdapter, addr, data); bResult = Efuse_Read1ByteFromFakeContent(pAdapter, addr, data);
return bResult; return bResult;
} }
// -----------------e-fuse reg ctrl --------------------------------- /* -----------------e-fuse reg ctrl --------------------------------- */
//address /* address */
rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff)); rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
rtw_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) &0x03) ) | rtw_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) &0x03) ) |
(rtw_read8(pAdapter, EFUSE_CTRL+2)&0xFC )); (rtw_read8(pAdapter, EFUSE_CTRL+2)&0xFC ));
rtw_write8(pAdapter, EFUSE_CTRL+3, 0x72);//read cmd rtw_write8(pAdapter, EFUSE_CTRL+3, 0x72);/* read cmd */
while (!(0x80 &rtw_read8(pAdapter, EFUSE_CTRL+3))&&(tmpidx<100)) while (!(0x80 &rtw_read8(pAdapter, EFUSE_CTRL+3))&&(tmpidx<100))
{ {
@ -467,18 +463,18 @@ efuse_OneByteWrite(
bResult = Efuse_Write1ByteToFakeContent(pAdapter, addr, data); bResult = Efuse_Write1ByteToFakeContent(pAdapter, addr, data);
return bResult; return bResult;
} }
//RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr = %x Data=%x\n", addr, data)); /* RT_TRACE(COMP_EFUSE, DBG_LOUD, ("Addr = %x Data=%x\n", addr, data)); */
//return 0; /* return 0; */
// -----------------e-fuse reg ctrl --------------------------------- /* -----------------e-fuse reg ctrl --------------------------------- */
//address /* address */
rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff)); rtw_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
rtw_write8(pAdapter, EFUSE_CTRL+2, rtw_write8(pAdapter, EFUSE_CTRL+2,
(rtw_read8(pAdapter, EFUSE_CTRL+2)&0xFC )|(u8)((addr>>8)&0x03) ); (rtw_read8(pAdapter, EFUSE_CTRL+2)&0xFC )|(u8)((addr>>8)&0x03) );
rtw_write8(pAdapter, EFUSE_CTRL, data);//data rtw_write8(pAdapter, EFUSE_CTRL, data);/* data */
rtw_write8(pAdapter, EFUSE_CTRL+3, 0xF2);//write cmd rtw_write8(pAdapter, EFUSE_CTRL+3, 0xF2);/* write cmd */
while ((0x80 & rtw_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx<100) ){ while ((0x80 & rtw_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx<100) ){
tmpidx++; tmpidx++;
@ -632,7 +628,7 @@ u8 rtw_efuse_access(PADAPTER padapter, u8 bWrite, u16 start_addr, u16 cnts, u8 *
Efuse_PowerSwitch(padapter, bWrite, true); Efuse_PowerSwitch(padapter, bWrite, true);
// e-fuse one byte read / write /* e-fuse one byte read / write */
for (i = 0; i < cnts; i++) { for (i = 0; i < cnts; i++) {
if (start_addr >= real_content_len) { if (start_addr >= real_content_len) {
res = _FAIL; res = _FAIL;
@ -647,14 +643,14 @@ u8 rtw_efuse_access(PADAPTER padapter, u8 bWrite, u16 start_addr, u16 cnts, u8 *
return res; return res;
} }
//------------------------------------------------------------------------------ /* */
u16 efuse_GetMaxSize(PADAPTER padapter) u16 efuse_GetMaxSize(PADAPTER padapter)
{ {
u16 max_size; u16 max_size;
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI , TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_size, false); EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI , TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (void *)&max_size, false);
return max_size; return max_size;
} }
//------------------------------------------------------------------------------ /* */
u8 efuse_GetCurrentSize(PADAPTER padapter, u16 *size) u8 efuse_GetCurrentSize(PADAPTER padapter, u16 *size)
{ {
Efuse_PowerSwitch(padapter, false, true); Efuse_PowerSwitch(padapter, false, true);
@ -663,7 +659,7 @@ u8 efuse_GetCurrentSize(PADAPTER padapter, u16 *size)
return _SUCCESS; return _SUCCESS;
} }
//------------------------------------------------------------------------------ /* */
u8 rtw_efuse_map_read(PADAPTER padapter, u16 addr, u16 cnts, u8 *data) u8 rtw_efuse_map_read(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
{ {
u16 mapLen=0; u16 mapLen=0;
@ -699,7 +695,7 @@ u8 rtw_BT_efuse_map_read(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
return _SUCCESS; return _SUCCESS;
} }
//------------------------------------------------------------------------------ /* */
u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data) u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
{ {
u8 offset, word_en; u8 offset, word_en;
@ -727,11 +723,11 @@ u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
offset = (addr >> 3); offset = (addr >> 3);
word_en = 0xF; word_en = 0xF;
_rtw_memset(newdata, 0xFF, PGPKT_DATA_SIZE); _rtw_memset(newdata, 0xFF, PGPKT_DATA_SIZE);
i = addr & 0x7; // index of one package i = addr & 0x7; /* index of one package */
idx = 0; // data index idx = 0; /* data index */
if (i & 0x1) { if (i & 0x1) {
// odd start /* odd start */
if (data[idx] != map[addr+idx]) { if (data[idx] != map[addr+idx]) {
word_en &= ~BIT(i >> 1); word_en &= ~BIT(i >> 1);
newdata[i-1] = map[addr+idx-1]; newdata[i-1] = map[addr+idx-1];
@ -791,7 +787,7 @@ exit:
return ret; return ret;
} }
//------------------------------------------------------------------------------ /* */
u8 rtw_BT_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data) u8 rtw_BT_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
{ {
u8 offset, word_en; u8 offset, word_en;
@ -818,11 +814,11 @@ u8 rtw_BT_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
offset = (addr >> 3); offset = (addr >> 3);
word_en = 0xF; word_en = 0xF;
_rtw_memset(newdata, 0xFF, PGPKT_DATA_SIZE); _rtw_memset(newdata, 0xFF, PGPKT_DATA_SIZE);
i = addr & 0x7; // index of one package i = addr & 0x7; /* index of one package */
idx = 0; // data index idx = 0; /* data index */
if (i & 0x1) { if (i & 0x1) {
// odd start /* odd start */
if (data[idx] != map[addr+idx]) { if (data[idx] != map[addr+idx]) {
word_en &= ~BIT(i >> 1); word_en &= ~BIT(i >> 1);
newdata[i-1] = map[addr+idx-1]; newdata[i-1] = map[addr+idx-1];
@ -955,9 +951,9 @@ efuse_ShadowRead1Byte(
*Value = pEEPROM->efuse_eeprom_data[Offset]; *Value = pEEPROM->efuse_eeprom_data[Offset];
} // EFUSE_ShadowRead1Byte } /* EFUSE_ShadowRead1Byte */
//---------------Read Two Bytes /* Read Two Bytes */
static void static void
efuse_ShadowRead2Byte( efuse_ShadowRead2Byte(
PADAPTER pAdapter, PADAPTER pAdapter,
@ -969,9 +965,9 @@ efuse_ShadowRead2Byte(
*Value = pEEPROM->efuse_eeprom_data[Offset]; *Value = pEEPROM->efuse_eeprom_data[Offset];
*Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8; *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
} // EFUSE_ShadowRead2Byte } /* EFUSE_ShadowRead2Byte */
//---------------Read Four Bytes /* Read Four Bytes */
static void static void
efuse_ShadowRead4Byte( efuse_ShadowRead4Byte(
PADAPTER pAdapter, PADAPTER pAdapter,
@ -985,7 +981,7 @@ efuse_ShadowRead4Byte(
*Value |= pEEPROM->efuse_eeprom_data[Offset+2]<<16; *Value |= pEEPROM->efuse_eeprom_data[Offset+2]<<16;
*Value |= pEEPROM->efuse_eeprom_data[Offset+3]<<24; *Value |= pEEPROM->efuse_eeprom_data[Offset+3]<<24;
} // efuse_ShadowRead4Byte } /* efuse_ShadowRead4Byte */
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
@ -1012,7 +1008,7 @@ efuse_ShadowWrite1Byte(
PADAPTER pAdapter, PADAPTER pAdapter,
u16 Offset, u16 Offset,
u8 Value); u8 Value);
#endif //PLATFORM #endif /* PLATFORM */
static void static void
efuse_ShadowWrite1Byte( efuse_ShadowWrite1Byte(
PADAPTER pAdapter, PADAPTER pAdapter,
@ -1023,9 +1019,9 @@ efuse_ShadowWrite1Byte(
pEEPROM->efuse_eeprom_data[Offset] = Value; pEEPROM->efuse_eeprom_data[Offset] = Value;
} // efuse_ShadowWrite1Byte } /* efuse_ShadowWrite1Byte */
//---------------Write Two Bytes /* Write Two Bytes */
static void static void
efuse_ShadowWrite2Byte( efuse_ShadowWrite2Byte(
PADAPTER pAdapter, PADAPTER pAdapter,
@ -1037,9 +1033,9 @@ efuse_ShadowWrite2Byte(
pEEPROM->efuse_eeprom_data[Offset] = Value&0x00FF; pEEPROM->efuse_eeprom_data[Offset] = Value&0x00FF;
pEEPROM->efuse_eeprom_data[Offset+1] = Value>>8; pEEPROM->efuse_eeprom_data[Offset+1] = Value>>8;
} // efuse_ShadowWrite1Byte } /* efuse_ShadowWrite1Byte */
//---------------Write Four Bytes /* Write Four Bytes */
static void static void
efuse_ShadowWrite4Byte( efuse_ShadowWrite4Byte(
PADAPTER pAdapter, PADAPTER pAdapter,
@ -1053,7 +1049,7 @@ efuse_ShadowWrite4Byte(
pEEPROM->efuse_eeprom_data[Offset+2] = (u8)((Value>>16)&0x00FF); pEEPROM->efuse_eeprom_data[Offset+2] = (u8)((Value>>16)&0x00FF);
pEEPROM->efuse_eeprom_data[Offset+3] = (u8)((Value>>24)&0xFF); pEEPROM->efuse_eeprom_data[Offset+3] = (u8)((Value>>24)&0xFF);
} // efuse_ShadowWrite1Byte } /* efuse_ShadowWrite1Byte */
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
* Function: EFUSE_ShadowMapUpdate * Function: EFUSE_ShadowMapUpdate
@ -1099,9 +1095,9 @@ void EFUSE_ShadowMapUpdate(
#endif #endif
} }
//PlatformMoveMemory((void *)&pHalData->EfuseMap[EFUSE_MODIFY_MAP][0], /* PlatformMoveMemory((void *)&pHalData->EfuseMap[EFUSE_MODIFY_MAP][0], */
//(void *)&pHalData->EfuseMap[EFUSE_INIT_MAP][0], mapLen); /* void *)&pHalData->EfuseMap[EFUSE_INIT_MAP][0], mapLen); */
}// EFUSE_ShadowMapUpdate }/* EFUSE_ShadowMapUpdate */
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
@ -1134,7 +1130,7 @@ EFUSE_ShadowRead(
else if (Type == 4) else if (Type == 4)
efuse_ShadowRead4Byte(pAdapter, Offset, (u32 *)Value); efuse_ShadowRead4Byte(pAdapter, Offset, (u32 *)Value);
} // EFUSE_ShadowRead } /* EFUSE_ShadowRead */
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
* Function: EFUSE_ShadowWrite * Function: EFUSE_ShadowWrite
@ -1179,7 +1175,7 @@ EFUSE_ShadowWrite(
else if (Type == 4) else if (Type == 4)
efuse_ShadowWrite4Byte(pAdapter, Offset, (u32)Value); efuse_ShadowWrite4Byte(pAdapter, Offset, (u32)Value);
} // EFUSE_ShadowWrite } /* EFUSE_ShadowWrite */
void void
Efuse_InitSomeVar( Efuse_InitSomeVar(
@ -1213,7 +1209,7 @@ Efuse_InitSomeVar(
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
#ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
//#include <rtw_eeprom.h> /* include <rtw_eeprom.h> */
int isAdaptorInfoFileValid(void) int isAdaptorInfoFileValid(void)
{ {
@ -1257,5 +1253,5 @@ int retriveAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv)
} }
return ret; return ret;
} }
#endif //CONFIG_ADAPTOR_INFO_CACHING_FILE #endif /* CONFIG_ADAPTOR_INFO_CACHING_FILE */
#endif //PLATFORM_LINUX #endif /* PLATFORM_LINUX */

View file

@ -47,9 +47,9 @@ u8 RSN_CIPHER_SUITE_TKIP[] = { 0x00, 0x0f, 0xac, 2 };
u8 RSN_CIPHER_SUITE_WRAP[] = { 0x00, 0x0f, 0xac, 3 }; u8 RSN_CIPHER_SUITE_WRAP[] = { 0x00, 0x0f, 0xac, 3 };
u8 RSN_CIPHER_SUITE_CCMP[] = { 0x00, 0x0f, 0xac, 4 }; u8 RSN_CIPHER_SUITE_CCMP[] = { 0x00, 0x0f, 0xac, 4 };
u8 RSN_CIPHER_SUITE_WEP104[] = { 0x00, 0x0f, 0xac, 5 }; u8 RSN_CIPHER_SUITE_WEP104[] = { 0x00, 0x0f, 0xac, 5 };
//----------------------------------------------------------- /* */
// for adhoc-master to generate ie and provide supported-rate to fw /* for adhoc-master to generate ie and provide supported-rate to fw */
//----------------------------------------------------------- /* */
static u8 WIFI_CCKRATES[] = static u8 WIFI_CCKRATES[] =
{(IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK), {(IEEE80211_CCK_RATE_1MB | IEEE80211_BASIC_RATE_MASK),
@ -70,7 +70,7 @@ static u8 WIFI_OFDMRATES[] =
int rtw_get_bit_value_from_ieee_value(u8 val) int rtw_get_bit_value_from_ieee_value(u8 val)
{ {
unsigned char dot11_rate_table[]={2,4,11,22,12,18,24,36,48,72,96,108,0}; // last element must be zero!! unsigned char dot11_rate_table[]={2,4,11,22,12,18,24,36,48,72,96,108,0}; /* last element must be zero!! */
int i=0; int i=0;
while (dot11_rate_table[i] != 0) { while (dot11_rate_table[i] != 0) {
@ -124,7 +124,7 @@ int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)
else else
return WIRELESS_11A; return WIRELESS_11A;
} }
else // could be pure B, pure G, or B/G else /* could be pure B, pure G, or B/G */
{ {
if ((rtw_is_cckratesonly_included(rate)) == true) if ((rtw_is_cckratesonly_included(rate)) == true)
return WIRELESS_11B; return WIRELESS_11B;
@ -144,14 +144,14 @@ u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *sourc
return (pbuf + len); return (pbuf + len);
} }
// rtw_set_ie will update frame length /* rtw_set_ie will update frame length */
u8 *rtw_set_ie u8 *rtw_set_ie
( (
u8 *pbuf, u8 *pbuf,
sint index, sint index,
uint len, uint len,
u8 *source, u8 *source,
uint *frlen //frame length uint *frlen /* frame length */
) )
{ {
_func_enter_; _func_enter_;
@ -300,7 +300,7 @@ u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, u
} }
else else
{ {
cnt+=in_ie[cnt+1]+2; //goto next cnt+=in_ie[cnt+1]+2; /* goto next */
} }
} }
@ -370,7 +370,7 @@ _func_enter_;
case WIRELESS_11G: case WIRELESS_11G:
case WIRELESS_11A: case WIRELESS_11A:
case WIRELESS_11_5N: case WIRELESS_11_5N:
case WIRELESS_11A_5N://Todo: no basic rate for ofdm ? case WIRELESS_11A_5N:/* Todo: no basic rate for ofdm ? */
_rtw_memcpy(SupportedRates, WIFI_OFDMRATES, IEEE80211_NUM_OFDM_RATESLEN); _rtw_memcpy(SupportedRates, WIFI_OFDMRATES, IEEE80211_NUM_OFDM_RATESLEN);
break; break;
@ -413,16 +413,16 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
_func_enter_; _func_enter_;
//timestamp will be inserted by hardware /* timestamp will be inserted by hardware */
sz += 8; sz += 8;
ie += sz; ie += sz;
//beacon interval : 2bytes /* beacon interval : 2bytes */
*(__le16*)ie = cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);//BCN_INTERVAL; *(__le16*)ie = cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);/* BCN_INTERVAL; */
sz += 2; sz += 2;
ie += 2; ie += 2;
//capability info /* capability info */
*(u16*)ie = 0; *(u16*)ie = 0;
*(__le16*)ie |= cpu_to_le16(cap_IBSS); *(__le16*)ie |= cpu_to_le16(cap_IBSS);
@ -436,10 +436,10 @@ _func_enter_;
sz += 2; sz += 2;
ie += 2; ie += 2;
//SSID /* SSID */
ie = rtw_set_ie(ie, _SSID_IE_, pdev_network->Ssid.SsidLength, pdev_network->Ssid.Ssid, &sz); ie = rtw_set_ie(ie, _SSID_IE_, pdev_network->Ssid.SsidLength, pdev_network->Ssid.Ssid, &sz);
//supported rates /* supported rates */
if (pregistrypriv->wireless_mode == WIRELESS_11ABGN) if (pregistrypriv->wireless_mode == WIRELESS_11ABGN)
{ {
if (pdev_network->Configuration.DSConfig > 14) if (pdev_network->Configuration.DSConfig > 14)
@ -459,18 +459,18 @@ _func_enter_;
if (rateLen > 8) if (rateLen > 8)
{ {
ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, 8, pdev_network->SupportedRates, &sz); ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, 8, pdev_network->SupportedRates, &sz);
//ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz); /* ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz); */
} }
else else
{ {
ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, rateLen, pdev_network->SupportedRates, &sz); ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, rateLen, pdev_network->SupportedRates, &sz);
} }
//DS parameter set /* DS parameter set */
ie = rtw_set_ie(ie, _DSSET_IE_, 1, (u8 *)&(pdev_network->Configuration.DSConfig), &sz); ie = rtw_set_ie(ie, _DSSET_IE_, 1, (u8 *)&(pdev_network->Configuration.DSConfig), &sz);
//IBSS Parameter Set /* IBSS Parameter Set */
ie = rtw_set_ie(ie, _IBSS_PARA_IE_, 2, (u8 *)&(pdev_network->Configuration.ATIMWindow), &sz); ie = rtw_set_ie(ie, _IBSS_PARA_IE_, 2, (u8 *)&(pdev_network->Configuration.ATIMWindow), &sz);
@ -480,22 +480,19 @@ _func_enter_;
} }
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
//HT Cap. /* HT Cap. */
if (((pregistrypriv->wireless_mode&WIRELESS_11_5N)||(pregistrypriv->wireless_mode&WIRELESS_11_24N)) if (((pregistrypriv->wireless_mode&WIRELESS_11_5N)||(pregistrypriv->wireless_mode&WIRELESS_11_24N))
&& (pregistrypriv->ht_enable==true)) && (pregistrypriv->ht_enable==true))
{ {
//todo: /* todo: */
} }
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
//pdev_network->IELength = sz; //update IELength
_func_exit_; _func_exit_;
//return _SUCCESS; /* return _SUCCESS; */
return sz; return sz;
} }
unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit) unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
@ -513,13 +510,13 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
if (pbuf) { if (pbuf) {
//check if oui matches... /* check if oui matches... */
if (_rtw_memcmp((pbuf + 2), wpa_oui_type, sizeof (wpa_oui_type)) == false) { if (_rtw_memcmp((pbuf + 2), wpa_oui_type, sizeof (wpa_oui_type)) == false) {
goto check_next_ie; goto check_next_ie;
} }
//check version... /* check version... */
_rtw_memcpy((u8 *)&le_tmp, (pbuf + 6), sizeof(val16)); _rtw_memcpy((u8 *)&le_tmp, (pbuf + 6), sizeof(val16));
val16 = le16_to_cpu(le_tmp); val16 = le16_to_cpu(le_tmp);
@ -619,7 +616,7 @@ int rtw_parse_wpa_ie(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
left = wpa_ie_len - 8; left = wpa_ie_len - 8;
//group_cipher /* group_cipher */
if (left >= WPA_SELECTOR_LEN) { if (left >= WPA_SELECTOR_LEN) {
*group_cipher = rtw_get_wpa_cipher_suite(pos); *group_cipher = rtw_get_wpa_cipher_suite(pos);
@ -636,10 +633,10 @@ int rtw_parse_wpa_ie(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
} }
//pairwise_cipher /* pairwise_cipher */
if (left >= 2) if (left >= 2)
{ {
//count = le16_to_cpu(*(u16*)pos); /* count = le16_to_cpu(*(u16*)pos); */
count = RTW_GET_LE16(pos); count = RTW_GET_LE16(pos);
pos += 2; pos += 2;
left -= 2; left -= 2;
@ -701,7 +698,7 @@ int rtw_parse_wpa2_ie(u8* rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
pos += 4; pos += 4;
left = rsn_ie_len - 4; left = rsn_ie_len - 4;
//group_cipher /* group_cipher */
if (left >= RSN_SELECTOR_LEN) { if (left >= RSN_SELECTOR_LEN) {
*group_cipher = rtw_get_wpa2_cipher_suite(pos); *group_cipher = rtw_get_wpa2_cipher_suite(pos);
@ -714,10 +711,10 @@ int rtw_parse_wpa2_ie(u8* rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
return _FAIL; return _FAIL;
} }
//pairwise_cipher /* pairwise_cipher */
if (left >= 2) if (left >= 2)
{ {
//count = le16_to_cpu(*(u16*)pos); /* count = le16_to_cpu(*(u16*)pos); */
count = RTW_GET_LE16(pos); count = RTW_GET_LE16(pos);
pos += 2; pos += 2;
left -= 2; left -= 2;
@ -772,7 +769,7 @@ _func_enter_;
{ {
authmode=in_ie[cnt]; authmode=in_ie[cnt];
//if (authmode==_WAPI_IE_) /* if (authmode==_WAPI_IE_) */
if (authmode==_WAPI_IE_ && (_rtw_memcmp(&in_ie[cnt+6], wapi_oui1,4)==true || if (authmode==_WAPI_IE_ && (_rtw_memcmp(&in_ie[cnt+6], wapi_oui1,4)==true ||
_rtw_memcmp(&in_ie[cnt+6], wapi_oui2,4)==true)) _rtw_memcmp(&in_ie[cnt+6], wapi_oui2,4)==true))
{ {
@ -787,11 +784,11 @@ _func_enter_;
} }
*wapi_len=in_ie[cnt+1]+2; *wapi_len=in_ie[cnt+1]+2;
cnt+=in_ie[cnt+1]+2; //get next cnt+=in_ie[cnt+1]+2; /* get next */
} }
else else
{ {
cnt+=in_ie[cnt+1]+2; //get next cnt+=in_ie[cnt+1]+2; /* get next */
} }
} }
@ -810,7 +807,7 @@ int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16
_func_enter_; _func_enter_;
//Search required WPA or WPA2 IE and copy to sec_ie[ ] /* Search required WPA or WPA2 IE and copy to sec_ie[ ] */
cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_); cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_);
@ -835,7 +832,7 @@ _func_enter_;
} }
*wpa_len=in_ie[cnt+1]+2; *wpa_len=in_ie[cnt+1]+2;
cnt+=in_ie[cnt+1]+2; //get next cnt+=in_ie[cnt+1]+2; /* get next */
} }
else else
{ {
@ -854,11 +851,11 @@ _func_enter_;
} }
*rsn_len=in_ie[cnt+1]+2; *rsn_len=in_ie[cnt+1]+2;
cnt+=in_ie[cnt+1]+2; //get next cnt+=in_ie[cnt+1]+2; /* get next */
} }
else else
{ {
cnt+=in_ie[cnt+1]+2; //get next cnt+=in_ie[cnt+1]+2; /* get next */
} }
} }
@ -881,7 +878,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
if ((eid==_WPA_IE_ID_)&&(_rtw_memcmp(&ie_ptr[2], wps_oui, 4)==true)) if ((eid==_WPA_IE_ID_)&&(_rtw_memcmp(&ie_ptr[2], wps_oui, 4)==true))
{ {
//DBG_88E("==> found WPS_IE.....\n"); /* DBG_88E("==> found WPS_IE.....\n"); */
*wps_ielen = ie_ptr[1]+2; *wps_ielen = ie_ptr[1]+2;
match=true; match=true;
} }
@ -931,7 +928,7 @@ u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
} }
else else
{ {
cnt+=in_ie[cnt+1]+2; //goto next cnt+=in_ie[cnt+1]+2; /* goto next */
} }
} }
@ -964,17 +961,17 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_att
return attr_ptr; return attr_ptr;
} }
// 6 = 1(Element ID) + 1(Length) + 4(WPS OUI) /* 6 = 1(Element ID) + 1(Length) + 4(WPS OUI) */
attr_ptr = wps_ie + 6; //goto first attr attr_ptr = wps_ie + 6; /* goto first attr */
while (attr_ptr - wps_ie < wps_ielen) while (attr_ptr - wps_ie < wps_ielen)
{ {
// 4 = 2(Attribute ID) + 2(Length) /* 4 = 2(Attribute ID) + 2(Length) */
u16 attr_id = RTW_GET_BE16(attr_ptr); u16 attr_id = RTW_GET_BE16(attr_ptr);
u16 attr_data_len = RTW_GET_BE16(attr_ptr + 2); u16 attr_data_len = RTW_GET_BE16(attr_ptr + 2);
u16 attr_len = attr_data_len + 4; u16 attr_len = attr_data_len + 4;
//DBG_88E("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); /* DBG_88E("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); */
if ( attr_id == target_attr_id ) if ( attr_id == target_attr_id )
{ {
target_attr_ptr = attr_ptr; target_attr_ptr = attr_ptr;
@ -989,7 +986,7 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_att
} }
else else
{ {
attr_ptr += attr_len; //goto next attr_ptr += attr_len; /* goto next */
} }
} }
@ -1291,7 +1288,7 @@ void rtw_macaddr_cfg(u8 *mac_addr)
if (mac_addr == NULL) return; if (mac_addr == NULL) return;
if ( rtw_initmac ) if ( rtw_initmac )
{ // Users specify the mac address { /* Users specify the mac address */
int jj,kk; int jj,kk;
for ( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 ) for ( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
@ -1301,7 +1298,7 @@ void rtw_macaddr_cfg(u8 *mac_addr)
_rtw_memcpy(mac_addr, mac, ETH_ALEN); _rtw_memcpy(mac_addr, mac, ETH_ALEN);
} }
else else
{ // Use the mac address stored in the Efuse { /* Use the mac address stored in the Efuse */
_rtw_memcpy(mac, mac_addr, ETH_ALEN); _rtw_memcpy(mac, mac_addr, ETH_ALEN);
} }
@ -1316,7 +1313,7 @@ void rtw_macaddr_cfg(u8 *mac_addr)
mac[3] = 0x87; mac[3] = 0x87;
mac[4] = 0x00; mac[4] = 0x00;
mac[5] = 0x00; mac[5] = 0x00;
// use default mac addresss /* use default mac addresss */
_rtw_memcpy(mac_addr, mac, ETH_ALEN); _rtw_memcpy(mac_addr, mac, ETH_ALEN);
DBG_88E("MAC Address from efuse error, assign default one !!!\n"); DBG_88E("MAC Address from efuse error, assign default one !!!\n");
} }
@ -1436,7 +1433,7 @@ u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen)
} }
else else
{ {
cnt += in_ie[ cnt + 1 ] +2; //goto next cnt += in_ie[ cnt + 1 ] +2; /* goto next */
} }
} }
@ -1470,17 +1467,17 @@ u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 *buf_attr
return attr_ptr; return attr_ptr;
} }
// 6 = 1(Element ID) + 1(Length) + 3 (OUI) + 1(OUI Type) /* 6 = 1(Element ID) + 1(Length) + 3 (OUI) + 1(OUI Type) */
attr_ptr = p2p_ie + 6; //goto first attr attr_ptr = p2p_ie + 6; /* goto first attr */
while (attr_ptr - p2p_ie < p2p_ielen) while (attr_ptr - p2p_ie < p2p_ielen)
{ {
// 3 = 1(Attribute ID) + 2(Length) /* 3 = 1(Attribute ID) + 2(Length) */
u8 attr_id = *attr_ptr; u8 attr_id = *attr_ptr;
u16 attr_data_len = RTW_GET_LE16(attr_ptr + 1); u16 attr_data_len = RTW_GET_LE16(attr_ptr + 1);
u16 attr_len = attr_data_len + 3; u16 attr_len = attr_data_len + 3;
//DBG_88E("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); /* DBG_88E("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); */
if ( attr_id == target_attr_id ) if ( attr_id == target_attr_id )
{ {
target_attr_ptr = attr_ptr; target_attr_ptr = attr_ptr;
@ -1495,7 +1492,7 @@ u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 *buf_attr
} }
else else
{ {
attr_ptr += attr_len; //goto next attr_ptr += attr_len; /* goto next */
} }
} }
@ -1543,7 +1540,7 @@ u32 rtw_set_p2p_attr_content(u8 *pbuf, u8 attr_id, u16 attr_len, u8 *pdata_attr)
*pbuf = attr_id; *pbuf = attr_id;
//*(u16*)(pbuf + 1) = cpu_to_le16(attr_len); /* u16*)(pbuf + 1) = cpu_to_le16(attr_len); */
RTW_PUT_LE16(pbuf + 1, attr_len); RTW_PUT_LE16(pbuf + 1, attr_len);
if (pdata_attr) if (pdata_attr)
@ -1605,7 +1602,7 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id)
} }
} }
#endif //CONFIG_P2P #endif /* CONFIG_P2P */
#ifdef CONFIG_WFD #ifdef CONFIG_WFD
int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen) int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen)
@ -1653,7 +1650,7 @@ int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen)
} }
else else
{ {
cnt += in_ie[ cnt + 1 ] +2; //goto next cnt += in_ie[ cnt + 1 ] +2; /* goto next */
} }
} }
@ -1667,8 +1664,8 @@ int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen)
} }
// attr_content: The output buffer, contains the "body field" of WFD attribute. /* attr_content: The output buffer, contains the "body field" of WFD attribute. */
// attr_contentlen: The data length of the "body field" of WFD attribute. /* attr_contentlen: The data length of the "body field" of WFD attribute. */
int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *attr_content, uint *attr_contentlen) int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *attr_content, uint *attr_contentlen)
{ {
int match; int match;
@ -1684,7 +1681,7 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *
return( match ); return( match );
} }
// 1 ( WFD IE ) + 1 ( Length ) + 3 ( OUI ) + 1 ( OUI Type ) /* 1 ( WFD IE ) + 1 ( Length ) + 3 ( OUI ) + 1 ( OUI Type ) */
cnt = 6; cnt = 6;
while ( cnt < wfd_ielen ) while ( cnt < wfd_ielen )
{ {
@ -1693,7 +1690,7 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *
attr_id = wfd_ie[cnt]; attr_id = wfd_ie[cnt];
if ( attr_id == target_attr_id ) if ( attr_id == target_attr_id )
{ {
// 3 -> 1 byte for attribute ID field, 2 bytes for length field /* 3 -> 1 byte for attribute ID field, 2 bytes for length field */
if (attr_content) if (attr_content)
_rtw_memcpy( attr_content, &wfd_ie[ cnt + 3 ], attrlen ); _rtw_memcpy( attr_content, &wfd_ie[ cnt + 3 ], attrlen );
@ -1707,7 +1704,7 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *
} }
else else
{ {
cnt += attrlen + 3; //goto next cnt += attrlen + 3; /* goto next */
} }
} }
@ -1715,9 +1712,9 @@ int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *
return match; return match;
} }
#endif // CONFIG_WFD #endif /* CONFIG_WFD */
//Baron adds to avoid FreeBSD warning /* Baron adds to avoid FreeBSD warning */
int ieee80211_is_empty_essid(const char *essid, int essid_len) int ieee80211_is_empty_essid(const char *essid, int essid_len)
{ {
/* Single white space is for Linksys APs */ /* Single white space is for Linksys APs */
@ -1860,7 +1857,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork)
} }
} }
//show MCS rate, unit: 100Kbps /* show MCS rate, unit: 100Kbps */
u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40, unsigned char * MCS_rate) u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40, unsigned char * MCS_rate)
{ {
u16 max_rate = 0; u16 max_rate = 0;

View file

@ -90,7 +90,7 @@ jackson@realtek.com.tw
u8 _rtw_read8(_adapter *adapter, u32 addr) u8 _rtw_read8(_adapter *adapter, u32 addr)
{ {
u8 r_val; u8 r_val;
//struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr); u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
@ -104,30 +104,30 @@ u8 _rtw_read8(_adapter *adapter, u32 addr)
u16 _rtw_read16(_adapter *adapter, u32 addr) u16 _rtw_read16(_adapter *adapter, u32 addr)
{ {
__le16 r_val; u16 r_val;
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
__le16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr); u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
_func_enter_; _func_enter_;
_read16 = pintfhdl->io_ops._read16; _read16 = pintfhdl->io_ops._read16;
r_val = _read16(pintfhdl, addr); r_val = _read16(pintfhdl, addr);
_func_exit_; _func_exit_;
return rtw_le16_to_cpu(r_val); return r_val;
} }
u32 _rtw_read32(_adapter *adapter, u32 addr) u32 _rtw_read32(_adapter *adapter, u32 addr)
{ {
__le32 r_val; u32 r_val;
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
__le32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr); u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
_func_enter_; _func_enter_;
_read32 = pintfhdl->io_ops._read32; _read32 = pintfhdl->io_ops._read32;
r_val = _read32(pintfhdl, addr); r_val = _read32(pintfhdl, addr);
_func_exit_; _func_exit_;
return rtw_le32_to_cpu(r_val); return r_val;
} }
int _rtw_write8(_adapter *adapter, u32 addr, u8 val) int _rtw_write8(_adapter *adapter, u32 addr, u8 val)
@ -149,14 +149,12 @@ int _rtw_write16(_adapter *adapter, u32 addr, u16 val)
{ {
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, __le16 val); int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
int ret; int ret;
__le16 ival;
_func_enter_; _func_enter_;
_write16 = pintfhdl->io_ops._write16; _write16 = pintfhdl->io_ops._write16;
ival = rtw_cpu_to_le16(val); ret = _write16(pintfhdl, addr, val);
ret = _write16(pintfhdl, addr, ival);
_func_exit_; _func_exit_;
return RTW_STATUS_CODE(ret); return RTW_STATUS_CODE(ret);
@ -165,14 +163,12 @@ int _rtw_write32(_adapter *adapter, u32 addr, u32 val)
{ {
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, __le32 val); int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
int ret; int ret;
__le32 ival;
_func_enter_; _func_enter_;
_write32 = pintfhdl->io_ops._write32; _write32 = pintfhdl->io_ops._write32;
ival = rtw_cpu_to_le32(val); ret = _write32(pintfhdl, addr, val);
ret = _write32(pintfhdl, addr, ival);
_func_exit_; _func_exit_;
return RTW_STATUS_CODE(ret); return RTW_STATUS_CODE(ret);
@ -211,14 +207,12 @@ int _rtw_write16_async(_adapter *adapter, u32 addr, u16 val)
{ {
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, __le16 val); int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
int ret; int ret;
__le16 ival;
_func_enter_; _func_enter_;
_write16_async = pintfhdl->io_ops._write16_async; _write16_async = pintfhdl->io_ops._write16_async;
ival = rtw_cpu_to_le16(val); ret = _write16_async(pintfhdl, addr, val);
ret = _write16_async(pintfhdl, addr, ival);
_func_exit_; _func_exit_;
return RTW_STATUS_CODE(ret); return RTW_STATUS_CODE(ret);
@ -228,14 +222,12 @@ int _rtw_write32_async(_adapter *adapter, u32 addr, u32 val)
{ {
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, __le32 val); int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
int ret; int ret;
__le32 ival;
_func_enter_; _func_enter_;
_write32_async = pintfhdl->io_ops._write32_async; _write32_async = pintfhdl->io_ops._write32_async;
ival = rtw_cpu_to_le32(val); ret = _write32_async(pintfhdl, addr, val);
ret = _write32_async(pintfhdl, addr, ival);
_func_exit_; _func_exit_;
return RTW_STATUS_CODE(ret); return RTW_STATUS_CODE(ret);
@ -266,7 +258,6 @@ void _rtw_read_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
void _rtw_write_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem) void _rtw_write_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
{ {
void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
//struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
@ -283,7 +274,6 @@ void _rtw_write_mem(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
void _rtw_read_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem) void _rtw_read_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
{ {
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
//struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
@ -319,7 +309,6 @@ void _rtw_read_port_cancel(_adapter *adapter)
u32 _rtw_write_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem) u32 _rtw_write_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
{ {
u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
//struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
struct io_priv *pio_priv = &adapter->iopriv; struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf); struct intf_hdl *pintfhdl = &(pio_priv->intf);
u32 ret = _SUCCESS; u32 ret = _SUCCESS;
@ -385,12 +374,9 @@ int rtw_init_io_priv(_adapter *padapter, void (*set_intf_ops)(struct _io_ops *po
#ifdef DBG_IO #ifdef DBG_IO
u16 read_sniff_ranges[][2] = { u16 read_sniff_ranges[][2] = {
//{0x550, 0x551},
}; };
u16 write_sniff_ranges[][2] = { u16 write_sniff_ranges[][2] = {
//{0x550, 0x551},
//{0x4c, 0x4c},
}; };
int read_sniff_num = sizeof(read_sniff_ranges)/sizeof(u16)/2; int read_sniff_num = sizeof(read_sniff_ranges)/sizeof(u16)/2;

View file

@ -27,9 +27,9 @@
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
// /* */
// Added for WPA2-PSK, by Annie, 2005-09-20. /* Added for WPA2-PSK, by Annie, 2005-09-20. */
// /* */
u8 u8
query_802_11_capability( query_802_11_capability(
_adapter* Adapter, _adapter* Adapter,
@ -67,7 +67,7 @@ query_802_11_capability(
pCap->NoOfPMKIDs = NUM_PMKID_CACHE; pCap->NoOfPMKIDs = NUM_PMKID_CACHE;
pCap->NoOfAuthEncryptPairsSupported = ulNumOfPairSupported; pCap->NoOfAuthEncryptPairsSupported = ulNumOfPairSupported;
if ( sizeof (szAuthEnc) <= 240 ) // 240 = 256 - 4*4 // SecurityInfo.szCapability: only 256 bytes in size. if ( sizeof (szAuthEnc) <= 240 ) /* 240 = 256 - 4*4 SecurityInfo.szCapability: only 256 bytes in size. */
{ {
_rtw_memcpy( pucAuthEncryptionSupported, (u8*)szAuthEnc, sizeof (szAuthEnc) ); _rtw_memcpy( pucAuthEncryptionSupported, (u8*)szAuthEnc, sizeof (szAuthEnc) );
*pulOutLen = pCap->Length; *pulOutLen = pCap->Length;
@ -90,14 +90,12 @@ u8 query_802_11_association_information( _adapter *padapter,PNDIS_802_11_ASSOCIA
u8 * pDest = (u8 *)pAssocInfo + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); u8 * pDest = (u8 *)pAssocInfo + sizeof(NDIS_802_11_ASSOCIATION_INFORMATION);
unsigned char i,*auth_ie,*supp_ie; unsigned char i,*auth_ie,*supp_ie;
//NdisZeroMemory(pAssocInfo, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION));
_rtw_memset(pAssocInfo, 0, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION)); _rtw_memset(pAssocInfo, 0, sizeof(NDIS_802_11_ASSOCIATION_INFORMATION));
//pAssocInfo->Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION);
//------------------------------------------------------ /* */
// Association Request related information /* Association Request related information */
//------------------------------------------------------ /* */
// Req_1. AvailableRequestFixedIEs /* Req_1. AvailableRequestFixedIEs */
if (psecnetwork!=NULL){ if (psecnetwork!=NULL){
pAssocInfo->AvailableRequestFixedIEs |= NDIS_802_11_AI_REQFI_CAPABILITIES|NDIS_802_11_AI_REQFI_CURRENTAPADDRESS; pAssocInfo->AvailableRequestFixedIEs |= NDIS_802_11_AI_REQFI_CAPABILITIES|NDIS_802_11_AI_REQFI_CURRENTAPADDRESS;
@ -111,9 +109,9 @@ u8 query_802_11_association_information( _adapter *padapter,PNDIS_802_11_ASSOCIA
{ {
if (psecuritypriv->ndisauthtype>=Ndis802_11AuthModeWPA2) if (psecuritypriv->ndisauthtype>=Ndis802_11AuthModeWPA2)
pDest[0] =48; //RSN Information Element pDest[0] =48; /* RSN Information Element */
else else
pDest[0] =221; //WPA(SSN) Information Element pDest[0] =221; /* WPA(SSN) Information Element */
RT_TRACE(_module_rtl871x_ioctl_query_c_,_drv_info_,("\n Adapter->ndisauthtype==Ndis802_11AuthModeWPA)?0xdd:0x30 [%d]",pDest[0])); RT_TRACE(_module_rtl871x_ioctl_query_c_,_drv_info_,("\n Adapter->ndisauthtype==Ndis802_11AuthModeWPA)?0xdd:0x30 [%d]",pDest[0]));
supp_ie=&psecuritypriv->supplicant_ie[0]; supp_ie=&psecuritypriv->supplicant_ie[0];
@ -122,7 +120,7 @@ u8 query_802_11_association_information( _adapter *padapter,PNDIS_802_11_ASSOCIA
RT_TRACE(_module_rtl871x_ioctl_query_c_,_drv_info_,("IEs [%d] = 0x%x\n\n", i,supp_ie[i])); RT_TRACE(_module_rtl871x_ioctl_query_c_,_drv_info_,("IEs [%d] = 0x%x\n\n", i,supp_ie[i]));
} }
i=13; //0~11 is fixed information element i=13; /* 0~11 is fixed information element */
RT_TRACE(_module_rtl871x_ioctl_query_c_,_drv_info_,("i= %d tgt_network->network.IELength=%d\n\n", i,(int)psecnetwork->IELength)); RT_TRACE(_module_rtl871x_ioctl_query_c_,_drv_info_,("i= %d tgt_network->network.IELength=%d\n\n", i,(int)psecnetwork->IELength));
while ((i<supp_ie[0]) && (i<256)){ while ((i<supp_ie[0]) && (i<256)){
if ((unsigned char)supp_ie[i]==pDest[0]){ if ((unsigned char)supp_ie[i]==pDest[0]){
@ -141,7 +139,7 @@ u8 query_802_11_association_information( _adapter *padapter,PNDIS_802_11_ASSOCIA
} }
pAssocInfo->RequestIELength += (2 + supp_ie[1+i]);// (2 + psecnetwork->IEs[1+i]+4); pAssocInfo->RequestIELength += (2 + supp_ie[1+i]);/* (2 + psecnetwork->IEs[1+i]+4); */
} }
@ -151,9 +149,9 @@ u8 query_802_11_association_information( _adapter *padapter,PNDIS_802_11_ASSOCIA
} }
//------------------------------------------------------ /* */
// Association Response related information /* Association Response related information */
//------------------------------------------------------ /* */
if (check_fwstate( pmlmepriv, _FW_LINKED)==true) if (check_fwstate( pmlmepriv, _FW_LINKED)==true)
{ {

View file

@ -62,7 +62,7 @@ _func_enter_;
for (i = 0; i < ssid->SsidLength; i++) for (i = 0; i < ssid->SsidLength; i++)
{ {
//wifi, printable ascii code must be supported /* wifi, printable ascii code must be supported */
if (!( (ssid->Ssid[i] >= 0x20) && (ssid->Ssid[i] <= 0x7e) )){ if (!( (ssid->Ssid[i] >= 0x20) && (ssid->Ssid[i] <= 0x7e) )){
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("ssid has nonprintabl ascii\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("ssid has nonprintabl ascii\n"));
ret= false; ret= false;
@ -108,8 +108,8 @@ _func_enter_;
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
//when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty /* when set_ssid/set_bssid for rtw_do_join(), but scanning queue is empty */
//we try to issue sitesurvey firstly /* we try to issue sitesurvey firstly */
if (pmlmepriv->LinkDetectInfo.bBusyTraffic==false if (pmlmepriv->LinkDetectInfo.bBusyTraffic==false
#ifdef CONFIG_LAYER2_ROAMING #ifdef CONFIG_LAYER2_ROAMING
@ -118,7 +118,7 @@ _func_enter_;
) )
{ {
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_do_join(): site survey if scanned_queue is empty\n.")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_do_join(): site survey if scanned_queue is empty\n."));
// submit site_survey_cmd /* submit site_survey_cmd */
if (_SUCCESS!=(ret=rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) ) { if (_SUCCESS!=(ret=rtw_sitesurvey_cmd(padapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) ) {
pmlmepriv->to_join = false; pmlmepriv->to_join = false;
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_do_join(): site survey return error\n.")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_do_join(): site survey return error\n."));
@ -145,9 +145,9 @@ _func_enter_;
{ {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==true) if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)==true)
{ {
// submit createbss_cmd to change to a ADHOC_MASTER /* submit createbss_cmd to change to a ADHOC_MASTER */
//pmlmepriv->lock has been acquired by caller... /* pmlmepriv->lock has been acquired by caller... */
WLAN_BSSID_EX *pdev_network = &(padapter->registrypriv.dev_network); WLAN_BSSID_EX *pdev_network = &(padapter->registrypriv.dev_network);
pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE; pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
@ -175,11 +175,11 @@ _func_enter_;
} }
else else
{ {
// can't associate ; reset under-linking /* can't associate ; reset under-linking */
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
//when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue /* when set_ssid/set_bssid for rtw_do_join(), but there are no desired bss in scanning queue */
//we try to issue sitesurvey firstly /* we try to issue sitesurvey firstly */
if (pmlmepriv->LinkDetectInfo.bBusyTraffic==false if (pmlmepriv->LinkDetectInfo.bBusyTraffic==false
#ifdef CONFIG_LAYER2_ROAMING #ifdef CONFIG_LAYER2_ROAMING
|| pmlmepriv->to_roaming >0 || pmlmepriv->to_roaming >0
@ -234,7 +234,6 @@ u8 rtw_pnp_set_power_sleep(_adapter* padapter)
_func_enter_; _func_enter_;
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("==>rtw_pnp_set_power_sleep!!!\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("==>rtw_pnp_set_power_sleep!!!\n"));
//DbgPrint("+rtw_pnp_set_power_sleep\n");
res = rtw_setstandby_cmd(padapter, 1); res = rtw_setstandby_cmd(padapter, 1);
@ -256,12 +255,11 @@ _func_enter_;
break; break;
} }
// SecClearAllKeys(Adapter); /* 8711 CAM was not for En/Decrypt only */
// 8711 CAM was not for En/Decrypt only /* so, we can't clear all keys. */
// so, we can't clear all keys. /* should we disable WPAcfg (ox0088) bit 1-2, instead of clear all CAM */
// should we disable WPAcfg (ox0088) bit 1-2, instead of clear all CAM
//TO DO... /* TO DO... */
_func_exit_; _func_exit_;
@ -341,7 +339,7 @@ _func_enter_;
if (_rtw_memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN) == true) if (_rtw_memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN) == true)
{ {
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == false) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == false)
goto release_mlme_lock;//it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. goto release_mlme_lock;/* it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. */
} else { } else {
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("Set BSSID not the same bssid\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("Set BSSID not the same bssid\n"));
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("set_bssid=%pM\n", (bssid) )); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("set_bssid=%pM\n", (bssid) ));
@ -362,7 +360,7 @@ _func_enter_;
} }
handle_tkip_countermeasure: handle_tkip_countermeasure:
//should we add something here...? /* should we add something here...? */
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
if (padapter->securitypriv.btkip_countermeasure == true) { if (padapter->securitypriv.btkip_countermeasure == true) {
@ -449,7 +447,7 @@ _func_enter_;
if (rtw_is_same_ibss(padapter, pnetwork) == false) if (rtw_is_same_ibss(padapter, pnetwork) == false)
{ {
//if in WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE, create bss or rejoin again /* if in WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE, create bss or rejoin again */
rtw_disassoc_cmd(padapter, 0, true); rtw_disassoc_cmd(padapter, 0, true);
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
@ -464,7 +462,7 @@ _func_enter_;
} }
else else
{ {
goto release_mlme_lock;//it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. goto release_mlme_lock;/* it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. */
} }
} }
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
@ -501,19 +499,19 @@ handle_tkip_countermeasure:
u32 diff_time,cur_time ; u32 diff_time,cur_time ;
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid:padapter->securitypriv.btkip_countermeasure==true\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid:padapter->securitypriv.btkip_countermeasure==true\n"));
NdisGetCurrentSystemTime(&sys_time); NdisGetCurrentSystemTime(&sys_time);
cur_time=(u32)(sys_time.QuadPart/10); // In micro-second. cur_time=(u32)(sys_time.QuadPart/10); /* In micro-second. */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid:cur_time=0x%x\n",cur_time)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid:cur_time=0x%x\n",cur_time));
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid:psecuritypriv->last_mic_err_time=0x%x\n",padapter->securitypriv.btkip_countermeasure_time)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid:psecuritypriv->last_mic_err_time=0x%x\n",padapter->securitypriv.btkip_countermeasure_time));
diff_time = cur_time -padapter->securitypriv.btkip_countermeasure_time; // In micro-second. diff_time = cur_time -padapter->securitypriv.btkip_countermeasure_time; /* In micro-second. */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid:diff_time=0x%x\n",diff_time)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid:diff_time=0x%x\n",diff_time));
if (diff_time > 60000000) { if (diff_time > 60000000) {
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid(): countermeasure time >60s.\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid(): countermeasure time >60s.\n"));
padapter->securitypriv.btkip_countermeasure=false; padapter->securitypriv.btkip_countermeasure=false;
// Update MIC error time. /* Update MIC error time. */
padapter->securitypriv.btkip_countermeasure_time=0; padapter->securitypriv.btkip_countermeasure_time=0;
} else { } else {
// can't join in 60 seconds. /* can't join in 60 seconds. */
status = _FAIL; status = _FAIL;
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid(): countermeasure time <60s.\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_ssid(): countermeasure time <60s.\n"));
goto release_mlme_lock; goto release_mlme_lock;
@ -587,11 +585,11 @@ _func_enter_;
_enter_critical_bh(&pmlmepriv->lock, &irqL); _enter_critical_bh(&pmlmepriv->lock, &irqL);
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,(" change mode!")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,(" change mode!"));
//DBG_88E("change mode, old_mode=%d, new_mode=%d, fw_state=0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); /* DBG_88E("change mode, old_mode=%d, new_mode=%d, fw_state=0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); */
if (*pold_state==Ndis802_11APMode) if (*pold_state==Ndis802_11APMode)
{ {
//change to other mode from Ndis802_11APMode /* change to other mode from Ndis802_11APMode */
cur_network->join_res = -1; cur_network->join_res = -1;
#ifdef CONFIG_NATIVEAP_MLME #ifdef CONFIG_NATIVEAP_MLME
@ -610,7 +608,7 @@ _func_enter_;
{ {
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
{ {
rtw_indicate_disconnect(padapter); //will clr Linked_state; before this function, we must have chked whether issue dis-assoc_cmd or not rtw_indicate_disconnect(padapter); /* will clr Linked_state; before this function, we must have chked whether issue dis-assoc_cmd or not */
} }
} }
@ -632,7 +630,6 @@ _func_enter_;
set_fwstate(pmlmepriv, WIFI_AP_STATE); set_fwstate(pmlmepriv, WIFI_AP_STATE);
#ifdef CONFIG_NATIVEAP_MLME #ifdef CONFIG_NATIVEAP_MLME
start_ap_mode(padapter); start_ap_mode(padapter);
//rtw_indicate_connect(padapter);
#endif #endif
break; break;
@ -641,12 +638,6 @@ _func_enter_;
case Ndis802_11InfrastructureMax: case Ndis802_11InfrastructureMax:
break; break;
} }
//SecClearAllKeys(adapter);
//RT_TRACE(COMP_OID_SET, DBG_LOUD, ("set_infrastructure: fw_state:%x after changing mode\n",
// get_fwstate(pmlmepriv) ));
_exit_critical_bh(&pmlmepriv->lock, &irqL); _exit_critical_bh(&pmlmepriv->lock, &irqL);
} }
@ -705,7 +696,7 @@ _func_enter_;
if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) || if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) ||
(pmlmepriv->LinkDetectInfo.bBusyTraffic == true)) (pmlmepriv->LinkDetectInfo.bBusyTraffic == true))
{ {
// Scan or linking is in progress, do nothing. /* Scan or linking is in progress, do nothing. */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_set_802_11_bssid_list_scan fail since fw_state = %x\n", get_fwstate(pmlmepriv))); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("rtw_set_802_11_bssid_list_scan fail since fw_state = %x\n", get_fwstate(pmlmepriv)));
res = true; res = true;
@ -876,15 +867,15 @@ u8 rtw_set_802_11_add_key(_adapter* padapter, NDIS_802_11_KEY *key){
u8 * pbssid; u8 * pbssid;
struct sta_info *stainfo; struct sta_info *stainfo;
u8 bgroup = false; u8 bgroup = false;
u8 bgrouptkey = false;//can be remove later u8 bgrouptkey = false;/* can be remove later */
u8 ret=_SUCCESS; u8 ret=_SUCCESS;
_func_enter_; _func_enter_;
if (((key->KeyIndex & 0x80000000) == 0) && ((key->KeyIndex & 0x40000000) > 0)){ if (((key->KeyIndex & 0x80000000) == 0) && ((key->KeyIndex & 0x40000000) > 0)){
// It is invalid to clear bit 31 and set bit 30. If the miniport driver encounters this combination, /* It is invalid to clear bit 31 and set bit 30. If the miniport driver encounters this combination, */
// it must fail the request and return NDIS_STATUS_INVALID_DATA. /* it must fail the request and return NDIS_STATUS_INVALID_DATA. */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_key: ((key->KeyIndex & 0x80000000) == 0)[=%d] ",(int)(key->KeyIndex & 0x80000000) == 0)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_key: ((key->KeyIndex & 0x80000000) == 0)[=%d] ",(int)(key->KeyIndex & 0x80000000) == 0));
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_key:((key->KeyIndex & 0x40000000) > 0)[=%d]" , (int)(key->KeyIndex & 0x40000000) > 0)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_key:((key->KeyIndex & 0x40000000) > 0)[=%d]" , (int)(key->KeyIndex & 0x40000000) > 0));
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_key: key->KeyIndex=%d\n" ,(int)key->KeyIndex)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("rtw_set_802_11_add_key: key->KeyIndex=%d\n" ,(int)key->KeyIndex));
@ -894,7 +885,7 @@ _func_enter_;
if (key->KeyIndex & 0x40000000) if (key->KeyIndex & 0x40000000)
{ {
// Pairwise key /* Pairwise key */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ Pairwise key +++++\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ Pairwise key +++++\n"));
@ -919,15 +910,15 @@ _func_enter_;
} }
if (key->KeyIndex & 0x000000FF){ if (key->KeyIndex & 0x000000FF){
// The key index is specified in the lower 8 bits by values of zero to 255. /* The key index is specified in the lower 8 bits by values of zero to 255. */
// The key index should be set to zero for a Pairwise key, and the driver should fail with /* The key index should be set to zero for a Pairwise key, and the driver should fail with */
// NDIS_STATUS_INVALID_DATA if the lower 8 bits is not zero /* NDIS_STATUS_INVALID_DATA if the lower 8 bits is not zero */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,(" key->KeyIndex & 0x000000FF.\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,(" key->KeyIndex & 0x000000FF.\n"));
ret= _FAIL; ret= _FAIL;
goto exit; goto exit;
} }
// check BSSID /* check BSSID */
if (IS_MAC_ADDRESS_BROADCAST(key->BSSID) == true){ if (IS_MAC_ADDRESS_BROADCAST(key->BSSID) == true){
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("MacAddr_isBcst(key->BSSID)\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("MacAddr_isBcst(key->BSSID)\n"));
@ -935,8 +926,7 @@ _func_enter_;
goto exit; goto exit;
} }
// Check key length for TKIP. /* Check key length for TKIP. */
//if (encryptionAlgorithm == RT_ENC_TKIP_ENCRYPTION && key->KeyLength != 32)
if ((encryptionalgo== _TKIP_)&& (key->KeyLength != 32)){ if ((encryptionalgo== _TKIP_)&& (key->KeyLength != 32)){
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("TKIP KeyLength:0x%x != 32\n", key->KeyLength)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("TKIP KeyLength:0x%x != 32\n", key->KeyLength));
ret=_FAIL; ret=_FAIL;
@ -944,9 +934,9 @@ _func_enter_;
} }
// Check key length for AES. /* Check key length for AES. */
if ((encryptionalgo== _AES_)&& (key->KeyLength != 16)) { if ((encryptionalgo== _AES_)&& (key->KeyLength != 16)) {
// For our supplicant, EAPPkt9x.vxd, cannot differentiate TKIP and AES case. /* For our supplicant, EAPPkt9x.vxd, cannot differentiate TKIP and AES case. */
if (key->KeyLength == 32) { if (key->KeyLength == 32) {
key->KeyLength = 16; key->KeyLength = 16;
} else { } else {
@ -955,7 +945,7 @@ _func_enter_;
} }
} }
// Check key length for WEP. For NDTEST, 2005.01.27, by rcnjko. /* Check key length for WEP. For NDTEST, 2005.01.27, by rcnjko. */
if ( (encryptionalgo== _WEP40_|| encryptionalgo== _WEP104_) && (key->KeyLength != 5 || key->KeyLength != 13)) { if ( (encryptionalgo== _WEP40_|| encryptionalgo== _WEP104_) && (key->KeyLength != 5 || key->KeyLength != 13)) {
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("WEP KeyLength:0x%x != 5 or 13\n", key->KeyLength)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("WEP KeyLength:0x%x != 5 or 13\n", key->KeyLength));
ret=_FAIL; ret=_FAIL;
@ -964,7 +954,7 @@ _func_enter_;
bgroup = false; bgroup = false;
// Check the pairwise key. Added by Annie, 2005-07-06. /* Check the pairwise key. Added by Annie, 2005-07-06. */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("------------------------------------------\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("------------------------------------------\n"));
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("[Pairwise Key set]\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("[Pairwise Key set]\n"));
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("------------------------------------------\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("------------------------------------------\n"));
@ -975,11 +965,11 @@ _func_enter_;
} }
else else
{ {
// Group key - KeyIndex(BIT30==0) /* Group key - KeyIndex(BIT30==0) */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ Group key +++++\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ Group key +++++\n"));
// when add wep key through add key and didn't assigned encryption type before /* when add wep key through add key and didn't assigned encryption type before */
if ((padapter->securitypriv.ndisauthtype<=3)&&(padapter->securitypriv.dot118021XGrpPrivacy==0)) if ((padapter->securitypriv.ndisauthtype<=3)&&(padapter->securitypriv.dot118021XGrpPrivacy==0))
{ {
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("keylen=%d( Adapter->securitypriv.dot11PrivacyAlgrthm=%x )padapter->securitypriv.dot118021XGrpPrivacy(%x)\n", key->KeyLength,padapter->securitypriv.dot11PrivacyAlgrthm,padapter->securitypriv.dot118021XGrpPrivacy)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("keylen=%d( Adapter->securitypriv.dot11PrivacyAlgrthm=%x )padapter->securitypriv.dot118021XGrpPrivacy(%x)\n", key->KeyLength,padapter->securitypriv.dot11PrivacyAlgrthm,padapter->securitypriv.dot118021XGrpPrivacy));
@ -1018,7 +1008,7 @@ _func_enter_;
goto exit; goto exit;
} }
// Check key length for TKIP /* Check key length for TKIP */
if ((encryptionalgo== _TKIP_) && (key->KeyLength != 32)) { if ((encryptionalgo== _TKIP_) && (key->KeyLength != 32)) {
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,(" TKIP GTK KeyLength:%u != 32\n", key->KeyLength)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,(" TKIP GTK KeyLength:%u != 32\n", key->KeyLength));
@ -1027,20 +1017,20 @@ _func_enter_;
} else if (encryptionalgo== _AES_ && (key->KeyLength != 16 && key->KeyLength != 32) ) { } else if (encryptionalgo== _AES_ && (key->KeyLength != 16 && key->KeyLength != 32) ) {
// Check key length for AES /* Check key length for AES */
// For NDTEST, we allow keylen=32 in this case. 2005.01.27, by rcnjko. /* For NDTEST, we allow keylen=32 in this case. 2005.01.27, by rcnjko. */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("<=== SetInfo, OID_802_11_ADD_KEY: AES GTK KeyLength:%u != 16 or 32\n", key->KeyLength)); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("<=== SetInfo, OID_802_11_ADD_KEY: AES GTK KeyLength:%u != 16 or 32\n", key->KeyLength));
ret= _FAIL; ret= _FAIL;
goto exit; goto exit;
} }
// Change the key length for EAPPkt9x.vxd. Added by Annie, 2005-11-03. /* Change the key length for EAPPkt9x.vxd. Added by Annie, 2005-11-03. */
if ((encryptionalgo== _AES_) && (key->KeyLength == 32) ) { if ((encryptionalgo== _AES_) && (key->KeyLength == 32) ) {
key->KeyLength = 16; key->KeyLength = 16;
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("AES key length changed: %u\n", key->KeyLength) ); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("AES key length changed: %u\n", key->KeyLength) );
} }
if (key->KeyIndex & 0x8000000) {//error ??? 0x8000_0000 if (key->KeyIndex & 0x8000000) {/* error ??? 0x8000_0000 */
bgrouptkey = true; bgrouptkey = true;
} }
@ -1060,7 +1050,7 @@ _func_enter_;
} }
// If WEP encryption algorithm, just call rtw_set_802_11_add_wep(). /* If WEP encryption algorithm, just call rtw_set_802_11_add_wep(). */
if ((padapter->securitypriv.dot11AuthAlgrthm !=dot11AuthAlgrthm_8021X)&&(encryptionalgo== _WEP40_ || encryptionalgo== _WEP104_)) if ((padapter->securitypriv.dot11AuthAlgrthm !=dot11AuthAlgrthm_8021X)&&(encryptionalgo== _WEP40_ || encryptionalgo== _WEP104_))
{ {
u32 keyindex; u32 keyindex;
@ -1089,7 +1079,7 @@ _func_enter_;
} }
if (key->KeyIndex & 0x20000000){ if (key->KeyIndex & 0x20000000){
// SetRSC /* SetRSC */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ SetRSC+++++\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("OID_802_11_ADD_KEY: +++++ SetRSC+++++\n"));
if (bgroup == true) if (bgroup == true)
{ {
@ -1104,9 +1094,9 @@ _func_enter_;
} }
// Indicate this key idx is used for TX /* Indicate this key idx is used for TX */
// Save the key in KeyMaterial /* Save the key in KeyMaterial */
if (bgroup == true) // Group transmit key if (bgroup == true) /* Group transmit key */
{ {
int res; int res;
@ -1151,7 +1141,7 @@ _func_enter_;
} }
//set group key by index /* set group key by index */
_rtw_memcpy(&padapter->securitypriv.dot118021XGrpKey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial, key->KeyLength); _rtw_memcpy(&padapter->securitypriv.dot118021XGrpKey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial, key->KeyLength);
key->KeyIndex=key->KeyIndex & 0x03; key->KeyIndex=key->KeyIndex & 0x03;
@ -1170,7 +1160,7 @@ _func_enter_;
goto exit; goto exit;
} }
else // Pairwise Key else /* Pairwise Key */
{ {
u8 res; u8 res;
@ -1179,7 +1169,7 @@ _func_enter_;
if (stainfo!=NULL) if (stainfo!=NULL)
{ {
_rtw_memset( &stainfo->dot118021x_UncstKey, 0, 16);// clear keybuffer _rtw_memset( &stainfo->dot118021x_UncstKey, 0, 16);/* clear keybuffer */
_rtw_memcpy(&stainfo->dot118021x_UncstKey, key->KeyMaterial, 16); _rtw_memcpy(&stainfo->dot118021x_UncstKey, key->KeyMaterial, 16);
@ -1187,11 +1177,11 @@ _func_enter_;
{ {
padapter->securitypriv.busetkipkey=false; padapter->securitypriv.busetkipkey=false;
//_set_timer(&padapter->securitypriv.tkip_timer, 50); /* _set_timer(&padapter->securitypriv.tkip_timer, 50); */
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n ==========_set_timer\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n ==========_set_timer\n"));
// if TKIP, save the Receive/Transmit MIC key in KeyMaterial[128-255] /* if TKIP, save the Receive/Transmit MIC key in KeyMaterial[128-255] */
if ((key->KeyIndex & 0x10000000)){ if ((key->KeyIndex & 0x10000000)){
_rtw_memcpy(&stainfo->dot11tkiptxmickey, key->KeyMaterial + 16, 8); _rtw_memcpy(&stainfo->dot11tkiptxmickey, key->KeyMaterial + 16, 8);
_rtw_memcpy(&stainfo->dot11tkiprxmickey, key->KeyMaterial + 24, 8); _rtw_memcpy(&stainfo->dot11tkiprxmickey, key->KeyMaterial + 24, 8);
@ -1209,8 +1199,8 @@ _func_enter_;
} }
//Set key to CAM through H2C command /* Set key to CAM through H2C command */
if (bgrouptkey)//never go to here if (bgrouptkey)/* never go to here */
{ {
res=rtw_setstakey_cmd(padapter, (unsigned char *)stainfo, false); res=rtw_setstakey_cmd(padapter, (unsigned char *)stainfo, false);
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(group)\n")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(group)\n"));
@ -1250,21 +1240,19 @@ _func_enter_;
} }
if (bgroup == true) { if (bgroup == true) {
// clear group key by index /* clear group key by index */
//NdisZeroMemory(Adapter->MgntInfo.SecurityInfo.KeyBuf[keyIndex], MAX_WEP_KEY_LEN);
//Adapter->MgntInfo.SecurityInfo.KeyLen[keyIndex] = 0;
_rtw_memset(&padapter->securitypriv.dot118021XGrpKey[keyIndex], 0, 16); _rtw_memset(&padapter->securitypriv.dot118021XGrpKey[keyIndex], 0, 16);
//! \todo Send a H2C Command to Firmware for removing this Key in CAM Entry. /* \todo Send a H2C Command to Firmware for removing this Key in CAM Entry. */
} else { } else {
pbssid=get_bssid(&padapter->mlmepriv); pbssid=get_bssid(&padapter->mlmepriv);
stainfo=rtw_get_stainfo(&padapter->stapriv , pbssid ); stainfo=rtw_get_stainfo(&padapter->stapriv , pbssid );
if (stainfo) { if (stainfo) {
// clear key by BSSID /* clear key by BSSID */
_rtw_memset(&stainfo->dot118021x_UncstKey, 0, 16); _rtw_memset(&stainfo->dot118021x_UncstKey, 0, 16);
//! \todo Send a H2C Command to Firmware for disable this Key in CAM Entry. /* \todo Send a H2C Command to Firmware for disable this Key in CAM Entry. */
} else { } else {
ret= _FAIL; ret= _FAIL;
goto exit; goto exit;
@ -1321,11 +1309,9 @@ u16 rtw_get_cur_max_rate(_adapter *adapter)
_rtw_memcpy(&mcs_rate , pht_capie->supp_mcs_set, 2); _rtw_memcpy(&mcs_rate , pht_capie->supp_mcs_set, 2);
//bw_40MHz = (pht_capie->cap_info&IEEE80211_HT_CAP_SUP_WIDTH) ? 1:0; /* cur_bwmod is updated by beacon, pmlmeinfo is updated by association response */
//cur_bwmod is updated by beacon, pmlmeinfo is updated by association response
bw_40MHz = (pmlmeext->cur_bwmode && (HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo->HT_info.infos[0])) ? 1:0; bw_40MHz = (pmlmeext->cur_bwmode && (HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo->HT_info.infos[0])) ? 1:0;
//short_GI = (pht_capie->cap_info&(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1:0;
short_GI_20 = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info)&IEEE80211_HT_CAP_SGI_20) ? 1:0; short_GI_20 = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info)&IEEE80211_HT_CAP_SGI_20) ? 1:0;
short_GI_40 = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info)&IEEE80211_HT_CAP_SGI_40) ? 1:0; short_GI_40 = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info)&IEEE80211_HT_CAP_SGI_40) ? 1:0;
@ -1340,7 +1326,7 @@ u16 rtw_get_cur_max_rate(_adapter *adapter)
} }
} }
else else
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
{ {
while ( (pcur_bss->SupportedRates[i]!=0) && (pcur_bss->SupportedRates[i]!=0xFF)) while ( (pcur_bss->SupportedRates[i]!=0) && (pcur_bss->SupportedRates[i]!=0xFF))
{ {
@ -1385,7 +1371,7 @@ int rtw_set_channel_plan(_adapter *adapter, u8 channel_plan)
struct registry_priv *pregistrypriv = &adapter->registrypriv; struct registry_priv *pregistrypriv = &adapter->registrypriv;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
//handle by cmd_thread to sync with scan operation /* handle by cmd_thread to sync with scan operation */
return rtw_set_chplan_cmd(adapter, channel_plan, 1); return rtw_set_chplan_cmd(adapter, channel_plan, 1);
} }
@ -1402,8 +1388,8 @@ int rtw_set_country(_adapter *adapter, const char *country_code)
DBG_88E("%s country_code:%s\n", __func__, country_code); DBG_88E("%s country_code:%s\n", __func__, country_code);
//TODO: should have a table to match country code and RT_CHANNEL_DOMAIN /* TODO: should have a table to match country code and RT_CHANNEL_DOMAIN */
//TODO: should consider 2-character and 3-character country code /* TODO: should consider 2-character and 3-character country code */
if (0 == strcmp(country_code, "US")) if (0 == strcmp(country_code, "US"))
channel_plan = RT_CHANNEL_DOMAIN_FCC; channel_plan = RT_CHANNEL_DOMAIN_FCC;
else if (0 == strcmp(country_code, "EU")) else if (0 == strcmp(country_code, "EU"))

View file

@ -50,7 +50,7 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter)
pattrib = &xmit_frame->attrib; pattrib = &xmit_frame->attrib;
update_mgntframe_attrib(adapter, pattrib); update_mgntframe_attrib(adapter, pattrib);
pattrib->qsel = 0x10;//Beacon pattrib->qsel = 0x10;/* Beacon */
pattrib->subtype = WIFI_BEACON; pattrib->subtype = WIFI_BEACON;
pattrib->pktlen = pattrib->last_txcmdsz = 0; pattrib->pktlen = pattrib->last_txcmdsz = 0;
@ -81,7 +81,7 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len
buf_offset = TXDESC_OFFSET; buf_offset = TXDESC_OFFSET;
ori_len = buf_offset+pattrib->pktlen; ori_len = buf_offset+pattrib->pktlen;
//check if the io_buf can accommodate new cmds /* check if the io_buf can accommodate new cmds */
if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) { if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) {
DBG_88E("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", __func__ DBG_88E("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", __func__
, ori_len + cmd_len + 8, MAX_XMITBUF_SZ); , ori_len + cmd_len + 8, MAX_XMITBUF_SZ);
@ -92,10 +92,9 @@ int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len
pattrib->pktlen += cmd_len; pattrib->pktlen += cmd_len;
pattrib->last_txcmdsz += cmd_len; pattrib->last_txcmdsz += cmd_len;
//DBG_88E("%s ori:%u + cmd_len:%u = %u\n", __func__, ori_len, cmd_len, buf_offset+pattrib->pktlen);
return _SUCCESS; return _SUCCESS;
} }
bool rtw_IOL_applied(ADAPTER *adapter) bool rtw_IOL_applied(ADAPTER *adapter)
{ {
if (1 == adapter->registrypriv.fw_iol) if (1 == adapter->registrypriv.fw_iol)
@ -137,40 +136,31 @@ int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8
{ {
struct ioreg_cfg cmd = {8,IOREG_CMD_WB_REG,0x0, 0x0,0x0}; struct ioreg_cfg cmd = {8,IOREG_CMD_WB_REG,0x0, 0x0,0x0};
//RTW_PUT_LE16((u8*)&cmd.address, addr);
//RTW_PUT_LE32((u8*)&cmd.value, (u32)value);
cmd.address = cpu_to_le16(addr); cmd.address = cpu_to_le16(addr);
cmd.data = cpu_to_le32(value); cmd.data = cpu_to_le32(value);
if (mask!=0xFF) if (mask!=0xFF)
{ {
cmd.length = 12; cmd.length = 12;
//RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask);
cmd.mask = cpu_to_le32(mask); cmd.mask = cpu_to_le32(mask);
} }
//DBG_88E("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __func__, addr,value,mask);
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length);
} }
int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask) int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask)
{ {
struct ioreg_cfg cmd = {8,IOREG_CMD_WW_REG,0x0, 0x0,0x0}; struct ioreg_cfg cmd = {8,IOREG_CMD_WW_REG,0x0, 0x0,0x0};
//RTW_PUT_LE16((u8*)&cmd.address, addr);
//RTW_PUT_LE32((u8*)&cmd.value, (u32)value);
cmd.address = cpu_to_le16(addr); cmd.address = cpu_to_le16(addr);
cmd.data = cpu_to_le32(value); cmd.data = cpu_to_le32(value);
if (mask!=0xFFFF) if (mask!=0xFFFF)
{ {
cmd.length = 12; cmd.length = 12;
//RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask);
cmd.mask = cpu_to_le32(mask); cmd.mask = cpu_to_le32(mask);
} }
//DBG_88E("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __func__, addr,value,mask);
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length);
@ -179,19 +169,15 @@ int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u
{ {
struct ioreg_cfg cmd = {8,IOREG_CMD_WD_REG,0x0, 0x0,0x0}; struct ioreg_cfg cmd = {8,IOREG_CMD_WD_REG,0x0, 0x0,0x0};
//RTW_PUT_LE16((u8*)&cmd.address, addr);
//RTW_PUT_LE32((u8*)&cmd.value, (u32)value);
cmd.address = cpu_to_le16(addr); cmd.address = cpu_to_le16(addr);
cmd.data = cpu_to_le32(value); cmd.data = cpu_to_le32(value);
if (mask!=0xFFFFFFFF) if (mask!=0xFFFFFFFF)
{ {
cmd.length = 12; cmd.length = 12;
//RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask);
cmd.mask = cpu_to_le32(mask); cmd.mask = cpu_to_le32(mask);
} }
//DBG_88E("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__, addr,value,mask);
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length);
@ -201,33 +187,23 @@ int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr,
{ {
struct ioreg_cfg cmd = {8,IOREG_CMD_W_RF,0x0, 0x0,0x0}; struct ioreg_cfg cmd = {8,IOREG_CMD_W_RF,0x0, 0x0,0x0};
//RTW_PUT_LE16((u8*)&cmd.address, addr); cmd.address = cpu_to_le16((rf_path<<8) |((addr) &0xFF));
//RTW_PUT_LE32((u8*)&cmd.value, (u32)value);
cmd.address = (rf_path<<8) |((addr) &0xFF);
cmd.data = cpu_to_le32(value); cmd.data = cpu_to_le32(value);
if (mask!=0x000FFFFF) if (mask != 0x000FFFFF) {
{
cmd.length = 12; cmd.length = 12;
//RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask);
cmd.mask = cpu_to_le32(mask); cmd.mask = cpu_to_le32(mask);
} }
//DBG_88E("%s rf_path:0x%02x addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__,rf_path, addr,value,mask);
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, cmd.length);
} }
int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us) int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
{ {
struct ioreg_cfg cmd = {4,IOREG_CMD_DELAY_US,0x0, 0x0,0x0}; struct ioreg_cfg cmd = {4,IOREG_CMD_DELAY_US,0x0, 0x0,0x0};
//RTW_PUT_LE16((u8*)&cmd.address, us);
cmd.address = cpu_to_le16(us); cmd.address = cpu_to_le16(us);
//DBG_88E("%s %u\n", __func__, us);
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4);
} }
@ -235,15 +211,13 @@ int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
{ {
struct ioreg_cfg cmd = {4,IOREG_CMD_DELAY_US,0x0, 0x0,0x0}; struct ioreg_cfg cmd = {4,IOREG_CMD_DELAY_US,0x0, 0x0,0x0};
//RTW_PUT_LE16((u8*)&cmd.address, ms);
cmd.address = cpu_to_le16(ms); cmd.address = cpu_to_le16(ms);
//DBG_88E("%s %u\n", __func__, ms);
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4);
} }
int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame) 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); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4);
} }
@ -255,7 +229,6 @@ u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame)
rtw_IOL_append_END_cmd(pxmit_frame); rtw_IOL_append_END_cmd(pxmit_frame);
pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen+32)/256)+1)*256 ); pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen+32)/256)+1)*256 );
//printk("==> %s, pktlen(%d)\n",__func__,pxmit_frame->attrib.pktlen);
pxmit_frame->attrib.last_txcmdsz = pxmit_frame->attrib.pktlen; pxmit_frame->attrib.last_txcmdsz = pxmit_frame->attrib.pktlen;
is_cmd_bndy = true; is_cmd_bndy = true;
} }
@ -278,7 +251,7 @@ void rtw_IOL_cmd_buf_dump(ADAPTER *Adapter,int buf_len,u8 *pbuf)
} }
#else //CONFIG_IOL_NEW_GENERATION #else /* CONFIG_IOL_NEW_GENERATION */
int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary) int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary)
{ {
IOL_CMD cmd = {0x0, IOL_CMD_LLT, 0x0, 0x0}; IOL_CMD cmd = {0x0, IOL_CMD_LLT, 0x0, 0x0};
@ -351,8 +324,6 @@ int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
RTW_PUT_BE32((u8*)&cmd.value, (u32)us); RTW_PUT_BE32((u8*)&cmd.value, (u32)us);
//DBG_88E("%s %u\n", __func__, us);
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 8); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 8);
} }
@ -362,8 +333,6 @@ int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
RTW_PUT_BE32((u8*)&cmd.value, (u32)ms); RTW_PUT_BE32((u8*)&cmd.value, (u32)ms);
//DBG_88E("%s %u\n", __func__, ms);
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 8); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 8);
} }
@ -394,9 +363,9 @@ int rtw_IOL_exec_empty_cmds_sync(ADAPTER *adapter, u32 max_wating_ms)
IOL_CMD end_cmd = {0x0, IOL_CMD_END, 0x0, 0x0}; IOL_CMD end_cmd = {0x0, IOL_CMD_END, 0x0, 0x0};
return rtw_IOL_exec_cmd_array_sync(adapter, (u8*)&end_cmd, 1, max_wating_ms); return rtw_IOL_exec_cmd_array_sync(adapter, (u8*)&end_cmd, 1, max_wating_ms);
} }
#endif //CONFIG_IOL_NEW_GENERATION #endif /* CONFIG_IOL_NEW_GENERATION */
#endif //CONFIG_IOL #endif /* CONFIG_IOL */

View file

@ -21,21 +21,18 @@
#include <drv_types.h> #include <drv_types.h>
#include "rtw_led.h" #include "rtw_led.h"
// /* */
// Description: /* Description: */
// Callback function of LED BlinkTimer, /* Callback function of LED BlinkTimer, */
// it just schedules to corresponding BlinkWorkItem/led_blink_hdl /* it just schedules to corresponding BlinkWorkItem/led_blink_hdl */
// /* */
void BlinkTimerCallback(void *data) void BlinkTimerCallback(void *data)
{ {
PLED_871x pLed = (PLED_871x)data; PLED_871x pLed = (PLED_871x)data;
_adapter *padapter = pLed->padapter; _adapter *padapter = pLed->padapter;
//DBG_88E("%s\n", __func__);
if ( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) if ( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true))
{ {
//DBG_88E("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __func__, padapter->bSurpriseRemoved, padapter->bDriverStopped);
return; return;
} }
@ -52,11 +49,11 @@ void BlinkTimerCallback(void *data)
} }
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)
// /* */
// Description: /* Description: */
// Callback function of LED BlinkWorkItem. /* Callback function of LED BlinkWorkItem. */
// We dispatch acture LED blink action according to LedStrategy. /* We dispatch acture LED blink action according to LedStrategy. */
// /* */
void BlinkWorkItemCallback(struct work_struct *work) void BlinkWorkItemCallback(struct work_struct *work)
{ {
PLED_871x pLed = container_of(work, LED_871x, BlinkWorkItem); PLED_871x pLed = container_of(work, LED_871x, BlinkWorkItem);
@ -64,20 +61,20 @@ void BlinkWorkItemCallback(struct work_struct *work)
} }
#endif #endif
// /* */
// Description: /* Description: */
// Reset status of LED_871x object. /* Reset status of LED_871x object. */
// /* */
void ResetLedStatus(PLED_871x pLed) { void ResetLedStatus(PLED_871x pLed) {
pLed->CurrLedState = RTW_LED_OFF; // Current LED state. pLed->CurrLedState = RTW_LED_OFF; /* Current LED state. */
pLed->bLedOn = false; // true if LED is ON, false if LED is OFF. pLed->bLedOn = false; /* true if LED is ON, false if LED is OFF. */
pLed->bLedBlinkInProgress = false; // true if it is blinking, false o.w.. pLed->bLedBlinkInProgress = false; /* true if it is blinking, false o.w.. */
pLed->bLedWPSBlinkInProgress = false; pLed->bLedWPSBlinkInProgress = false;
pLed->BlinkTimes = 0; // Number of times to toggle led state for blinking. pLed->BlinkTimes = 0; /* Number of times to toggle led state for blinking. */
pLed->BlinkingLedState = LED_UNKNOWN; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. pLed->BlinkingLedState = LED_UNKNOWN; /* Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. */
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI)
pLed->bLedNoLinkBlinkInProgress = false; pLed->bLedNoLinkBlinkInProgress = false;
@ -87,10 +84,10 @@ void ResetLedStatus(PLED_871x pLed) {
#endif #endif
} }
// /* */
// Description: /* Description: */
// Initialize an LED_871x object. /* Initialize an LED_871x object. */
// /* */
void void
InitLed871x( InitLed871x(
_adapter *padapter, _adapter *padapter,
@ -111,10 +108,10 @@ InitLed871x(
} }
// /* */
// Description: /* Description: */
// DeInitialize an LED_871x object. /* DeInitialize an LED_871x object. */
// /* */
void void
DeInitLed871x( DeInitLed871x(
PLED_871x pLed PLED_871x pLed
@ -128,11 +125,11 @@ DeInitLed871x(
} }
// /* */
// Description: /* Description: */
// Implementation of LED blinking behavior. /* Implementation of LED blinking behavior. */
// It toggle off LED and schedule corresponding timer if necessary. /* It toggle off LED and schedule corresponding timer if necessary. */
// /* */
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
void SwLedOn(_adapter *padapter, PLED_871x pLed); void SwLedOn(_adapter *padapter, PLED_871x pLed);
@ -149,7 +146,7 @@ SwLedBlink(
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
u8 bStopBlinking = false; u8 bStopBlinking = false;
// Change LED according to BlinkingLedState specified. /* Change LED according to BlinkingLedState specified. */
if ( pLed->BlinkingLedState == RTW_LED_ON ) if ( pLed->BlinkingLedState == RTW_LED_ON )
{ {
SwLedOn(padapter, pLed); SwLedOn(padapter, pLed);
@ -161,7 +158,7 @@ SwLedBlink(
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn off\n", pLed->BlinkTimes)); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn off\n", pLed->BlinkTimes));
} }
// Determine if we shall change LED state again. /* Determine if we shall change LED state again. */
pLed->BlinkTimes--; pLed->BlinkTimes--;
switch (pLed->CurrLedState) switch (pLed->CurrLedState)
{ {
@ -205,7 +202,7 @@ SwLedBlink(
if (bStopBlinking) if (bStopBlinking)
{ {
//if ( padapter->pwrctrlpriv.cpwm >= PS_STATE_S2) /* if ( padapter->pwrctrlpriv.cpwm >= PS_STATE_S2) */
if (0) if (0)
{ {
SwLedOff(padapter, pLed); SwLedOff(padapter, pLed);
@ -224,13 +221,13 @@ SwLedBlink(
} }
else else
{ {
// Assign LED state to toggle. /* Assign LED state to toggle. */
if ( pLed->BlinkingLedState == RTW_LED_ON ) if ( pLed->BlinkingLedState == RTW_LED_ON )
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
// Schedule a timer to toggle LED state. /* Schedule a timer to toggle LED state. */
switch ( pLed->CurrLedState ) switch ( pLed->CurrLedState )
{ {
case LED_BLINK_NORMAL: case LED_BLINK_NORMAL:
@ -277,7 +274,7 @@ SwLedBlink1(
pLed = &(ledpriv->SwLed1); pLed = &(ledpriv->SwLed1);
#endif #endif
// Change LED according to BlinkingLedState specified. /* Change LED according to BlinkingLedState specified. */
if ( pLed->BlinkingLedState == RTW_LED_ON ) if ( pLed->BlinkingLedState == RTW_LED_ON )
{ {
SwLedOn(padapter, pLed); SwLedOn(padapter, pLed);
@ -438,7 +435,7 @@ SwLedBlink1(
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
break; break;
case LED_BLINK_WPS_STOP: //WPS success case LED_BLINK_WPS_STOP: /* WPS success */
if (pLed->BlinkingLedState == RTW_LED_ON) if (pLed->BlinkingLedState == RTW_LED_ON)
bStopBlinking = false; bStopBlinking = false;
else else
@ -479,7 +476,7 @@ SwLedBlink2(
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
u8 bStopBlinking = false; u8 bStopBlinking = false;
// Change LED according to BlinkingLedState specified. /* Change LED according to BlinkingLedState specified. */
if ( pLed->BlinkingLedState == RTW_LED_ON) if ( pLed->BlinkingLedState == RTW_LED_ON)
{ {
SwLedOn(padapter, pLed); SwLedOn(padapter, pLed);
@ -601,7 +598,7 @@ SwLedBlink3(
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
u8 bStopBlinking = false; u8 bStopBlinking = false;
// Change LED according to BlinkingLedState specified. /* Change LED according to BlinkingLedState specified. */
if ( pLed->BlinkingLedState == RTW_LED_ON ) if ( pLed->BlinkingLedState == RTW_LED_ON )
{ {
SwLedOn(padapter, pLed); SwLedOn(padapter, pLed);
@ -726,7 +723,7 @@ SwLedBlink3(
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
break; break;
case LED_BLINK_WPS_STOP: //WPS success case LED_BLINK_WPS_STOP: /* WPS success */
if (pLed->BlinkingLedState == RTW_LED_ON) if (pLed->BlinkingLedState == RTW_LED_ON)
{ {
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
@ -774,7 +771,7 @@ SwLedBlink4(
PLED_871x pLed1 = &(ledpriv->SwLed1); PLED_871x pLed1 = &(ledpriv->SwLed1);
u8 bStopBlinking = false; u8 bStopBlinking = false;
// Change LED according to BlinkingLedState specified. /* Change LED according to BlinkingLedState specified. */
if ( pLed->BlinkingLedState == RTW_LED_ON ) if ( pLed->BlinkingLedState == RTW_LED_ON )
{ {
SwLedOn(padapter, pLed); SwLedOn(padapter, pLed);
@ -912,7 +909,7 @@ SwLedBlink4(
} }
break; break;
case LED_BLINK_WPS_STOP: //WPS authentication fail case LED_BLINK_WPS_STOP: /* WPS authentication fail */
if ( pLed->bLedOn ) if ( pLed->bLedOn )
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
@ -921,7 +918,7 @@ SwLedBlink4(
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
break; break;
case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap case LED_BLINK_WPS_STOP_OVERLAP: /* WPS session overlap */
pLed->BlinkTimes--; pLed->BlinkTimes--;
if (pLed->BlinkTimes == 0) if (pLed->BlinkTimes == 0)
{ {
@ -971,7 +968,7 @@ SwLedBlink5(
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
u8 bStopBlinking = false; u8 bStopBlinking = false;
// Change LED according to BlinkingLedState specified. /* Change LED according to BlinkingLedState specified. */
if ( pLed->BlinkingLedState == RTW_LED_ON ) if ( pLed->BlinkingLedState == RTW_LED_ON )
{ {
SwLedOn(padapter, pLed); SwLedOn(padapter, pLed);
@ -1089,7 +1086,7 @@ SwLedBlink6(
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
u8 bStopBlinking = false; u8 bStopBlinking = false;
// Change LED according to BlinkingLedState specified. /* Change LED according to BlinkingLedState specified. */
if ( pLed->BlinkingLedState == RTW_LED_ON ) if ( pLed->BlinkingLedState == RTW_LED_ON )
{ {
SwLedOn(padapter, pLed); SwLedOn(padapter, pLed);
@ -1113,7 +1110,7 @@ SwLedControlMode0(
struct led_priv *ledpriv = &(padapter->ledpriv); struct led_priv *ledpriv = &(padapter->ledpriv);
PLED_871x pLed = &(ledpriv->SwLed1); PLED_871x pLed = &(ledpriv->SwLed1);
// Decide led state /* Decide led state */
switch (LedAction) switch (LedAction)
{ {
case LED_CTL_TX: case LED_CTL_TX:
@ -1218,7 +1215,7 @@ SwLedControlMode0(
} }
//ALPHA, added by chiyoko, 20090106 /* ALPHA, added by chiyoko, 20090106 */
static void static void
SwLedControlMode1( SwLedControlMode1(
_adapter *padapter, _adapter *padapter,
@ -1359,7 +1356,7 @@ SwLedControlMode1(
} }
break; break;
case LED_CTL_START_WPS: //wait until xinpin finish case LED_CTL_START_WPS: /* wait until xinpin finish */
case LED_CTL_START_WPS_BOTTON: case LED_CTL_START_WPS_BOTTON:
if (pLed->bLedWPSBlinkInProgress ==false) if (pLed->bLedWPSBlinkInProgress ==false)
{ {
@ -1493,7 +1490,7 @@ SwLedControlMode1(
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
} }
//Arcadyan/Sitecom , added by chiyoko, 20090216 /* Arcadyan/Sitecom , added by chiyoko, 20090216 */
static void static void
SwLedControlMode2( SwLedControlMode2(
_adapter *padapter, _adapter *padapter,
@ -1567,7 +1564,7 @@ SwLedControlMode2(
_set_timer(&(pLed->BlinkTimer), 0); _set_timer(&(pLed->BlinkTimer), 0);
break; break;
case LED_CTL_START_WPS: //wait until xinpin finish case LED_CTL_START_WPS: /* wait until xinpin finish */
case LED_CTL_START_WPS_BOTTON: case LED_CTL_START_WPS_BOTTON:
if (pLed->bLedWPSBlinkInProgress ==false) if (pLed->bLedWPSBlinkInProgress ==false)
{ {
@ -1658,7 +1655,7 @@ SwLedControlMode2(
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState)); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
} }
//COREGA, added by chiyoko, 20090316 /* COREGA, added by chiyoko, 20090316 */
static void static void
SwLedControlMode3( SwLedControlMode3(
_adapter *padapter, _adapter *padapter,
@ -1735,7 +1732,7 @@ SwLedControlMode2(
_set_timer(&(pLed->BlinkTimer), 0); _set_timer(&(pLed->BlinkTimer), 0);
break; break;
case LED_CTL_START_WPS: //wait until xinpin finish case LED_CTL_START_WPS: /* wait until xinpin finish */
case LED_CTL_START_WPS_BOTTON: case LED_CTL_START_WPS_BOTTON:
if (pLed->bLedWPSBlinkInProgress ==false) if (pLed->bLedWPSBlinkInProgress ==false)
{ {
@ -1837,7 +1834,7 @@ SwLedControlMode2(
} }
//Edimax-Belkin, added by chiyoko, 20090413 /* Edimax-Belkin, added by chiyoko, 20090413 */
static void static void
SwLedControlMode4( SwLedControlMode4(
_adapter *padapter, _adapter *padapter,
@ -1898,7 +1895,7 @@ SwLedControlMode4(
case LED_CTL_LINK: case LED_CTL_LINK:
case LED_CTL_NO_LINK: case LED_CTL_NO_LINK:
//LED1 settings /* LED1 settings */
if (LedAction == LED_CTL_LINK) if (LedAction == LED_CTL_LINK)
{ {
if (pLed1->bLedWPSBlinkInProgress) if (pLed1->bLedWPSBlinkInProgress)
@ -1989,7 +1986,7 @@ SwLedControlMode4(
} }
break; break;
case LED_CTL_START_WPS: //wait until xinpin finish case LED_CTL_START_WPS: /* wait until xinpin finish */
case LED_CTL_START_WPS_BOTTON: case LED_CTL_START_WPS_BOTTON:
if (pLed1->bLedWPSBlinkInProgress) if (pLed1->bLedWPSBlinkInProgress)
{ {
@ -2035,7 +2032,7 @@ SwLedControlMode4(
} }
break; break;
case LED_CTL_STOP_WPS: //WPS connect success case LED_CTL_STOP_WPS: /* WPS connect success */
if (pLed->bLedWPSBlinkInProgress) if (pLed->bLedWPSBlinkInProgress)
{ {
_cancel_timer_ex(&(pLed->BlinkTimer)); _cancel_timer_ex(&(pLed->BlinkTimer));
@ -2052,7 +2049,7 @@ SwLedControlMode4(
break; break;
case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail case LED_CTL_STOP_WPS_FAIL: /* WPS authentication fail */
if (pLed->bLedWPSBlinkInProgress) if (pLed->bLedWPSBlinkInProgress)
{ {
_cancel_timer_ex(&(pLed->BlinkTimer)); _cancel_timer_ex(&(pLed->BlinkTimer));
@ -2067,7 +2064,7 @@ SwLedControlMode4(
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
//LED1 settings /* LED1 settings */
if (pLed1->bLedWPSBlinkInProgress) if (pLed1->bLedWPSBlinkInProgress)
_cancel_timer_ex(&(pLed1->BlinkTimer)); _cancel_timer_ex(&(pLed1->BlinkTimer));
else else
@ -2082,7 +2079,7 @@ SwLedControlMode4(
break; break;
case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap case LED_CTL_STOP_WPS_FAIL_OVERLAP: /* WPS session overlap */
if (pLed->bLedWPSBlinkInProgress) if (pLed->bLedWPSBlinkInProgress)
{ {
_cancel_timer_ex(&(pLed->BlinkTimer)); _cancel_timer_ex(&(pLed->BlinkTimer));
@ -2097,7 +2094,7 @@ SwLedControlMode4(
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
//LED1 settings /* LED1 settings */
if (pLed1->bLedWPSBlinkInProgress) if (pLed1->bLedWPSBlinkInProgress)
_cancel_timer_ex(&(pLed1->BlinkTimer)); _cancel_timer_ex(&(pLed1->BlinkTimer));
else else
@ -2169,7 +2166,7 @@ SwLedControlMode4(
//Sercomm-Belkin, added by chiyoko, 20090415 /* Sercomm-Belkin, added by chiyoko, 20090415 */
static void static void
SwLedControlMode5( SwLedControlMode5(
_adapter *padapter, _adapter *padapter,
@ -2192,7 +2189,7 @@ SwLedControlMode5(
{ {
case LED_CTL_POWER_ON: case LED_CTL_POWER_ON:
case LED_CTL_NO_LINK: case LED_CTL_NO_LINK:
case LED_CTL_LINK: //solid blue case LED_CTL_LINK: /* solid blue */
pLed->CurrLedState = RTW_LED_ON; pLed->CurrLedState = RTW_LED_ON;
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
@ -2260,7 +2257,7 @@ SwLedControlMode5(
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState)); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
} }
//WNC-Corega, added by chiyoko, 20090902 /* WNC-Corega, added by chiyoko, 20090902 */
static void static void
SwLedControlMode6( SwLedControlMode6(
_adapter *padapter, _adapter *padapter,
@ -2293,23 +2290,18 @@ SwLedControlMode6(
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("ledcontrol 6 Led %d\n", pLed0->CurrLedState)); RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("ledcontrol 6 Led %d\n", pLed0->CurrLedState));
} }
// /* */
// Description: /* Description: */
// Handler function of LED Blinking. /* Handler function of LED Blinking. */
// We dispatch acture LED blink action according to LedStrategy. /* We dispatch acture LED blink action according to LedStrategy. */
// /* */
void BlinkHandler(PLED_871x pLed) void BlinkHandler(PLED_871x pLed)
{ {
_adapter *padapter = pLed->padapter; _adapter *padapter = pLed->padapter;
struct led_priv *ledpriv = &(padapter->ledpriv); struct led_priv *ledpriv = &(padapter->ledpriv);
//DBG_88E("%s (%s:%d)\n",__func__, current->comm, current->pid);
if ( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) if ( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true))
{
//DBG_88E("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __func__, padapter->bSurpriseRemoved, padapter->bDriverStopped);
return; return;
}
switch (ledpriv->LedStrategy) switch (ledpriv->LedStrategy)
{ {
@ -2342,8 +2334,6 @@ void BlinkHandler(PLED_871x pLed)
break; break;
default: default:
//RT_TRACE(COMP_LED, DBG_LOUD, ("BlinkWorkItemCallback 0x%x\n", pHalData->LedStrategy));
//SwLedBlink(pLed);
break; break;
} }
} }
@ -2366,11 +2356,7 @@ LedControl871x(
if ( ledpriv->bRegUseLed == false) if ( ledpriv->bRegUseLed == false)
return; return;
//if (!priv->up)
// return;
//if (priv->bInHctTest)
// return;
if ( (padapter->pwrctrlpriv.rf_pwrstate != rf_on && if ( (padapter->pwrctrlpriv.rf_pwrstate != rf_on &&
padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) &&
@ -2386,7 +2372,6 @@ LedControl871x(
switch (ledpriv->LedStrategy) switch (ledpriv->LedStrategy)
{ {
case SW_LED_MODE0: case SW_LED_MODE0:
//SwLedControlMode0(padapter, LedAction);
break; break;
case SW_LED_MODE1: case SW_LED_MODE1:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -157,69 +157,6 @@ static void _init_mp_priv_(struct mp_priv *pmp_priv)
_rtw_memcpy(pnetwork->Ssid.Ssid, "mp_871x", pnetwork->Ssid.SsidLength); _rtw_memcpy(pnetwork->Ssid.Ssid, "mp_871x", pnetwork->Ssid.SsidLength);
} }
#ifdef PLATFORM_WINDOWS
/*
void mp_wi_callback(
IN NDIS_WORK_ITEM* pwk_item,
IN void * cntx
)
{
_adapter* padapter =(_adapter *)cntx;
struct mp_priv *pmppriv=&padapter->mppriv;
struct mp_wi_cntx *pmp_wi_cntx=&pmppriv->wi_cntx;
// Execute specified action.
if (pmp_wi_cntx->curractfunc != NULL)
{
LARGE_INTEGER cur_time;
ULONGLONG start_time, end_time;
NdisGetCurrentSystemTime(&cur_time); // driver version
start_time = cur_time.QuadPart/10; // The return value is in microsecond
pmp_wi_cntx->curractfunc(padapter);
NdisGetCurrentSystemTime(&cur_time); // driver version
end_time = cur_time.QuadPart/10; // The return value is in microsecond
RT_TRACE(_module_mp_, _drv_info_,
("WorkItemActType: %d, time spent: %I64d us\n",
pmp_wi_cntx->param.act_type, (end_time-start_time)));
}
NdisAcquireSpinLock(&(pmp_wi_cntx->mp_wi_lock));
pmp_wi_cntx->bmp_wi_progress= false;
NdisReleaseSpinLock(&(pmp_wi_cntx->mp_wi_lock));
if (pmp_wi_cntx->bmpdrv_unload)
{
NdisSetEvent(&(pmp_wi_cntx->mp_wi_evt));
}
}
*/
static int init_mp_priv_by_os(struct mp_priv *pmp_priv)
{
struct mp_wi_cntx *pmp_wi_cntx;
if (pmp_priv == NULL) return _FAIL;
pmp_priv->rx_testcnt = 0;
pmp_priv->rx_testcnt1 = 0;
pmp_priv->rx_testcnt2 = 0;
pmp_priv->tx_testcnt = 0;
pmp_priv->tx_testcnt1 = 0;
pmp_wi_cntx = &pmp_priv->wi_cntx
pmp_wi_cntx->bmpdrv_unload = false;
pmp_wi_cntx->bmp_wi_progress = false;
pmp_wi_cntx->curractfunc = NULL;
return _SUCCESS;
}
#endif
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
static int init_mp_priv_by_os(struct mp_priv *pmp_priv) static int init_mp_priv_by_os(struct mp_priv *pmp_priv)
{ {
@ -268,26 +205,26 @@ static void mp_init_xmit_attrib(struct mp_tx *pmptx, PADAPTER padapter)
struct pkt_attrib *pattrib; struct pkt_attrib *pattrib;
struct tx_desc *desc; struct tx_desc *desc;
// init xmitframe attribute /* init xmitframe attribute */
pattrib = &pmptx->attrib; pattrib = &pmptx->attrib;
_rtw_memset(pattrib, 0, sizeof(struct pkt_attrib)); _rtw_memset(pattrib, 0, sizeof(struct pkt_attrib));
desc = &pmptx->desc; desc = &pmptx->desc;
_rtw_memset(desc, 0, TXDESC_SIZE); _rtw_memset(desc, 0, TXDESC_SIZE);
pattrib->ether_type = 0x8712; pattrib->ether_type = 0x8712;
//_rtw_memcpy(pattrib->src, padapter->eeprompriv.mac_addr, ETH_ALEN); /* _rtw_memcpy(pattrib->src, padapter->eeprompriv.mac_addr, ETH_ALEN); */
// _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); /* _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); */
_rtw_memset(pattrib->dst, 0xFF, ETH_ALEN); _rtw_memset(pattrib->dst, 0xFF, ETH_ALEN);
// pattrib->pctrl = 0; /* pattrib->pctrl = 0; */
// pattrib->dhcp_pkt = 0; /* pattrib->dhcp_pkt = 0; */
// pattrib->pktlen = 0; /* pattrib->pktlen = 0; */
pattrib->ack_policy = 0; pattrib->ack_policy = 0;
// pattrib->pkt_hdrlen = ETH_HLEN; /* pattrib->pkt_hdrlen = ETH_HLEN; */
pattrib->hdrlen = WLAN_HDR_A3_LEN; pattrib->hdrlen = WLAN_HDR_A3_LEN;
pattrib->subtype = WIFI_DATA; pattrib->subtype = WIFI_DATA;
pattrib->priority = 0; pattrib->priority = 0;
pattrib->qsel = pattrib->priority; pattrib->qsel = pattrib->priority;
// do_queue_select(padapter, pattrib); /* do_queue_select(padapter, pattrib); */
pattrib->nr_frags = 1; pattrib->nr_frags = 1;
pattrib->encrypt = 0; pattrib->encrypt = 0;
pattrib->bswenc = false; pattrib->bswenc = false;
@ -340,14 +277,14 @@ void free_mp_priv(struct mp_priv *pmp_priv)
#if defined (CONFIG_RTL8192C) || defined (CONFIG_RTL8723A) #if defined (CONFIG_RTL8192C) || defined (CONFIG_RTL8723A)
#define PHY_IQCalibrate(a,b) rtl8192c_PHY_IQCalibrate(a,b) #define PHY_IQCalibrate(a,b) rtl8192c_PHY_IQCalibrate(a,b)
#define PHY_LCCalibrate(a) rtl8192c_PHY_LCCalibrate(a) #define PHY_LCCalibrate(a) rtl8192c_PHY_LCCalibrate(a)
//#define dm_CheckTXPowerTracking(a) rtl8192c_odm_CheckTXPowerTracking(a) /* define dm_CheckTXPowerTracking(a) rtl8192c_odm_CheckTXPowerTracking(a) */
#define PHY_SetRFPathSwitch(a,b) rtl8192c_PHY_SetRFPathSwitch(a,b) #define PHY_SetRFPathSwitch(a,b) rtl8192c_PHY_SetRFPathSwitch(a,b)
#endif #endif
#ifdef CONFIG_RTL8192D #ifdef CONFIG_RTL8192D
#define PHY_IQCalibrate(a,b) rtl8192d_PHY_IQCalibrate(a) #define PHY_IQCalibrate(a,b) rtl8192d_PHY_IQCalibrate(a)
#define PHY_LCCalibrate(a) rtl8192d_PHY_LCCalibrate(a) #define PHY_LCCalibrate(a) rtl8192d_PHY_LCCalibrate(a)
//#define dm_CheckTXPowerTracking(a) rtl8192d_odm_CheckTXPowerTracking(a) /* define dm_CheckTXPowerTracking(a) rtl8192d_odm_CheckTXPowerTracking(a) */
#define PHY_SetRFPathSwitch(a,b) rtl8192d_PHY_SetRFPathSwitch(a,b) #define PHY_SetRFPathSwitch(a,b) rtl8192d_PHY_SetRFPathSwitch(a,b)
#endif #endif
@ -368,18 +305,18 @@ MPT_InitializeAdapter(
PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx; PMPT_CONTEXT pMptCtx = &pAdapter->mppriv.MptCtx;
struct mlme_priv *pmlmepriv = &pAdapter->mlmepriv; struct mlme_priv *pmlmepriv = &pAdapter->mlmepriv;
//------------------------------------------------------------------------- /* */
// HW Initialization for 8190 MPT. /* HW Initialization for 8190 MPT. */
//------------------------------------------------------------------------- /* */
//------------------------------------------------------------------------- /* */
// SW Initialization for 8190 MP. /* SW Initialization for 8190 MP. */
//------------------------------------------------------------------------- /* */
pMptCtx->bMptDrvUnload = false; pMptCtx->bMptDrvUnload = false;
pMptCtx->bMassProdTest = false; pMptCtx->bMassProdTest = false;
pMptCtx->bMptIndexEven = true; //default gain index is -6.0db pMptCtx->bMptIndexEven = true; /* default gain index is -6.0db */
pMptCtx->h2cReqNum = 0x0; pMptCtx->h2cReqNum = 0x0;
/* Init mpt event. */ /* Init mpt event. */
//init for BT MP /* init for BT MP */
#ifdef CONFIG_RTL8723A #ifdef CONFIG_RTL8723A
pMptCtx->bMPh2c_timeout = false; pMptCtx->bMPh2c_timeout = false;
pMptCtx->MptH2cRspEvent = false; pMptCtx->MptH2cRspEvent = false;
@ -391,13 +328,13 @@ MPT_InitializeAdapter(
pMptCtx->bMptWorkItemInProgress = false; pMptCtx->bMptWorkItemInProgress = false;
pMptCtx->CurrMptAct = NULL; pMptCtx->CurrMptAct = NULL;
//------------------------------------------------------------------------- /* */
// Don't accept any packets /* Don't accept any packets */
rtw_write32(pAdapter, REG_RCR, 0); rtw_write32(pAdapter, REG_RCR, 0);
PHY_IQCalibrate(pAdapter, false); PHY_IQCalibrate(pAdapter, false);
dm_CheckTXPowerTracking(&pHalData->odmpriv); //trigger thermal meter dm_CheckTXPowerTracking(&pHalData->odmpriv); /* trigger thermal meter */
PHY_LCCalibrate(pAdapter); PHY_LCCalibrate(pAdapter);
pMptCtx->backup0xc50 = (u1Byte)PHY_QueryBBReg(pAdapter, rOFDM0_XAAGCCore1, bMaskByte0); pMptCtx->backup0xc50 = (u1Byte)PHY_QueryBBReg(pAdapter, rOFDM0_XAAGCCore1, bMaskByte0);
@ -406,7 +343,7 @@ MPT_InitializeAdapter(
pMptCtx->backup0x52_RF_A = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0); pMptCtx->backup0x52_RF_A = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0);
pMptCtx->backup0x52_RF_B = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0); pMptCtx->backup0x52_RF_B = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0);
//set ant to wifi side in mp mode /* set ant to wifi side in mp mode */
rtw_write16(pAdapter, 0x870, 0x300); rtw_write16(pAdapter, 0x870, 0x300);
rtw_write16(pAdapter, 0x860, 0x110); rtw_write16(pAdapter, 0x860, 0x110);
@ -486,8 +423,8 @@ static void disable_dm(PADAPTER padapter)
struct dm_priv *pdmpriv = &pHalData->dmpriv; struct dm_priv *pdmpriv = &pHalData->dmpriv;
//3 1. disable firmware dynamic mechanism /* 3 1. disable firmware dynamic mechanism */
// disable Power Training, Rate Adaptive /* disable Power Training, Rate Adaptive */
#ifdef CONFIG_RTL8723A #ifdef CONFIG_RTL8723A
SetBcnCtrlReg(padapter, 0, EN_BCN_FUNCTION); SetBcnCtrlReg(padapter, 0, EN_BCN_FUNCTION);
#else #else
@ -496,20 +433,20 @@ static void disable_dm(PADAPTER padapter)
rtw_write8(padapter, REG_BCN_CTRL, v8); rtw_write8(padapter, REG_BCN_CTRL, v8);
#endif #endif
//3 2. disable driver dynamic mechanism /* 3 2. disable driver dynamic mechanism */
// disable Dynamic Initial Gain /* disable Dynamic Initial Gain */
// disable High Power /* disable High Power */
// disable Power Tracking /* disable Power Tracking */
Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false); Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false);
// enable APK, LCK and IQK but disable power tracking /* enable APK, LCK and IQK but disable power tracking */
#ifndef CONFIG_RTL8188E #ifndef CONFIG_RTL8188E
pdmpriv->TxPowerTrackControl = false; pdmpriv->TxPowerTrackControl = false;
#endif #endif
Switch_DM_Func(padapter, DYNAMIC_RF_CALIBRATION, true); Switch_DM_Func(padapter, DYNAMIC_RF_CALIBRATION, true);
} }
//This function initializes the DUT to the MP test mode /* This function initializes the DUT to the MP test mode */
s32 mp_start_test(PADAPTER padapter) s32 mp_start_test(PADAPTER padapter)
{ {
WLAN_BSSID_EX bssid; WLAN_BSSID_EX bssid;
@ -525,15 +462,15 @@ s32 mp_start_test(PADAPTER padapter)
struct wlan_network *tgt_network = &pmlmepriv->cur_network; struct wlan_network *tgt_network = &pmlmepriv->cur_network;
padapter->registrypriv.mp_mode = 1; padapter->registrypriv.mp_mode = 1;
pmppriv->bSetTxPower=0; //for manually set tx power pmppriv->bSetTxPower=0; /* for manually set tx power */
//3 disable dynamic mechanism /* 3 disable dynamic mechanism */
disable_dm(padapter); disable_dm(padapter);
//3 0. update mp_priv /* 3 0. update mp_priv */
if (padapter->registrypriv.rf_config == RF_819X_MAX_TYPE) { if (padapter->registrypriv.rf_config == RF_819X_MAX_TYPE) {
// switch (phal->rf_type) { /* switch (phal->rf_type) { */
switch (GET_RF_TYPE(padapter)) { switch (GET_RF_TYPE(padapter)) {
case RF_1T1R: case RF_1T1R:
pmppriv->antenna_tx = ANTENNA_A; pmppriv->antenna_tx = ANTENNA_A;
@ -558,8 +495,8 @@ s32 mp_start_test(PADAPTER padapter)
mpt_ProStartTest(padapter); mpt_ProStartTest(padapter);
//3 1. initialize a new WLAN_BSSID_EX /* 3 1. initialize a new WLAN_BSSID_EX */
// _rtw_memset(&bssid, 0, sizeof(WLAN_BSSID_EX)); /* _rtw_memset(&bssid, 0, sizeof(WLAN_BSSID_EX)); */
_rtw_memcpy(bssid.MacAddress, pmppriv->network_macaddr, ETH_ALEN); _rtw_memcpy(bssid.MacAddress, pmppriv->network_macaddr, ETH_ALEN);
bssid.Ssid.SsidLength = strlen("mp_pseudo_adhoc"); bssid.Ssid.SsidLength = strlen("mp_pseudo_adhoc");
_rtw_memcpy(bssid.Ssid.Ssid, (u8*)"mp_pseudo_adhoc", bssid.Ssid.SsidLength); _rtw_memcpy(bssid.Ssid.Ssid, (u8*)"mp_pseudo_adhoc", bssid.Ssid.SsidLength);
@ -569,7 +506,7 @@ s32 mp_start_test(PADAPTER padapter)
length = get_WLAN_BSSID_EX_sz(&bssid); length = get_WLAN_BSSID_EX_sz(&bssid);
if (length % 4) if (length % 4)
bssid.Length = ((length >> 2) + 1) << 2; //round up to multiple of 4 bytes. bssid.Length = ((length >> 2) + 1) << 2; /* round up to multiple of 4 bytes. */
else else
bssid.Length = length; bssid.Length = length;
@ -578,7 +515,7 @@ s32 mp_start_test(PADAPTER padapter)
if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)
goto end_of_mp_start_test; goto end_of_mp_start_test;
//init mp_start_test status /* init mp_start_test status */
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
rtw_disassoc_cmd(padapter, 500, true); rtw_disassoc_cmd(padapter, 500, true);
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
@ -589,8 +526,8 @@ s32 mp_start_test(PADAPTER padapter)
pmlmepriv->fw_state = WIFI_MP_STATE; pmlmepriv->fw_state = WIFI_MP_STATE;
set_fwstate(pmlmepriv, _FW_UNDER_LINKING); set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
//3 2. create a new psta for mp driver /* 3 2. create a new psta for mp driver */
//clear psta in the cur_network, if any /* clear psta in the cur_network, if any */
psta = rtw_get_stainfo(&padapter->stapriv, tgt_network->network.MacAddress); psta = rtw_get_stainfo(&padapter->stapriv, tgt_network->network.MacAddress);
if (psta) rtw_free_stainfo(padapter, psta); if (psta) rtw_free_stainfo(padapter, psta);
@ -602,7 +539,7 @@ s32 mp_start_test(PADAPTER padapter)
goto end_of_mp_start_test; goto end_of_mp_start_test;
} }
//3 3. join psudo AdHoc /* 3 3. join psudo AdHoc */
tgt_network->join_res = 1; tgt_network->join_res = 1;
tgt_network->aid = psta->aid = 1; tgt_network->aid = psta->aid = 1;
_rtw_memcpy(&tgt_network->network, &bssid, length); _rtw_memcpy(&tgt_network->network, &bssid, length);
@ -616,31 +553,31 @@ end_of_mp_start_test:
if (res == _SUCCESS) if (res == _SUCCESS)
{ {
// set MSR to WIFI_FW_ADHOC_STATE /* set MSR to WIFI_FW_ADHOC_STATE */
#if !defined (CONFIG_RTL8712) #if !defined (CONFIG_RTL8712)
val8 = rtw_read8(padapter, MSR) & 0xFC; // 0x0102 val8 = rtw_read8(padapter, MSR) & 0xFC; /* 0x0102 */
val8 |= WIFI_FW_ADHOC_STATE; val8 |= WIFI_FW_ADHOC_STATE;
rtw_write8(padapter, MSR, val8); // Link in ad hoc network rtw_write8(padapter, MSR, val8); /* Link in ad hoc network */
#endif #endif
#if defined (CONFIG_RTL8712) #if defined (CONFIG_RTL8712)
rtw_write8(padapter, MSR, 1); // Link in ad hoc network rtw_write8(padapter, MSR, 1); /* Link in ad hoc network */
rtw_write8(padapter, RCR, 0); // RCR : disable all pkt, 0x10250048 rtw_write8(padapter, RCR, 0); /* RCR : disable all pkt, 0x10250048 */
rtw_write8(padapter, RCR+2, 0x57); // RCR disable Check BSSID, 0x1025004a rtw_write8(padapter, RCR+2, 0x57); /* RCR disable Check BSSID, 0x1025004a */
// disable RX filter map , mgt frames will put in RX FIFO 0 /* disable RX filter map , mgt frames will put in RX FIFO 0 */
rtw_write16(padapter, RXFLTMAP0, 0x0); // 0x10250116 rtw_write16(padapter, RXFLTMAP0, 0x0); /* 0x10250116 */
val8 = rtw_read8(padapter, EE_9346CR); // 0x1025000A val8 = rtw_read8(padapter, EE_9346CR); /* 0x1025000A */
if (!(val8 & _9356SEL))//boot from EFUSE if (!(val8 & _9356SEL))/* boot from EFUSE */
efuse_change_max_size(padapter); efuse_change_max_size(padapter);
#endif #endif
} }
return res; return res;
} }
//------------------------------------------------------------------------------ /* */
//This function change the DUT from the MP test mode into normal mode /* This function change the DUT from the MP test mode into normal mode */
void mp_stop_test(PADAPTER padapter) void mp_stop_test(PADAPTER padapter)
{ {
struct mp_priv *pmppriv = &padapter->mppriv; struct mp_priv *pmppriv = &padapter->mppriv;
@ -657,18 +594,18 @@ void mp_stop_test(PADAPTER padapter)
if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false) if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false)
goto end_of_mp_stop_test; goto end_of_mp_stop_test;
//3 1. disconnect psudo AdHoc /* 3 1. disconnect psudo AdHoc */
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
//3 2. clear psta used in mp test mode. /* 3 2. clear psta used in mp test mode. */
// rtw_free_assoc_resources(padapter, 1); /* rtw_free_assoc_resources(padapter, 1); */
psta = rtw_get_stainfo(&padapter->stapriv, tgt_network->network.MacAddress); psta = rtw_get_stainfo(&padapter->stapriv, tgt_network->network.MacAddress);
if (psta) rtw_free_stainfo(padapter, psta); if (psta) rtw_free_stainfo(padapter, psta);
//3 3. return to normal state (default:station mode) /* 3 3. return to normal state (default:station mode) */
pmlmepriv->fw_state = pmppriv->prev_fw_state; // WIFI_STATION_STATE; pmlmepriv->fw_state = pmppriv->prev_fw_state; /* WIFI_STATION_STATE; */
//flush the cur_network /* flush the cur_network */
_rtw_memset(tgt_network, 0, sizeof(struct wlan_network)); _rtw_memset(tgt_network, 0, sizeof(struct wlan_network));
_clr_fwstate_(pmlmepriv, WIFI_MP_STATE); _clr_fwstate_(pmlmepriv, WIFI_MP_STATE);
@ -870,7 +807,7 @@ void PhySetTxPowerLevel(PADAPTER pAdapter)
{ {
struct mp_priv *pmp_priv = &pAdapter->mppriv; struct mp_priv *pmp_priv = &pAdapter->mppriv;
if (pmp_priv->bSetTxPower==0) // for NO manually set power index if (pmp_priv->bSetTxPower==0) /* for NO manually set power index */
{ {
#ifdef CONFIG_RTL8188E #ifdef CONFIG_RTL8188E
PHY_SetTxPowerLevel8188E(pAdapter,pmp_priv->channel); PHY_SetTxPowerLevel8188E(pAdapter,pmp_priv->channel);
@ -882,7 +819,7 @@ void PhySetTxPowerLevel(PADAPTER pAdapter)
} }
} }
//------------------------------------------------------------------------------ /* */
static void dump_mpframe(PADAPTER padapter, struct xmit_frame *pmpframe) static void dump_mpframe(PADAPTER padapter, struct xmit_frame *pmpframe)
{ {
rtw_hal_mgnt_xmit(padapter, pmpframe); rtw_hal_mgnt_xmit(padapter, pmpframe);
@ -931,7 +868,7 @@ static thread_return mp_xmit_packet_thread(thread_context context)
thread_enter("RTW_MP_THREAD"); thread_enter("RTW_MP_THREAD");
//DBG_88E("%s:pkTx Start\n", __func__); /* DBG_88E("%s:pkTx Start\n", __func__); */
while (1) { while (1) {
pxmitframe = alloc_mp_xmitframe(pxmitpriv); pxmitframe = alloc_mp_xmitframe(pxmitpriv);
if (pxmitframe == NULL) { if (pxmitframe == NULL) {
@ -966,7 +903,7 @@ static thread_return mp_xmit_packet_thread(thread_context context)
} }
exit: exit:
//DBG_88E("%s:pkTx Exit\n", __func__); /* DBG_88E("%s:pkTx Exit\n", __func__); */
rtw_mfree(pmptx->pallocated_buf, pmptx->buf_size); rtw_mfree(pmptx->pallocated_buf, pmptx->buf_size);
pmptx->pallocated_buf = NULL; pmptx->pallocated_buf = NULL;
pmptx->stop = 1; pmptx->stop = 1;
@ -998,7 +935,7 @@ void SetPacketTx(PADAPTER padapter)
pmp_priv->tx.stop = 0; pmp_priv->tx.stop = 0;
pmp_priv->tx_pktcount = 0; pmp_priv->tx_pktcount = 0;
//3 1. update_attrib() /* 3 1. update_attrib() */
pattrib = &pmp_priv->tx.attrib; pattrib = &pmp_priv->tx.attrib;
_rtw_memcpy(pattrib->src, padapter->eeprompriv.mac_addr, ETH_ALEN); _rtw_memcpy(pattrib->src, padapter->eeprompriv.mac_addr, ETH_ALEN);
_rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN); _rtw_memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
@ -1014,7 +951,7 @@ void SetPacketTx(PADAPTER padapter)
pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->pktlen; pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->pktlen;
//3 2. allocate xmit buffer /* 3 2. allocate xmit buffer */
pkt_size = pattrib->last_txcmdsz; pkt_size = pattrib->last_txcmdsz;
if (pmp_priv->tx.pallocated_buf) if (pmp_priv->tx.pallocated_buf)
@ -1034,41 +971,37 @@ void SetPacketTx(PADAPTER padapter)
pkt_start = ptr; pkt_start = ptr;
pkt_end = pkt_start + pkt_size; pkt_end = pkt_start + pkt_size;
//3 3. init TX descriptor /* 3 3. init TX descriptor */
// offset 0 /* offset 0 */
#if defined(CONFIG_RTL8188E) && !defined(CONFIG_RTL8188E_SDIO) #if defined(CONFIG_RTL8188E) && !defined(CONFIG_RTL8188E_SDIO)
desc->txdw0 |= cpu_to_le32(OWN | FSG | LSG); desc->txdw0 |= cpu_to_le32(OWN | FSG | LSG);
desc->txdw0 |= cpu_to_le32(pkt_size & 0x0000FFFF); // packet size desc->txdw0 |= cpu_to_le32(pkt_size & 0x0000FFFF); /* packet size */
desc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ) << OFFSET_SHT) & 0x00FF0000); //32 bytes for TX Desc desc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ) << OFFSET_SHT) & 0x00FF0000); /* 32 bytes for TX Desc */
if (bmcast) desc->txdw0 |= cpu_to_le32(BMC); // broadcast packet if (bmcast) desc->txdw0 |= cpu_to_le32(BMC); /* broadcast packet */
desc->txdw1 |= cpu_to_le32((0x01 << 26) & 0xff000000); desc->txdw1 |= cpu_to_le32((0x01 << 26) & 0xff000000);
#endif #endif
// offset 4 /* offset 4 */
#ifndef CONFIG_RTL8188E #ifndef CONFIG_RTL8188E
desc->txdw1 |= cpu_to_le32(BK); // don't aggregate(AMPDU) desc->txdw1 |= cpu_to_le32(BK); /* don't aggregate(AMPDU) */
desc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x1F); //CAM_ID(MAC_ID) desc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x1F); /* CAM_ID(MAC_ID) */
#else #else
desc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x3F); //CAM_ID(MAC_ID) desc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x3F); /* CAM_ID(MAC_ID) */
#endif #endif
desc->txdw1 |= cpu_to_le32((pattrib->qsel << QSEL_SHT) & 0x00001F00); // Queue Select, TID desc->txdw1 |= cpu_to_le32((pattrib->qsel << QSEL_SHT) & 0x00001F00); /* Queue Select, TID */
#ifdef CONFIG_RTL8188E #ifdef CONFIG_RTL8188E
desc->txdw1 |= cpu_to_le32((pattrib->raid << RATE_ID_SHT) & 0x000F0000); // Rate Adaptive ID desc->txdw1 |= cpu_to_le32((pattrib->raid << RATE_ID_SHT) & 0x000F0000); /* Rate Adaptive ID */
#else #else
desc->txdw1 |= cpu_to_le32((pattrib->raid << Rate_ID_SHT) & 0x000F0000); // Rate Adaptive ID desc->txdw1 |= cpu_to_le32((pattrib->raid << Rate_ID_SHT) & 0x000F0000); /* Rate Adaptive ID */
#endif #endif
// offset 8 /* offset 8 */
// desc->txdw2 |= cpu_to_le32(AGG_BK);//AGG BK /* offset 12 */
// offset 12
desc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0x0fff0000); desc->txdw3 |= cpu_to_le32((pattrib->seqnum<<16)&0x0fff0000);
// desc->txdw3 |= cpu_to_le32((pattrib->seqnum & 0xFFF) << SEQ_SHT);
//desc->txdw3 |= cpu_to_le32((pattrib->seqnum << SEQ_SHT) & 0xffff0000);
// offset 16 /* offset 16 */
//desc->txdw4 |= cpu_to_le32(QoS)
#ifdef CONFIG_RTL8188E #ifdef CONFIG_RTL8188E
desc->txdw4 |= cpu_to_le32(HW_SSN); desc->txdw4 |= cpu_to_le32(HW_SSN);
#else #else
@ -1079,33 +1012,33 @@ void SetPacketTx(PADAPTER padapter)
if ( pmp_priv->preamble ){ if ( pmp_priv->preamble ){
if (pmp_priv->rateidx <= MPT_RATE_54M) if (pmp_priv->rateidx <= MPT_RATE_54M)
desc->txdw4 |= cpu_to_le32(DATA_SHORT); // CCK Short Preamble desc->txdw4 |= cpu_to_le32(DATA_SHORT); /* CCK Short Preamble */
} }
if (pmp_priv->bandwidth == HT_CHANNEL_WIDTH_40) if (pmp_priv->bandwidth == HT_CHANNEL_WIDTH_40)
desc->txdw4 |= cpu_to_le32(DATA_BW); desc->txdw4 |= cpu_to_le32(DATA_BW);
// offset 20 /* offset 20 */
desc->txdw5 |= cpu_to_le32(pmp_priv->rateidx & 0x0000001F); desc->txdw5 |= cpu_to_le32(pmp_priv->rateidx & 0x0000001F);
if ( pmp_priv->preamble ){ if ( pmp_priv->preamble ){
if (pmp_priv->rateidx > MPT_RATE_54M) if (pmp_priv->rateidx > MPT_RATE_54M)
desc->txdw5 |= cpu_to_le32(SGI); // MCS Short Guard Interval desc->txdw5 |= cpu_to_le32(SGI); /* MCS Short Guard Interval */
} }
#ifdef CONFIG_RTL8188E #ifdef CONFIG_RTL8188E
desc->txdw5 |= cpu_to_le32(RTY_LMT_EN); // retry limit enable desc->txdw5 |= cpu_to_le32(RTY_LMT_EN); /* retry limit enable */
desc->txdw5 |= cpu_to_le32(0x00180000); // DATA/RTS Rate Fallback Limit desc->txdw5 |= cpu_to_le32(0x00180000); /* DATA/RTS Rate Fallback Limit */
#else #else
desc->txdw5 |= cpu_to_le32(0x0001FF00); // DATA/RTS Rate Fallback Limit desc->txdw5 |= cpu_to_le32(0x0001FF00); /* DATA/RTS Rate Fallback Limit */
#endif #endif
//3 4. make wlan header, make_wlanhdr() /* 3 4. make wlan header, make_wlanhdr() */
hdr = (struct rtw_ieee80211_hdr *)pkt_start; hdr = (struct rtw_ieee80211_hdr *)pkt_start;
SetFrameSubType(&hdr->frame_ctl, pattrib->subtype); SetFrameSubType(&hdr->frame_ctl, pattrib->subtype);
_rtw_memcpy(hdr->addr1, pattrib->dst, ETH_ALEN); // DA _rtw_memcpy(hdr->addr1, pattrib->dst, ETH_ALEN); /* DA */
_rtw_memcpy(hdr->addr2, pattrib->src, ETH_ALEN); // SA _rtw_memcpy(hdr->addr2, pattrib->src, ETH_ALEN); /* SA */
_rtw_memcpy(hdr->addr3, get_bssid(&padapter->mlmepriv), ETH_ALEN); // RA, BSSID _rtw_memcpy(hdr->addr3, get_bssid(&padapter->mlmepriv), ETH_ALEN); /* RA, BSSID */
//3 5. make payload /* 3 5. make payload */
ptr = pkt_start + pattrib->hdrlen; ptr = pkt_start + pattrib->hdrlen;
switch (pmp_priv->tx.payload) { switch (pmp_priv->tx.payload) {
@ -1128,7 +1061,7 @@ void SetPacketTx(PADAPTER padapter)
_rtw_memset(ptr, payload, pkt_end - ptr); _rtw_memset(ptr, payload, pkt_end - ptr);
//3 6. start thread /* 3 6. start thread */
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
pmp_priv->tx.PktTxThread = kthread_run(mp_xmit_packet_thread, pmp_priv, "RTW_MP_THREAD"); pmp_priv->tx.PktTxThread = kthread_run(mp_xmit_packet_thread, pmp_priv, "RTW_MP_THREAD");
if (IS_ERR(pmp_priv->tx.PktTxThread)) if (IS_ERR(pmp_priv->tx.PktTxThread))
@ -1153,16 +1086,16 @@ void SetPacketRx(PADAPTER pAdapter, u8 bStartRx)
if (bStartRx) if (bStartRx)
{ {
// Accept CRC error and destination address /* Accept CRC error and destination address */
#if 1 #if 1
//ndef CONFIG_RTL8723A /* ndef CONFIG_RTL8723A */
pHalData->ReceiveConfig = AAP | APM | AM | AB | APP_ICV | ADF | AMF | HTC_LOC_CTRL | APP_MIC | APP_PHYSTS; pHalData->ReceiveConfig = AAP | APM | AM | AB | APP_ICV | ADF | AMF | HTC_LOC_CTRL | APP_MIC | APP_PHYSTS;
pHalData->ReceiveConfig |= ACRC32; pHalData->ReceiveConfig |= ACRC32;
rtw_write32(pAdapter, REG_RCR, pHalData->ReceiveConfig); rtw_write32(pAdapter, REG_RCR, pHalData->ReceiveConfig);
// Accept all data frames /* Accept all data frames */
rtw_write16(pAdapter, REG_RXFLTMAP2, 0xFFFF); rtw_write16(pAdapter, REG_RXFLTMAP2, 0xFFFF);
#else #else
rtw_write32(pAdapter, REG_RCR, 0x70000101); rtw_write32(pAdapter, REG_RCR, 0x70000101);
@ -1180,21 +1113,21 @@ void ResetPhyRxPktCount(PADAPTER pAdapter)
for (i = 0; i <= 0xF; i++) { for (i = 0; i <= 0xF; i++) {
phyrx_set = 0; phyrx_set = 0;
phyrx_set |= _RXERR_RPT_SEL(i); //select phyrx_set |= _RXERR_RPT_SEL(i); /* select */
phyrx_set |= RXERR_RPT_RST; // set counter to zero phyrx_set |= RXERR_RPT_RST; /* set counter to zero */
rtw_write32(pAdapter, REG_RXERR_RPT, phyrx_set); rtw_write32(pAdapter, REG_RXERR_RPT, phyrx_set);
} }
} }
static u32 GetPhyRxPktCounts(PADAPTER pAdapter, u32 selbit) static u32 GetPhyRxPktCounts(PADAPTER pAdapter, u32 selbit)
{ {
//selection /* selection */
u32 phyrx_set = 0, count = 0; u32 phyrx_set = 0, count = 0;
phyrx_set = _RXERR_RPT_SEL(selbit & 0xF); phyrx_set = _RXERR_RPT_SEL(selbit & 0xF);
rtw_write32(pAdapter, REG_RXERR_RPT, phyrx_set); rtw_write32(pAdapter, REG_RXERR_RPT, phyrx_set);
//Read packet count /* Read packet count */
count = rtw_read32(pAdapter, REG_RXERR_RPT) & RXERR_COUNTER_MASK; count = rtw_read32(pAdapter, REG_RXERR_RPT) & RXERR_COUNTER_MASK;
return count; return count;
@ -1222,9 +1155,9 @@ u32 GetPhyRxPktCRC32Error(PADAPTER pAdapter)
return OFDM_cnt + CCK_cnt + HT_cnt; return OFDM_cnt + CCK_cnt + HT_cnt;
} }
//reg 0x808[9:0]: FFT data x /* reg 0x808[9:0]: FFT data x */
//reg 0x808[22]: 0 --> 1 to get 1 FFT data y /* reg 0x808[22]: 0 --> 1 to get 1 FFT data y */
//reg 0x8B4[15:0]: FFT data y report /* reg 0x8B4[15:0]: FFT data y report */
static u32 rtw_GetPSDData(PADAPTER pAdapter, u32 point) static u32 rtw_GetPSDData(PADAPTER pAdapter, u32 point)
{ {
int psd_val; int psd_val;
@ -1273,7 +1206,7 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
return 0; return 0;
} }
if (strlen(data) == 0) { //default value if (strlen(data) == 0) { /* default value */
psd_pts = 128; psd_pts = 128;
psd_start = 64; psd_start = 64;
psd_stop = 128; psd_stop = 128;
@ -1349,7 +1282,7 @@ void _rtw_mp_xmit_priv (struct xmit_priv *pxmitpriv)
num_xmit_extbuf = NR_XMIT_EXTBUFF; num_xmit_extbuf = NR_XMIT_EXTBUFF;
} }
// Init xmit extension buff /* Init xmit extension buff */
_rtw_init_queue(&pxmitpriv->free_xmit_extbuf_queue); _rtw_init_queue(&pxmitpriv->free_xmit_extbuf_queue);
pxmitpriv->pallocated_xmit_extbuf = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_buf) + 4); pxmitpriv->pallocated_xmit_extbuf = rtw_zvmalloc(num_xmit_extbuf * sizeof(struct xmit_buf) + 4);

View file

@ -24,11 +24,11 @@
#include <drv_types.h> #include <drv_types.h>
#include <mlme_osdep.h> #include <mlme_osdep.h>
//#include <rtw_mp.h> /* include <rtw_mp.h> */
#include <rtw_mp_ioctl.h> #include <rtw_mp_ioctl.h>
//**************** oid_rtl_seg_81_85 section start **************** /* oid_rtl_seg_81_85 section start **************** */
NDIS_STATUS oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv)
{ {
NDIS_STATUS status = NDIS_STATUS_SUCCESS; NDIS_STATUS status = NDIS_STATUS_SUCCESS;
@ -53,7 +53,7 @@ _func_exit_;
return status; return status;
} }
//**************** oid_rtl_seg_81_87_80 section start **************** /* oid_rtl_seg_81_87_80 section start **************** */
NDIS_STATUS oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_write_bb_reg_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -77,7 +77,7 @@ _func_enter_;
pbbreg = (struct bb_reg_param *)(poid_par_priv->information_buf); pbbreg = (struct bb_reg_param *)(poid_par_priv->information_buf);
offset = (u16)(pbbreg->offset) & 0xFFF; //0ffset :0x800~0xfff offset = (u16)(pbbreg->offset) & 0xFFF; /* 0ffset :0x800~0xfff */
if (offset < BB_REG_BASE_ADDR) offset |= BB_REG_BASE_ADDR; if (offset < BB_REG_BASE_ADDR) offset |= BB_REG_BASE_ADDR;
value = pbbreg->value; value = pbbreg->value;
@ -94,7 +94,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_read_bb_reg_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -118,7 +118,7 @@ _func_enter_;
pbbreg = (struct bb_reg_param *)(poid_par_priv->information_buf); pbbreg = (struct bb_reg_param *)(poid_par_priv->information_buf);
offset = (u16)(pbbreg->offset) & 0xFFF; //0ffset :0x800~0xfff offset = (u16)(pbbreg->offset) & 0xFFF; /* 0ffset :0x800~0xfff */
if (offset < BB_REG_BASE_ADDR) offset |= BB_REG_BASE_ADDR; if (offset < BB_REG_BASE_ADDR) offset |= BB_REG_BASE_ADDR;
_irqlevel_changed_(&oldirql, LOWER); _irqlevel_changed_(&oldirql, LOWER);
@ -135,7 +135,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_write_rf_reg_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -183,7 +183,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_read_rf_reg_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -232,17 +232,17 @@ _func_exit_;
return status; return status;
} }
//**************** oid_rtl_seg_81_87_00 section end**************** /* oid_rtl_seg_81_87_00 section end**************** */
//------------------------------------------------------------------------------ /* */
//**************** oid_rtl_seg_81_80_00 section start **************** /* oid_rtl_seg_81_80_00 section start **************** */
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_set_data_rate_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_set_data_rate_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
_irqL oldirql; _irqL oldirql;
#endif #endif
u32 ratevalue;//4 u32 ratevalue;/* 4 */
NDIS_STATUS status = NDIS_STATUS_SUCCESS; NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context); PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
@ -257,7 +257,7 @@ _func_enter_;
if (poid_par_priv->information_buf_len != sizeof(u32)) if (poid_par_priv->information_buf_len != sizeof(u32))
return NDIS_STATUS_INVALID_LENGTH; return NDIS_STATUS_INVALID_LENGTH;
ratevalue = *((u32*)poid_par_priv->information_buf);//4 ratevalue = *((u32*)poid_par_priv->information_buf);/* 4 */
RT_TRACE(_module_mp_, _drv_notice_, RT_TRACE(_module_mp_, _drv_notice_,
("oid_rt_pro_set_data_rate_hdl: data rate idx=%d\n", ratevalue)); ("oid_rt_pro_set_data_rate_hdl: data rate idx=%d\n", ratevalue));
if (ratevalue >= MPT_RATE_LAST) if (ratevalue >= MPT_RATE_LAST)
@ -273,7 +273,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -295,10 +295,10 @@ _func_enter_;
_irqlevel_changed_(&oldirql, LOWER); _irqlevel_changed_(&oldirql, LOWER);
//IQCalibrateBcut(Adapter); /* IQCalibrateBcut(Adapter); */
mode = *((u32*)poid_par_priv->information_buf); mode = *((u32*)poid_par_priv->information_buf);
Adapter->mppriv.mode = mode;// 1 for loopback Adapter->mppriv.mode = mode;/* 1 for loopback */
if (mp_start_test(Adapter) == _FAIL) { if (mp_start_test(Adapter) == _FAIL) {
status = NDIS_STATUS_NOT_ACCEPTED; status = NDIS_STATUS_NOT_ACCEPTED;
@ -314,7 +314,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_stop_test_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_stop_test_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -340,7 +340,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_set_channel_direct_call_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_set_channel_direct_call_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -379,7 +379,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_set_bandwidth_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_set_bandwidth_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -401,7 +401,7 @@ _func_enter_;
if (poid_par_priv->information_buf_len < sizeof(u32)) if (poid_par_priv->information_buf_len < sizeof(u32))
return NDIS_STATUS_INVALID_LENGTH; return NDIS_STATUS_INVALID_LENGTH;
bandwidth = *((u32*)poid_par_priv->information_buf);//4 bandwidth = *((u32*)poid_par_priv->information_buf);/* 4 */
channel_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; channel_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
if (bandwidth != HT_CHANNEL_WIDTH_40) if (bandwidth != HT_CHANNEL_WIDTH_40)
@ -421,7 +421,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_set_antenna_bb_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_set_antenna_bb_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -499,9 +499,9 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
//**************** oid_rtl_seg_81_80_20 section start **************** /* oid_rtl_seg_81_80_20 section start **************** */
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_query_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_query_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv)
{ {
NDIS_STATUS status = NDIS_STATUS_SUCCESS; NDIS_STATUS status = NDIS_STATUS_SUCCESS;
@ -525,7 +525,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_query_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_query_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv)
{ {
NDIS_STATUS status = NDIS_STATUS_SUCCESS; NDIS_STATUS status = NDIS_STATUS_SUCCESS;
@ -550,7 +550,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_query_rx_packet_crc32_error_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_query_rx_packet_crc32_error_hdl(struct oid_par_priv *poid_par_priv)
{ {
NDIS_STATUS status = NDIS_STATUS_SUCCESS; NDIS_STATUS status = NDIS_STATUS_SUCCESS;
@ -575,7 +575,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_reset_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_reset_tx_packet_sent_hdl(struct oid_par_priv *poid_par_priv)
{ {
@ -596,7 +596,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_reset_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_reset_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv)
{ {
NDIS_STATUS status = NDIS_STATUS_SUCCESS; NDIS_STATUS status = NDIS_STATUS_SUCCESS;
@ -621,7 +621,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_reset_phy_rx_packet_count_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_reset_phy_rx_packet_count_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -645,7 +645,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_get_phy_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_get_phy_rx_packet_received_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -676,7 +676,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_get_phy_rx_packet_crc32_error_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_get_phy_rx_packet_crc32_error_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -708,7 +708,7 @@ _func_exit_;
return status; return status;
} }
//**************** oid_rtl_seg_81_80_20 section end **************** /* oid_rtl_seg_81_80_20 section end **************** */
NDIS_STATUS oid_rt_pro_set_continuous_tx_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_set_continuous_tx_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -876,13 +876,13 @@ _func_exit_;
return status; return status;
} }
//**************** oid_rtl_seg_81_80_00 section end **************** /* oid_rtl_seg_81_80_00 section end **************** */
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro8711_join_bss_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro8711_join_bss_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_read_register_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -934,7 +934,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_write_register_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -997,69 +997,69 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_burst_read_register_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_burst_read_register_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_burst_write_register_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_burst_write_register_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_write_txcmd_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_write_txcmd_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_read16_eeprom_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_read16_eeprom_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_write16_eeprom_hdl (struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_write16_eeprom_hdl (struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro8711_wi_poll_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro8711_wi_poll_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro8711_pkt_loss_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro8711_pkt_loss_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_rd_attrib_mem_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_rd_attrib_mem_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_wr_attrib_mem_hdl (struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_wr_attrib_mem_hdl (struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_set_rf_intfs_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_set_rf_intfs_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_poll_rx_status_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_poll_rx_status_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_cfg_debug_message_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_cfg_debug_message_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_set_data_rate_ex_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_set_data_rate_ex_hdl(struct oid_par_priv *poid_par_priv)
{ {
PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context); PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
@ -1087,7 +1087,7 @@ _func_exit_;
return status; return status;
} }
//----------------------------------------------------------------------------- /* */
NDIS_STATUS oid_rt_get_thermal_meter_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_get_thermal_meter_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -1118,12 +1118,12 @@ _func_exit_;
return status; return status;
} }
//----------------------------------------------------------------------------- /* */
NDIS_STATUS oid_rt_pro_read_tssi_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_read_tssi_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_set_power_tracking_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_set_power_tracking_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -1156,54 +1156,54 @@ _func_exit_;
return status; return status;
} }
//----------------------------------------------------------------------------- /* */
NDIS_STATUS oid_rt_pro_set_basic_rate_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_set_basic_rate_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_qry_pwrstate_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_qry_pwrstate_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_set_pwrstate_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_set_pwrstate_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_h2c_set_rate_table_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_h2c_set_rate_table_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_h2c_get_rate_table_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_h2c_get_rate_table_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//**************** oid_rtl_seg_87_12_00 section start **************** /* oid_rtl_seg_87_12_00 section start **************** */
NDIS_STATUS oid_rt_pro_encryption_ctrl_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_encryption_ctrl_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_add_sta_info_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_dele_sta_info_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;
} }
//------------------------------------------------------------------------------ /* */
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_rx_packet_type_hdl(struct oid_par_priv *poid_par_priv)
{ {
return NDIS_STATUS_SUCCESS; return NDIS_STATUS_SUCCESS;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -1251,7 +1251,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -1294,7 +1294,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_rw_efuse_pgpkt_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_rw_efuse_pgpkt_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -1306,7 +1306,7 @@ NDIS_STATUS oid_rt_pro_rw_efuse_pgpkt_hdl(struct oid_par_priv *poid_par_priv)
_func_enter_; _func_enter_;
// RT_TRACE(_module_mp_, _drv_info_, ("+oid_rt_pro_rw_efuse_pgpkt_hdl\n")); /* RT_TRACE(_module_mp_, _drv_info_, ("+oid_rt_pro_rw_efuse_pgpkt_hdl\n")); */
*poid_par_priv->bytes_rw = 0; *poid_par_priv->bytes_rw = 0;
@ -1351,7 +1351,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_get_efuse_current_size_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_get_efuse_current_size_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -1383,7 +1383,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_get_efuse_max_size_hdl(struct oid_par_priv *poid_par_priv)
{ {
NDIS_STATUS status = NDIS_STATUS_SUCCESS; NDIS_STATUS status = NDIS_STATUS_SUCCESS;
@ -1408,7 +1408,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_efuse_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_efuse_hdl(struct oid_par_priv *poid_par_priv)
{ {
NDIS_STATUS status; NDIS_STATUS status;
@ -1428,7 +1428,7 @@ _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv)
{ {
#ifdef PLATFORM_OS_XP #ifdef PLATFORM_OS_XP
@ -1467,7 +1467,7 @@ _func_enter_;
status = NDIS_STATUS_FAILURE; status = NDIS_STATUS_FAILURE;
} }
} else { } else {
// SET_OID /* SET_OID */
RT_TRACE(_module_mp_, _drv_info_, RT_TRACE(_module_mp_, _drv_info_,
("oid_rt_pro_efuse_map_hdl: WRITE\n")); ("oid_rt_pro_efuse_map_hdl: WRITE\n"));
@ -1514,7 +1514,7 @@ _func_enter_;
if (poid_par_priv->information_buf_len < sizeof(u8)) if (poid_par_priv->information_buf_len < sizeof(u8))
return NDIS_STATUS_INVALID_LENGTH; return NDIS_STATUS_INVALID_LENGTH;
rx_pkt_type = *((u8*)poid_par_priv->information_buf);//4 rx_pkt_type = *((u8*)poid_par_priv->information_buf);/* 4 */
RT_TRACE(_module_mp_, _drv_info_, ("rx_pkt_type: %x\n",rx_pkt_type )); RT_TRACE(_module_mp_, _drv_info_, ("rx_pkt_type: %x\n",rx_pkt_type ));
_func_exit_; _func_exit_;
@ -1566,7 +1566,7 @@ unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv)
return NDIS_STATUS_SUCCESS; return NDIS_STATUS_SUCCESS;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_set_power_down_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_set_power_down_hdl(struct oid_par_priv *poid_par_priv)
{ {
NDIS_STATUS status = NDIS_STATUS_SUCCESS; NDIS_STATUS status = NDIS_STATUS_SUCCESS;
@ -1583,14 +1583,14 @@ _func_enter_;
_irqlevel_changed_(&oldirql, LOWER); _irqlevel_changed_(&oldirql, LOWER);
//CALL the power_down function /* CALL the power_down function */
_irqlevel_changed_(&oldirql, RAISE); _irqlevel_changed_(&oldirql, RAISE);
_func_exit_; _func_exit_;
return status; return status;
} }
//------------------------------------------------------------------------------ /* */
NDIS_STATUS oid_rt_get_power_mode_hdl(struct oid_par_priv *poid_par_priv) NDIS_STATUS oid_rt_get_power_mode_hdl(struct oid_par_priv *poid_par_priv)
{ {
return 0; return 0;

File diff suppressed because it is too large Load diff

View file

@ -53,7 +53,7 @@ void ips_enter(_adapter * padapter)
pwrpriv->bips_processing = true; pwrpriv->bips_processing = true;
// syn ips_mode with request /* syn ips_mode with request */
pwrpriv->ips_mode = pwrpriv->ips_mode_req; pwrpriv->ips_mode = pwrpriv->ips_mode_req;
pwrpriv->ips_enter_cnts++; pwrpriv->ips_enter_cnts++;
@ -149,7 +149,7 @@ static bool rtw_pwr_unassociated_idle(_adapter *adapter)
bool ret = false; bool ret = false;
if (adapter->pwrctrlpriv.ips_deny_time >= rtw_get_current_time()) { if (adapter->pwrctrlpriv.ips_deny_time >= rtw_get_current_time()) {
//DBG_88E("%s ips_deny_time\n", __func__); /* DBG_88E("%s ips_deny_time\n", __func__); */
goto exit; goto exit;
} }
@ -200,12 +200,12 @@ void rtw_ps_processor(_adapter*padapter)
{ {
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
#endif //CONFIG_P2P #endif /* CONFIG_P2P */
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
#ifdef SUPPORT_HW_RFOFF_DETECTED #ifdef SUPPORT_HW_RFOFF_DETECTED
rt_rf_power_state rfpwrstate; rt_rf_power_state rfpwrstate;
#endif //SUPPORT_HW_RFOFF_DETECTED #endif /* SUPPORT_HW_RFOFF_DETECTED */
pwrpriv->ps_processing = true; pwrpriv->ps_processing = true;
@ -213,7 +213,7 @@ void rtw_ps_processor(_adapter*padapter)
if (pwrpriv->bips_processing == true) if (pwrpriv->bips_processing == true)
goto exit; goto exit;
//DBG_88E("==> fw report state(0x%x)\n",rtw_read8(padapter,0x1ca)); /* DBG_88E("==> fw report state(0x%x)\n",rtw_read8(padapter,0x1ca)); */
if (padapter->pwrctrlpriv.bHWPwrPindetect) if (padapter->pwrctrlpriv.bHWPwrPindetect)
{ {
#ifdef CONFIG_AUTOSUSPEND #ifdef CONFIG_AUTOSUSPEND
@ -241,7 +241,7 @@ void rtw_ps_processor(_adapter*padapter)
} }
} }
else else
#endif //CONFIG_AUTOSUSPEND #endif /* CONFIG_AUTOSUSPEND */
{ {
rfpwrstate = RfOnOffDetect(padapter); rfpwrstate = RfOnOffDetect(padapter);
DBG_88E("@@@@- #2 %s==> rfstate:%s\n",__func__,(rfpwrstate==rf_on)?"rf_on":"rf_off"); DBG_88E("@@@@- #2 %s==> rfstate:%s\n",__func__,(rfpwrstate==rf_on)?"rf_on":"rf_off");
@ -265,7 +265,7 @@ void rtw_ps_processor(_adapter*padapter)
} }
pwrpriv->pwr_state_check_cnts ++; pwrpriv->pwr_state_check_cnts ++;
} }
#endif //SUPPORT_HW_RFOFF_DETECTED #endif /* SUPPORT_HW_RFOFF_DETECTED */
if (pwrpriv->ips_mode_req == IPS_NONE if (pwrpriv->ips_mode_req == IPS_NONE
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
@ -305,17 +305,17 @@ void rtw_ps_processor(_adapter*padapter)
#else #else
padapter->bCardDisableWOHSM = true; padapter->bCardDisableWOHSM = true;
autosuspend_enter(padapter); autosuspend_enter(padapter);
#endif //if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) #endif /* if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) */
} }
else if (pwrpriv->bHWPwrPindetect) else if (pwrpriv->bHWPwrPindetect)
{ {
} }
else else
#endif //CONFIG_AUTOSUSPEND #endif /* CONFIG_AUTOSUSPEND */
{ {
#if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) #if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND)
pwrpriv->change_rfpwrstate = rf_off; pwrpriv->change_rfpwrstate = rf_off;
#endif //defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) #endif /* defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) */
#ifdef CONFIG_IPS #ifdef CONFIG_IPS
ips_enter(padapter); ips_enter(padapter);
@ -368,7 +368,7 @@ _func_enter_;
DBG_88E("%s: RPWM timeout, force to set RPWM(0x%02X) again!\n", __func__, pslv); DBG_88E("%s: RPWM timeout, force to set RPWM(0x%02X) again!\n", __func__, pslv);
} }
else else
#endif // CONFIG_LPS_RPWM_TIMER #endif /* CONFIG_LPS_RPWM_TIMER */
{ {
if ( (pwrpriv->rpwm == pslv) if ( (pwrpriv->rpwm == pslv)
#ifdef CONFIG_LPS_LCLK #ifdef CONFIG_LPS_LCLK
@ -408,7 +408,7 @@ _func_enter_;
rpwm = pslv | pwrpriv->tog; rpwm = pslv | pwrpriv->tog;
#ifdef CONFIG_LPS_LCLK #ifdef CONFIG_LPS_LCLK
// only when from PS_STATE S0/S1 to S2 and higher needs ACK /* only when from PS_STATE S0/S1 to S2 and higher needs ACK */
if ((pwrpriv->cpwm < PS_STATE_S2) && (pslv >= PS_STATE_S2)) if ((pwrpriv->cpwm < PS_STATE_S2) && (pslv >= PS_STATE_S2))
rpwm |= PS_ACK; rpwm |= PS_ACK;
#endif #endif
@ -420,13 +420,13 @@ _func_enter_;
#ifdef CONFIG_LPS_RPWM_TIMER #ifdef CONFIG_LPS_RPWM_TIMER
if (rpwm & PS_ACK) if (rpwm & PS_ACK)
_set_timer(&pwrpriv->pwr_rpwm_timer, LPS_RPWM_WAIT_MS); _set_timer(&pwrpriv->pwr_rpwm_timer, LPS_RPWM_WAIT_MS);
#endif // CONFIG_LPS_RPWM_TIMER #endif /* CONFIG_LPS_RPWM_TIMER */
rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&rpwm)); rtw_hal_set_hwreg(padapter, HW_VAR_SET_RPWM, (u8 *)(&rpwm));
pwrpriv->tog += 0x80; pwrpriv->tog += 0x80;
#ifdef CONFIG_LPS_LCLK #ifdef CONFIG_LPS_LCLK
// No LPS 32K, No Ack /* No LPS 32K, No Ack */
if (!(rpwm & PS_ACK)) if (!(rpwm & PS_ACK))
#endif #endif
{ {
@ -485,14 +485,14 @@ void rtw_set_ps_mode(PADAPTER padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &( padapter->wdinfo ); struct wifidirect_info *pwdinfo = &( padapter->wdinfo );
#endif //CONFIG_P2P #endif /* CONFIG_P2P */
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
_irqL irqL; _irqL irqL;
int i, j; int i, j;
_list *plist, *phead; _list *plist, *phead;
struct sta_info *ptdls_sta; struct sta_info *ptdls_sta;
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
_func_enter_; _func_enter_;
@ -520,12 +520,12 @@ _func_enter_;
_enter_pwrlock(&pwrpriv->lock); _enter_pwrlock(&pwrpriv->lock);
#endif #endif
//if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) /* if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) */
if (ps_mode == PS_MODE_ACTIVE) if (ps_mode == PS_MODE_ACTIVE)
{ {
#ifdef CONFIG_P2P_PS #ifdef CONFIG_P2P_PS
if (pwdinfo->opp_ps == 0) if (pwdinfo->opp_ps == 0)
#endif //CONFIG_P2P_PS #endif /* CONFIG_P2P_PS */
{ {
DBG_88E("rtw_set_ps_mode: Leave 802.11 power save\n"); DBG_88E("rtw_set_ps_mode: Leave 802.11 power save\n");
@ -548,7 +548,7 @@ _func_enter_;
} }
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
pwrpriv->pwr_mode = ps_mode; pwrpriv->pwr_mode = ps_mode;
rtw_set_rpwm(padapter, PS_STATE_S4); rtw_set_rpwm(padapter, PS_STATE_S4);
@ -585,7 +585,7 @@ _func_enter_;
} }
_exit_critical_bh(&pstapriv->sta_hash_lock, &irqL); _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
pwrpriv->bFwCurrentInPSMode = true; pwrpriv->bFwCurrentInPSMode = true;
pwrpriv->pwr_mode = ps_mode; pwrpriv->pwr_mode = ps_mode;
@ -594,10 +594,10 @@ _func_enter_;
rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode)); rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_PWRMODE, (u8 *)(&ps_mode));
#ifdef CONFIG_P2P_PS #ifdef CONFIG_P2P_PS
// Set CTWindow after LPS /* Set CTWindow after LPS */
if (pwdinfo->opp_ps == 1) if (pwdinfo->opp_ps == 1)
p2p_ps_wk_cmd(padapter, P2P_PS_ENABLE, 0); p2p_ps_wk_cmd(padapter, P2P_PS_ENABLE, 0);
#endif //CONFIG_P2P_PS #endif /* CONFIG_P2P_PS */
#ifdef CONFIG_LPS_LCLK #ifdef CONFIG_LPS_LCLK
if (pwrpriv->alives == 0) if (pwrpriv->alives == 0)
@ -654,10 +654,10 @@ s32 LPS_RF_ON_check(PADAPTER padapter, u32 delay_ms)
return err; return err;
} }
// /* */
// Description: /* Description: */
// Enter the leisure power save mode. /* Enter the leisure power save mode. */
// /* */
void LPS_Enter(PADAPTER padapter) void LPS_Enter(PADAPTER padapter)
{ {
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
@ -666,7 +666,7 @@ void LPS_Enter(PADAPTER padapter)
_func_enter_; _func_enter_;
// DBG_88E("+LeisurePSEnter\n"); /* DBG_88E("+LeisurePSEnter\n"); */
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
if (padapter->iface_type != IFACE_PORT0) if (padapter->iface_type != IFACE_PORT0)
@ -703,14 +703,14 @@ _func_enter_;
if (true == pwrpriv->bLeisurePs) if (true == pwrpriv->bLeisurePs)
{ {
// Idle for a while if we connect to AP a while ago. /* Idle for a while if we connect to AP a while ago. */
if (pwrpriv->LpsIdleCount >= 2) // 4 Sec if (pwrpriv->LpsIdleCount >= 2) /* 4 Sec */
{ {
if (pwrpriv->pwr_mode == PS_MODE_ACTIVE) if (pwrpriv->pwr_mode == PS_MODE_ACTIVE)
{ {
pwrpriv->bpower_saving = true; pwrpriv->bpower_saving = true;
DBG_88E("%s smart_ps:%d\n", __func__, pwrpriv->smart_ps); DBG_88E("%s smart_ps:%d\n", __func__, pwrpriv->smart_ps);
//For Tenda W311R IOT issue /* For Tenda W311R IOT issue */
rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, pwrpriv->smart_ps, 0); rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, pwrpriv->smart_ps, 0);
} }
} }
@ -718,15 +718,15 @@ _func_enter_;
pwrpriv->LpsIdleCount++; pwrpriv->LpsIdleCount++;
} }
// DBG_88E("-LeisurePSEnter\n"); /* DBG_88E("-LeisurePSEnter\n"); */
_func_exit_; _func_exit_;
} }
// /* */
// Description: /* Description: */
// Leave the leisure power save mode. /* Leave the leisure power save mode. */
// /* */
void LPS_Leave(PADAPTER padapter) void LPS_Leave(PADAPTER padapter)
{ {
#define LPS_LEAVE_TIMEOUT_MS 100 #define LPS_LEAVE_TIMEOUT_MS 100
@ -742,7 +742,7 @@ _func_enter_;
return; /* Skip power saving for concurrent mode port 1*/ return; /* Skip power saving for concurrent mode port 1*/
#endif #endif
// DBG_88E("+LeisurePSLeave\n"); /* DBG_88E("+LeisurePSLeave\n"); */
if (pwrpriv->bLeisurePs) if (pwrpriv->bLeisurePs)
{ {
@ -757,16 +757,16 @@ _func_enter_;
pwrpriv->bpower_saving = false; pwrpriv->bpower_saving = false;
// DBG_88E("-LeisurePSLeave\n"); /* DBG_88E("-LeisurePSLeave\n"); */
_func_exit_; _func_exit_;
} }
#endif #endif
// /* */
// Description: Leave all power save mode: LPS, FwLPS, IPS if needed. /* Description: Leave all power save mode: LPS, FwLPS, IPS if needed. */
// Move code to function by tynli. 2010.03.26. /* Move code to function by tynli. 2010.03.26. */
// /* */
void LeaveAllPowerSaveMode(PADAPTER Adapter) void LeaveAllPowerSaveMode(PADAPTER Adapter)
{ {
struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
@ -775,14 +775,14 @@ void LeaveAllPowerSaveMode(PADAPTER Adapter)
_func_enter_; _func_enter_;
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
{ //connect { /* connect */
#ifdef CONFIG_LPS_LCLK #ifdef CONFIG_LPS_LCLK
enqueue = 1; enqueue = 1;
#endif #endif
#ifdef CONFIG_P2P_PS #ifdef CONFIG_P2P_PS
p2p_ps_wk_cmd(Adapter, P2P_PS_DISABLE, enqueue); p2p_ps_wk_cmd(Adapter, P2P_PS_DISABLE, enqueue);
#endif //CONFIG_P2P_PS #endif /* CONFIG_P2P_PS */
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
rtw_lps_ctrl_wk_cmd(Adapter, LPS_CTRL_LEAVE, enqueue); rtw_lps_ctrl_wk_cmd(Adapter, LPS_CTRL_LEAVE, enqueue);
@ -802,7 +802,7 @@ _func_enter_;
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
usb_disable_autosuspend(adapter_to_dvobj(Adapter)->pusbdev); usb_disable_autosuspend(adapter_to_dvobj(Adapter)->pusbdev);
#elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,34)) #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,34))
adapter_to_dvobj(Adapter)->pusbdev->autosuspend_disabled = Adapter->bDisableAutosuspend;//autosuspend disabled by the user adapter_to_dvobj(Adapter)->pusbdev->autosuspend_disabled = Adapter->bDisableAutosuspend;/* autosuspend disabled by the user */
#endif #endif
} }
else else
@ -815,7 +815,7 @@ _func_enter_;
DBG_88E("======> ips_leave fail.............\n"); DBG_88E("======> ips_leave fail.............\n");
} }
#endif #endif
#endif //CONFIG_PLATFORM_SPRD && CONFIG_RTL8188E #endif /* CONFIG_PLATFORM_SPRD && CONFIG_RTL8188E */
} }
} }
} }
@ -896,7 +896,7 @@ _func_enter_;
_exit_pwrlock(&pwrpriv->lock); _exit_pwrlock(&pwrpriv->lock);
goto exit; goto exit;
} }
#endif // CONFIG_LPS_RPWM_TIMER #endif /* CONFIG_LPS_RPWM_TIMER */
pwrpriv->cpwm = PS_STATE(preportpwrstate->state); pwrpriv->cpwm = PS_STATE(preportpwrstate->state);
pwrpriv->cpwm_tog = preportpwrstate->state & PS_TOGGLE; pwrpriv->cpwm_tog = preportpwrstate->state & PS_TOGGLE;
@ -925,7 +925,7 @@ static void cpwm_event_callback(struct work_struct *work)
_adapter *adapter = container_of(pwrpriv, _adapter, pwrctrlpriv); _adapter *adapter = container_of(pwrpriv, _adapter, pwrctrlpriv);
struct reportpwrstate_parm report; struct reportpwrstate_parm report;
//DBG_88E("%s\n",__func__); /* DBG_88E("%s\n",__func__); */
report.state = PS_STATE_S2; report.state = PS_STATE_S2;
cpwm_int_hdl(adapter, &report); cpwm_int_hdl(adapter, &report);
@ -940,7 +940,7 @@ static void rpwmtimeout_workitem_callback(struct work_struct *work)
pwrpriv = container_of(work, struct pwrctrl_priv, rpwmtimeoutwi); pwrpriv = container_of(work, struct pwrctrl_priv, rpwmtimeoutwi);
padapter = container_of(pwrpriv, _adapter, pwrctrlpriv); padapter = container_of(pwrpriv, _adapter, pwrctrlpriv);
// DBG_88E("+%s: rpwm=0x%02X cpwm=0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm); /* DBG_88E("+%s: rpwm=0x%02X cpwm=0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm); */
_enter_pwrlock(&pwrpriv->lock); _enter_pwrlock(&pwrpriv->lock);
if ((pwrpriv->rpwm == pwrpriv->cpwm) || (pwrpriv->cpwm >= PS_STATE_S2)) if ((pwrpriv->rpwm == pwrpriv->cpwm) || (pwrpriv->cpwm >= PS_STATE_S2))
@ -991,7 +991,7 @@ static void pwr_rpwm_timeout_handler(void *FunctionContext)
padapter = (PADAPTER)FunctionContext; padapter = (PADAPTER)FunctionContext;
pwrpriv = &padapter->pwrctrlpriv; pwrpriv = &padapter->pwrctrlpriv;
// DBG_88E("+%s: rpwm=0x%02X cpwm=0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm); /* DBG_88E("+%s: rpwm=0x%02X cpwm=0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm); */
if ((pwrpriv->rpwm == pwrpriv->cpwm) || (pwrpriv->cpwm >= PS_STATE_S2)) if ((pwrpriv->rpwm == pwrpriv->cpwm) || (pwrpriv->cpwm >= PS_STATE_S2))
{ {
@ -1001,7 +1001,7 @@ static void pwr_rpwm_timeout_handler(void *FunctionContext)
_set_workitem(&pwrpriv->rpwmtimeoutwi); _set_workitem(&pwrpriv->rpwmtimeoutwi);
} }
#endif // CONFIG_LPS_RPWM_TIMER #endif /* CONFIG_LPS_RPWM_TIMER */
__inline static void register_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag) __inline static void register_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag)
{ {
@ -1313,7 +1313,7 @@ _func_exit_;
#ifdef CONFIG_RESUME_IN_WORKQUEUE #ifdef CONFIG_RESUME_IN_WORKQUEUE
static void resume_workitem_callback(struct work_struct *work); static void resume_workitem_callback(struct work_struct *work);
#endif //CONFIG_RESUME_IN_WORKQUEUE #endif /* CONFIG_RESUME_IN_WORKQUEUE */
void rtw_init_pwrctrl_priv(PADAPTER padapter) void rtw_init_pwrctrl_priv(PADAPTER padapter)
{ {
@ -1347,11 +1347,10 @@ _func_enter_;
#endif #endif
pwrctrlpriv->LpsIdleCount = 0; pwrctrlpriv->LpsIdleCount = 0;
//pwrctrlpriv->FWCtrlPSMode =padapter->registrypriv.power_mgnt;// PS_MODE_MIN;
if (padapter->registrypriv.mp_mode == 1) if (padapter->registrypriv.mp_mode == 1)
pwrctrlpriv->power_mgnt =PS_MODE_ACTIVE ; pwrctrlpriv->power_mgnt =PS_MODE_ACTIVE ;
else else
pwrctrlpriv->power_mgnt =padapter->registrypriv.power_mgnt;// PS_MODE_MIN; pwrctrlpriv->power_mgnt =padapter->registrypriv.power_mgnt;/* PS_MODE_MIN; */
pwrctrlpriv->bLeisurePs = (PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt)?true:false; pwrctrlpriv->bLeisurePs = (PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt)?true:false;
pwrctrlpriv->bFwCurrentInPSMode = false; pwrctrlpriv->bFwCurrentInPSMode = false;
@ -1376,8 +1375,8 @@ _func_enter_;
pwrctrlpriv->brpwmtimeout = false; pwrctrlpriv->brpwmtimeout = false;
_init_workitem(&pwrctrlpriv->rpwmtimeoutwi, rpwmtimeout_workitem_callback, NULL); _init_workitem(&pwrctrlpriv->rpwmtimeoutwi, rpwmtimeout_workitem_callback, NULL);
_init_timer(&pwrctrlpriv->pwr_rpwm_timer, padapter->pnetdev, pwr_rpwm_timeout_handler, padapter); _init_timer(&pwrctrlpriv->pwr_rpwm_timer, padapter->pnetdev, pwr_rpwm_timeout_handler, padapter);
#endif // CONFIG_LPS_RPWM_TIMER #endif /* CONFIG_LPS_RPWM_TIMER */
#endif // CONFIG_LPS_LCLK #endif /* CONFIG_LPS_LCLK */
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
_init_timer(&(pwrctrlpriv->pwr_state_check_timer), padapter->pnetdev, pwr_state_check_handler, (u8 *)padapter); _init_timer(&(pwrctrlpriv->pwr_state_check_timer), padapter->pnetdev, pwr_state_check_handler, (u8 *)padapter);
@ -1386,12 +1385,12 @@ _func_enter_;
#ifdef CONFIG_RESUME_IN_WORKQUEUE #ifdef CONFIG_RESUME_IN_WORKQUEUE
_init_workitem(&pwrctrlpriv->resume_work, resume_workitem_callback, NULL); _init_workitem(&pwrctrlpriv->resume_work, resume_workitem_callback, NULL);
pwrctrlpriv->rtw_workqueue = create_singlethread_workqueue("rtw_workqueue"); pwrctrlpriv->rtw_workqueue = create_singlethread_workqueue("rtw_workqueue");
#endif //CONFIG_RESUME_IN_WORKQUEUE #endif /* CONFIG_RESUME_IN_WORKQUEUE */
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER) #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
pwrctrlpriv->early_suspend.suspend = NULL; pwrctrlpriv->early_suspend.suspend = NULL;
rtw_register_early_suspend(pwrctrlpriv); rtw_register_early_suspend(pwrctrlpriv);
#endif //CONFIG_HAS_EARLYSUSPEND || CONFIG_ANDROID_POWER #endif /* CONFIG_HAS_EARLYSUSPEND || CONFIG_ANDROID_POWER */
_func_exit_; _func_exit_;
@ -1405,7 +1404,7 @@ void rtw_free_pwrctrl_priv(PADAPTER adapter)
_func_enter_; _func_enter_;
//_rtw_memset((unsigned char *)pwrctrlpriv, 0, sizeof(struct pwrctrl_priv)); /* _rtw_memset((unsigned char *)pwrctrlpriv, 0, sizeof(struct pwrctrl_priv)); */
#ifdef CONFIG_RESUME_IN_WORKQUEUE #ifdef CONFIG_RESUME_IN_WORKQUEUE
@ -1418,7 +1417,7 @@ _func_enter_;
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER) #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
rtw_unregister_early_suspend(pwrctrlpriv); rtw_unregister_early_suspend(pwrctrlpriv);
#endif //CONFIG_HAS_EARLYSUSPEND || CONFIG_ANDROID_POWER #endif /* CONFIG_HAS_EARLYSUSPEND || CONFIG_ANDROID_POWER */
_free_pwrlock(&pwrctrlpriv->lock); _free_pwrlock(&pwrctrlpriv->lock);
@ -1444,7 +1443,7 @@ static void resume_workitem_callback(struct work_struct *work)
void rtw_resume_in_workqueue(struct pwrctrl_priv *pwrpriv) void rtw_resume_in_workqueue(struct pwrctrl_priv *pwrpriv)
{ {
// accquire system's suspend lock preventing from falliing asleep while resume in workqueue /* accquire system's suspend lock preventing from falliing asleep while resume in workqueue */
rtw_lock_suspend(); rtw_lock_suspend();
#if 1 #if 1
@ -1453,7 +1452,7 @@ void rtw_resume_in_workqueue(struct pwrctrl_priv *pwrpriv)
_set_workitem(&pwrpriv->resume_work); _set_workitem(&pwrpriv->resume_work);
#endif #endif
} }
#endif //CONFIG_RESUME_IN_WORKQUEUE #endif /* CONFIG_RESUME_IN_WORKQUEUE */
#ifdef CONFIG_HAS_EARLYSUSPEND #ifdef CONFIG_HAS_EARLYSUSPEND
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
@ -1464,7 +1463,7 @@ static void rtw_early_suspend(struct early_suspend *h)
struct pwrctrl_priv *pwrpriv = container_of(h, struct pwrctrl_priv, early_suspend); struct pwrctrl_priv *pwrpriv = container_of(h, struct pwrctrl_priv, early_suspend);
DBG_88E("%s\n",__func__); DBG_88E("%s\n",__func__);
//jeff: do nothing but set do_late_resume to false /* jeff: do nothing but set do_late_resume to false */
pwrpriv->do_late_resume = false; pwrpriv->do_late_resume = false;
} }
@ -1486,7 +1485,7 @@ void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv)
{ {
DBG_88E("%s\n", __func__); DBG_88E("%s\n", __func__);
//jeff: set the early suspend level before blank screen, so we wll do late resume after scree is lit /* jeff: set the early suspend level before blank screen, so we wll do late resume after scree is lit */
pwrpriv->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20; pwrpriv->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20;
pwrpriv->early_suspend.suspend = rtw_early_suspend; pwrpriv->early_suspend.suspend = rtw_early_suspend;
pwrpriv->early_suspend.resume = rtw_late_resume; pwrpriv->early_suspend.resume = rtw_late_resume;
@ -1507,7 +1506,7 @@ void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv)
pwrpriv->early_suspend.suspend = NULL; pwrpriv->early_suspend.suspend = NULL;
pwrpriv->early_suspend.resume = NULL; pwrpriv->early_suspend.resume = NULL;
} }
#endif //CONFIG_HAS_EARLYSUSPEND #endif /* CONFIG_HAS_EARLYSUSPEND */
#ifdef CONFIG_ANDROID_POWER #ifdef CONFIG_ANDROID_POWER
#if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) #if defined(CONFIG_USB_HCI) || defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
@ -1518,7 +1517,7 @@ static void rtw_early_suspend(android_early_suspend_t *h)
struct pwrctrl_priv *pwrpriv = container_of(h, struct pwrctrl_priv, early_suspend); struct pwrctrl_priv *pwrpriv = container_of(h, struct pwrctrl_priv, early_suspend);
DBG_88E("%s\n",__func__); DBG_88E("%s\n",__func__);
//jeff: do nothing but set do_late_resume to false /* jeff: do nothing but set do_late_resume to false */
pwrpriv->do_late_resume = false; pwrpriv->do_late_resume = false;
} }
@ -1540,7 +1539,7 @@ void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv)
{ {
DBG_88E("%s\n", __func__); DBG_88E("%s\n", __func__);
//jeff: set the early suspend level before blank screen, so we wll do late resume after scree is lit /* jeff: set the early suspend level before blank screen, so we wll do late resume after scree is lit */
pwrpriv->early_suspend.level = ANDROID_EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20; pwrpriv->early_suspend.level = ANDROID_EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20;
pwrpriv->early_suspend.suspend = rtw_early_suspend; pwrpriv->early_suspend.suspend = rtw_early_suspend;
pwrpriv->early_suspend.resume = rtw_late_resume; pwrpriv->early_suspend.resume = rtw_late_resume;
@ -1559,7 +1558,7 @@ void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv)
pwrpriv->early_suspend.suspend = NULL; pwrpriv->early_suspend.suspend = NULL;
pwrpriv->early_suspend.resume = NULL; pwrpriv->early_suspend.resume = NULL;
} }
#endif //CONFIG_ANDROID_POWER #endif /* CONFIG_ANDROID_POWER */
u8 rtw_interface_ps_func(_adapter *padapter,HAL_INTF_PS_FUNC efunc_id,u8* val) u8 rtw_interface_ps_func(_adapter *padapter,HAL_INTF_PS_FUNC efunc_id,u8* val)
{ {
@ -1616,19 +1615,19 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
} }
} }
//System suspend is not allowed to wakeup /* System suspend is not allowed to wakeup */
if ((pwrpriv->bInternalAutoSuspend == false) && (true == pwrpriv->bInSuspend )){ if ((pwrpriv->bInternalAutoSuspend == false) && (true == pwrpriv->bInSuspend )){
ret = _FAIL; ret = _FAIL;
goto exit; goto exit;
} }
//block??? /* block??? */
if ((pwrpriv->bInternalAutoSuspend == true) && (padapter->net_closed == true)) { if ((pwrpriv->bInternalAutoSuspend == true) && (padapter->net_closed == true)) {
ret = _FAIL; ret = _FAIL;
goto exit; goto exit;
} }
//I think this should be check in IPS, LPS, autosuspend functions... /* I think this should be check in IPS, LPS, autosuspend functions... */
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
{ {
#if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) #if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND)
@ -1646,12 +1645,12 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
#endif #endif
pwrpriv->autopm_cnt++; pwrpriv->autopm_cnt++;
} }
#endif //#if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) #endif /* if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) */
ret = _SUCCESS; ret = _SUCCESS;
goto exit; goto exit;
#if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) #if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND)
} }
#endif //#if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) #endif /* if defined (CONFIG_BT_COEXIST)&& defined (CONFIG_AUTOSUSPEND) */
} }
if (rf_off == pwrpriv->rf_pwrstate ) if (rf_off == pwrpriv->rf_pwrstate )
{ {
@ -1689,7 +1688,7 @@ int _rtw_pwr_wakeup(_adapter *padapter, u32 ips_deffer_ms, const char *caller)
} }
} }
//TODO: the following checking need to be merged... /* TODO: the following checking need to be merged... */
if (padapter->bDriverStopped if (padapter->bDriverStopped
|| !padapter->bup || !padapter->bup
|| !padapter->hw_init_completed || !padapter->hw_init_completed

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,7 @@
#include <osdep_intf.h> #include <osdep_intf.h>
//=====WEP related===== /* WEP related===== */
#define CRC32_POLY 0x04c11db7 #define CRC32_POLY 0x04c11db7
@ -160,7 +160,7 @@ _func_exit_;
Need to consider the fragment situation Need to consider the fragment situation
*/ */
void rtw_wep_encrypt(_adapter *padapter, u8 *pxmitframe) void rtw_wep_encrypt(_adapter *padapter, u8 *pxmitframe)
{ // exclude ICV { /* exclude ICV */
unsigned char crc[4]; unsigned char crc[4];
struct arc4context mycontext; struct arc4context mycontext;
@ -168,7 +168,7 @@ void rtw_wep_encrypt(_adapter *padapter, u8 *pxmitframe)
sint curfragnum,length; sint curfragnum,length;
u32 keylength; u32 keylength;
u8 *pframe, *payload,*iv; //,*wepkey u8 *pframe, *payload,*iv; /* wepkey */
u8 wepkey[16]; u8 wepkey[16];
u8 hw_hdr_offset=0; u8 hw_hdr_offset=0;
struct pkt_attrib *pattrib = &((struct xmit_frame*)pxmitframe)->attrib; struct pkt_attrib *pattrib = &((struct xmit_frame*)pxmitframe)->attrib;
@ -194,7 +194,7 @@ _func_enter_;
pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset; pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset;
//start to encrypt each fragment /* start to encrypt each fragment */
if ((pattrib->encrypt==_WEP40_)||(pattrib->encrypt==_WEP104_)) if ((pattrib->encrypt==_WEP40_)||(pattrib->encrypt==_WEP104_))
{ {
keylength=psecuritypriv->dot11DefKeylen[psecuritypriv->dot11PrivacyKeyIndex]; keylength=psecuritypriv->dot11DefKeylen[psecuritypriv->dot11PrivacyKeyIndex];
@ -207,7 +207,7 @@ _func_enter_;
payload=pframe+pattrib->iv_len+pattrib->hdrlen; payload=pframe+pattrib->iv_len+pattrib->hdrlen;
if ((curfragnum+1)==pattrib->nr_frags) if ((curfragnum+1)==pattrib->nr_frags)
{ //the last fragment { /* the last fragment */
length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len;
@ -241,7 +241,7 @@ _func_exit_;
void rtw_wep_decrypt(_adapter *padapter, u8 *precvframe) void rtw_wep_decrypt(_adapter *padapter, u8 *precvframe)
{ {
// exclude ICV /* exclude ICV */
u8 crc[4]; u8 crc[4];
struct arc4context mycontext; struct arc4context mycontext;
sint length; sint length;
@ -255,7 +255,7 @@ _func_enter_;
pframe = (unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; pframe = (unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data;
//start to decrypt recvframe /* start to decrypt recvframe */
if ((prxattrib->encrypt==_WEP40_)||(prxattrib->encrypt==_WEP104_)) { if ((prxattrib->encrypt==_WEP40_)||(prxattrib->encrypt==_WEP104_)) {
iv=pframe+prxattrib->hdrlen; iv=pframe+prxattrib->hdrlen;
keyindex = prxattrib->key_index; keyindex = prxattrib->key_index;
@ -266,11 +266,11 @@ _func_enter_;
payload=pframe+prxattrib->iv_len+prxattrib->hdrlen; payload=pframe+prxattrib->iv_len+prxattrib->hdrlen;
//decrypt payload include icv /* decrypt payload include icv */
arcfour_init(&mycontext, wepkey,3+keylength); arcfour_init(&mycontext, wepkey,3+keylength);
arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload, payload, length);
//calculate icv and compare the icv /* calculate icv and compare the icv */
*((__le32 *)crc) = getcrc32(payload, length - 4); *((__le32 *)crc) = getcrc32(payload, length - 4);
if (crc[3] != payload[length-1] || if (crc[3] != payload[length-1] ||
@ -286,10 +286,10 @@ _func_exit_;
return; return;
} }
//3 =====TKIP related===== /* 3 =====TKIP related===== */
static u32 secmicgetuint32( u8 * p ) static u32 secmicgetuint32( u8 * p )
// Convert from Byte[] to Us4Byte32 in a portable way /* Convert from Byte[] to Us4Byte32 in a portable way */
{ {
s32 i; s32 i;
u32 res = 0; u32 res = 0;
@ -303,7 +303,7 @@ _func_exit_;
} }
static void secmicputuint32( u8 * p, u32 val ) static void secmicputuint32( u8 * p, u32 val )
// Convert from Us4Byte32 to Byte[] in a portable way /* Convert from Us4Byte32 to Byte[] in a portable way */
{ {
long i; long i;
_func_enter_; _func_enter_;
@ -317,7 +317,7 @@ _func_exit_;
static void secmicclear(struct mic_data *pmicdata) static void secmicclear(struct mic_data *pmicdata)
{ {
// Reset the state to the empty message. /* Reset the state to the empty message. */
_func_enter_; _func_enter_;
pmicdata->L = pmicdata->K0; pmicdata->L = pmicdata->K0;
pmicdata->R = pmicdata->K1; pmicdata->R = pmicdata->K1;
@ -328,11 +328,11 @@ _func_exit_;
void rtw_secmicsetkey(struct mic_data *pmicdata, u8 * key ) void rtw_secmicsetkey(struct mic_data *pmicdata, u8 * key )
{ {
// Set the key /* Set the key */
_func_enter_; _func_enter_;
pmicdata->K0 = secmicgetuint32( key ); pmicdata->K0 = secmicgetuint32( key );
pmicdata->K1 = secmicgetuint32( key + 4 ); pmicdata->K1 = secmicgetuint32( key + 4 );
// and reset the message /* and reset the message */
secmicclear(pmicdata); secmicclear(pmicdata);
_func_exit_; _func_exit_;
} }
@ -340,10 +340,10 @@ _func_exit_;
void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b ) void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b )
{ {
_func_enter_; _func_enter_;
// Append the byte to our word-sized buffer /* Append the byte to our word-sized buffer */
pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM); pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM);
pmicdata->nBytesInM++; pmicdata->nBytesInM++;
// Process the word if it is full. /* Process the word if it is full. */
if ( pmicdata->nBytesInM >= 4 ) if ( pmicdata->nBytesInM >= 4 )
{ {
pmicdata->L ^= pmicdata->M; pmicdata->L ^= pmicdata->M;
@ -355,7 +355,7 @@ _func_enter_;
pmicdata->L += pmicdata->R; pmicdata->L += pmicdata->R;
pmicdata->R ^= ROR32( pmicdata->L, 2 ); pmicdata->R ^= ROR32( pmicdata->L, 2 );
pmicdata->L += pmicdata->R; pmicdata->L += pmicdata->R;
// Clear the buffer /* Clear the buffer */
pmicdata->M = 0; pmicdata->M = 0;
pmicdata->nBytesInM = 0; pmicdata->nBytesInM = 0;
} }
@ -365,7 +365,7 @@ _func_exit_;
void rtw_secmicappend(struct mic_data *pmicdata, u8 * src, u32 nbytes ) void rtw_secmicappend(struct mic_data *pmicdata, u8 * src, u32 nbytes )
{ {
_func_enter_; _func_enter_;
// This is simple /* This is simple */
while ( nbytes > 0 ) while ( nbytes > 0 )
{ {
rtw_secmicappendbyte(pmicdata, *src++ ); rtw_secmicappendbyte(pmicdata, *src++ );
@ -377,21 +377,21 @@ _func_exit_;
void rtw_secgetmic(struct mic_data *pmicdata, u8 * dst ) void rtw_secgetmic(struct mic_data *pmicdata, u8 * dst )
{ {
_func_enter_; _func_enter_;
// Append the minimum padding /* Append the minimum padding */
rtw_secmicappendbyte(pmicdata, 0x5a ); rtw_secmicappendbyte(pmicdata, 0x5a );
rtw_secmicappendbyte(pmicdata, 0 ); rtw_secmicappendbyte(pmicdata, 0 );
rtw_secmicappendbyte(pmicdata, 0 ); rtw_secmicappendbyte(pmicdata, 0 );
rtw_secmicappendbyte(pmicdata, 0 ); rtw_secmicappendbyte(pmicdata, 0 );
rtw_secmicappendbyte(pmicdata, 0 ); rtw_secmicappendbyte(pmicdata, 0 );
// and then zeroes until the length is a multiple of 4 /* and then zeroes until the length is a multiple of 4 */
while ( pmicdata->nBytesInM != 0 ) while ( pmicdata->nBytesInM != 0 )
{ {
rtw_secmicappendbyte(pmicdata, 0 ); rtw_secmicappendbyte(pmicdata, 0 );
} }
// The appendByte function has already computed the result. /* The appendByte function has already computed the result. */
secmicputuint32( dst, pmicdata->L ); secmicputuint32( dst, pmicdata->L );
secmicputuint32( dst+4, pmicdata->R ); secmicputuint32( dst+4, pmicdata->R );
// Reset to the empty message. /* Reset to the empty message. */
secmicclear(pmicdata); secmicclear(pmicdata);
_func_exit_; _func_exit_;
} }
@ -407,16 +407,16 @@ _func_enter_;
priority[0]=pri; priority[0]=pri;
/* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */ /* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */
if (header[1]&1){ //ToDS==1 if (header[1]&1){ /* ToDS==1 */
rtw_secmicappend(&micdata, &header[16], 6); //DA rtw_secmicappend(&micdata, &header[16], 6); /* DA */
if (header[1]&2) //From Ds==1 if (header[1]&2) /* From Ds==1 */
rtw_secmicappend(&micdata, &header[24], 6); rtw_secmicappend(&micdata, &header[24], 6);
else else
rtw_secmicappend(&micdata, &header[10], 6); rtw_secmicappend(&micdata, &header[10], 6);
} }
else{ //ToDS==0 else{ /* ToDS==0 */
rtw_secmicappend(&micdata, &header[4], 6); //DA rtw_secmicappend(&micdata, &header[4], 6); /* DA */
if (header[1]&2) //From Ds==1 if (header[1]&2) /* From Ds==1 */
rtw_secmicappend(&micdata, &header[16], 6); rtw_secmicappend(&micdata, &header[16], 6);
else else
rtw_secmicappend(&micdata, &header[10], 6); rtw_secmicappend(&micdata, &header[10], 6);
@ -642,9 +642,9 @@ _func_exit_;
} }
//The hlen isn't include the IV /* The hlen isn't include the IV */
u32 rtw_tkip_encrypt(_adapter *padapter, u8 *pxmitframe) u32 rtw_tkip_encrypt(_adapter *padapter, u8 *pxmitframe)
{ // exclude ICV { /* exclude ICV */
u16 pnl; u16 pnl;
u32 pnh; u32 pnh;
u8 rc4key[16]; u8 rc4key[16];
@ -678,7 +678,7 @@ _func_enter_;
#endif #endif
pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset; pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset;
//4 start to encrypt each fragment /* 4 start to encrypt each fragment */
if (pattrib->encrypt==_TKIP_){ if (pattrib->encrypt==_TKIP_){
if (pattrib->psta) if (pattrib->psta)
@ -715,7 +715,7 @@ _func_enter_;
phase2(&rc4key[0],prwskey,(u16 *)&ttkey[0],pnl); phase2(&rc4key[0],prwskey,(u16 *)&ttkey[0],pnl);
if ((curfragnum+1)==pattrib->nr_frags){ //4 the last fragment if ((curfragnum+1)==pattrib->nr_frags){ /* 4 the last fragment */
length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len;
RT_TRACE(_module_rtl871x_security_c_, _drv_info_, RT_TRACE(_module_rtl871x_security_c_, _drv_info_,
("pattrib->iv_len =%x, pattrib->icv_len =%x\n", ("pattrib->iv_len =%x, pattrib->icv_len =%x\n",
@ -754,9 +754,9 @@ _func_exit_;
} }
//The hlen isn't include the IV /* The hlen isn't include the IV */
u32 rtw_tkip_decrypt(_adapter *padapter, u8 *precvframe) u32 rtw_tkip_decrypt(_adapter *padapter, u8 *precvframe)
{ // exclude ICV { /* exclude ICV */
u16 pnl; u16 pnl;
u32 pnh; u32 pnh;
u8 rc4key[16]; u8 rc4key[16];
@ -770,14 +770,14 @@ u32 rtw_tkip_decrypt(_adapter *padapter, u8 *precvframe)
struct sta_info *stainfo; struct sta_info *stainfo;
struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib; struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
struct security_priv *psecuritypriv=&padapter->securitypriv; struct security_priv *psecuritypriv=&padapter->securitypriv;
// struct recv_priv *precvpriv=&padapter->recvpriv; /* struct recv_priv *precvpriv=&padapter->recvpriv; */
u32 res=_SUCCESS; u32 res=_SUCCESS;
_func_enter_; _func_enter_;
pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data;
//4 start to decrypt recvframe /* 4 start to decrypt recvframe */
if (prxattrib->encrypt==_TKIP_){ if (prxattrib->encrypt==_TKIP_){
stainfo=rtw_get_stainfo(&padapter->stapriv ,&prxattrib->ta[0] ); stainfo=rtw_get_stainfo(&padapter->stapriv ,&prxattrib->ta[0] );
@ -791,8 +791,8 @@ _func_enter_;
DBG_88E("%s:rx bc/mc packets,but didn't install group key!!!!!!!!!!\n",__func__); DBG_88E("%s:rx bc/mc packets,but didn't install group key!!!!!!!!!!\n",__func__);
goto exit; goto exit;
} }
//DBG_88E("rx bc/mc packets, to perform sw rtw_tkip_decrypt\n"); /* DBG_88E("rx bc/mc packets, to perform sw rtw_tkip_decrypt\n"); */
//prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; /* prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; */
prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey; prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey;
} }
else else
@ -813,7 +813,7 @@ _func_enter_;
phase1((u16 *)&ttkey[0],prwskey,&prxattrib->ta[0],pnh); phase1((u16 *)&ttkey[0],prwskey,&prxattrib->ta[0],pnh);
phase2(&rc4key[0],prwskey,(unsigned short *)&ttkey[0],pnl); phase2(&rc4key[0],prwskey,(unsigned short *)&ttkey[0],pnl);
//4 decrypt payload include icv /* 4 decrypt payload include icv */
arcfour_init(&mycontext, rc4key,16); arcfour_init(&mycontext, rc4key,16);
arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload, payload, length);
@ -840,7 +840,7 @@ exit:
} }
//3 =====AES related===== /* 3 =====AES related===== */
@ -926,7 +926,7 @@ static void add_round_key( u8 *shiftrow_in,
u8 *block_in, u8 *block_in,
sint round, sint round,
u8 *out); u8 *out);
#endif //PLATFORM_FREEBSD #endif /* PLATFORM_FREEBSD */
static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext); static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
@ -1218,7 +1218,6 @@ _func_enter_;
mic_header2[4] = mpdu[20]; mic_header2[4] = mpdu[20];
mic_header2[5] = mpdu[21]; mic_header2[5] = mpdu[21];
//mic_header2[6] = mpdu[22] & 0xf0; /* SC */
mic_header2[6] = 0x00; mic_header2[6] = 0x00;
mic_header2[7] = 0x00; /* mpdu[23]; */ mic_header2[7] = 0x00; /* mpdu[23]; */
@ -1306,7 +1305,6 @@ _func_exit_;
static sint aes_cipher(u8 *key, uint hdrlen, static sint aes_cipher(u8 *key, uint hdrlen,
u8 *pframe, uint plen) u8 *pframe, uint plen)
{ {
// /*static*/ unsigned char message[MAX_MSG_SIZE];
uint qc_exists, a4_exists, i, j, payload_remainder, uint qc_exists, a4_exists, i, j, payload_remainder,
num_blocks, payload_index; num_blocks, payload_index;
@ -1321,7 +1319,6 @@ static sint aes_cipher(u8 *key, uint hdrlen,
u8 aes_out[16]; u8 aes_out[16];
u8 padded_buffer[16]; u8 padded_buffer[16];
u8 mic[8]; u8 mic[8];
// uint offset = 0;
uint frtype = GetFrameType(pframe); uint frtype = GetFrameType(pframe);
uint frsubtype = GetFrameSubType(pframe); uint frsubtype = GetFrameSubType(pframe);
@ -1379,7 +1376,7 @@ _func_enter_;
mic_iv, mic_iv,
qc_exists, qc_exists,
a4_exists, a4_exists,
pframe, //message, pframe, /* message, */
plen, plen,
pn_vector pn_vector
); );
@ -1387,11 +1384,11 @@ _func_enter_;
construct_mic_header1( construct_mic_header1(
mic_header1, mic_header1,
hdrlen, hdrlen,
pframe //message pframe /* message */
); );
construct_mic_header2( construct_mic_header2(
mic_header2, mic_header2,
pframe, //message, pframe, /* message, */
a4_exists, a4_exists,
qc_exists qc_exists
); );
@ -1412,7 +1409,7 @@ _func_enter_;
for (i = 0; i < num_blocks; i++) for (i = 0; i < num_blocks; i++)
{ {
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);//bitwise_xor(aes_out, &message[payload_index], chain_buffer); bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */
payload_index += 16; payload_index += 16;
aes128k128d(key, chain_buffer, aes_out); aes128k128d(key, chain_buffer, aes_out);
@ -1424,7 +1421,7 @@ _func_enter_;
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++) for (j = 0; j < payload_remainder; j++)
{ {
padded_buffer[j] = pframe[payload_index++];//padded_buffer[j] = message[payload_index++]; padded_buffer[j] = pframe[payload_index++];/* padded_buffer[j] = message[payload_index++]; */
} }
bitwise_xor(aes_out, padded_buffer, chain_buffer); bitwise_xor(aes_out, padded_buffer, chain_buffer);
aes128k128d(key, chain_buffer, aes_out); aes128k128d(key, chain_buffer, aes_out);
@ -1435,7 +1432,7 @@ _func_enter_;
/* Insert MIC into payload */ /* Insert MIC into payload */
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
pframe[payload_index+j] = mic[j]; //message[payload_index+j] = mic[j]; pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */
payload_index = hdrlen + 8; payload_index = hdrlen + 8;
for (i=0; i< num_blocks; i++) for (i=0; i< num_blocks; i++)
@ -1444,12 +1441,12 @@ _func_enter_;
ctr_preload, ctr_preload,
a4_exists, a4_exists,
qc_exists, qc_exists,
pframe, //message, pframe, /* message, */
pn_vector, pn_vector,
i+1); i+1);
aes128k128d(key, ctr_preload, aes_out); aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);//bitwise_xor(aes_out, &message[payload_index], chain_buffer); bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */
for (j=0; j<16;j++) pframe[payload_index++] = chain_buffer[j];//for (j=0; j<16;j++) message[payload_index++] = chain_buffer[j]; for (j=0; j<16;j++) pframe[payload_index++] = chain_buffer[j];/* for (j=0; j<16;j++) message[payload_index++] = chain_buffer[j]; */
} }
if (payload_remainder > 0) /* If there is a short final block, then pad it,*/ if (payload_remainder > 0) /* If there is a short final block, then pad it,*/
@ -1458,18 +1455,18 @@ _func_enter_;
ctr_preload, ctr_preload,
a4_exists, a4_exists,
qc_exists, qc_exists,
pframe, //message, pframe, /* message, */
pn_vector, pn_vector,
num_blocks+1); num_blocks+1);
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++) for (j = 0; j < payload_remainder; j++)
{ {
padded_buffer[j] = pframe[payload_index+j];//padded_buffer[j] = message[payload_index+j]; padded_buffer[j] = pframe[payload_index+j];/* padded_buffer[j] = message[payload_index+j]; */
} }
aes128k128d(key, ctr_preload, aes_out); aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer); bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j=0; j<payload_remainder;j++) pframe[payload_index++] = chain_buffer[j];//for (j=0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; for (j=0; j<payload_remainder;j++) pframe[payload_index++] = chain_buffer[j];/* for (j=0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; */
} }
/* Encrypt the MIC */ /* Encrypt the MIC */
@ -1477,19 +1474,19 @@ _func_enter_;
ctr_preload, ctr_preload,
a4_exists, a4_exists,
qc_exists, qc_exists,
pframe, //message, pframe, /* message, */
pn_vector, pn_vector,
0); 0);
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
{ {
padded_buffer[j] = pframe[j+hdrlen+8+plen];//padded_buffer[j] = message[j+hdrlen+8+plen]; padded_buffer[j] = pframe[j+hdrlen+8+plen];/* padded_buffer[j] = message[j+hdrlen+8+plen]; */
} }
aes128k128d(key, ctr_preload, aes_out); aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer); bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j=0; j<8;j++) pframe[payload_index++] = chain_buffer[j];//for (j=0; j<8;j++) message[payload_index++] = chain_buffer[j]; for (j=0; j<8;j++) pframe[payload_index++] = chain_buffer[j];/* for (j=0; j<8;j++) message[payload_index++] = chain_buffer[j]; */
_func_exit_; _func_exit_;
return _SUCCESS; return _SUCCESS;
} }
@ -1499,22 +1496,22 @@ _func_exit_;
u32 rtw_aes_encrypt(_adapter *padapter, u8 *pxmitframe) u32 rtw_aes_encrypt(_adapter *padapter, u8 *pxmitframe)
{ // exclude ICV { /* exclude ICV */
/*static*/ /*static*/
// unsigned char message[MAX_MSG_SIZE]; /* unsigned char message[MAX_MSG_SIZE]; */
/* Intermediate Buffers */ /* Intermediate Buffers */
sint curfragnum,length; sint curfragnum,length;
u8 *pframe,*prwskey; //, *payload,*iv u8 *pframe,*prwskey; /* *payload,*iv */
u8 hw_hdr_offset = 0; u8 hw_hdr_offset = 0;
struct sta_info *stainfo; struct sta_info *stainfo;
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib; struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
struct security_priv *psecuritypriv=&padapter->securitypriv; struct security_priv *psecuritypriv=&padapter->securitypriv;
struct xmit_priv *pxmitpriv=&padapter->xmitpriv; struct xmit_priv *pxmitpriv=&padapter->xmitpriv;
// uint offset = 0; /* uint offset = 0; */
u32 res=_SUCCESS; u32 res=_SUCCESS;
_func_enter_; _func_enter_;
@ -1534,7 +1531,7 @@ _func_enter_;
pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset; pframe = ((struct xmit_frame*)pxmitframe)->buf_addr + hw_hdr_offset;
//4 start to encrypt each fragment /* 4 start to encrypt each fragment */
if ((pattrib->encrypt==_AES_)){ if ((pattrib->encrypt==_AES_)){
if (pattrib->psta) if (pattrib->psta)
@ -1558,7 +1555,7 @@ _func_enter_;
prwskey=&stainfo->dot118021x_UncstKey.skey[0]; prwskey=&stainfo->dot118021x_UncstKey.skey[0];
} }
#ifdef CONFIG_TDLS //swencryption #ifdef CONFIG_TDLS /* swencryption */
{ {
struct sta_info *ptdls_sta; struct sta_info *ptdls_sta;
ptdls_sta=rtw_get_stainfo(&padapter->stapriv ,&pattrib->dst[0] ); ptdls_sta=rtw_get_stainfo(&padapter->stapriv ,&pattrib->dst[0] );
@ -1568,10 +1565,10 @@ _func_enter_;
prwskey=&ptdls_sta->tpk.tk[0]; prwskey=&ptdls_sta->tpk.tk[0];
} }
} }
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
for (curfragnum=0;curfragnum<pattrib->nr_frags;curfragnum++){ for (curfragnum=0;curfragnum<pattrib->nr_frags;curfragnum++){
if ((curfragnum+1)==pattrib->nr_frags){ //4 the last fragment if ((curfragnum+1)==pattrib->nr_frags){ /* 4 the last fragment */
length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len;
aes_cipher(prwskey,pattrib->hdrlen,pframe, length); aes_cipher(prwskey,pattrib->hdrlen,pframe, length);
@ -1621,7 +1618,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
u8 mic[8]; u8 mic[8];
// uint offset = 0; /* uint offset = 0; */
uint frtype = GetFrameType(pframe); uint frtype = GetFrameType(pframe);
uint frsubtype = GetFrameSubType(pframe); uint frsubtype = GetFrameSubType(pframe);
_func_enter_; _func_enter_;
@ -1636,9 +1633,9 @@ _func_enter_;
_rtw_memset((void *)aes_out, 0, 16); _rtw_memset((void *)aes_out, 0, 16);
_rtw_memset((void *)padded_buffer, 0, 16); _rtw_memset((void *)padded_buffer, 0, 16);
//start to decrypt the payload /* start to decrypt the payload */
num_blocks = (plen-8) / 16; //(plen including llc, payload_length and mic ) num_blocks = (plen-8) / 16; /* plen including llc, payload_length and mic ) */
payload_remainder = (plen-8) % 16; payload_remainder = (plen-8) % 16;
@ -1681,9 +1678,9 @@ _func_enter_;
qc_exists = 0; qc_exists = 0;
// now, decrypt pframe with hdrlen offset and plen long /* now, decrypt pframe with hdrlen offset and plen long */
payload_index = hdrlen + 8; // 8 is for extiv payload_index = hdrlen + 8; /* 8 is for extiv */
for (i=0; i< num_blocks; i++) for (i=0; i< num_blocks; i++)
{ {
@ -1723,9 +1720,9 @@ _func_enter_;
for (j=0; j<payload_remainder;j++) pframe[payload_index++] = chain_buffer[j]; for (j=0; j<payload_remainder;j++) pframe[payload_index++] = chain_buffer[j];
} }
//start to calculate the mic /* start to calculate the mic */
if ((hdrlen +plen+8) <= MAX_MSG_SIZE) if ((hdrlen +plen+8) <= MAX_MSG_SIZE)
_rtw_memcpy((void *)message, pframe, (hdrlen +plen+8)); //8 is for ext iv len _rtw_memcpy((void *)message, pframe, (hdrlen +plen+8)); /* 8 is for ext iv len */
pn_vector[0]=pframe[hdrlen]; pn_vector[0]=pframe[hdrlen];
@ -1853,7 +1850,7 @@ _func_enter_;
bitwise_xor(aes_out, padded_buffer, chain_buffer); bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j=0; j<8;j++) message[payload_index++] = chain_buffer[j]; for (j=0; j<8;j++) message[payload_index++] = chain_buffer[j];
//compare the mic /* compare the mic */
for (i=0;i<8;i++){ for (i=0;i<8;i++){
if (pframe[hdrlen+8+plen-8+i] != message[hdrlen+8+plen-8+i]) if (pframe[hdrlen+8+plen-8+i] != message[hdrlen+8+plen-8+i])
{ {
@ -1869,26 +1866,26 @@ _func_exit_;
} }
u32 rtw_aes_decrypt(_adapter *padapter, u8 *precvframe) u32 rtw_aes_decrypt(_adapter *padapter, u8 *precvframe)
{ // exclude ICV { /* exclude ICV */
/*static*/ /*static*/
// unsigned char message[MAX_MSG_SIZE]; /* unsigned char message[MAX_MSG_SIZE]; */
/* Intermediate Buffers */ /* Intermediate Buffers */
sint length; sint length;
u8 *pframe,*prwskey; //, *payload,*iv u8 *pframe,*prwskey; /* *payload,*iv */
struct sta_info *stainfo; struct sta_info *stainfo;
struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib; struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
struct security_priv *psecuritypriv=&padapter->securitypriv; struct security_priv *psecuritypriv=&padapter->securitypriv;
// struct recv_priv *precvpriv=&padapter->recvpriv; /* struct recv_priv *precvpriv=&padapter->recvpriv; */
u32 res=_SUCCESS; u32 res=_SUCCESS;
_func_enter_; _func_enter_;
pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data;
//4 start to encrypt each fragment /* 4 start to encrypt each fragment */
if ((prxattrib->encrypt==_AES_)){ if ((prxattrib->encrypt==_AES_)){
stainfo=rtw_get_stainfo(&padapter->stapriv ,&prxattrib->ta[0] ); stainfo=rtw_get_stainfo(&padapter->stapriv ,&prxattrib->ta[0] );
@ -1897,9 +1894,9 @@ _func_enter_;
if (IS_MCAST(prxattrib->ra)) if (IS_MCAST(prxattrib->ra))
{ {
//in concurrent we should use sw descrypt in group key, so we remove this message /* in concurrent we should use sw descrypt in group key, so we remove this message */
//DBG_88E("rx bc/mc packets, to perform sw rtw_aes_decrypt\n"); /* DBG_88E("rx bc/mc packets, to perform sw rtw_aes_decrypt\n"); */
//prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; /* prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; */
if (psecuritypriv->binstallGrpkey==false) if (psecuritypriv->binstallGrpkey==false)
{ {
res=_FAIL; res=_FAIL;
@ -2202,7 +2199,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
_len[1] = 32; _len[1] = 32;
sha256_vector(2, _addr, _len, mac); sha256_vector(2, _addr, _len, mac);
} }
#endif //PLATFORM_FREEBSD #endif /* PLATFORM_FREEBSD */
/** /**
* sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2) * sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2)
* @key: Key for PRF * @key: Key for PRF
@ -2216,7 +2213,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
* This function is used to derive new, cryptographically separate keys from a * This function is used to derive new, cryptographically separate keys from a
* given key. * given key.
*/ */
#ifndef PLATFORM_FREEBSD //Baron #ifndef PLATFORM_FREEBSD /* Baron */
static void sha256_prf(u8 *key, size_t key_len, char *label, static void sha256_prf(u8 *key, size_t key_len, char *label,
u8 *data, size_t data_len, u8 *buf, size_t buf_len) u8 *data, size_t data_len, u8 *buf, size_t buf_len)
{ {
@ -2253,7 +2250,7 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
counter++; counter++;
} }
} }
#endif //PLATFORM_FREEBSD Baron #endif /* PLATFORM_FREEBSD Baron */
/* AES tables*/ /* AES tables*/
const u32 Te0[256] = { const u32 Te0[256] = {
@ -2432,7 +2429,7 @@ const u8 rcons[] = {
* *
* @return the number of rounds for the given cipher key size. * @return the number of rounds for the given cipher key size.
*/ */
#ifndef PLATFORM_FREEBSD //Baron #ifndef PLATFORM_FREEBSD /* Baron */
static void rijndaelKeySetupEnc(u32 rk[/*44*/], const u8 cipherKey[]) static void rijndaelKeySetupEnc(u32 rk[/*44*/], const u8 cipherKey[])
{ {
int i; int i;
@ -2648,7 +2645,7 @@ static int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac)
{ {
return omac1_aes_128_vector(key, 1, &data, &data_len, mac); return omac1_aes_128_vector(key, 1, &data, &data_len, mac);
} }
#endif //PLATFORM_FREEBSD Baron #endif /* PLATFORM_FREEBSD Baron */
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
void wpa_tdls_generate_tpk(_adapter *padapter, struct sta_info *psta) void wpa_tdls_generate_tpk(_adapter *padapter, struct sta_info *psta)
@ -2809,16 +2806,16 @@ int tdls_verify_mic(u8 *kck, u8 trans_seq,
rx_ftie = ftie+4; rx_ftie = ftie+4;
if (os_memcmp(mic, rx_ftie, 16) == 0) { if (os_memcmp(mic, rx_ftie, 16) == 0) {
//Valid MIC /* Valid MIC */
return 1; return 1;
} }
//Invalid MIC /* Invalid MIC */
DBG_88E( "[%s] Invalid MIC\n", __func__); DBG_88E( "[%s] Invalid MIC\n", __func__);
return 0; return 0;
} }
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
void rtw_use_tkipkey_handler ( void rtw_use_tkipkey_handler (

View file

@ -71,7 +71,7 @@ u8 sreset_get_wifi_status(_adapter *padapter)
} }
DBG_88E("==> %s wifi_status(0x%x)\n",__func__,status); DBG_88E("==> %s wifi_status(0x%x)\n",__func__,status);
//status restore /* status restore */
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
return status; return status;

View file

@ -46,9 +46,9 @@ _func_enter_;
_rtw_spinlock_init(&psta->lock); _rtw_spinlock_init(&psta->lock);
_rtw_init_listhead(&psta->list); _rtw_init_listhead(&psta->list);
_rtw_init_listhead(&psta->hash_list); _rtw_init_listhead(&psta->hash_list);
//_rtw_init_listhead(&psta->asoc_list); /* _rtw_init_listhead(&psta->asoc_list); */
//_rtw_init_listhead(&psta->sleep_list); /* _rtw_init_listhead(&psta->sleep_list); */
//_rtw_init_listhead(&psta->wakeup_list); /* _rtw_init_listhead(&psta->wakeup_list); */
_rtw_init_queue(&psta->sleep_q); _rtw_init_queue(&psta->sleep_q);
psta->sleepq_len = 0; psta->sleepq_len = 0;
@ -82,11 +82,11 @@ _func_enter_;
#ifdef CONFIG_TX_MCAST2UNI #ifdef CONFIG_TX_MCAST2UNI
psta->under_exist_checking = 0; psta->under_exist_checking = 0;
#endif // CONFIG_TX_MCAST2UNI #endif /* CONFIG_TX_MCAST2UNI */
psta->keep_alive_trycnt = 0; psta->keep_alive_trycnt = 0;
#endif // CONFIG_AP_MODE #endif /* CONFIG_AP_MODE */
_func_exit_; _func_exit_;
@ -111,7 +111,7 @@ _func_enter_;
_rtw_spinlock_init(&pstapriv->sta_hash_lock); _rtw_spinlock_init(&pstapriv->sta_hash_lock);
//_rtw_init_queue(&pstapriv->asoc_q); /* _rtw_init_queue(&pstapriv->asoc_q); */
pstapriv->asoc_sta_count = 0; pstapriv->asoc_sta_count = 0;
_rtw_init_queue(&pstapriv->sleep_q); _rtw_init_queue(&pstapriv->sleep_q);
_rtw_init_queue(&pstapriv->wakeup_q); _rtw_init_queue(&pstapriv->wakeup_q);
@ -144,14 +144,12 @@ _func_enter_;
pstapriv->asoc_list_cnt = 0; pstapriv->asoc_list_cnt = 0;
pstapriv->auth_list_cnt = 0; pstapriv->auth_list_cnt = 0;
pstapriv->auth_to = 3; // 3*2 = 6 sec pstapriv->auth_to = 3; /* 3*2 = 6 sec */
pstapriv->assoc_to = 3; pstapriv->assoc_to = 3;
//pstapriv->expire_to = 900;// 900*2 = 1800 sec = 30 min, expire after no any traffic.
//pstapriv->expire_to = 30;// 30*2 = 60 sec = 1 min, expire after no any traffic.
#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
pstapriv->expire_to = 3; // 3*2 = 6 sec pstapriv->expire_to = 3; /* 3*2 = 6 sec */
#else #else
pstapriv->expire_to = 60;// 60*2 = 120 sec = 2 min, expire after no any traffic. pstapriv->expire_to = 60;/* 60*2 = 120 sec = 2 min, expire after no any traffic. */
#endif #endif
pstapriv->max_num_sta = NUM_STA; pstapriv->max_num_sta = NUM_STA;
@ -222,7 +220,7 @@ _func_exit_;
} }
// this function is used to free the memory of lock || sema for all stainfos /* this function is used to free the memory of lock || sema for all stainfos */
void rtw_mfree_all_stainfo(struct sta_priv *pstapriv ); void rtw_mfree_all_stainfo(struct sta_priv *pstapriv );
void rtw_mfree_all_stainfo(struct sta_priv *pstapriv ) void rtw_mfree_all_stainfo(struct sta_priv *pstapriv )
{ {
@ -258,7 +256,7 @@ void rtw_mfree_sta_priv_lock(struct sta_priv *pstapriv)
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
#endif #endif
rtw_mfree_all_stainfo(pstapriv); //be done before free sta_hash_lock rtw_mfree_all_stainfo(pstapriv); /* be done before free sta_hash_lock */
_rtw_spinlock_free(&pstapriv->free_sta_queue.lock); _rtw_spinlock_free(&pstapriv->free_sta_queue.lock);
@ -362,10 +360,10 @@ _func_enter_;
_exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);
// Commented by Albert 2009/08/13 /* Commented by Albert 2009/08/13 */
// For the SMC router, the sequence number of first packet of WPS handshake will be 0. /* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
// In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. /* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
// So, we initialize the tid_rxseq variable as the 0xffff. /* So, we initialize the tid_rxseq variable as the 0xffff. */
for ( i = 0; i < 16; i++ ) for ( i = 0; i < 16; i++ )
{ {
@ -385,9 +383,9 @@ _func_enter_;
init_off_ch_timer(pstapriv->padapter, psta); init_off_ch_timer(pstapriv->padapter, psta);
init_handshake_timer(pstapriv->padapter, psta); init_handshake_timer(pstapriv->padapter, psta);
init_tdls_alive_timer(pstapriv->padapter, psta); init_tdls_alive_timer(pstapriv->padapter, psta);
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
//for A-MPDU Rx reordering buffer control /* for A-MPDU Rx reordering buffer control */
for (i=0; i < 16 ; i++) for (i=0; i < 16 ; i++)
{ {
preorder_ctrl = &psta->recvreorder_ctrl[i]; preorder_ctrl = &psta->recvreorder_ctrl[i];
@ -402,8 +400,8 @@ _func_enter_;
preorder_ctrl->indicate_seq); preorder_ctrl->indicate_seq);
#endif #endif
preorder_ctrl->wend_b= 0xffff; preorder_ctrl->wend_b= 0xffff;
//preorder_ctrl->wsize_b = (NR_RECVBUFF-2); /* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */
preorder_ctrl->wsize_b = 64;//64; preorder_ctrl->wsize_b = 64;/* 64; */
_rtw_init_queue(&preorder_ctrl->pending_recvframe_queue); _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);
@ -411,7 +409,7 @@ _func_enter_;
} }
//init for DM /* init for DM */
psta->rssi_stat.UndecoratedSmoothedPWDB = (-1); psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
psta->rssi_stat.UndecoratedSmoothedCCK = (-1); psta->rssi_stat.UndecoratedSmoothedCCK = (-1);
@ -429,7 +427,7 @@ _func_exit_;
} }
// using pstapriv->sta_hash_lock to protect /* using pstapriv->sta_hash_lock to protect */
u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta) u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta)
{ {
int i; int i;
@ -451,48 +449,48 @@ _func_enter_;
pstaxmitpriv = &psta->sta_xmitpriv; pstaxmitpriv = &psta->sta_xmitpriv;
//rtw_list_delete(&psta->sleep_list); /* rtw_list_delete(&psta->sleep_list); */
//rtw_list_delete(&psta->wakeup_list); /* rtw_list_delete(&psta->wakeup_list); */
_enter_critical_bh(&pxmitpriv->lock, &irqL0); _enter_critical_bh(&pxmitpriv->lock, &irqL0);
rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q); rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
psta->sleepq_len = 0; psta->sleepq_len = 0;
//_enter_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); /* _enter_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); */
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->vo_q.sta_pending); rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending)); rtw_list_delete(&(pstaxmitpriv->vo_q.tx_pending));
//_exit_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); /* _exit_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); */
//_enter_critical_bh(&(pxmitpriv->vi_pending.lock), &irqL0); /* _enter_critical_bh(&(pxmitpriv->vi_pending.lock), &irqL0); */
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->vi_q.sta_pending); rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
rtw_list_delete(&(pstaxmitpriv->vi_q.tx_pending)); rtw_list_delete(&(pstaxmitpriv->vi_q.tx_pending));
//_exit_critical_bh(&(pxmitpriv->vi_pending.lock), &irqL0); /* _exit_critical_bh(&(pxmitpriv->vi_pending.lock), &irqL0); */
//_enter_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); /* _enter_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); */
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->bk_q.sta_pending); rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending)); rtw_list_delete(&(pstaxmitpriv->bk_q.tx_pending));
//_exit_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); /* _exit_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); */
//_enter_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); /* _enter_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); */
rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->be_q.sta_pending); rtw_free_xmitframe_queue( pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending)); rtw_list_delete(&(pstaxmitpriv->be_q.tx_pending));
//_exit_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); /* _exit_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); */
_exit_critical_bh(&pxmitpriv->lock, &irqL0); _exit_critical_bh(&pxmitpriv->lock, &irqL0);
@ -501,7 +499,7 @@ _func_enter_;
pstapriv->asoc_sta_count --; pstapriv->asoc_sta_count --;
// re-init sta_info; 20061114 /* re-init sta_info; 20061114 */
_rtw_init_sta_xmit_priv(&psta->sta_xmitpriv); _rtw_init_sta_xmit_priv(&psta->sta_xmitpriv);
_rtw_init_sta_recv_priv(&psta->sta_recvpriv); _rtw_init_sta_recv_priv(&psta->sta_recvpriv);
@ -514,9 +512,9 @@ _func_enter_;
_cancel_timer_ex(&psta->off_ch_timer); _cancel_timer_ex(&psta->off_ch_timer);
_cancel_timer_ex(&psta->alive_timer1); _cancel_timer_ex(&psta->alive_timer1);
_cancel_timer_ex(&psta->alive_timer2); _cancel_timer_ex(&psta->alive_timer2);
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
//for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer /* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */
for (i=0; i < 16 ; i++) for (i=0; i < 16 ; i++)
{ {
_irqL irqL; _irqL irqL;
@ -587,7 +585,7 @@ _func_enter_;
pstapriv->sta_dz_bitmap &=~BIT(psta->aid); pstapriv->sta_dz_bitmap &=~BIT(psta->aid);
pstapriv->tim_bitmap &=~BIT(psta->aid); pstapriv->tim_bitmap &=~BIT(psta->aid);
//rtw_indicate_sta_disassoc_event(padapter, psta); /* rtw_indicate_sta_disassoc_event(padapter, psta); */
if ((psta->aid >0)&&(pstapriv->sta_aid[psta->aid - 1] == psta)) if ((psta->aid >0)&&(pstapriv->sta_aid[psta->aid - 1] == psta))
{ {
@ -595,13 +593,13 @@ _func_enter_;
psta->aid = 0; psta->aid = 0;
} }
#endif // CONFIG_NATIVEAP_MLME #endif /* CONFIG_NATIVEAP_MLME */
#ifdef CONFIG_TX_MCAST2UNI #ifdef CONFIG_TX_MCAST2UNI
psta->under_exist_checking = 0; psta->under_exist_checking = 0;
#endif // CONFIG_TX_MCAST2UNI #endif /* CONFIG_TX_MCAST2UNI */
#endif // CONFIG_AP_MODE #endif /* CONFIG_AP_MODE */
_enter_critical_bh(&(pfree_sta_queue->lock), &irqL0); _enter_critical_bh(&(pfree_sta_queue->lock), &irqL0);
rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue)); rtw_list_insert_tail(&psta->list, get_list_head(pfree_sta_queue));
@ -615,7 +613,7 @@ _func_exit_;
} }
// free all stainfo which in sta_hash[all] /* free all stainfo which in sta_hash[all] */
void rtw_free_all_stainfo(_adapter *padapter) void rtw_free_all_stainfo(_adapter *padapter)
{ {
_irqL irqL; _irqL irqL;
@ -701,7 +699,7 @@ _func_enter_;
psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN))== true) if ((_rtw_memcmp(psta->hwaddr, addr, ETH_ALEN))== true)
{ // if found the matched address { /* if found the matched address */
break; break;
} }
psta=NULL; psta=NULL;
@ -722,7 +720,7 @@ u32 rtw_init_bcmc_stainfo(_adapter* padapter)
NDIS_802_11_MAC_ADDRESS bcast_addr= {0xff,0xff,0xff,0xff,0xff,0xff}; NDIS_802_11_MAC_ADDRESS bcast_addr= {0xff,0xff,0xff,0xff,0xff,0xff};
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
//_queue *pstapending = &padapter->xmitpriv.bm_pending; /* _queue *pstapending = &padapter->xmitpriv.bm_pending; */
_func_enter_; _func_enter_;
@ -734,7 +732,7 @@ _func_enter_;
goto exit; goto exit;
} }
// default broadcast & multicast use macid 1 /* default broadcast & multicast use macid 1 */
psta->mac_id = 1; psta->mac_id = 1;
exit: exit:
@ -786,11 +784,11 @@ u8 rtw_access_ctrl(_adapter *padapter, u8 *mac_addr)
_exit_critical_bh(&(pacl_node_q->lock), &irqL); _exit_critical_bh(&(pacl_node_q->lock), &irqL);
if (pacl_list->mode == 1)//accept unless in deny list if (pacl_list->mode == 1)/* accept unless in deny list */
{ {
res = (match == true) ? false:true; res = (match == true) ? false:true;
} }
else if (pacl_list->mode == 2)//deny unless in accept list else if (pacl_list->mode == 2)/* deny unless in accept list */
{ {
res = (match == true) ? true:false; res = (match == true) ? true:false;
} }

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,7 @@ unsigned char REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20};
extern unsigned char MCS_rate_2R[16]; extern unsigned char MCS_rate_2R[16];
#ifdef CONFIG_DISABLE_MCS13TO15 #ifdef CONFIG_DISABLE_MCS13TO15
extern unsigned char MCS_rate_2R_MCS13TO15_OFF[16]; extern unsigned char MCS_rate_2R_MCS13TO15_OFF[16];
#endif //CONFIG_DISABLE_MCS13TO15 #endif /* CONFIG_DISABLE_MCS13TO15 */
extern unsigned char MCS_rate_1R[16]; extern unsigned char MCS_rate_1R[16];
extern unsigned char RTW_WPA_OUI[]; extern unsigned char RTW_WPA_OUI[];
extern unsigned char WPA_TKIP_CIPHER[4]; extern unsigned char WPA_TKIP_CIPHER[4];
@ -52,7 +52,7 @@ extern unsigned char RSN_TKIP_CIPHER[4];
#define R2T_PHY_DELAY (0) #define R2T_PHY_DELAY (0)
//#define WAIT_FOR_BCN_TO_M (3000) /* define WAIT_FOR_BCN_TO_M (3000) */
#define WAIT_FOR_BCN_TO_MIN (6000) #define WAIT_FOR_BCN_TO_MIN (6000)
#define WAIT_FOR_BCN_TO_MAX (20000) #define WAIT_FOR_BCN_TO_MAX (20000)
@ -314,7 +314,7 @@ void UpdateBrateTbl(PADAPTER Adapter, u8 *mBratesOS)
u8 i; u8 i;
u8 rate; u8 rate;
// 1M, 2M, 5.5M, 11M, 6M, 12M, 24M are mandatory. /* 1M, 2M, 5.5M, 11M, 6M, 12M, 24M are mandatory. */
for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
rate = mBratesOS[i] & 0x7f; rate = mBratesOS[i] & 0x7f;
switch (rate) { switch (rate) {
@ -487,17 +487,17 @@ void SelectChannel(_adapter *padapter, unsigned char channel)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
#ifdef CONFIG_DUALMAC_CONCURRENT #ifdef CONFIG_DUALMAC_CONCURRENT
//saved channel info /* saved channel info */
rtw_set_oper_ch(padapter, channel); rtw_set_oper_ch(padapter, channel);
dc_SelectChannel(padapter, channel); dc_SelectChannel(padapter, channel);
#else //CONFIG_DUALMAC_CONCURRENT #else /* CONFIG_DUALMAC_CONCURRENT */
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
_enter_critical_mutex(padapter->psetch_mutex, NULL); _enter_critical_mutex(padapter->psetch_mutex, NULL);
#endif #endif
//saved channel info /* saved channel info */
rtw_set_oper_ch(padapter, channel); rtw_set_oper_ch(padapter, channel);
rtw_hal_set_chan(padapter, channel); rtw_hal_set_chan(padapter, channel);
@ -507,7 +507,7 @@ void SelectChannel(_adapter *padapter, unsigned char channel)
_exit_critical_mutex(padapter->psetch_mutex, NULL); _exit_critical_mutex(padapter->psetch_mutex, NULL);
#endif #endif
#endif // CONFIG_DUALMAC_CONCURRENT #endif /* CONFIG_DUALMAC_CONCURRENT */
} }
void SetBWMode(_adapter *padapter, unsigned short bwmode, unsigned char channel_offset) void SetBWMode(_adapter *padapter, unsigned short bwmode, unsigned char channel_offset)
@ -515,17 +515,17 @@ void SetBWMode(_adapter *padapter, unsigned short bwmode, unsigned char channel_
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
#ifdef CONFIG_DUALMAC_CONCURRENT #ifdef CONFIG_DUALMAC_CONCURRENT
//saved bw info /* saved bw info */
rtw_set_oper_bw(padapter, bwmode); rtw_set_oper_bw(padapter, bwmode);
rtw_set_oper_choffset(padapter, channel_offset); rtw_set_oper_choffset(padapter, channel_offset);
dc_SetBWMode(padapter, bwmode, channel_offset); dc_SetBWMode(padapter, bwmode, channel_offset);
#else //CONFIG_DUALMAC_CONCURRENT #else /* CONFIG_DUALMAC_CONCURRENT */
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
_enter_critical_mutex(padapter->psetbw_mutex, NULL); _enter_critical_mutex(padapter->psetbw_mutex, NULL);
#endif #endif
//saved bw info /* saved bw info */
rtw_set_oper_bw(padapter, bwmode); rtw_set_oper_bw(padapter, bwmode);
rtw_set_oper_choffset(padapter, channel_offset); rtw_set_oper_choffset(padapter, channel_offset);
@ -535,7 +535,7 @@ void SetBWMode(_adapter *padapter, unsigned short bwmode, unsigned char channel_
_exit_critical_mutex(padapter->psetbw_mutex, NULL); _exit_critical_mutex(padapter->psetbw_mutex, NULL);
#endif #endif
#endif // CONFIG_DUALMAC_CONCURRENT #endif /* CONFIG_DUALMAC_CONCURRENT */
} }
void set_channel_bwmode(_adapter *padapter, unsigned char channel, unsigned char channel_offset, unsigned short bwmode) void set_channel_bwmode(_adapter *padapter, unsigned char channel, unsigned char channel_offset, unsigned short bwmode)
@ -550,50 +550,50 @@ void set_channel_bwmode(_adapter *padapter, unsigned char channel, unsigned char
if ((bwmode == HT_CHANNEL_WIDTH_20)||(channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)) if ((bwmode == HT_CHANNEL_WIDTH_20)||(channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE))
{ {
//SelectChannel(padapter, channel); /* SelectChannel(padapter, channel); */
center_ch = channel; center_ch = channel;
} }
else else
{ {
//switch to the proper channel /* switch to the proper channel */
if (channel_offset == HAL_PRIME_CHNL_OFFSET_LOWER) if (channel_offset == HAL_PRIME_CHNL_OFFSET_LOWER)
{ {
//SelectChannel(padapter, channel + 2); /* SelectChannel(padapter, channel + 2); */
center_ch = channel + 2; center_ch = channel + 2;
} }
else else
{ {
//SelectChannel(padapter, channel - 2); /* SelectChannel(padapter, channel - 2); */
center_ch = channel - 2; center_ch = channel - 2;
} }
} }
//set Channel /* set Channel */
#ifdef CONFIG_DUALMAC_CONCURRENT #ifdef CONFIG_DUALMAC_CONCURRENT
//saved channel/bw info /* saved channel/bw info */
rtw_set_oper_ch(padapter, channel); rtw_set_oper_ch(padapter, channel);
rtw_set_oper_bw(padapter, bwmode); rtw_set_oper_bw(padapter, bwmode);
rtw_set_oper_choffset(padapter, channel_offset); rtw_set_oper_choffset(padapter, channel_offset);
dc_SelectChannel(padapter, center_ch);// set center channel dc_SelectChannel(padapter, center_ch);/* set center channel */
#else //CONFIG_DUALMAC_CONCURRENT #else /* CONFIG_DUALMAC_CONCURRENT */
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
_enter_critical_mutex(padapter->psetch_mutex, NULL); _enter_critical_mutex(padapter->psetch_mutex, NULL);
#endif #endif
//saved channel/bw info /* saved channel/bw info */
rtw_set_oper_ch(padapter, channel); rtw_set_oper_ch(padapter, channel);
rtw_set_oper_bw(padapter, bwmode); rtw_set_oper_bw(padapter, bwmode);
rtw_set_oper_choffset(padapter, channel_offset); rtw_set_oper_choffset(padapter, channel_offset);
rtw_hal_set_chan(padapter, center_ch); // set center channel rtw_hal_set_chan(padapter, center_ch); /* set center channel */
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
_exit_critical_mutex(padapter->psetch_mutex, NULL); _exit_critical_mutex(padapter->psetch_mutex, NULL);
#endif #endif
#endif // CONFIG_DUALMAC_CONCURRENT #endif /* CONFIG_DUALMAC_CONCURRENT */
SetBWMode(padapter, bwmode, channel_offset); SetBWMode(padapter, bwmode, channel_offset);
@ -745,12 +745,12 @@ void write_cam(_adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key)
rtw_hal_set_hwreg(padapter, HW_VAR_CAM_WRITE, (u8 *)cam_val); rtw_hal_set_hwreg(padapter, HW_VAR_CAM_WRITE, (u8 *)cam_val);
//rtw_write32(padapter, WCAMI, val); /* rtw_write32(padapter, WCAMI, val); */
//cmd = CAM_POLLINIG | CAM_WRITE | (addr + j); /* cmd = CAM_POLLINIG | CAM_WRITE | (addr + j); */
//rtw_write32(padapter, RWCAM, cmd); /* rtw_write32(padapter, RWCAM, cmd); */
//DBG_88E("%s=> cam write: %x, %x\n",__func__, cmd, val); /* DBG_88E("%s=> cam write: %x, %x\n",__func__, cmd, val); */
} }
@ -792,7 +792,7 @@ void flush_all_cam_entry(_adapter *padapter)
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
//if (check_buddy_mlmeinfo_state(padapter, _HW_STATE_NOLINK_)) /* if (check_buddy_mlmeinfo_state(padapter, _HW_STATE_NOLINK_)) */
if (check_buddy_fwstate(padapter, _FW_LINKED) == false) if (check_buddy_fwstate(padapter, _FW_LINKED) == false)
{ {
rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, 0); rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, 0);
@ -803,32 +803,32 @@ void flush_all_cam_entry(_adapter *padapter)
{ {
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
struct sta_info *psta; struct sta_info *psta;
u8 cam_id;//cam_entry u8 cam_id;/* cam_entry */
psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress); psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress);
if (psta) { if (psta) {
if (psta->state & WIFI_AP_STATE) if (psta->state & WIFI_AP_STATE)
{} //clear cam when ap free per sta_info {} /* clear cam when ap free per sta_info */
else { else {
if (psta->mac_id==2) if (psta->mac_id==2)
cam_id = 5; cam_id = 5;
else else
cam_id = 4; cam_id = 4;
} }
//clear_cam_entry(padapter, cam_id); /* clear_cam_entry(padapter, cam_id); */
rtw_clearstakey_cmd(padapter, (u8*)psta, cam_id, false); rtw_clearstakey_cmd(padapter, (u8*)psta, cam_id, false);
} }
} }
else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
{ {
//clear cam when ap free per sta_info /* clear cam when ap free per sta_info */
} }
} }
#else //CONFIG_CONCURRENT_MODE #else /* CONFIG_CONCURRENT_MODE */
rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, NULL); rtw_hal_set_hwreg(padapter, HW_VAR_CAM_INVALID_ALL, NULL);
#endif //CONFIG_CONCURRENT_MODE #endif /* CONFIG_CONCURRENT_MODE */
_rtw_memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info)); _rtw_memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info));
@ -872,7 +872,7 @@ int WFD_info_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
int WMM_param_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) int WMM_param_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
{ {
//struct registry_priv *pregpriv = &padapter->registrypriv; /* struct registry_priv *pregpriv = &padapter->registrypriv; */
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
@ -886,27 +886,6 @@ int WMM_param_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
pmlmeinfo->WMM_enable = 1; pmlmeinfo->WMM_enable = 1;
_rtw_memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element)); _rtw_memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element));
return true; return true;
/*if (pregpriv->wifi_spec == 1)
{
if (pmlmeinfo->WMM_enable == 1)
{
//todo: compare the parameter set count & decide wheher to update or not
return _FAIL;
}
else
{
pmlmeinfo->WMM_enable = 1;
_rtw_rtw_memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element));
return true;
}
}
else
{
pmlmeinfo->WMM_enable = 0;
return _FAIL;
}*/
} }
void WMMOnAssocRsp(_adapter *padapter) void WMMOnAssocRsp(_adapter *padapter)
@ -937,7 +916,7 @@ void WMMOnAssocRsp(_adapter *padapter)
ACI = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 5) & 0x03; ACI = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 5) & 0x03;
ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01; ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01;
//AIFS = AIFSN * slot time + SIFS - r2t phy delay /* AIFS = AIFSN * slot time + SIFS - r2t phy delay */
AIFS = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN & 0x0f) * pmlmeinfo->slotTime + aSifsTime; AIFS = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN & 0x0f) * pmlmeinfo->slotTime + aSifsTime;
ECWMin = (pmlmeinfo->WMM_param.ac_param[i].CW & 0x0f); ECWMin = (pmlmeinfo->WMM_param.ac_param[i].CW & 0x0f);
@ -955,7 +934,7 @@ void WMMOnAssocRsp(_adapter *padapter)
case 0x1: case 0x1:
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acParm)); rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acParm));
//acm_mask |= (ACM? BIT(0):0); /* acm_mask |= (ACM? BIT(0):0); */
edca[XMIT_BK_QUEUE] = acParm; edca[XMIT_BK_QUEUE] = acParm;
break; break;
@ -986,19 +965,19 @@ void WMMOnAssocRsp(_adapter *padapter)
{ {
u32 j, tmp, change_inx; u32 j, tmp, change_inx;
//entry indx: 0->vo, 1->vi, 2->be, 3->bk. /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
for (i=0; i<4; i++) for (i=0; i<4; i++)
{ {
for (j=i+1; j<4; j++) for (j=i+1; j<4; j++)
{ {
//compare CW and AIFS /* compare CW and AIFS */
if ((edca[j] & 0xFFFF) < (edca[i] & 0xFFFF)) if ((edca[j] & 0xFFFF) < (edca[i] & 0xFFFF))
{ {
change_inx = true; change_inx = true;
} }
else if ((edca[j] & 0xFFFF) == (edca[i] & 0xFFFF)) else if ((edca[j] & 0xFFFF) == (edca[i] & 0xFFFF))
{ {
//compare TXOP /* compare TXOP */
if ((edca[j] >> 16) > (edca[i] >> 16)) if ((edca[j] >> 16) > (edca[i] >> 16))
change_inx = true; change_inx = true;
} }
@ -1082,7 +1061,7 @@ static void bwmode_update_check(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pI
pmlmeext->cur_bwmode = new_bwmode; pmlmeext->cur_bwmode = new_bwmode;
pmlmeext->cur_ch_offset = new_ch_offset; pmlmeext->cur_ch_offset = new_ch_offset;
//update HT info also /* update HT info also */
HT_info_handler(padapter, pIE); HT_info_handler(padapter, pIE);
} }
else else
@ -1097,10 +1076,10 @@ static void bwmode_update_check(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pI
WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network);
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
//set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); /* set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
//update ap's stainfo /* update ap's stainfo */
psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress); psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress);
if (psta) if (psta)
{ {
@ -1108,7 +1087,7 @@ static void bwmode_update_check(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pI
if (phtpriv_sta->ht_option) if (phtpriv_sta->ht_option)
{ {
// bwmode /* bwmode */
phtpriv_sta->bwmode = pmlmeext->cur_bwmode; phtpriv_sta->bwmode = pmlmeext->cur_bwmode;
phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset; phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset;
} }
@ -1117,13 +1096,9 @@ static void bwmode_update_check(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pI
phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20; phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20;
phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
} }
} }
//pmlmeinfo->bwmode_updated = false;//bwmode_updated done, reset it!
} }
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
} }
void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
@ -1148,13 +1123,13 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
{ {
if (i != 2) if (i != 2)
{ {
// Commented by Albert 2010/07/12 /* Commented by Albert 2010/07/12 */
// Got the endian issue here. /* Got the endian issue here. */
pmlmeinfo->HT_caps.u.HT_cap[i] &= (pIE->data[i]); pmlmeinfo->HT_caps.u.HT_cap[i] &= (pIE->data[i]);
} }
else else
{ {
//modify from fw by Thomas 2010/11/17 /* modify from fw by Thomas 2010/11/17 */
if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3)) if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3))
{ {
max_AMPDU_len = (pIE->data[i] & 0x3); max_AMPDU_len = (pIE->data[i] & 0x3);
@ -1179,7 +1154,7 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
//update the MCS rates /* update the MCS rates */
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) { if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) {
pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
@ -1191,13 +1166,13 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i];
#else #else
pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i];
#endif //CONFIG_DISABLE_MCS13TO15 #endif /* CONFIG_DISABLE_MCS13TO15 */
} }
#ifdef RTL8192C_RECONFIG_TO_1T1R #ifdef RTL8192C_RECONFIG_TO_1T1R
pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
#endif #endif
} }
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
return; return;
} }
@ -1219,7 +1194,7 @@ void HT_info_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
pmlmeinfo->HT_info_enable = 1; pmlmeinfo->HT_info_enable = 1;
_rtw_memcpy(&(pmlmeinfo->HT_info), pIE->data, pIE->Length); _rtw_memcpy(&(pmlmeinfo->HT_info), pIE->data, pIE->Length);
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
return; return;
} }
@ -1227,7 +1202,7 @@ void HTOnAssocRsp(_adapter *padapter)
{ {
unsigned char max_AMPDU_len; unsigned char max_AMPDU_len;
unsigned char min_MPDU_spacing; unsigned char min_MPDU_spacing;
//struct registry_priv *pregpriv = &padapter->registrypriv; /* struct registry_priv *pregpriv = &padapter->registrypriv; */
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
@ -1240,11 +1215,11 @@ void HTOnAssocRsp(_adapter *padapter)
else else
{ {
pmlmeinfo->HT_enable = 0; pmlmeinfo->HT_enable = 0;
//set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); /* set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */
return; return;
} }
//handle A-MPDU parameter field /* handle A-MPDU parameter field */
/* /*
AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
AMPDU_para [4:2]:Min MPDU Start Spacing AMPDU_para [4:2]:Min MPDU Start Spacing
@ -1278,12 +1253,12 @@ void VCS_update(_adapter *padapter, struct sta_info *psta)
switch (pregpriv->vrtl_carrier_sense)/* 0:off 1:on 2:auto */ switch (pregpriv->vrtl_carrier_sense)/* 0:off 1:on 2:auto */
{ {
case 0: //off case 0: /* off */
psta->rtsen = 0; psta->rtsen = 0;
psta->cts2self = 0; psta->cts2self = 0;
break; break;
case 1: //on case 1: /* on */
if (pregpriv->vcs_type == 1) /* 1:RTS/CTS 2:CTS to self */ if (pregpriv->vcs_type == 1) /* 1:RTS/CTS 2:CTS to self */
{ {
psta->rtsen = 1; psta->rtsen = 1;
@ -1296,7 +1271,7 @@ void VCS_update(_adapter *padapter, struct sta_info *psta)
} }
break; break;
case 2: //auto case 2: /* auto */
default: default:
if ((pmlmeinfo->ERP_enable) && (pmlmeinfo->ERP_IE & BIT(1))) if ((pmlmeinfo->ERP_enable) && (pmlmeinfo->ERP_IE & BIT(1)))
{ {
@ -1323,7 +1298,7 @@ void VCS_update(_adapter *padapter, struct sta_info *psta)
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
int check_ap_tdls_prohibited(u8 *pframe, u8 pkt_len) int check_ap_tdls_prohibited(u8 *pframe, u8 pkt_len)
{ {
u8 tdls_prohibited_bit = 0x40; //bit(38); TDLS_prohibited u8 tdls_prohibited_bit = 0x40; /* bit(38); TDLS_prohibited */
if (pkt_len < 5) if (pkt_len < 5)
{ {
@ -1336,7 +1311,7 @@ int check_ap_tdls_prohibited(u8 *pframe, u8 pkt_len)
return false; return false;
} }
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len) int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len)
{ {
@ -1344,7 +1319,7 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len)
unsigned char *p; unsigned char *p;
unsigned short val16, subtype; unsigned short val16, subtype;
struct wlan_network *cur_network = &(Adapter->mlmepriv.cur_network); struct wlan_network *cur_network = &(Adapter->mlmepriv.cur_network);
//u8 wpa_ie[255],rsn_ie[255]; /* u8 wpa_ie[255],rsn_ie[255]; */
u16 wpa_len=0,rsn_len=0; u16 wpa_len=0,rsn_len=0;
u8 encryp_protocol = 0; u8 encryp_protocol = 0;
WLAN_BSSID_EX *bssid; WLAN_BSSID_EX *bssid;
@ -1414,12 +1389,12 @@ int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len)
cur_network->BcnInfo.ht_cap_info, cur_network->BcnInfo.ht_info_infos_0); cur_network->BcnInfo.ht_cap_info, cur_network->BcnInfo.ht_info_infos_0);
DBG_88E("%s bw mode change, disconnect\n", __func__); DBG_88E("%s bw mode change, disconnect\n", __func__);
{ {
//bcn_info_update /* bcn_info_update */
cur_network->BcnInfo.ht_cap_info = ht_cap_info; cur_network->BcnInfo.ht_cap_info = ht_cap_info;
cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0; cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0;
//to do : need to check that whether modify related register of BB or not /* to do : need to check that whether modify related register of BB or not */
} }
//goto _mismatch; /* goto _mismatch; */
} }
/* Checking for channel */ /* Checking for channel */
@ -1555,8 +1530,8 @@ void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
struct tdls_info *ptdlsinfo = &padapter->tdlsinfo; struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
u8 tdls_prohibited[] = { 0x00, 0x00, 0x00, 0x00, 0x10 }; //bit(38): TDLS_prohibited u8 tdls_prohibited[] = { 0x00, 0x00, 0x00, 0x00, 0x10 }; /* bit(38): TDLS_prohibited */
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
len = pkt_len - (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN); len = pkt_len - (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN);
@ -1566,8 +1541,8 @@ void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta
switch (pIE->ElementID) switch (pIE->ElementID)
{ {
case _HT_EXTRA_INFO_IE_: //HT info case _HT_EXTRA_INFO_IE_: /* HT info */
//HT_info_handler(padapter, pIE); /* HT_info_handler(padapter, pIE); */
bwmode_update_check(padapter, pIE); bwmode_update_check(padapter, pIE);
break; break;
@ -1581,7 +1556,7 @@ void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta
if ( check_ap_tdls_prohibited(pIE->data, pIE->Length) == true ) if ( check_ap_tdls_prohibited(pIE->data, pIE->Length) == true )
ptdlsinfo->ap_prohibited = true; ptdlsinfo->ap_prohibited = true;
break; break;
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
default: default:
break; break;
} }
@ -1618,7 +1593,7 @@ void process_csa_ie(_adapter *padapter, u8 *pframe, uint pkt_len)
i += (pIE->Length + 2); i += (pIE->Length + 2);
} }
} }
#endif //CONFIG_DFS #endif /* CONFIG_DFS */
unsigned int is_ap_in_tkip(_adapter *padapter) unsigned int is_ap_in_tkip(_adapter *padapter)
{ {
@ -1917,27 +1892,27 @@ void enable_rate_adaptive(_adapter *padapter, u32 mac_id)
void set_sta_rate(_adapter *padapter, struct sta_info *psta) void set_sta_rate(_adapter *padapter, struct sta_info *psta)
{ {
//rate adaptive /* rate adaptive */
enable_rate_adaptive(padapter, psta->mac_id); enable_rate_adaptive(padapter, psta->mac_id);
} }
// Update RRSR and Rate for USERATE /* Update RRSR and Rate for USERATE */
void update_tx_basic_rate(_adapter *padapter, u8 wirelessmode) void update_tx_basic_rate(_adapter *padapter, u8 wirelessmode)
{ {
NDIS_802_11_RATES_EX supported_rates; NDIS_802_11_RATES_EX supported_rates;
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
struct wifidirect_info* pwdinfo = &padapter->wdinfo; struct wifidirect_info* pwdinfo = &padapter->wdinfo;
// Added by Albert 2011/03/22 /* Added by Albert 2011/03/22 */
// In the P2P mode, the driver should not support the b mode. /* In the P2P mode, the driver should not support the b mode. */
// So, the Tx packet shouldn't use the CCK rate /* So, the Tx packet shouldn't use the CCK rate */
if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
return; return;
#endif //CONFIG_P2P #endif /* CONFIG_P2P */
#ifdef CONFIG_INTEL_WIDI #ifdef CONFIG_INTEL_WIDI
if (padapter->mlmepriv.widi_state != INTEL_WIDI_STATE_NONE) if (padapter->mlmepriv.widi_state != INTEL_WIDI_STATE_NONE)
return; return;
#endif //CONFIG_INTEL_WIDI #endif /* CONFIG_INTEL_WIDI */
_rtw_memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX); _rtw_memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX);
@ -2063,13 +2038,13 @@ void update_IOT_info(_adapter *padapter)
case HT_IOT_PEER_RALINK: case HT_IOT_PEER_RALINK:
pmlmeinfo->turboMode_cts2self = 0; pmlmeinfo->turboMode_cts2self = 0;
pmlmeinfo->turboMode_rtsen = 1; pmlmeinfo->turboMode_rtsen = 1;
//disable high power /* disable high power */
Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false); Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false);
break; break;
case HT_IOT_PEER_REALTEK: case HT_IOT_PEER_REALTEK:
//rtw_write16(padapter, 0x4cc, 0xffff); /* rtw_write16(padapter, 0x4cc, 0xffff); */
//rtw_write16(padapter, 0x546, 0x01c0); /* rtw_write16(padapter, 0x546, 0x01c0); */
//disable high power /* disable high power */
Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false); Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false);
break; break;
default: default:
@ -2086,14 +2061,14 @@ void update_capinfo(PADAPTER Adapter, u16 updateCap)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
bool ShortPreamble; bool ShortPreamble;
// Check preamble mode, 2005.01.06, by rcnjko. /* Check preamble mode, 2005.01.06, by rcnjko. */
// Mark to update preamble value forever, 2008.03.18 by lanhsin /* Mark to update preamble value forever, 2008.03.18 by lanhsin */
//if ( pMgntInfo->RegPreambleMode == PREAMBLE_AUTO ) /* if ( pMgntInfo->RegPreambleMode == PREAMBLE_AUTO ) */
{ {
if (updateCap & cShortPreamble) if (updateCap & cShortPreamble)
{ // Short Preamble { /* Short Preamble */
if (pmlmeinfo->preamble_mode != PREAMBLE_SHORT) // PREAMBLE_LONG or PREAMBLE_AUTO if (pmlmeinfo->preamble_mode != PREAMBLE_SHORT) /* PREAMBLE_LONG or PREAMBLE_AUTO */
{ {
ShortPreamble = true; ShortPreamble = true;
pmlmeinfo->preamble_mode = PREAMBLE_SHORT; pmlmeinfo->preamble_mode = PREAMBLE_SHORT;
@ -2101,8 +2076,8 @@ void update_capinfo(PADAPTER Adapter, u16 updateCap)
} }
} }
else else
{ // Long Preamble { /* Long Preamble */
if (pmlmeinfo->preamble_mode != PREAMBLE_LONG) // PREAMBLE_SHORT or PREAMBLE_AUTO if (pmlmeinfo->preamble_mode != PREAMBLE_LONG) /* PREAMBLE_SHORT or PREAMBLE_AUTO */
{ {
ShortPreamble = false; ShortPreamble = false;
pmlmeinfo->preamble_mode = PREAMBLE_LONG; pmlmeinfo->preamble_mode = PREAMBLE_LONG;
@ -2112,23 +2087,23 @@ void update_capinfo(PADAPTER Adapter, u16 updateCap)
} }
if ( updateCap & cIBSS ) { if ( updateCap & cIBSS ) {
//Filen: See 802.11-2007 p.91 /* Filen: See 802.11-2007 p.91 */
pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME; pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME;
} }
else else
{ {
//Filen: See 802.11-2007 p.90 /* Filen: See 802.11-2007 p.90 */
if ( pmlmeext->cur_wireless_mode & (WIRELESS_11G | WIRELESS_11_24N)) if ( pmlmeext->cur_wireless_mode & (WIRELESS_11G | WIRELESS_11_24N))
{ {
if ( (updateCap & cShortSlotTime) /* && (!(pMgntInfo->pHTInfo->RT2RT_HT_Mode & RT_HT_CAP_USE_LONG_PREAMBLE)) */) if ( (updateCap & cShortSlotTime) /* && (!(pMgntInfo->pHTInfo->RT2RT_HT_Mode & RT_HT_CAP_USE_LONG_PREAMBLE)) */)
{ // Short Slot Time { /* Short Slot Time */
if (pmlmeinfo->slotTime != SHORT_SLOT_TIME) if (pmlmeinfo->slotTime != SHORT_SLOT_TIME)
{ {
pmlmeinfo->slotTime = SHORT_SLOT_TIME; pmlmeinfo->slotTime = SHORT_SLOT_TIME;
} }
} }
else else
{ // Long Slot Time { /* Long Slot Time */
if (pmlmeinfo->slotTime != NON_SHORT_SLOT_TIME) if (pmlmeinfo->slotTime != NON_SHORT_SLOT_TIME)
{ {
pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME; pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME;
@ -2141,7 +2116,7 @@ void update_capinfo(PADAPTER Adapter, u16 updateCap)
} }
else else
{ {
//B Mode /* B Mode */
pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME; pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME;
} }
} }
@ -2197,16 +2172,9 @@ void update_wireless_mode(_adapter *padapter)
} }
pmlmeext->cur_wireless_mode = network_type & padapter->registrypriv.wireless_mode; pmlmeext->cur_wireless_mode = network_type & padapter->registrypriv.wireless_mode;
/*
if ((pmlmeext->cur_wireless_mode==WIRELESS_11G) ||
(pmlmeext->cur_wireless_mode==WIRELESS_11BG))//WIRELESS_MODE_G)
SIFS_Timer = 0x0a0a;//CCK
else
SIFS_Timer = 0x0e0e;//pHalData->SifsTime; //OFDM
*/
SIFS_Timer = 0x0a0a0808; //0x0808 -> for CCK, 0x0a0a -> for OFDM SIFS_Timer = 0x0a0a0808; /* 0x0808 -> for CCK, 0x0a0a -> for OFDM */
//change this value if having IOT issues. /* change this value if having IOT issues. */
padapter->HalFunc.SetHwRegHandler( padapter, HW_VAR_RESP_SIFS, (u8 *)&SIFS_Timer); padapter->HalFunc.SetHwRegHandler( padapter, HW_VAR_RESP_SIFS, (u8 *)&SIFS_Timer);
@ -2223,7 +2191,7 @@ void update_bmc_sta_support_rate(_adapter *padapter, u32 mac_id)
if (pmlmeext->cur_wireless_mode & WIRELESS_11B) if (pmlmeext->cur_wireless_mode & WIRELESS_11B)
{ {
// Only B, B/G, and B/G/N AP could use CCK rate /* Only B, B/G, and B/G/N AP could use CCK rate */
_rtw_memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), rtw_basic_rate_cck, 4); _rtw_memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), rtw_basic_rate_cck, 4);
} }
else else
@ -2338,19 +2306,19 @@ int rtw_handle_dualmac(_adapter *adapter, bool init)
} else { } else {
adapter->pbuddy_adapter = pbuddy_padapter; adapter->pbuddy_adapter = pbuddy_padapter;
pbuddy_padapter->pbuddy_adapter = adapter; pbuddy_padapter->pbuddy_adapter = adapter;
// clear global value /* clear global value */
pbuddy_padapter = NULL; pbuddy_padapter = NULL;
DBG_88E("%s(): pbuddy_padapter exist, Exchange Information\n",__func__); DBG_88E("%s(): pbuddy_padapter exist, Exchange Information\n",__func__);
} }
#ifdef CONFIG_DUALMAC_CONCURRENT #ifdef CONFIG_DUALMAC_CONCURRENT
if (dvobj->InterfaceNumber == 0) { if (dvobj->InterfaceNumber == 0) {
//set adapter_type/iface type /* set adapter_type/iface type */
adapter->isprimary = true; adapter->isprimary = true;
adapter->adapter_type = PRIMARY_ADAPTER; adapter->adapter_type = PRIMARY_ADAPTER;
adapter->iface_type = IFACE_PORT0; adapter->iface_type = IFACE_PORT0;
DBG_88E("%s(): PRIMARY_ADAPTER\n",__func__); DBG_88E("%s(): PRIMARY_ADAPTER\n",__func__);
} else { } else {
//set adapter_type/iface type /* set adapter_type/iface type */
adapter->isprimary = false; adapter->isprimary = false;
adapter->adapter_type = SECONDARY_ADAPTER; adapter->adapter_type = SECONDARY_ADAPTER;
adapter->iface_type = IFACE_PORT1; adapter->iface_type = IFACE_PORT1;

File diff suppressed because it is too large Load diff