rtl8188eu: Change C90 comments to /* */ form

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2015-02-19 15:34:32 -06:00
parent 9b5b5c4e12
commit 54abf571c4
21 changed files with 4526 additions and 4764 deletions

File diff suppressed because it is too large Load diff

View file

@ -56,7 +56,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:
@ -70,7 +70,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;
@ -78,7 +78,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)
@ -101,7 +101,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);
@ -301,8 +301,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;
@ -379,9 +379,9 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
static __inline__ void __network_hash_link(struct adapter *priv, static __inline__ void __network_hash_link(struct 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)
@ -389,15 +389,15 @@ static __inline__ void __network_hash_link(struct 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)
@ -405,7 +405,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); */
} }
@ -423,7 +423,7 @@ static int __nat25_db_network_lookup_and_replace(struct 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);
@ -571,7 +571,7 @@ void nat25_db_expire(struct 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++)
{ {
@ -668,13 +668,13 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
case NAT25_INSERT: case NAT25_INSERT:
{ {
tmp = be32_to_cpu(iph->saddr); tmp = be32_to_cpu(iph->saddr);
//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); DEBUG_INFO("NAT25: Insert IP, SA=%08x, DA=%08x\n", iph->saddr, iph->daddr);
__nat25_generate_ipv4_network_addr(networkAddr, &tmp); __nat25_generate_ipv4_network_addr(networkAddr, &tmp);
//record source IP address and , source mac address into db /* 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);
@ -697,11 +697,11 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
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");
@ -737,14 +737,14 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
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;
@ -771,7 +771,7 @@ int nat25_db_handle(struct 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);
@ -814,28 +814,28 @@ int nat25_db_handle(struct 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;
} }
@ -848,7 +848,7 @@ int nat25_db_handle(struct 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))
{ {
@ -904,7 +904,7 @@ int nat25_db_handle(struct 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
@ -928,7 +928,7 @@ int nat25_db_handle(struct 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
@ -962,7 +962,7 @@ int nat25_db_handle(struct 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",
@ -991,7 +991,7 @@ int nat25_db_handle(struct 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;
@ -1064,7 +1064,7 @@ int nat25_db_handle(struct 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)
{ {
@ -1075,7 +1075,7 @@ int nat25_db_handle(struct 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");
@ -1095,19 +1095,19 @@ int nat25_db_handle(struct 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 = (__be16 *)tag->tag_data; pMagic = (__be16 *)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");
@ -1123,7 +1123,7 @@ int nat25_db_handle(struct 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);
@ -1186,7 +1186,7 @@ int nat25_db_handle(struct 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;
@ -1332,7 +1332,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
return -1; return -1;
} }
} }
#endif // CL_IPV6_PASS #endif /* CL_IPV6_PASS */
return -1; return -1;
} }
@ -1380,7 +1380,7 @@ int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb)
!memcmp(priv->br_ip, skb->data+ETH_HLEN+16, 4)) || !memcmp(priv->br_ip, skb->data+ETH_HLEN+16, 4)) ||
((*((__be16 *)(skb->data+ETH_ALEN*2)) == __constant_htons(ETH_P_ARP)) && ((*((__be16 *)(skb->data+ETH_ALEN*2)) == __constant_htons(ETH_P_ARP)) &&
!memcmp(priv->br_ip, skb->data+ETH_HLEN+24, 4))) { !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);
} }
} }
@ -1394,7 +1394,7 @@ int nat25_handle_frame(struct 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;
} }
} }
@ -1435,30 +1435,30 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
{ {
__be16 protocol = *((__be16 *)(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));
if(dhcph->cookie == DHCP_MAGIC) // match magic word if(dhcph->cookie == DHCP_MAGIC) /* match magic word */
{ {
if(!(dhcph->flags & BROADCAST_FLAG)) // if not broadcast if(!(dhcph->flags & 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 |= BROADCAST_FLAG; dhcph->flags |= BROADCAST_FLAG;
// recalculate checksum /* recalculate checksum */
sum = ~(udph->check) & 0xffff; sum = ~(udph->check) & 0xffff;
sum += dhcph->flags; sum += dhcph->flags;
while(sum >> 16) while(sum >> 16)
@ -1479,8 +1479,8 @@ void *scdb_findEntry(struct 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);
@ -1488,15 +1488,15 @@ void *scdb_findEntry(struct 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,11 +27,11 @@
#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 */
#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.
@ -45,13 +45,13 @@ sint _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv)
; ;
_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;
@ -99,7 +99,7 @@ sint _rtw_init_evt_priv(struct evt_priv *pevtpriv)
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;
@ -119,7 +119,7 @@ sint _rtw_init_evt_priv(struct evt_priv *pevtpriv)
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);
@ -175,7 +175,7 @@ void _rtw_free_cmd_priv (struct cmd_priv *pcmdpriv)
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)
@ -206,12 +206,12 @@ sint _rtw_enqueue_cmd(_queue *queue, struct cmd_obj *obj)
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:
@ -228,7 +228,7 @@ struct cmd_obj *_rtw_dequeue_cmd(_queue *queue)
; ;
//_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;
@ -238,7 +238,7 @@ struct cmd_obj *_rtw_dequeue_cmd(_queue *queue)
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);
; ;
@ -283,10 +283,10 @@ void rtw_free_cmd_priv (struct cmd_priv *pcmdpriv)
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( (adapter_to_pwrctl(pcmdpriv->padapter)->bHWPwrPindetect) if( (adapter_to_pwrctl(pcmdpriv->padapter)->bHWPwrPindetect)
&&(!pcmdpriv->padapter->registrypriv.usbss_enable) &&(!pcmdpriv->padapter->registrypriv.usbss_enable)
) )
@ -296,7 +296,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_871X("==>enqueue POWER_SAVING_CTRL_WK_CID\n"); /* DBG_871X("==>enqueue POWER_SAVING_CTRL_WK_CID\n"); */
bAllow = true; bAllow = true;
} }
} }
@ -307,14 +307,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_871X("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __FUNCTION__, /* DBG_871X("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __FUNCTION__, */
// 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;
} }
@ -366,7 +366,7 @@ void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv)
{ {
; ;
pcmdpriv->cmd_done_cnt++; pcmdpriv->cmd_done_cnt++;
//_rtw_up_sema(&(pcmdpriv->cmd_done_sema)); /* _rtw_up_sema(&(pcmdpriv->cmd_done_sema)); */
; ;
} }
@ -376,7 +376,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd)
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);
} }
@ -384,12 +384,12 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd)
{ {
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));
; ;
@ -451,7 +451,7 @@ thread_return rtw_cmd_thread(thread_context context)
if(rtw_is_list_empty(&(pcmdpriv->cmd_queue.queue))) if(rtw_is_list_empty(&(pcmdpriv->cmd_queue.queue)))
{ {
//DBG_871X("%s: cmd queue is empty!\n", __func__); /* DBG_871X("%s: cmd queue is empty!\n", __func__); */
continue; continue;
} }
@ -487,7 +487,7 @@ _next:
pcmdpriv->cmd_issued_cnt++; pcmdpriv->cmd_issued_cnt++;
pcmd->cmdsz = _RND4((pcmd->cmdsz));//_RND4 pcmd->cmdsz = _RND4((pcmd->cmdsz));/* _RND4 */
memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz); memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);
@ -512,7 +512,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;
@ -523,8 +523,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
@ -541,7 +541,7 @@ 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) {
@ -551,7 +551,7 @@ post_process:
break; break;
} }
//DBG_871X("%s: leaving... drop cmdcode:%u\n", __FUNCTION__, pcmd->cmdcode); /* DBG_871X("%s: leaving... drop cmdcode:%u\n", __FUNCTION__, pcmd->cmdcode); */
rtw_free_cmd_obj(pcmd); rtw_free_cmd_obj(pcmd);
}while(1); }while(1);
@ -587,7 +587,7 @@ u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj)
_exit_critical_bh(&queue->lock, &irqL); _exit_critical_bh(&queue->lock, &irqL);
//rtw_evt_notify_isr(pevtpriv); /* rtw_evt_notify_isr(pevtpriv); */
exit: exit:
@ -696,7 +696,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, NDIS_802_11_SSID *ssid, int ssi
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 */
; ;
@ -710,7 +710,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, NDIS_802_11_SSID *ssid, int ssi
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)
@ -771,12 +771,12 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, NDIS_802_11_SSID *ssid, int ssi
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 * ( padapter->mlmeextpriv.max_chan_nums + ( padapter->mlmeextpriv.max_chan_nums / RTW_SCAN_NUM_OF_CH ) * RTW_STAY_AP_CH_MILLISECOND ) + 1000 ); _set_timer(&pmlmepriv->scan_to_timer, SURVEY_TO * ( padapter->mlmeextpriv.max_chan_nums + ( padapter->mlmeextpriv.max_chan_nums / 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);
} }
@ -811,7 +811,7 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset)
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;
// memcpy(pbsetdataratepara, rateset, sizeof(u32)); /* memcpy(pbsetdataratepara, rateset, sizeof(u32)); */
#else #else
pbsetdataratepara->mac_id = 5; pbsetdataratepara->mac_id = 5;
memcpy(pbsetdataratepara->datarates, rateset, NumRates); memcpy(pbsetdataratepara->datarates, rateset, NumRates);
@ -871,8 +871,8 @@ u8 rtw_setphy_cmd(struct 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;
; ;
@ -1044,7 +1044,7 @@ void rtw_getbbrfreg_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *p
{ {
; ;
//rtw_free_cmd_obj(pcmd); /* rtw_free_cmd_obj(pcmd); */
rtw_mfree((unsigned char*) pcmd->parmbuf, pcmd->cmdsz); rtw_mfree((unsigned char*) pcmd->parmbuf, pcmd->cmdsz);
rtw_mfree((unsigned char*) pcmd, sizeof(struct cmd_obj)); rtw_mfree((unsigned char*) pcmd, sizeof(struct cmd_obj));
@ -1146,7 +1146,7 @@ u8 rtw_joinbss_cmd(struct 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);
@ -1167,19 +1167,11 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork)
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)
@ -1227,10 +1219,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork)
} }
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 )
{ {
@ -1251,11 +1243,11 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork)
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 */
} }
} }
@ -1263,14 +1255,14 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork)
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);
} }
@ -1287,10 +1279,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network* pnetwork)
DBG_871X("%s: smart_ps=%d\n", __func__, adapter_to_pwrctl(padapter)->smart_ps); DBG_871X("%s: smart_ps=%d\n", __func__, adapter_to_pwrctl(padapter)->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 */
_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;
@ -1413,7 +1405,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key, bool en
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);
@ -1424,14 +1416,14 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key, bool en
if((sta->tdls_sta_state&TDLS_LINKED_STATE)==TDLS_LINKED_STATE) if((sta->tdls_sta_state&TDLS_LINKED_STATE)==TDLS_LINKED_STATE)
memcpy(&psetstakey_para->key, sta->tpk.tk, 16); memcpy(&psetstakey_para->key, sta->tpk.tk, 16);
else else
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16); memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16);
} }
else { else {
memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16); 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;
if(enqueue) if(enqueue)
@ -1581,7 +1573,7 @@ u8 rtw_getrttbl_cmd(struct adapter *padapter, struct getratable_rsp *pval)
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);
@ -1673,9 +1665,9 @@ u8 rtw_addbareq_cmd(struct adapter*padapter, u8 tid, u8 *addr)
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_871X("rtw_addbareq_cmd, tid=%d\n", tid); /* DBG_871X("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:
@ -1684,7 +1676,7 @@ exit:
return res; return res;
} }
//add for CONFIG_IEEE80211W, none 11w can use it /* add for CONFIG_IEEE80211W, none 11w can use it */
u8 rtw_reset_securitypriv_cmd(struct adapter*padapter) u8 rtw_reset_securitypriv_cmd(struct adapter*padapter)
{ {
struct cmd_obj* ph2c; struct cmd_obj* ph2c;
@ -1714,7 +1706,7 @@ u8 rtw_reset_securitypriv_cmd(struct adapter*padapter)
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:
@ -1754,7 +1746,7 @@ u8 rtw_free_assoc_resources_cmd(struct adapter*padapter)
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:
@ -1792,7 +1784,7 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter*padapter)
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:
@ -1870,13 +1862,13 @@ u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue)
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;
@ -1886,7 +1878,7 @@ u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue)
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));
@ -1899,14 +1891,14 @@ u8 rtw_set_chplan_cmd(struct adapter*padapter, u8 chplan, u8 enqueue)
} }
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;
@ -2027,7 +2019,7 @@ u8 rtw_tdls_cmd(struct adapter *padapter, u8 *addr, u8 option)
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:
@ -2065,7 +2057,7 @@ u8 rtw_event_polling_cmd(struct adapter*padapter)
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:
@ -2081,7 +2073,7 @@ static void traffic_status_watchdog(struct adapter *padapter)
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
u8 bEnterPS; u8 bEnterPS;
#endif #endif
u16 BusyThreshold = 200;// 100; u16 BusyThreshold = 200;/* 100; */
u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false;
u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false; u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false;
#ifdef CONFIG_FTP_PROTECT #ifdef CONFIG_FTP_PROTECT
@ -2090,19 +2082,19 @@ static void traffic_status_watchdog(struct 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 */
RT_LINK_DETECT_T * link_detect = &pmlmepriv->LinkDetectInfo; RT_LINK_DETECT_T * link_detect = &pmlmepriv->LinkDetectInfo;
// /* */
// 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)*/)
{ {
// if we raise bBusyTraffic in last watchdog, using lower threshold. /* if we raise bBusyTraffic in last watchdog, using lower threshold. */
if (pmlmepriv->LinkDetectInfo.bBusyTraffic) if (pmlmepriv->LinkDetectInfo.bBusyTraffic)
BusyThreshold =180; // 75; BusyThreshold =180; /* 75; */
if( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold || if( pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold ||
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold ) pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold )
{ {
@ -2114,7 +2106,7 @@ static void traffic_status_watchdog(struct 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 )
{ {
@ -2140,7 +2132,7 @@ static void traffic_status_watchdog(struct 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_TRAFFIC_PROTECT #ifdef CONFIG_TRAFFIC_PROTECT
#define TX_ACTIVE_TH 2 #define TX_ACTIVE_TH 2
@ -2162,22 +2154,22 @@ static void traffic_status_watchdog(struct adapter *padapter)
#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_871X("Tx = %d, Rx = %d \n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod); /* DBG_871X("Tx = %d, Rx = %d \n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod); */
bEnterPS= false; bEnterPS= false;
} }
else else
@ -2185,7 +2177,7 @@ static void traffic_status_watchdog(struct 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);
@ -2195,7 +2187,7 @@ static void traffic_status_watchdog(struct adapter *padapter)
LPS_Leave(padapter); LPS_Leave(padapter);
} }
} }
#endif // CONFIG_LPS #endif /* CONFIG_LPS */
} }
else else
{ {
@ -2230,13 +2222,13 @@ void dynamic_chk_wk_hdl(struct 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);
@ -2244,12 +2236,12 @@ void dynamic_chk_wk_hdl(struct 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
} }
@ -2274,26 +2266,26 @@ void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
switch(lps_ctrl_type) switch(lps_ctrl_type)
{ {
case LPS_CTRL_SCAN: case LPS_CTRL_SCAN:
//DBG_871X("LPS_CTRL_SCAN \n"); /* DBG_871X("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_871X("LPS_CTRL_JOINBSS \n"); /* DBG_871X("LPS_CTRL_JOINBSS \n"); */
LPS_Leave(padapter); LPS_Leave(padapter);
break; break;
case LPS_CTRL_CONNECT: case LPS_CTRL_CONNECT:
//DBG_871X("LPS_CTRL_CONNECT \n"); /* DBG_871X("LPS_CTRL_CONNECT \n"); */
mstatus = 1;//connect mstatus = 1;/* connect */
// Reset LPS Setting /* Reset LPS Setting */
pwrpriv->LpsIdleCount = 0; pwrpriv->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
@ -2301,8 +2293,8 @@ void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
#endif #endif
break; break;
case LPS_CTRL_DISCONNECT: case LPS_CTRL_DISCONNECT:
//DBG_871X("LPS_CTRL_DISCONNECT \n"); /* DBG_871X("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)
@ -2313,7 +2305,7 @@ void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
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_871X("LPS_CTRL_SPECIAL_PACKET \n"); /* DBG_871X("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);
@ -2324,7 +2316,7 @@ void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
} }
break; break;
case LPS_CTRL_LEAVE: case LPS_CTRL_LEAVE:
//DBG_871X("LPS_CTRL_LEAVE \n"); /* DBG_871X("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)
@ -2486,7 +2478,7 @@ void power_saving_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz)
rtw_ps_processor(padapter); rtw_ps_processor(padapter);
} }
//add for CONFIG_IEEE80211W, none 11w can use it /* add for CONFIG_IEEE80211W, none 11w can use it */
static void reset_securitypriv_hdl(struct adapter *padapter) static void reset_securitypriv_hdl(struct adapter *padapter)
{ {
rtw_reset_securitypriv(padapter); rtw_reset_securitypriv(padapter);
@ -2527,8 +2519,8 @@ u8 p2p_protocol_wk_cmd(struct adapter*padapter, int intCmdType )
} }
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));
@ -2541,7 +2533,7 @@ exit:
return res; return res;
} }
#endif //CONFIG_P2P #endif /* CONFIG_P2P */
u8 rtw_ps_cmd(struct adapter*padapter) u8 rtw_ps_cmd(struct adapter*padapter)
{ {
@ -2594,8 +2586,8 @@ static void rtw_chk_hi_queue_hdl(struct 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);
@ -2618,7 +2610,7 @@ static void rtw_chk_hi_queue_hdl(struct 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);
} }
@ -2770,8 +2762,8 @@ void event_polling_hdl(struct adapter *padapter, u8 *pbuf, int sz)
c2h_id_filter ccx_id_filter = rtw_hal_c2h_id_filter_ccx(padapter); c2h_id_filter ccx_id_filter = rtw_hal_c2h_id_filter_ccx(padapter);
u8 check_c2hcmd, check_ccx; u8 check_c2hcmd, check_ccx;
//check_c2hcmd = rtw_read8(padapter, REG_C2HEVT_CLEAR); /* check_c2hcmd = rtw_read8(padapter, REG_C2HEVT_CLEAR); */
//check_ccx= rtw_read8(padapter, REG_C2HEVT_MSG_NORMAL); /* check_ccx= rtw_read8(padapter, REG_C2HEVT_MSG_NORMAL); */
rtw_hal_get_hwreg(padapter, HW_VAR_C2HEVT_CLEAR, (u8 *)(&check_c2hcmd)); rtw_hal_get_hwreg(padapter, HW_VAR_C2HEVT_CLEAR, (u8 *)(&check_c2hcmd));
rtw_hal_get_hwreg(padapter, HW_VAR_C2HEVT_MSG_NORMAL, (u8 *)(&check_ccx)); rtw_hal_get_hwreg(padapter, HW_VAR_C2HEVT_MSG_NORMAL, (u8 *)(&check_ccx));
@ -2845,23 +2837,23 @@ u8 rtw_drvextra_cmd_hdl(struct 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 */
//add for CONFIG_IEEE80211W, none 11w can use it /* add for CONFIG_IEEE80211W, none 11w can use it */
case RESET_SECURITYPRIV: case RESET_SECURITYPRIV:
reset_securitypriv_hdl(padapter); reset_securitypriv_hdl(padapter);
break; break;
@ -2896,8 +2888,8 @@ void rtw_survey_cmd_callback(struct adapter* padapter , struct cmd_obj *pcmd)
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) {
@ -2905,7 +2897,7 @@ void rtw_survey_cmd_callback(struct adapter* padapter , struct cmd_obj *pcmd)
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);
; ;
@ -2928,11 +2920,11 @@ void rtw_disassoc_cmd_callback(struct adapter* padapter, struct cmd_obj *pcmd)
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:
@ -2949,8 +2941,8 @@ void rtw_joinbss_cmd_callback(struct adapter* padapter, struct cmd_obj *pcmd)
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)
@ -2985,14 +2977,14 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
_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);
@ -3045,20 +3037,20 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
pnetwork->Length = get_WLAN_BSSID_EX_sz(pnetwork); pnetwork->Length = get_WLAN_BSSID_EX_sz(pnetwork);
memcpy(&(pwlan->network), pnetwork, pnetwork->Length); 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 */
memcpy(&tgt_network->network, pnetwork, (get_WLAN_BSSID_EX_sz(pnetwork))); 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) */
} }
@ -3089,15 +3081,10 @@ void rtw_setstaKey_cmdrsp_callback(struct adapter* padapter , struct cmd_obj *p
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);
;
} }
void rtw_setassocsta_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd) void rtw_setassocsta_cmdrsp_callback(struct adapter* padapter, struct cmd_obj *pcmd)
{ {
_irqL irqL; _irqL irqL;

View file

@ -291,7 +291,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;
} }
@ -343,7 +343,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++)
{ {
@ -556,7 +556,7 @@ 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 = 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);
@ -583,7 +583,7 @@ 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 = 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);
@ -609,7 +609,7 @@ 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 = 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);
@ -636,7 +636,7 @@ 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 = 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);
@ -856,7 +856,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,
@ -924,7 +924,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,
@ -1008,7 +1008,7 @@ int proc_get_all_sta_info(char *page, char **start,
plist = get_next(plist); plist = get_next(plist);
//if(extra_arg == psta->aid) /* if(extra_arg == psta->aid) */
{ {
len += snprintf(page + len, count - len, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->hwaddr)); len += snprintf(page + len, count - len, "sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->hwaddr));
len += snprintf(page + len, count - len, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self); len += snprintf(page + len, count - len, "rtsen=%d, cts2slef=%d\n", psta->rtsen, psta->cts2self);
@ -1018,7 +1018,7 @@ int proc_get_all_sta_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 */
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);
@ -1071,7 +1071,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;
@ -1079,10 +1079,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;
@ -1092,14 +1092,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

@ -45,10 +45,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. */
//------------------------------------------------------------------------------ /* */
BOOLEAN BOOLEAN
Efuse_Read1ByteFromFakeContent( Efuse_Read1ByteFromFakeContent(
@ -65,7 +65,7 @@ Efuse_Read1ByteFromFakeContent(
{ {
return false; return false;
} }
//DbgPrint("Read fake content, offset = %d\n", Offset); /* DbgPrint("Read fake content, offset = %d\n", Offset); */
if(fakeEfuseBank == 0) if(fakeEfuseBank == 0)
*Value = fakeEfuseContent[Offset]; *Value = fakeEfuseContent[Offset];
else else
@ -158,24 +158,24 @@ u8
Efuse_CalculateWordCnts(IN u8 word_en) Efuse_CalculateWordCnts(IN 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(
struct adapter *Adapter, struct adapter *Adapter,
@ -186,7 +186,7 @@ ReadEFuseByte(
u32 value32; u32 value32;
u8 readbyte; u8 readbyte;
u16 retry; u16 retry;
//u32 start=rtw_get_current_time(); /* u32 start=rtw_get_current_time(); */
if(bPseudoTest) if(bPseudoTest)
{ {
@ -194,55 +194,55 @@ 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<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_871X("ReadEFuseByte _offset:%08u, in %d ms\n",_offset ,rtw_get_passing_time_ms(start)); /* DBG_871X("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(
@ -307,22 +307,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))
{ {
@ -375,28 +375,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)
{ {
@ -427,13 +427,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))
{ {
@ -468,18 +468,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++;
@ -633,7 +633,7 @@ u8 rtw_efuse_access(struct adapter *padapter, u8 bWrite, u16 start_addr, u16 cnt
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;
@ -648,14 +648,14 @@ u8 rtw_efuse_access(struct adapter *padapter, u8 bWrite, u16 start_addr, u16 cnt
return res; return res;
} }
//------------------------------------------------------------------------------ /* */
u16 efuse_GetMaxSize(struct adapter *padapter) u16 efuse_GetMaxSize(struct adapter *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(struct adapter *padapter, u16 *size) u8 efuse_GetCurrentSize(struct adapter *padapter, u16 *size)
{ {
Efuse_PowerSwitch(padapter, false, true); Efuse_PowerSwitch(padapter, false, true);
@ -664,7 +664,7 @@ u8 efuse_GetCurrentSize(struct adapter *padapter, u16 *size)
return _SUCCESS; return _SUCCESS;
} }
//------------------------------------------------------------------------------ /* */
u8 rtw_efuse_map_read(struct adapter *padapter, u16 addr, u16 cnts, u8 *data) u8 rtw_efuse_map_read(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
{ {
u16 mapLen=0; u16 mapLen=0;
@ -700,7 +700,7 @@ u8 rtw_BT_efuse_map_read(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
return _SUCCESS; return _SUCCESS;
} }
//------------------------------------------------------------------------------ /* */
u8 rtw_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data) u8 rtw_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
{ {
u8 offset, word_en; u8 offset, word_en;
@ -728,12 +728,12 @@ u8 rtw_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
offset = (addr >> 3); offset = (addr >> 3);
word_en = 0xF; word_en = 0xF;
memset(newdata, 0xFF, PGPKT_DATA_SIZE); memset(newdata, 0xFF, PGPKT_DATA_SIZE);
i = addr & 0x7; // index of one package i = addr & 0x7; /* index of one package */
j = 0; // index of new package j = 0; /* index of new 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];
@ -798,7 +798,7 @@ exit:
} }
//------------------------------------------------------------------------------ /* */
u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data) u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
{ {
u8 offset, word_en; u8 offset, word_en;
@ -826,12 +826,12 @@ u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data
offset = (addr >> 3); offset = (addr >> 3);
word_en = 0xF; word_en = 0xF;
memset(newdata, 0xFF, PGPKT_DATA_SIZE); memset(newdata, 0xFF, PGPKT_DATA_SIZE);
i = addr & 0x7; // index of one package i = addr & 0x7; /* index of one package */
j = 0; // index of new package j = 0; /* index of new 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];
@ -966,9 +966,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(
IN struct adapter *pAdapter, IN struct adapter *pAdapter,
@ -980,9 +980,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(
IN struct adapter *pAdapter, IN struct adapter *pAdapter,
@ -996,7 +996,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 */
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
@ -1023,7 +1023,7 @@ efuse_ShadowWrite1Byte(
IN struct adapter *pAdapter, IN struct adapter *pAdapter,
IN u16 Offset, IN u16 Offset,
IN u8 Value); IN u8 Value);
#endif //PLATFORM #endif /* PLATFORM */
static void static void
efuse_ShadowWrite1Byte( efuse_ShadowWrite1Byte(
IN struct adapter *pAdapter, IN struct adapter *pAdapter,
@ -1034,9 +1034,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(
IN struct adapter *pAdapter, IN struct adapter *pAdapter,
@ -1048,9 +1048,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(
IN struct adapter *pAdapter, IN struct adapter *pAdapter,
@ -1064,7 +1064,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
@ -1110,9 +1110,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 */
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
@ -1145,7 +1145,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
@ -1190,7 +1190,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(
@ -1223,7 +1223,7 @@ Efuse_InitSomeVar(
} }
#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)
{ {
@ -1267,4 +1267,4 @@ 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 */

View file

@ -46,9 +46,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),
@ -69,7 +69,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) {
@ -123,7 +123,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;
@ -143,14 +143,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 */
) )
{ {
; ;
@ -299,7 +299,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 */
} }
} }
@ -369,7 +369,7 @@ void rtw_set_supported_rate(u8* SupportedRates, uint mode)
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 ? */
memcpy(SupportedRates, WIFI_OFDMRATES, IEEE80211_NUM_OFDM_RATESLEN); memcpy(SupportedRates, WIFI_OFDMRATES, IEEE80211_NUM_OFDM_RATESLEN);
break; break;
@ -412,16 +412,16 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
; ;
//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);
@ -435,10 +435,10 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
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)
@ -458,18 +458,18 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
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);
@ -479,22 +479,16 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
} }
#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
;
//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)
@ -512,13 +506,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... */
memcpy((u8 *)&le_tmp, (pbuf + 6), sizeof(val16)); memcpy((u8 *)&le_tmp, (pbuf + 6), sizeof(val16));
val16 = le16_to_cpu(le_tmp); val16 = le16_to_cpu(le_tmp);
@ -618,7 +612,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);
@ -635,10 +629,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;
@ -700,7 +694,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);
@ -713,10 +707,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;
@ -771,7 +765,7 @@ int rtw_get_wapi_ie(u8 *in_ie,uint in_len,u8 *wapi_ie,u16 *wapi_len)
{ {
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))
{ {
@ -786,11 +780,11 @@ int rtw_get_wapi_ie(u8 *in_ie,uint in_len,u8 *wapi_ie,u16 *wapi_len)
} }
*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 */
} }
} }
@ -809,7 +803,7 @@ int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16
; ;
//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_);
@ -834,7 +828,7 @@ int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16
} }
*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
{ {
@ -853,11 +847,11 @@ int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16
} }
*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 */
} }
} }
@ -880,7 +874,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_8192C("==> found WPS_IE.....\n"); /* DBG_8192C("==> found WPS_IE.....\n"); */
*wps_ielen = ie_ptr[1]+2; *wps_ielen = ie_ptr[1]+2;
match=true; match=true;
} }
@ -896,12 +890,12 @@ u8 *rtw_get_wps_ie_from_scan_queue(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps
{ {
case 1: case 1:
case 3: case 3:
{ // Beacon or Probe Response { /* Beacon or Probe Response */
wps = rtw_get_wps_ie(in_ie + _PROBERSP_IE_OFFSET_, in_len - _PROBERSP_IE_OFFSET_, wps_ie, wps_ielen); wps = rtw_get_wps_ie(in_ie + _PROBERSP_IE_OFFSET_, in_len - _PROBERSP_IE_OFFSET_, wps_ie, wps_ielen);
break; break;
} }
case 2: case 2:
{ // Probe Request { /* Probe Request */
wps = rtw_get_wps_ie(in_ie + _PROBEREQ_IE_OFFSET_ , in_len - _PROBEREQ_IE_OFFSET_ , wps_ie, wps_ielen); wps = rtw_get_wps_ie(in_ie + _PROBEREQ_IE_OFFSET_ , in_len - _PROBEREQ_IE_OFFSET_ , wps_ie, wps_ielen);
break; break;
} }
@ -952,7 +946,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 */
} }
} }
@ -985,17 +979,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_871X("%s attr_ptr:%p, id:%u, length:%u\n", __FUNCTION__, attr_ptr, attr_id, attr_data_len); /* DBG_871X("%s attr_ptr:%p, id:%u, length:%u\n", __FUNCTION__, 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;
@ -1010,7 +1004,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 */
} }
} }
@ -1320,7 +1314,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 )
@ -1330,7 +1324,7 @@ void rtw_macaddr_cfg(u8 *mac_addr)
memcpy(mac_addr, mac, ETH_ALEN); memcpy(mac_addr, mac, ETH_ALEN);
} }
else else
{ // Use the mac address stored in the Efuse { /* Use the mac address stored in the Efuse */
memcpy(mac, mac_addr, ETH_ALEN); memcpy(mac, mac_addr, ETH_ALEN);
} }
@ -1345,7 +1339,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 */
memcpy(mac_addr, mac, ETH_ALEN); memcpy(mac_addr, mac, ETH_ALEN);
DBG_871X("MAC Address from efuse error, assign default one !!!\n"); DBG_871X("MAC Address from efuse error, assign default one !!!\n");
} }
@ -1419,13 +1413,13 @@ u32 rtw_get_p2p_merged_ies_len(u8 *in_ie, u32 in_len)
if( pIE->ElementID == _VENDOR_SPECIFIC_IE_ && _rtw_memcmp(pIE->data, OUI, 4) ) if( pIE->ElementID == _VENDOR_SPECIFIC_IE_ && _rtw_memcmp(pIE->data, OUI, 4) )
{ {
len += pIE->Length-4; // 4 is P2P OUI length, don't count it in this loop len += pIE->Length-4; /* 4 is P2P OUI length, don't count it in this loop */
} }
i += (pIE->Length + 2); i += (pIE->Length + 2);
} }
return len + 4; // Append P2P OUI length at last. return len + 4; /* Append P2P OUI length at last. */
} }
/** /**
@ -1440,12 +1434,12 @@ int rtw_p2p_merge_ies(u8 *in_ie, u32 in_len, u8 *merge_ie)
PNDIS_802_11_VARIABLE_IEs pIE; PNDIS_802_11_VARIABLE_IEs pIE;
u8 len = 0; u8 len = 0;
u8 OUI[4] = { 0x50, 0x6f, 0x9a, 0x09 }; u8 OUI[4] = { 0x50, 0x6f, 0x9a, 0x09 };
u8 ELOUI[6] = { 0xDD, 0x00, 0x50, 0x6f, 0x9a, 0x09 }; //EID;Len;OUI, Len would copy at the end of function u8 ELOUI[6] = { 0xDD, 0x00, 0x50, 0x6f, 0x9a, 0x09 }; /* EID;Len;OUI, Len would copy at the end of function */
int i=0; int i=0;
if( merge_ie != NULL) if( merge_ie != NULL)
{ {
//Set first P2P OUI /* Set first P2P OUI */
memcpy(merge_ie, ELOUI, 6); memcpy(merge_ie, ELOUI, 6);
merge_ie += 6; merge_ie += 6;
@ -1453,7 +1447,7 @@ int rtw_p2p_merge_ies(u8 *in_ie, u32 in_len, u8 *merge_ie)
{ {
pIE = (PNDIS_802_11_VARIABLE_IEs)(in_ie+ i); pIE = (PNDIS_802_11_VARIABLE_IEs)(in_ie+ i);
// Take out the rest of P2P OUIs /* Take out the rest of P2P OUIs */
if( pIE->ElementID == _VENDOR_SPECIFIC_IE_ && _rtw_memcmp(pIE->data, OUI, 4) ) if( pIE->ElementID == _VENDOR_SPECIFIC_IE_ && _rtw_memcmp(pIE->data, OUI, 4) )
{ {
memcpy( merge_ie, pIE->data +4, pIE->Length -4); memcpy( merge_ie, pIE->data +4, pIE->Length -4);
@ -1464,7 +1458,7 @@ int rtw_p2p_merge_ies(u8 *in_ie, u32 in_len, u8 *merge_ie)
i += (pIE->Length + 2); i += (pIE->Length + 2);
} }
return len + 4; // 4 is for P2P OUI return len + 4; /* 4 is for P2P OUI */
} }
@ -1503,12 +1497,12 @@ u8 *rtw_get_p2p_ie_from_scan_queue(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_
{ {
case 1: case 1:
case 3: case 3:
{ // Beacon or Probe Response { /* Beacon or Probe Response */
p2p = rtw_get_p2p_ie(in_ie + _PROBERSP_IE_OFFSET_, in_len - _PROBERSP_IE_OFFSET_, p2p_ie, p2p_ielen); p2p = rtw_get_p2p_ie(in_ie + _PROBERSP_IE_OFFSET_, in_len - _PROBERSP_IE_OFFSET_, p2p_ie, p2p_ielen);
break; break;
} }
case 2: case 2:
{ // Probe Request { /* Probe Request */
p2p = rtw_get_p2p_ie(in_ie + _PROBEREQ_IE_OFFSET_ , in_len - _PROBEREQ_IE_OFFSET_ , p2p_ie, p2p_ielen); p2p = rtw_get_p2p_ie(in_ie + _PROBEREQ_IE_OFFSET_ , in_len - _PROBEREQ_IE_OFFSET_ , p2p_ie, p2p_ielen);
break; break;
} }
@ -1561,7 +1555,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 */
} }
} }
@ -1595,17 +1589,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_871X("%s attr_ptr:%p, id:%u, length:%u\n", __FUNCTION__, attr_ptr, attr_id, attr_data_len); /* DBG_871X("%s attr_ptr:%p, id:%u, length:%u\n", __FUNCTION__, 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;
@ -1620,7 +1614,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 */
} }
} }
@ -1668,7 +1662,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)
@ -1730,7 +1724,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
void dump_wfd_ie(u8 *ie, u32 ie_len) void dump_wfd_ie(u8 *ie, u32 ie_len)
@ -1801,7 +1795,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 */
} }
} }
@ -1826,12 +1820,12 @@ int rtw_get_wfd_ie_from_scan_queue(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_
{ {
case 1: case 1:
case 3: case 3:
{ // Beacon or Probe Response { /* Beacon or Probe Response */
match = rtw_get_wfd_ie(in_ie + _PROBERSP_IE_OFFSET_, in_len - _PROBERSP_IE_OFFSET_, wfd_ie, wfd_ielen); match = rtw_get_wfd_ie(in_ie + _PROBERSP_IE_OFFSET_, in_len - _PROBERSP_IE_OFFSET_, wfd_ie, wfd_ielen);
break; break;
} }
case 2: case 2:
{ // Probe Request { /* Probe Request */
match = rtw_get_wfd_ie(in_ie + _PROBEREQ_IE_OFFSET_ , in_len - _PROBEREQ_IE_OFFSET_ , wfd_ie, wfd_ielen); match = rtw_get_wfd_ie(in_ie + _PROBEREQ_IE_OFFSET_ , in_len - _PROBEREQ_IE_OFFSET_ , wfd_ie, wfd_ielen);
break; break;
} }
@ -1839,8 +1833,8 @@ int rtw_get_wfd_ie_from_scan_queue(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_
return match; return match;
} }
// 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;
@ -1856,7 +1850,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 )
{ {
@ -1865,7 +1859,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)
memcpy( attr_content, &wfd_ie[ cnt + 3 ], attrlen ); memcpy( attr_content, &wfd_ie[ cnt + 3 ], attrlen );
@ -1879,7 +1873,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 */
} }
} }
@ -1887,9 +1881,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 */
@ -1978,7 +1972,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork)
{ {
unsigned short cap = 0; unsigned short cap = 0;
u8 bencrypt = 0; u8 bencrypt = 0;
//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;
struct HT_info_element *pht_info = NULL; struct HT_info_element *pht_info = NULL;
struct rtw_ieee80211_ht_cap *pht_cap = NULL; struct rtw_ieee80211_ht_cap *pht_cap = NULL;
@ -2033,7 +2027,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

@ -49,7 +49,7 @@ jackson@realtek.com.tw
u8 _rtw_read8(struct adapter *adapter, u32 addr) u8 _rtw_read8(struct 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);
@ -85,7 +85,7 @@ u32 _rtw_read32(struct adapter *adapter, u32 addr)
int _rtw_write8(struct adapter *adapter, u32 addr, u8 val) int _rtw_write8(struct adapter *adapter, u32 addr, u8 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);
int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val); int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
@ -112,7 +112,7 @@ int _rtw_write16(struct adapter *adapter, u32 addr, u16 val)
} }
int _rtw_write32(struct adapter *adapter, u32 addr, u32 val) int _rtw_write32(struct adapter *adapter, u32 addr, u32 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);
int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val); int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
@ -126,7 +126,7 @@ int _rtw_write32(struct adapter *adapter, u32 addr, u32 val)
int _rtw_writeN(struct adapter *adapter, u32 addr ,u32 length , u8 *pdata) int _rtw_writeN(struct adapter *adapter, u32 addr ,u32 length , u8 *pdata)
{ {
//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 = (struct intf_hdl*)(&(pio_priv->intf)); struct intf_hdl *pintfhdl = (struct intf_hdl*)(&(pio_priv->intf));
int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr,u32 length, u8 *pdata); int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr,u32 length, u8 *pdata);
@ -309,7 +309,7 @@ int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj)
DBG_871X("[dvobj:%p][ERROR] continual_io_error:%d > %d\n", dvobj, value, MAX_CONTINUAL_IO_ERR); DBG_871X("[dvobj:%p][ERROR] continual_io_error:%d > %d\n", dvobj, value, MAX_CONTINUAL_IO_ERR);
ret = true; ret = true;
} else { } else {
//DBG_871X("[dvobj:%p] continual_io_error:%d\n", dvobj, value); /* DBG_871X("[dvobj:%p] continual_io_error:%d\n", dvobj, value); */
} }
return ret; return ret;
} }
@ -325,12 +325,12 @@ void rtw_reset_continual_io_error(struct dvobj_priv *dvobj)
#ifdef DBG_IO #ifdef DBG_IO
u16 read_sniff_ranges[][2] = { u16 read_sniff_ranges[][2] = {
//{0x550, 0x551}, /* 0x550, 0x551}, */
}; };
u16 write_sniff_ranges[][2] = { u16 write_sniff_ranges[][2] = {
//{0x550, 0x551}, /* 0x550, 0x551}, */
//{0x4c, 0x4c}, /* 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

@ -67,7 +67,7 @@ u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid)
#ifdef CONFIG_VALIDATE_SSID #ifdef CONFIG_VALIDATE_SSID
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;
@ -114,15 +114,15 @@ u8 rtw_do_join(struct adapter * padapter)
_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
|| rtw_to_roaming(padapter) > 0 || rtw_to_roaming(padapter) > 0
) )
{ {
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."));
@ -149,9 +149,9 @@ u8 rtw_do_join(struct adapter * padapter)
{ {
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;
@ -177,16 +177,16 @@ u8 rtw_do_join(struct adapter * padapter)
RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("***Error=> rtw_select_and_join_from_scanned_queue FAIL under STA_Mode*** \n ")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("***Error=> rtw_select_and_join_from_scanned_queue FAIL under STA_Mode*** \n "));
} 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
|| rtw_to_roaming(padapter) > 0 || rtw_to_roaming(padapter) > 0
) )
{ {
//DBG_871X("rtw_do_join() when no desired bss in scanning queue \n"); /* DBG_871X("rtw_do_join() when no desired bss in scanning queue \n"); */
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_,("do_join(): site survey return error\n.")); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("do_join(): site survey return error\n."));
@ -246,7 +246,7 @@ u8 rtw_set_802_11_bssid(struct adapter* padapter, u8 *bssid)
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="MAC_FMT"\n", MAC_ARG(bssid) )); RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_info_,("set_bssid="MAC_FMT"\n", MAC_ARG(bssid) ));
@ -340,7 +340,7 @@ u8 rtw_set_802_11_ssid(struct adapter* padapter, NDIS_802_11_SSID *ssid)
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)
@ -355,7 +355,7 @@ u8 rtw_set_802_11_ssid(struct adapter* padapter, NDIS_802_11_SSID *ssid)
} }
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
@ -510,11 +510,11 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter* padapter,
_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_871X("change mode, old_mode=%d, new_mode=%d, fw_state=0x%x\n", *pold_state, networktype, get_fwstate(pmlmepriv)); /* DBG_871X("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
@ -533,7 +533,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter* padapter,
{ {
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 */
} }
} }
@ -555,7 +555,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter* padapter,
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); /* rtw_indicate_connect(padapter); */
#endif #endif
break; break;
@ -565,10 +565,10 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter* padapter,
break; break;
} }
//SecClearAllKeys(adapter); /* SecClearAllKeys(adapter); */
//RT_TRACE(COMP_OID_SET, DBG_LOUD, ("set_infrastructure: fw_state:%x after changing mode\n", /* RT_TRACE(COMP_OID_SET, DBG_LOUD, ("set_infrastructure: fw_state:%x after changing mode\n", */
// get_fwstate(pmlmepriv) )); /* get_fwstate(pmlmepriv) )); */
_exit_critical_bh(&pmlmepriv->lock, &irqL); _exit_critical_bh(&pmlmepriv->lock, &irqL);
} }
@ -594,7 +594,7 @@ u8 rtw_set_802_11_disassociate(struct adapter *padapter)
rtw_disassoc_cmd(padapter, 0, true); rtw_disassoc_cmd(padapter, 0, true);
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
//modify for CONFIG_IEEE80211W, none 11w can use it /* modify for CONFIG_IEEE80211W, none 11w can use it */
rtw_free_assoc_resources_cmd(padapter); rtw_free_assoc_resources_cmd(padapter);
rtw_pwr_wakeup(padapter); rtw_pwr_wakeup(padapter);
} }
@ -629,7 +629,7 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter* padapter, NDIS_802_11_SSID *ps
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;
@ -702,8 +702,8 @@ u8 rtw_set_802_11_add_wep(struct adapter* padapter, NDIS_802_11_WEP *wep){
; ;
bdefaultkey=(wep->KeyIndex & 0x40000000) > 0 ? false : true; //for ??? bdefaultkey=(wep->KeyIndex & 0x40000000) > 0 ? false : true; /* for ??? */
btransmitkey= (wep->KeyIndex & 0x80000000) > 0 ? true : false; //for ??? btransmitkey= (wep->KeyIndex & 0x80000000) > 0 ? true : false; /* for ??? */
keyid=wep->KeyIndex & 0x3fffffff; keyid=wep->KeyIndex & 0x3fffffff;
if(keyid>4) if(keyid>4)
@ -805,15 +805,15 @@ u8 rtw_set_802_11_add_key(struct 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;
; ;
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));
@ -823,7 +823,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
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"));
@ -848,15 +848,15 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} }
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"));
@ -864,8 +864,8 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
goto exit; goto exit;
} }
// Check key length for TKIP. /* Check key length for TKIP. */
//if(encryptionAlgorithm == RT_ENC_TKIP_ENCRYPTION && key->KeyLength != 32) /* 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;
@ -873,9 +873,9 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} }
// 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 {
@ -884,7 +884,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} }
} }
// 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;
@ -893,7 +893,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
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"));
@ -904,11 +904,11 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} }
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));
@ -947,7 +947,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
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));
@ -956,20 +956,20 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} 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;
} }
@ -989,7 +989,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} }
// 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_))
{ {
u8 ret; u8 ret;
@ -1019,7 +1019,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} }
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)
{ {
@ -1034,9 +1034,9 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} }
// 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;
@ -1081,7 +1081,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} }
//set group key by index /* set group key by index */
memcpy(&padapter->securitypriv.dot118021XGrpKey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial, key->KeyLength); memcpy(&padapter->securitypriv.dot118021XGrpKey[(u8)((key->KeyIndex) & 0x03)], key->KeyMaterial, key->KeyLength);
key->KeyIndex=key->KeyIndex & 0x03; key->KeyIndex=key->KeyIndex & 0x03;
@ -1100,7 +1100,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
goto exit; goto exit;
} }
else // Pairwise Key else /* Pairwise Key */
{ {
u8 res; u8 res;
@ -1109,7 +1109,7 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
if(stainfo!=NULL) if(stainfo!=NULL)
{ {
memset( &stainfo->dot118021x_UncstKey, 0, 16);// clear keybuffer memset( &stainfo->dot118021x_UncstKey, 0, 16);/* clear keybuffer */
memcpy(&stainfo->dot118021x_UncstKey, key->KeyMaterial, 16); memcpy(&stainfo->dot118021x_UncstKey, key->KeyMaterial, 16);
@ -1117,11 +1117,11 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
{ {
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)){
memcpy(&stainfo->dot11tkiptxmickey, key->KeyMaterial + 16, 8); memcpy(&stainfo->dot11tkiptxmickey, key->KeyMaterial + 16, 8);
memcpy(&stainfo->dot11tkiprxmickey, key->KeyMaterial + 24, 8); memcpy(&stainfo->dot11tkiprxmickey, key->KeyMaterial + 24, 8);
@ -1139,8 +1139,8 @@ u8 rtw_set_802_11_add_key(struct adapter* padapter, NDIS_802_11_KEY *key){
} }
//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, true); res=rtw_setstakey_cmd(padapter, (unsigned char *)stainfo, false, true);
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"));
@ -1182,13 +1182,13 @@ u8 rtw_set_802_11_remove_key(struct adapter* padapter, NDIS_802_11_REMOVE_KEY *k
if (bgroup == true) { if (bgroup == true) {
encryptionalgo= padapter->securitypriv.dot118021XGrpPrivacy; encryptionalgo= padapter->securitypriv.dot118021XGrpPrivacy;
// clear group key by index /* clear group key by index */
//NdisZeroMemory(Adapter->MgntInfo.SecurityInfo.KeyBuf[keyIndex], MAX_WEP_KEY_LEN); /* NdisZeroMemory(Adapter->MgntInfo.SecurityInfo.KeyBuf[keyIndex], MAX_WEP_KEY_LEN); */
//Adapter->MgntInfo.SecurityInfo.KeyLen[keyIndex] = 0; /* Adapter->MgntInfo.SecurityInfo.KeyLen[keyIndex] = 0; */
memset(&padapter->securitypriv.dot118021XGrpKey[keyIndex], 0, 16); 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 {
@ -1197,10 +1197,10 @@ u8 rtw_set_802_11_remove_key(struct adapter* padapter, NDIS_802_11_REMOVE_KEY *k
if(stainfo !=NULL){ if(stainfo !=NULL){
encryptionalgo=stainfo->dot118021XPrivacy; encryptionalgo=stainfo->dot118021XPrivacy;
// clear key by BSSID /* clear key by BSSID */
memset(&stainfo->dot118021x_UncstKey, 0, 16); 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{
@ -1254,11 +1254,11 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
memcpy(&mcs_rate , pht_capie->supp_mcs_set, 2); memcpy(&mcs_rate , pht_capie->supp_mcs_set, 2);
//bw_40MHz = (pht_capie->cap_info&IEEE80211_HT_CAP_SUP_WIDTH) ? 1:0; /* 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 = (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;
@ -1273,7 +1273,7 @@ u16 rtw_get_cur_max_rate(struct 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))
{ {
@ -1318,7 +1318,7 @@ int rtw_set_channel_plan(struct 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);
} }
@ -1335,8 +1335,8 @@ int rtw_set_country(struct adapter *adapter, const char *country_code)
DBG_871X("%s country_code:%s\n", __func__, country_code); DBG_871X("%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(struct 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_871X("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", __FUNCTION__ DBG_871X("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", __FUNCTION__
, ori_len + cmd_len + 8, MAX_XMITBUF_SZ); , ori_len + cmd_len + 8, MAX_XMITBUF_SZ);
@ -92,7 +92,7 @@ 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_871X("%s ori:%u + cmd_len:%u = %u\n", __FUNCTION__, ori_len, cmd_len, buf_offset+pattrib->pktlen); /* DBG_871X("%s ori:%u + cmd_len:%u = %u\n", __FUNCTION__, ori_len, cmd_len, buf_offset+pattrib->pktlen); */
return _SUCCESS; return _SUCCESS;
} }
@ -120,19 +120,19 @@ 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_LE16((u8*)&cmd.address, addr); */
//RTW_PUT_LE32((u8*)&cmd.value, (u32)value); /* 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); /* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
cmd.mask = cpu_to_le32(mask); cmd.mask = cpu_to_le32(mask);
} }
//DBG_871X("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, addr,value,mask); /* DBG_871X("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, 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);
@ -141,19 +141,19 @@ int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u
{ {
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_LE16((u8*)&cmd.address, addr); */
//RTW_PUT_LE32((u8*)&cmd.value, (u32)value); /* 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); /* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
cmd.mask = cpu_to_le32(mask); cmd.mask = cpu_to_le32(mask);
} }
//DBG_871X("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, addr,value,mask); /* DBG_871X("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FUNCTION__, 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);
@ -162,19 +162,19 @@ 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_LE16((u8*)&cmd.address, addr); */
//RTW_PUT_LE32((u8*)&cmd.value, (u32)value); /* 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); /* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
cmd.mask = cpu_to_le32(mask); cmd.mask = cpu_to_le32(mask);
} }
//DBG_871X("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__, addr,value,mask); /* DBG_871X("%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);
@ -184,19 +184,19 @@ 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); /* RTW_PUT_LE16((u8*)&cmd.address, addr); */
//RTW_PUT_LE32((u8*)&cmd.value, (u32)value); /* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
cmd.address = cpu_to_le16((rf_path<<8) |((addr) &0xFF)); cmd.address = cpu_to_le16((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); /* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
cmd.mask = cpu_to_le32(mask); cmd.mask = cpu_to_le32(mask);
} }
//DBG_871X("%s rf_path:0x%02x addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__,rf_path, addr,value,mask); /* DBG_871X("%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);
@ -207,10 +207,10 @@ int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr,
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); /* RTW_PUT_LE16((u8*)&cmd.address, us); */
cmd.address = cpu_to_le16(us); cmd.address = cpu_to_le16(us);
//DBG_871X("%s %u\n", __FUNCTION__, us); /* DBG_871X("%s %u\n", __FUNCTION__, us); */
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 4);
} }
@ -218,10 +218,10 @@ 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); /* RTW_PUT_LE16((u8*)&cmd.address, ms); */
cmd.address = cpu_to_le16(ms); cmd.address = cpu_to_le16(ms);
//DBG_871X("%s %u\n", __FUNCTION__, ms); /* DBG_871X("%s %u\n", __FUNCTION__, 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)
@ -239,7 +239,7 @@ 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",__FUNCTION__,pxmit_frame->attrib.pktlen); /* printk("==> %s, pktlen(%d)\n",__FUNCTION__,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;
} }
@ -262,7 +262,7 @@ void rtw_IOL_cmd_buf_dump(struct 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};
@ -335,7 +335,7 @@ 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_871X("%s %u\n", __FUNCTION__, us); /* DBG_871X("%s %u\n", __FUNCTION__, us); */
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 8); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 8);
} }
@ -346,7 +346,7 @@ 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_871X("%s %u\n", __FUNCTION__, ms); /* DBG_871X("%s %u\n", __FUNCTION__, ms); */
return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 8); return rtw_IOL_append_cmds(xmit_frame, (u8*)&cmd, 8);
} }
@ -378,9 +378,9 @@ int rtw_IOL_exec_empty_cmds_sync(struct 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

@ -20,21 +20,21 @@
#include <drv_types.h> #include <drv_types.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;
struct adapter *padapter = pLed->padapter; struct adapter *padapter = pLed->padapter;
//DBG_871X("%s\n", __FUNCTION__); /* DBG_871X("%s\n", __FUNCTION__); */
if( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) if( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true))
{ {
//DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); /* DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); */
return; return;
} }
@ -45,31 +45,31 @@ void BlinkTimerCallback(void *data)
#endif #endif
} }
// /* */
// 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);
BlinkHandler(pLed); BlinkHandler(pLed);
} }
// /* */
// 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. */
pLed->bLedNoLinkBlinkInProgress = false; pLed->bLedNoLinkBlinkInProgress = false;
pLed->bLedLinkBlinkInProgress = false; pLed->bLedLinkBlinkInProgress = false;
@ -77,10 +77,10 @@ void ResetLedStatus(PLED_871x pLed) {
pLed->bLedScanBlinkInProgress = false; pLed->bLedScanBlinkInProgress = false;
} }
// /* */
// Description: /* Description: */
// Initialize an LED_871x object. /* Initialize an LED_871x object. */
// /* */
void void
InitLed871x( InitLed871x(
struct adapter *padapter, struct adapter *padapter,
@ -99,10 +99,10 @@ InitLed871x(
} }
// /* */
// Description: /* Description: */
// DeInitialize an LED_871x object. /* DeInitialize an LED_871x object. */
// /* */
void void
DeInitLed871x( DeInitLed871x(
PLED_871x pLed PLED_871x pLed
@ -114,11 +114,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. */
// /* */
#define CONFIG_LED_REMOVE_HAL #define CONFIG_LED_REMOVE_HAL
@ -128,7 +128,7 @@ static void SwLedBlink(PLED_871x pLed)
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);
@ -140,7 +140,7 @@ static void SwLedBlink(PLED_871x pLed)
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)
{ {
@ -184,7 +184,7 @@ static void SwLedBlink(PLED_871x pLed)
if(bStopBlinking) if(bStopBlinking)
{ {
//if(adapter_to_pwrctl(padapter)->cpwm >= PS_STATE_S2) /* if(adapter_to_pwrctl(padapter)->cpwm >= PS_STATE_S2) */
if(0) if(0)
{ {
SwLedOff(padapter, pLed); SwLedOff(padapter, pLed);
@ -203,13 +203,13 @@ static void SwLedBlink(PLED_871x pLed)
} }
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:
@ -253,7 +253,7 @@ static void SwLedBlink1(PLED_871x pLed)
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);
@ -414,7 +414,7 @@ static void SwLedBlink1(PLED_871x pLed)
_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
@ -451,7 +451,7 @@ static void SwLedBlink2(PLED_871x pLed)
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);
@ -570,7 +570,7 @@ static void SwLedBlink3(PLED_871x pLed)
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);
@ -695,7 +695,7 @@ static void SwLedBlink3(PLED_871x pLed)
_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;
@ -738,7 +738,7 @@ static void SwLedBlink4(PLED_871x pLed)
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);
@ -876,7 +876,7 @@ static void SwLedBlink4(PLED_871x pLed)
} }
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
@ -885,7 +885,7 @@ static void SwLedBlink4(PLED_871x pLed)
_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)
{ {
@ -930,7 +930,7 @@ static void SwLedBlink5(PLED_871x pLed)
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);
@ -1043,7 +1043,7 @@ static void SwLedBlink6(PLED_871x pLed)
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);
@ -1067,7 +1067,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:
@ -1172,7 +1172,7 @@ SwLedControlMode0(
} }
//ALPHA, added by chiyoko, 20090106 /* ALPHA, added by chiyoko, 20090106 */
static void static void
SwLedControlMode1( SwLedControlMode1(
struct adapter *padapter, struct adapter *padapter,
@ -1313,7 +1313,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)
{ {
@ -1447,7 +1447,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(
struct adapter *padapter, struct adapter *padapter,
@ -1521,7 +1521,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)
{ {
@ -1612,7 +1612,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(
struct adapter *padapter, struct adapter *padapter,
@ -1689,7 +1689,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)
{ {
@ -1791,7 +1791,7 @@ SwLedControlMode2(
} }
//Edimax-Belkin, added by chiyoko, 20090413 /* Edimax-Belkin, added by chiyoko, 20090413 */
static void static void
SwLedControlMode4( SwLedControlMode4(
struct adapter *padapter, struct adapter *padapter,
@ -1852,7 +1852,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)
@ -1943,7 +1943,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)
{ {
@ -1989,7 +1989,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));
@ -2006,7 +2006,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));
@ -2021,7 +2021,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
@ -2036,7 +2036,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));
@ -2051,7 +2051,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
@ -2123,7 +2123,7 @@ SwLedControlMode4(
//Sercomm-Belkin, added by chiyoko, 20090415 /* Sercomm-Belkin, added by chiyoko, 20090415 */
static void static void
SwLedControlMode5( SwLedControlMode5(
struct adapter *padapter, struct adapter *padapter,
@ -2146,7 +2146,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;
@ -2214,7 +2214,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(
struct adapter *padapter, struct adapter *padapter,
@ -2247,21 +2247,21 @@ 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)
{ {
struct adapter *padapter = pLed->padapter; struct adapter *padapter = pLed->padapter;
struct led_priv *ledpriv = &(padapter->ledpriv); struct led_priv *ledpriv = &(padapter->ledpriv);
//DBG_871X("%s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); /* DBG_871X("%s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); */
if( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true)) if( (padapter->bSurpriseRemoved == true) || ( padapter->bDriverStopped == true))
{ {
//DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); /* DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped); */
return; return;
} }
@ -2296,8 +2296,8 @@ void BlinkHandler(PLED_871x pLed)
break; break;
default: default:
//RT_TRACE(COMP_LED, DBG_LOUD, ("BlinkWorkItemCallback 0x%x \n", pHalData->LedStrategy)); /* RT_TRACE(COMP_LED, DBG_LOUD, ("BlinkWorkItemCallback 0x%x \n", pHalData->LedStrategy)); */
//SwLedBlink(pLed); /* SwLedBlink(pLed); */
break; break;
} }
} }
@ -2320,11 +2320,11 @@ LedControl871x(
if( ledpriv->bRegUseLed == false) if( ledpriv->bRegUseLed == false)
return; return;
//if (!priv->up) /* if (!priv->up) */
// return; /* return; */
//if(priv->bInHctTest) /* if(priv->bInHctTest) */
// return; /* return; */
if( (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on && if( (adapter_to_pwrctl(padapter)->rf_pwrstate != rf_on &&
adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) && adapter_to_pwrctl(padapter)->rfoff_reason > RF_CHANGE_BY_PS) &&
@ -2340,7 +2340,7 @@ LedControl871x(
switch(ledpriv->LedStrategy) switch(ledpriv->LedStrategy)
{ {
case SW_LED_MODE0: case SW_LED_MODE0:
//SwLedControlMode0(padapter, LedAction); /* 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

File diff suppressed because it is too large Load diff

View file

@ -42,7 +42,7 @@ void _ips_enter(struct 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++;
@ -134,7 +134,7 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter)
bool ret = false; bool ret = false;
if (adapter_to_pwrctl(adapter)->ips_deny_time >= rtw_get_current_time()) { if (adapter_to_pwrctl(adapter)->ips_deny_time >= rtw_get_current_time()) {
//DBG_871X("%s ips_deny_time\n", __func__); /* DBG_871X("%s ips_deny_time\n", __func__); */
goto exit; goto exit;
} }
@ -204,12 +204,12 @@ void rtw_ps_processor(struct 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 = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
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;
@ -217,7 +217,7 @@ void rtw_ps_processor(struct adapter*padapter)
if(pwrpriv->bips_processing == true) if(pwrpriv->bips_processing == true)
goto exit; goto exit;
//DBG_871X("==> fw report state(0x%x)\n",rtw_read8(padapter,0x1ca)); /* DBG_871X("==> fw report state(0x%x)\n",rtw_read8(padapter,0x1ca)); */
if(pwrpriv->bHWPwrPindetect) if(pwrpriv->bHWPwrPindetect)
{ {
#ifdef CONFIG_AUTOSUSPEND #ifdef CONFIG_AUTOSUSPEND
@ -245,7 +245,7 @@ void rtw_ps_processor(struct adapter*padapter)
} }
} }
else else
#endif //CONFIG_AUTOSUSPEND #endif /* CONFIG_AUTOSUSPEND */
{ {
rfpwrstate = RfOnOffDetect(padapter); rfpwrstate = RfOnOffDetect(padapter);
DBG_871X("@@@@- #2 %s==> rfstate:%s \n",__FUNCTION__,(rfpwrstate==rf_on)?"rf_on":"rf_off"); DBG_871X("@@@@- #2 %s==> rfstate:%s \n",__FUNCTION__,(rfpwrstate==rf_on)?"rf_on":"rf_off");
@ -269,7 +269,7 @@ void rtw_ps_processor(struct 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)
goto exit; goto exit;
@ -305,17 +305,17 @@ void rtw_ps_processor(struct 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);
@ -370,7 +370,7 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
DBG_871X("%s: RPWM timeout, force to set RPWM(0x%02X) again!\n", __FUNCTION__, pslv); DBG_871X("%s: RPWM timeout, force to set RPWM(0x%02X) again!\n", __FUNCTION__, pslv);
} }
else else
#endif // CONFIG_LPS_RPWM_TIMER #endif /* CONFIG_LPS_RPWM_TIMER */
{ {
if ((pwrpriv->rpwm == pslv)) { if ((pwrpriv->rpwm == pslv)) {
RT_TRACE(_module_rtl871x_pwrctrl_c_,_drv_err_, RT_TRACE(_module_rtl871x_pwrctrl_c_,_drv_err_,
@ -405,7 +405,7 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
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
@ -417,7 +417,7 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
#ifdef CONFIG_DETECT_CPWM_BY_POLLING #ifdef CONFIG_DETECT_CPWM_BY_POLLING
if (rpwm & PS_ACK) if (rpwm & PS_ACK)
{ {
//cpwm_orig = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HCPWM1); /* cpwm_orig = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HCPWM1); */
rtw_hal_get_hwreg(padapter, HW_VAR_GET_CPWM, (u8 *)(&cpwm_orig)); rtw_hal_get_hwreg(padapter, HW_VAR_GET_CPWM, (u8 *)(&cpwm_orig));
} }
#endif #endif
@ -425,13 +425,13 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
#if defined(CONFIG_LPS_RPWM_TIMER) && !defined(CONFIG_DETECT_CPWM_BY_POLLING) #if defined(CONFIG_LPS_RPWM_TIMER) && !defined(CONFIG_DETECT_CPWM_BY_POLLING)
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 && !CONFIG_DETECT_CPWM_BY_POLLING #endif /* CONFIG_LPS_RPWM_TIMER && !CONFIG_DETECT_CPWM_BY_POLLING */
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
{ {
@ -443,11 +443,11 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
{ {
cpwm_polling_start_time = rtw_get_current_time(); cpwm_polling_start_time = rtw_get_current_time();
//polling cpwm /* polling cpwm */
do{ do{
rtw_mdelay_os(1); rtw_mdelay_os(1);
//cpwm_now = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HCPWM1); /* cpwm_now = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HCPWM1); */
rtw_hal_get_hwreg(padapter, HW_VAR_GET_CPWM, (u8 *)(&cpwm_now)); rtw_hal_get_hwreg(padapter, HW_VAR_GET_CPWM, (u8 *)(&cpwm_now));
if ((cpwm_orig ^ cpwm_now) & 0x80) if ((cpwm_orig ^ cpwm_now) & 0x80)
{ {
@ -525,14 +525,14 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(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 */
#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 */
; ;
@ -560,12 +560,12 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
_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_871X("rtw_set_ps_mode: Leave 802.11 power save\n"); DBG_871X("rtw_set_ps_mode: Leave 802.11 power save\n");
@ -588,7 +588,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
} }
_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);
@ -601,7 +601,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
start_time = rtw_get_current_time(); start_time = rtw_get_current_time();
do { do {
rtw_hal_get_hwreg(padapter, HW_VAR_SYS_CLKR, &val8); rtw_hal_get_hwreg(padapter, HW_VAR_SYS_CLKR, &val8);
if (!(val8 & BIT(4))){ //0x08 bit4 =1 --> in 32k, bit4 = 0 --> leave 32k if (!(val8 & BIT(4))){ /* 0x08 bit4 =1 --> in 32k, bit4 = 0 --> leave 32k */
pwrpriv->cpwm = PS_STATE_S4; pwrpriv->cpwm = PS_STATE_S4;
break; break;
} }
@ -647,7 +647,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
} }
_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;
@ -656,10 +656,10 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a
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
DBG_871X("%s: alives: %d\n", __FUNCTION__, pwrpriv->alives); DBG_871X("%s: alives: %d\n", __FUNCTION__, pwrpriv->alives);
@ -717,10 +717,10 @@ s32 LPS_RF_ON_check(struct adapter *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(struct adapter *padapter) void LPS_Enter(struct adapter *padapter)
{ {
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
@ -731,14 +731,14 @@ void LPS_Enter(struct adapter *padapter)
return; return;
if (pwrpriv->bLeisurePs) { if (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_871X("%s smart_ps:%d\n", __func__, pwrpriv->smart_ps); DBG_871X("%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, 0x40); rtw_set_ps_mode(padapter, pwrpriv->power_mgnt, pwrpriv->smart_ps, 0x40);
} }
} }
@ -747,10 +747,10 @@ void LPS_Enter(struct adapter *padapter)
} }
} }
// /* */
// Description: /* Description: */
// Leave the leisure power save mode. /* Leave the leisure power save mode. */
// /* */
void LPS_Leave(struct adapter *padapter) void LPS_Leave(struct adapter *padapter)
{ {
#define LPS_LEAVE_TIMEOUT_MS 100 #define LPS_LEAVE_TIMEOUT_MS 100
@ -770,16 +770,16 @@ void LPS_Leave(struct adapter *padapter)
pwrpriv->bpower_saving = false; pwrpriv->bpower_saving = false;
// DBG_871X("-LeisurePSLeave\n"); /* DBG_871X("-LeisurePSLeave\n"); */
; ;
} }
#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(IN struct adapter *Adapter) void LeaveAllPowerSaveMode(IN struct adapter *Adapter)
{ {
struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
@ -787,16 +787,16 @@ void LeaveAllPowerSaveMode(IN struct adapter *Adapter)
; ;
//DBG_871X("%s.....\n",__FUNCTION__); /* DBG_871X("%s.....\n",__FUNCTION__); */
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);
@ -816,7 +816,7 @@ void LeaveAllPowerSaveMode(IN struct adapter *Adapter)
#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
@ -829,7 +829,7 @@ void LeaveAllPowerSaveMode(IN struct adapter *Adapter)
DBG_871X("======> ips_leave fail.............\n"); DBG_871X("======> ips_leave fail.............\n");
} }
#endif #endif
#endif //CONFIG_PLATFORM_SPRD #endif /* CONFIG_PLATFORM_SPRD */
} }
} }
} }
@ -908,7 +908,7 @@ void cpwm_int_hdl(
_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;
@ -938,7 +938,7 @@ static void cpwm_event_callback(struct work_struct *work)
struct adapter *adapter = dvobj->if1; struct adapter *adapter = dvobj->if1;
struct reportpwrstate_parm report; struct reportpwrstate_parm report;
//DBG_871X("%s\n",__FUNCTION__); /* DBG_871X("%s\n",__FUNCTION__); */
report.state = PS_STATE_S2; report.state = PS_STATE_S2;
cpwm_int_hdl(adapter, &report); cpwm_int_hdl(adapter, &report);
@ -955,7 +955,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);
dvobj = pwrctl_to_dvobj(pwrpriv); dvobj = pwrctl_to_dvobj(pwrpriv);
padapter = dvobj->if1; padapter = dvobj->if1;
// DBG_871X("+%s: rpwm=0x%02X cpwm=0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm); /* DBG_871X("+%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))
@ -1006,7 +1006,7 @@ static void pwr_rpwm_timeout_handler(void *FunctionContext)
padapter = (PADAPTER)FunctionContext; padapter = (PADAPTER)FunctionContext;
pwrpriv = adapter_to_pwrctl(padapter); pwrpriv = adapter_to_pwrctl(padapter);
// DBG_871X("+%s: rpwm=0x%02X cpwm=0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm); /* DBG_871X("+%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))
{ {
@ -1016,7 +1016,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)
{ {
@ -1087,7 +1087,7 @@ s32 rtw_register_tx_alive(struct adapter *padapter)
if (pwrctrl->cpwm >= PS_STATE_S2) if (pwrctrl->cpwm >= PS_STATE_S2)
res = _SUCCESS; res = _SUCCESS;
} }
#endif // CONFIG_DETECT_CPWM_BY_POLLING #endif /* CONFIG_DETECT_CPWM_BY_POLLING */
; ;
@ -1153,7 +1153,7 @@ s32 rtw_register_cmd_alive(struct adapter *padapter)
if (pwrctrl->cpwm >= PS_STATE_S2) if (pwrctrl->cpwm >= PS_STATE_S2)
res = _SUCCESS; res = _SUCCESS;
} }
#endif // CONFIG_DETECT_CPWM_BY_POLLING #endif /* CONFIG_DETECT_CPWM_BY_POLLING */
; ;
@ -1344,7 +1344,7 @@ void rtw_unregister_evt_alive(struct adapter *padapter)
#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(struct adapter *padapter) void rtw_init_pwrctrl_priv(struct adapter *padapter)
{ {
@ -1372,11 +1372,10 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
#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;
@ -1401,20 +1400,20 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
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 */
_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);
#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 */
; ;
@ -1436,7 +1435,7 @@ void rtw_free_pwrctrl_priv(struct adapter *adapter)
#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);
} }
@ -1456,7 +1455,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
@ -1465,7 +1464,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 */
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER) #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
inline bool rtw_is_earlysuspend_registered(struct pwrctrl_priv *pwrpriv) inline bool rtw_is_earlysuspend_registered(struct pwrctrl_priv *pwrpriv)
@ -1511,7 +1510,7 @@ void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv)
{ {
DBG_871X("%s\n", __FUNCTION__); DBG_871X("%s\n", __FUNCTION__);
//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;
@ -1530,7 +1529,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
extern int rtw_resume_process(struct adapter *padapter); extern int rtw_resume_process(struct adapter *padapter);
@ -1559,7 +1558,7 @@ void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv)
{ {
DBG_871X("%s\n", __FUNCTION__); DBG_871X("%s\n", __FUNCTION__);
//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;
@ -1578,7 +1577,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(struct adapter *padapter,HAL_INTF_PS_FUNC efunc_id,u8* val) u8 rtw_interface_ps_func(struct adapter *padapter,HAL_INTF_PS_FUNC efunc_id,u8* val)
{ {
@ -1649,19 +1648,19 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
DBG_871X("%s wait bInSuspend done\n", __func__); DBG_871X("%s wait bInSuspend done\n", __func__);
} }
//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)
@ -1679,12 +1678,12 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
#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 )
@ -1721,7 +1720,7 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
} }
} }
//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
@ -161,7 +161,7 @@ static __le32 getcrc32(u8 *buf, sint len)
Need to consider the fragment situation Need to consider the fragment situation
*/ */
void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
{ // exclude ICV { /* exclude ICV */
unsigned char crc[4]; unsigned char crc[4];
struct arc4context mycontext; struct arc4context mycontext;
@ -169,7 +169,7 @@ void rtw_wep_encrypt(struct 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;
@ -195,7 +195,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
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];
@ -208,7 +208,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
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;
@ -242,7 +242,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
{ {
// exclude ICV /* exclude ICV */
u8 crc[4]; u8 crc[4];
struct arc4context mycontext; struct arc4context mycontext;
sint length; sint length;
@ -256,25 +256,25 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
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=(iv[3]&0x3); /* keyindex=(iv[3]&0x3); */
keyindex = prxattrib->key_index; keyindex = prxattrib->key_index;
keylength=psecuritypriv->dot11DefKeylen[keyindex]; keylength=psecuritypriv->dot11DefKeylen[keyindex];
memcpy(&wepkey[0], iv, 3); memcpy(&wepkey[0], iv, 3);
//memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],keylength); /* memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],keylength); */
memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[keyindex].skey[0],keylength); memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[keyindex].skey[0],keylength);
length= ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len; length= ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len;
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] || crc[2]!=payload[length-2] || crc[1]!=payload[length-3] || crc[0]!=payload[length-4]) if(crc[3]!=payload[length-1] || crc[2]!=payload[length-2] || crc[1]!=payload[length-3] || crc[0]!=payload[length-4])
@ -291,10 +291,10 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
} }
//3 =====TKIP related===== /* 3 =====TKIP related===== */
static u32 secmicgetuint32( u8 * p ) static u32 secmicgetuint32( u8 * p )
// Convert from Byte[] to Us3232 in a portable way /* Convert from Byte[] to Us3232 in a portable way */
{ {
s32 i; s32 i;
u32 res = 0; u32 res = 0;
@ -308,7 +308,7 @@ static u32 secmicgetuint32( u8 * p )
} }
static void secmicputuint32( u8 * p, u32 val ) static void secmicputuint32( u8 * p, u32 val )
// Convert from Us3232 to Byte[] in a portable way /* Convert from Us3232 to Byte[] in a portable way */
{ {
long i; long i;
; ;
@ -322,7 +322,7 @@ static void secmicputuint32( u8 * p, u32 val )
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. */
; ;
pmicdata->L = pmicdata->K0; pmicdata->L = pmicdata->K0;
pmicdata->R = pmicdata->K1; pmicdata->R = pmicdata->K1;
@ -333,11 +333,11 @@ static void secmicclear(struct mic_data *pmicdata)
void rtw_secmicsetkey(struct mic_data *pmicdata, u8 * key ) void rtw_secmicsetkey(struct mic_data *pmicdata, u8 * key )
{ {
// Set the key /* Set the key */
; ;
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);
; ;
} }
@ -345,10 +345,10 @@ void rtw_secmicsetkey(struct mic_data *pmicdata, u8 * key )
void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b ) void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b )
{ {
; ;
// 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;
@ -360,7 +360,7 @@ void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b )
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;
} }
@ -370,7 +370,7 @@ void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b )
void rtw_secmicappend(struct mic_data *pmicdata, u8 * src, u32 nbytes ) void rtw_secmicappend(struct mic_data *pmicdata, u8 * src, u32 nbytes )
{ {
; ;
// This is simple /* This is simple */
while( nbytes > 0 ) while( nbytes > 0 )
{ {
rtw_secmicappendbyte(pmicdata, *src++ ); rtw_secmicappendbyte(pmicdata, *src++ );
@ -382,21 +382,21 @@ void rtw_secmicappend(struct mic_data *pmicdata, u8 * src, u32 nbytes )
void rtw_secgetmic(struct mic_data *pmicdata, u8 * dst ) void rtw_secgetmic(struct mic_data *pmicdata, u8 * dst )
{ {
; ;
// 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);
; ;
} }
@ -412,16 +412,16 @@ void rtw_seccalctkipmic(u8 * key,u8 *header,u8 *data,u32 data_len,u8 *mic_code,
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);
@ -647,9 +647,9 @@ static void phase2(u8 *rc4key,const u8 *tk,const u16 *p1k,u16 iv16)
} }
//The hlen isn't include the IV /* The hlen isn't include the IV */
u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
{ // exclude ICV { /* exclude ICV */
u16 pnl; u16 pnl;
u32 pnh; u32 pnh;
u8 rc4key[16]; u8 rc4key[16];
@ -684,7 +684,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
#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)
@ -731,7 +731,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
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_,("pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len,pattrib->icv_len)); RT_TRACE(_module_rtl871x_security_c_,_drv_info_,("pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len,pattrib->icv_len));
*((__le32 *)crc)=getcrc32(payload,length);/* modified by Amy*/ *((__le32 *)crc)=getcrc32(payload,length);/* modified by Amy*/
@ -769,9 +769,9 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
} }
//The hlen isn't include the IV /* The hlen isn't include the IV */
u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
{ // exclude ICV { /* exclude ICV */
u16 pnl; u16 pnl;
u32 pnh; u32 pnh;
u8 rc4key[16]; u8 rc4key[16];
@ -786,14 +786,14 @@ u32 rtw_tkip_decrypt(struct 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;
; ;
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] );
@ -837,8 +837,8 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
no_gkey_bc_cnt = 0; no_gkey_bc_cnt = 0;
no_gkey_mc_cnt = 0; no_gkey_mc_cnt = 0;
//DBG_871X("rx bc/mc packets, to perform sw rtw_tkip_decrypt\n"); /* DBG_871X("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;
prwskeylen=16; prwskeylen=16;
} }
@ -861,7 +861,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
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);
@ -890,7 +890,7 @@ exit:
} }
//3 =====AES related===== /* 3 =====AES related===== */
@ -947,12 +947,12 @@ static void construct_mic_iv(
u8 *mpdu, u8 *mpdu,
uint payload_length, uint payload_length,
u8 * pn_vector, u8 * pn_vector,
uint frtype);// add for CONFIG_IEEE80211W, none 11w also can use uint frtype);/* add for CONFIG_IEEE80211W, none 11w also can use */
static void construct_mic_header1( static void construct_mic_header1(
u8 *mic_header1, u8 *mic_header1,
sint header_length, sint header_length,
u8 *mpdu, u8 *mpdu,
uint frtype);// add for CONFIG_IEEE80211W, none 11w also can use uint frtype);/* add for CONFIG_IEEE80211W, none 11w also can use */
static void construct_mic_header2( static void construct_mic_header2(
u8 *mic_header2, u8 *mic_header2,
u8 *mpdu, u8 *mpdu,
@ -965,7 +965,7 @@ static void construct_ctr_preload(
u8 *mpdu, u8 *mpdu,
u8 *pn_vector, u8 *pn_vector,
sint c, sint c,
uint frtype);// add for CONFIG_IEEE80211W, none 11w also can use uint frtype);/* add for CONFIG_IEEE80211W, none 11w also can use */
static void xor_128(u8 *a, u8 *b, u8 *out); static void xor_128(u8 *a, u8 *b, u8 *out);
static void xor_32(u8 *a, u8 *b, u8 *out); static void xor_32(u8 *a, u8 *b, u8 *out);
static u8 sbox(u8 a); static u8 sbox(u8 a);
@ -1193,7 +1193,7 @@ static void construct_mic_iv(
u8 *mpdu, u8 *mpdu,
uint payload_length, uint payload_length,
u8 *pn_vector, u8 *pn_vector,
uint frtype// add for CONFIG_IEEE80211W, none 11w also can use uint frtype/* add for CONFIG_IEEE80211W, none 11w also can use */
) )
{ {
sint i; sint i;
@ -1203,10 +1203,10 @@ static void construct_mic_iv(
if (qc_exists && !a4_exists) mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */ if (qc_exists && !a4_exists) mic_iv[1] = mpdu[24] & 0x0f; /* mute bits 7-4 */
if (!qc_exists) mic_iv[1] = 0x00; if (!qc_exists) mic_iv[1] = 0x00;
#ifdef CONFIG_IEEE80211W #ifdef CONFIG_IEEE80211W
//802.11w management frame should set management bit(4) /* 802.11w management frame should set management bit(4) */
if(frtype == WIFI_MGT_TYPE) if(frtype == WIFI_MGT_TYPE)
mic_iv[1] |= BIT(4); mic_iv[1] |= BIT(4);
#endif //CONFIG_IEEE80211W #endif /* CONFIG_IEEE80211W */
for (i = 2; i < 8; i++) for (i = 2; i < 8; i++)
mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */ mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */
#ifdef CONSISTENT_PN_ORDER #ifdef CONSISTENT_PN_ORDER
@ -1232,18 +1232,18 @@ static void construct_mic_header1(
u8 *mic_header1, u8 *mic_header1,
sint header_length, sint header_length,
u8 *mpdu, u8 *mpdu,
uint frtype// add for CONFIG_IEEE80211W, none 11w also can use uint frtype/* add for CONFIG_IEEE80211W, none 11w also can use */
) )
{ {
; ;
mic_header1[0] = (u8)((header_length - 2) / 256); mic_header1[0] = (u8)((header_length - 2) / 256);
mic_header1[1] = (u8)((header_length - 2) % 256); mic_header1[1] = (u8)((header_length - 2) % 256);
#ifdef CONFIG_IEEE80211W #ifdef CONFIG_IEEE80211W
//802.11w management frame don't AND subtype bits 4,5,6 of frame control field /* 802.11w management frame don't AND subtype bits 4,5,6 of frame control field */
if(frtype == WIFI_MGT_TYPE) if(frtype == WIFI_MGT_TYPE)
mic_header1[2] = mpdu[0]; /* Mute CF poll & CF ack bits */ mic_header1[2] = mpdu[0]; /* Mute CF poll & CF ack bits */
else else
#endif //CONFIG_IEEE80211W #endif /* CONFIG_IEEE80211W */
mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */ mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */
mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */ mic_header1[3] = mpdu[1] & 0xc7; /* Mute retry, more data and pwr mgt bits */
@ -1286,7 +1286,6 @@ static void construct_mic_header2(
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]; */
@ -1329,7 +1328,7 @@ static void construct_ctr_preload(
u8 *mpdu, u8 *mpdu,
u8 *pn_vector, u8 *pn_vector,
sint c, sint c,
uint frtype // add for CONFIG_IEEE80211W, none 11w also can use uint frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
) )
{ {
sint i = 0; sint i = 0;
@ -1343,10 +1342,10 @@ static void construct_ctr_preload(
if (qc_exists && !a4_exists) if (qc_exists && !a4_exists)
ctr_preload[1] = mpdu[24] & 0x0f; ctr_preload[1] = mpdu[24] & 0x0f;
#ifdef CONFIG_IEEE80211W #ifdef CONFIG_IEEE80211W
//802.11w management frame should set management bit(4) /* 802.11w management frame should set management bit(4) */
if(frtype == WIFI_MGT_TYPE) if(frtype == WIFI_MGT_TYPE)
ctr_preload[1] |= BIT(4); ctr_preload[1] |= BIT(4);
#endif //CONFIG_IEEE80211W #endif /* CONFIG_IEEE80211W */
for (i = 2; i < 8; i++) for (i = 2; i < 8; i++)
ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */
#ifdef CONSISTENT_PN_ORDER #ifdef CONSISTENT_PN_ORDER
@ -1381,7 +1380,6 @@ static void bitwise_xor(u8 *ina, u8 *inb, u8 *out)
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;
@ -1396,7 +1394,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);
@ -1428,7 +1425,7 @@ static sint aes_cipher(u8 *key, uint hdrlen,
hdrlen += 2; hdrlen += 2;
} }
} }
// add for CONFIG_IEEE80211W, none 11w also can use /* add for CONFIG_IEEE80211W, none 11w also can use */
else if ((frtype == WIFI_DATA) && else if ((frtype == WIFI_DATA) &&
((frsubtype == 0x08) || ((frsubtype == 0x08) ||
(frsubtype == 0x09)|| (frsubtype == 0x09)||
@ -1455,21 +1452,21 @@ static sint aes_cipher(u8 *key, uint hdrlen,
mic_iv, mic_iv,
qc_exists, qc_exists,
a4_exists, a4_exists,
pframe, //message, pframe, /* message, */
plen, plen,
pn_vector, pn_vector,
frtype // add for CONFIG_IEEE80211W, none 11w also can use frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
); );
construct_mic_header1( construct_mic_header1(
mic_header1, mic_header1,
hdrlen, hdrlen,
pframe, //message pframe, /* message */
frtype // add for CONFIG_IEEE80211W, none 11w also can use frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
); );
construct_mic_header2( construct_mic_header2(
mic_header2, mic_header2,
pframe, //message, pframe, /* message, */
a4_exists, a4_exists,
qc_exists qc_exists
); );
@ -1490,7 +1487,7 @@ static sint aes_cipher(u8 *key, uint hdrlen,
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);
@ -1502,7 +1499,7 @@ static sint aes_cipher(u8 *key, uint hdrlen,
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);
@ -1513,7 +1510,7 @@ static sint aes_cipher(u8 *key, uint hdrlen,
/* 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++)
@ -1522,13 +1519,13 @@ static sint aes_cipher(u8 *key, uint hdrlen,
ctr_preload, ctr_preload,
a4_exists, a4_exists,
qc_exists, qc_exists,
pframe, //message, pframe, /* message, */
pn_vector, pn_vector,
i+1, i+1,
frtype); // add for CONFIG_IEEE80211W, none 11w also can use frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
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,*/
@ -1537,19 +1534,19 @@ static sint aes_cipher(u8 *key, uint hdrlen,
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,
frtype); // add for CONFIG_IEEE80211W, none 11w also can use frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
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 */
@ -1557,20 +1554,20 @@ static sint aes_cipher(u8 *key, uint hdrlen,
ctr_preload, ctr_preload,
a4_exists, a4_exists,
qc_exists, qc_exists,
pframe, //message, pframe, /* message, */
pn_vector, pn_vector,
0, 0,
frtype); // add for CONFIG_IEEE80211W, none 11w also can use frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
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]; */
; ;
return _SUCCESS; return _SUCCESS;
} }
@ -1580,23 +1577,23 @@ static sint aes_cipher(u8 *key, uint hdrlen,
u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) u32 rtw_aes_encrypt(struct 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;
u32 prwskeylen; u32 prwskeylen;
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;
; ;
@ -1616,7 +1613,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
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)
@ -1648,7 +1645,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
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] );
@ -1658,13 +1655,13 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
prwskey=&ptdls_sta->tpk.tk[0]; prwskey=&ptdls_sta->tpk.tk[0];
} }
} }
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
prwskeylen=16; prwskeylen=16;
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);
@ -1715,7 +1712,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);
; ;
@ -1730,9 +1727,9 @@ static sint aes_decipher(u8 *key, uint hdrlen,
memset((void *)aes_out, 0, 16); memset((void *)aes_out, 0, 16);
memset((void *)padded_buffer, 0, 16); 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;
@ -1758,7 +1755,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
hdrlen += 2; hdrlen += 2;
} }
}//only for data packet . add for CONFIG_IEEE80211W, none 11w also can use }/* only for data packet . add for CONFIG_IEEE80211W, none 11w also can use */
else if ((frtype == WIFI_DATA) && else if ((frtype == WIFI_DATA) &&
((frsubtype == 0x08) || ((frsubtype == 0x08) ||
(frsubtype == 0x09)|| (frsubtype == 0x09)||
@ -1775,9 +1772,9 @@ static sint aes_decipher(u8 *key, uint hdrlen,
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++)
{ {
@ -1806,7 +1803,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
pframe, pframe,
pn_vector, pn_vector,
num_blocks+1, num_blocks+1,
frtype // add for CONFIG_IEEE80211W, none 11w also can use frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
); );
for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 16; j++) padded_buffer[j] = 0x00;
@ -1819,9 +1816,9 @@ static sint aes_decipher(u8 *key, uint hdrlen,
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)
memcpy((void *)message, pframe, (hdrlen +plen+8)); //8 is for ext iv len memcpy((void *)message, pframe, (hdrlen +plen+8)); /* 8 is for ext iv len */
pn_vector[0]=pframe[hdrlen]; pn_vector[0]=pframe[hdrlen];
@ -1840,14 +1837,14 @@ static sint aes_decipher(u8 *key, uint hdrlen,
message, message,
plen-8, plen-8,
pn_vector, pn_vector,
frtype // add for CONFIG_IEEE80211W, none 11w also can use frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
); );
construct_mic_header1( construct_mic_header1(
mic_header1, mic_header1,
hdrlen, hdrlen,
message, message,
frtype // add for CONFIG_IEEE80211W, none 11w also can use frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
); );
construct_mic_header2( construct_mic_header2(
mic_header2, mic_header2,
@ -1907,7 +1904,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
message, message,
pn_vector, pn_vector,
i+1, i+1,
frtype); // add for CONFIG_IEEE80211W, none 11w also can use frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
aes128k128d(key, ctr_preload, aes_out); aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, &message[payload_index], chain_buffer); bitwise_xor(aes_out, &message[payload_index], chain_buffer);
for (j=0; j<16;j++) message[payload_index++] = chain_buffer[j]; for (j=0; j<16;j++) message[payload_index++] = chain_buffer[j];
@ -1922,7 +1919,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
message, message,
pn_vector, pn_vector,
num_blocks+1, num_blocks+1,
frtype); // add for CONFIG_IEEE80211W, none 11w also can use frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
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++)
@ -1942,7 +1939,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
message, message,
pn_vector, pn_vector,
0, 0,
frtype); // add for CONFIG_IEEE80211W, none 11w also can use frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
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++)
@ -1954,7 +1951,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
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])
{ {
@ -1970,16 +1967,16 @@ static sint aes_decipher(u8 *key, uint hdrlen,
} }
u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe) u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
{ // exclude ICV { /* exclude ICV */
int length; int 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;
u32 res=_SUCCESS; u32 res=_SUCCESS;
; ;
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] );
if (stainfo!=NULL){ if (stainfo!=NULL){
@ -1990,7 +1987,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
static u32 no_gkey_bc_cnt = 0; static u32 no_gkey_bc_cnt = 0;
static u32 no_gkey_mc_cnt = 0; static u32 no_gkey_mc_cnt = 0;
//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 */
if (!psecuritypriv->binstallGrpkey) { if (!psecuritypriv->binstallGrpkey) {
res=_FAIL; res=_FAIL;
@ -2066,29 +2063,29 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
DBG_871X("BIP AAD allocate fail\n"); DBG_871X("BIP AAD allocate fail\n");
return _FAIL; return _FAIL;
} }
//PKT start /* PKT start */
pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data; pframe=(unsigned char *)((union recv_frame*)precvframe)->u.hdr.rx_data;
//mapping to wlan header /* mapping to wlan header */
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
//save the frame body + MME /* save the frame body + MME */
memcpy(BIP_AAD+BIP_AAD_SIZE, pframe+WLAN_HDR_A3_LEN, pattrib->pkt_len-WLAN_HDR_A3_LEN); memcpy(BIP_AAD+BIP_AAD_SIZE, pframe+WLAN_HDR_A3_LEN, pattrib->pkt_len-WLAN_HDR_A3_LEN);
//find MME IE pointer /* find MME IE pointer */
p = rtw_get_ie(BIP_AAD+BIP_AAD_SIZE, _MME_IE_, &len, pattrib->pkt_len-WLAN_HDR_A3_LEN); p = rtw_get_ie(BIP_AAD+BIP_AAD_SIZE, _MME_IE_, &len, pattrib->pkt_len-WLAN_HDR_A3_LEN);
//Baron /* Baron */
if(p) if(p)
{ {
u16 keyid=0; u16 keyid=0;
u64 temp_ipn=0; u64 temp_ipn=0;
//save packet number /* save packet number */
memcpy(&temp_ipn, p+4, 6); memcpy(&temp_ipn, p+4, 6);
temp_ipn = le64_to_cpu(temp_ipn); temp_ipn = le64_to_cpu(temp_ipn);
//BIP packet number should bigger than previous BIP packet /* BIP packet number should bigger than previous BIP packet */
if(temp_ipn <= pmlmeext->mgnt_80211w_IPN_rx) if(temp_ipn <= pmlmeext->mgnt_80211w_IPN_rx)
{ {
DBG_871X("replay BIP packet\n"); DBG_871X("replay BIP packet\n");
goto BIP_exit; goto BIP_exit;
} }
//copy key index /* copy key index */
memcpy(&keyid, p+2, 2); memcpy(&keyid, p+2, 2);
keyid = le16_to_cpu(keyid); keyid = le16_to_cpu(keyid);
if(keyid != padapter->securitypriv.dot11wBIPKeyid) if(keyid != padapter->securitypriv.dot11wBIPKeyid)
@ -2096,41 +2093,41 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
DBG_871X("BIP key index error!\n"); DBG_871X("BIP key index error!\n");
goto BIP_exit; goto BIP_exit;
} }
//clear the MIC field of MME to zero /* clear the MIC field of MME to zero */
memset(p+2+len-8, 0, 8); memset(p+2+len-8, 0, 8);
//conscruct AAD, copy frame control field /* conscruct AAD, copy frame control field */
memcpy(BIP_AAD, &pwlanhdr->frame_ctl, 2); memcpy(BIP_AAD, &pwlanhdr->frame_ctl, 2);
ClearRetry(BIP_AAD); ClearRetry(BIP_AAD);
ClearPwrMgt(BIP_AAD); ClearPwrMgt(BIP_AAD);
ClearMData(BIP_AAD); ClearMData(BIP_AAD);
//conscruct AAD, copy address 1 to address 3 /* conscruct AAD, copy address 1 to address 3 */
memcpy(BIP_AAD+2, pwlanhdr->addr1, 18); memcpy(BIP_AAD+2, pwlanhdr->addr1, 18);
if(omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey if(omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey
, BIP_AAD, ori_len, mic)) , BIP_AAD, ori_len, mic))
goto BIP_exit; goto BIP_exit;
/*//management packet content /*/* management packet content */
{ {
int pp; int pp;
DBG_871X("pkt: "); DBG_871X("pkt: ");
for(pp=0;pp< pattrib->pkt_len; pp++) for(pp=0;pp< pattrib->pkt_len; pp++)
printk(" %02x ", pframe[pp]); printk(" %02x ", pframe[pp]);
DBG_871X("\n"); DBG_871X("\n");
//BIP AAD + management frame body + MME(MIC is zero) /* BIP AAD + management frame body + MME(MIC is zero) */
DBG_871X("AAD+PKT: "); DBG_871X("AAD+PKT: ");
for(pp=0;pp< ori_len; pp++) for(pp=0;pp< ori_len; pp++)
DBG_871X(" %02x ", BIP_AAD[pp]); DBG_871X(" %02x ", BIP_AAD[pp]);
DBG_871X("\n"); DBG_871X("\n");
//show the MIC result /* show the MIC result */
DBG_871X("mic: "); DBG_871X("mic: ");
for(pp=0;pp<16; pp++) for(pp=0;pp<16; pp++)
DBG_871X(" %02x ", mic[pp]); DBG_871X(" %02x ", mic[pp]);
DBG_871X("\n"); DBG_871X("\n");
} }
*/ */
//MIC field should be last 8 bytes of packet (packet without FCS) /* MIC field should be last 8 bytes of packet (packet without FCS) */
if(_rtw_memcmp(mic, pframe+pattrib->pkt_len-8, 8)) if(_rtw_memcmp(mic, pframe+pattrib->pkt_len-8, 8))
{ {
pmlmeext->mgnt_80211w_IPN_rx = temp_ipn; pmlmeext->mgnt_80211w_IPN_rx = temp_ipn;
@ -2147,7 +2144,7 @@ BIP_exit:
rtw_mfree(BIP_AAD, ori_len); rtw_mfree(BIP_AAD, ori_len);
return res; return res;
} }
#endif //CONFIG_IEEE80211W #endif /* CONFIG_IEEE80211W */
/* compress 512-bits */ /* compress 512-bits */
static int sha256_compress(struct sha256_state *md, unsigned char *buf) static int sha256_compress(struct sha256_state *md, unsigned char *buf)
@ -2851,7 +2848,7 @@ static int omac1_aes_128_vector(u8 *key, size_t num_elem,
* This is a mode for using block cipher (AES in this case) for authentication. * This is a mode for using block cipher (AES in this case) for authentication.
* OMAC1 was standardized with the name CMAC by NIST in a Special Publication * OMAC1 was standardized with the name CMAC by NIST in a Special Publication
* (SP) 800-38B. * (SP) 800-38B.
*/ //modify for CONFIG_IEEE80211W */ /* modify for CONFIG_IEEE80211W */
static int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac) 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);
@ -3016,16 +3013,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_871X( "[%s] Invalid MIC\n", __FUNCTION__); DBG_871X( "[%s] Invalid MIC\n", __FUNCTION__);
return 0; return 0;
} }
#endif //CONFIG_TDLS #endif /* CONFIG_TDLS */
void rtw_use_tkipkey_handler(void *FunctionContext) void rtw_use_tkipkey_handler(void *FunctionContext)
{ {

View file

@ -39,7 +39,7 @@ void sreset_reset_value(struct adapter *padapter)
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
struct sreset_priv *psrtpriv = &pHalData->srestpriv; struct sreset_priv *psrtpriv = &pHalData->srestpriv;
//psrtpriv->silent_reset_inprogress = false; /* psrtpriv->silent_reset_inprogress = false; */
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
psrtpriv->last_tx_time =0; psrtpriv->last_tx_time =0;
psrtpriv->last_tx_complete_time =0; psrtpriv->last_tx_complete_time =0;
@ -75,7 +75,7 @@ u8 sreset_get_wifi_status(struct adapter *padapter)
} }
DBG_8192C("==> %s wifi_status(0x%x)\n",__FUNCTION__,status); DBG_8192C("==> %s wifi_status(0x%x)\n",__FUNCTION__,status);
//status restore /* status restore */
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
return status; return status;
@ -126,7 +126,7 @@ static void sreset_restore_security_station(struct adapter *padapter)
val8 = 0xcc; val8 = 0xcc;
#ifdef CONFIG_WAPI_SUPPORT #ifdef CONFIG_WAPI_SUPPORT
} else if (padapter->wapiInfo.bWapiEnable && pmlmeinfo->auth_algo == dot11AuthAlgrthm_WAPI) { } else if (padapter->wapiInfo.bWapiEnable && pmlmeinfo->auth_algo == dot11AuthAlgrthm_WAPI) {
//Disable TxUseDefaultKey, RxUseDefaultKey, RxBroadcastUseDefaultKey. /* Disable TxUseDefaultKey, RxUseDefaultKey, RxBroadcastUseDefaultKey. */
val8 = 0x4c; val8 = 0x4c;
#endif #endif
} else { } else {
@ -140,13 +140,13 @@ static void sreset_restore_security_station(struct adapter *padapter)
{ {
psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv)); psta = rtw_get_stainfo(pstapriv, get_bssid(mlmepriv));
if (psta == NULL) { if (psta == NULL) {
//DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n")); /* DEBUG_ERR( ("Set wpa_set_encryption: Obtain Sta_info fail \n")); */
} }
else else
{ {
//pairwise key /* pairwise key */
rtw_setstakey_cmd(padapter, (unsigned char *)psta, true,false); rtw_setstakey_cmd(padapter, (unsigned char *)psta, true,false);
//group key /* group key */
rtw_set_key(padapter,&padapter->securitypriv,padapter->securitypriv.dot118021XGrpKeyid, 0,false); rtw_set_key(padapter,&padapter->securitypriv,padapter->securitypriv.dot118021XGrpKeyid, 0,false);
} }
} }
@ -162,8 +162,8 @@ static void sreset_restore_network_station(struct adapter *padapter)
{ {
u8 threshold; u8 threshold;
// TH=1 => means that invalidate usb rx aggregation /* TH=1 => means that invalidate usb rx aggregation */
// TH=0 => means that validate usb rx aggregation, use init value. /* TH=0 => means that validate usb rx aggregation, use init value. */
if(mlmepriv->htpriv.ht_option) { if(mlmepriv->htpriv.ht_option) {
if(padapter->registrypriv.wifi_spec==1) if(padapter->registrypriv.wifi_spec==1)
threshold = 1; threshold = 1;
@ -178,8 +178,8 @@ static void sreset_restore_network_station(struct adapter *padapter)
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);
//disable dynamic functions, such as high power, DIG /* disable dynamic functions, such as high power, DIG */
//Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false); /* Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false); */
rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress); rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pmlmeinfo->network.MacAddress);
@ -191,7 +191,7 @@ static void sreset_restore_network_station(struct adapter *padapter)
Set_MSR(padapter, (pmlmeinfo->state & 0x3)); Set_MSR(padapter, (pmlmeinfo->state & 0x3));
mlmeext_joinbss_event_callback(padapter, 1); mlmeext_joinbss_event_callback(padapter, 1);
//restore Sequence No. /* restore Sequence No. */
rtw_write8(padapter,0x4dc,padapter->xmitpriv.nqos_ssn); rtw_write8(padapter,0x4dc,padapter->xmitpriv.nqos_ssn);
sreset_restore_security_station(padapter); sreset_restore_security_station(padapter);

View file

@ -40,9 +40,9 @@ void _rtw_init_stainfo(struct sta_info *psta)
_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;
@ -76,11 +76,11 @@ void _rtw_init_stainfo(struct sta_info *psta)
#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 */
#ifdef DBG_TRX_STA_PKTS #ifdef DBG_TRX_STA_PKTS
psta->tx_be_cnt = 0; psta->tx_be_cnt = 0;
@ -116,7 +116,7 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
_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);
@ -149,14 +149,12 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
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
#ifdef CONFIG_ATMEL_RC_PATCH #ifdef CONFIG_ATMEL_RC_PATCH
memset( pstapriv->atmel_rc_pattern, 0, ETH_ALEN); memset( pstapriv->atmel_rc_pattern, 0, ETH_ALEN);
@ -230,7 +228,7 @@ void rtw_mfree_stainfo(struct sta_info *psta)
} }
// 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 )
{ {
@ -266,7 +264,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);
@ -328,7 +326,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
} }
//struct sta_info *rtw_alloc_stainfo(_queue *pfree_sta_queue, unsigned char *hwaddr) /* struct sta_info *rtw_alloc_stainfo(_queue *pfree_sta_queue, unsigned char *hwaddr) */
struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
{ {
_irqL irqL, irqL2; _irqL irqL, irqL2;
@ -346,7 +344,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2);
if (_rtw_queue_empty(pfree_sta_queue) == true) { if (_rtw_queue_empty(pfree_sta_queue) == true) {
// _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); /* _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); */
psta = NULL; psta = NULL;
} else { } else {
psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list);
@ -376,10 +374,10 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
pstapriv->asoc_sta_count ++ ; pstapriv->asoc_sta_count ++ ;
// 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++ )
memcpy( &psta->sta_recvpriv.rxcache.tid_rxseq[ i ], &wRxSeqInitialValue, 2 ); memcpy( &psta->sta_recvpriv.rxcache.tid_rxseq[ i ], &wRxSeqInitialValue, 2 );
@ -397,9 +395,9 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
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];
@ -413,8 +411,8 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
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);
@ -422,7 +420,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
} }
//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);
#ifdef CONFIG_ATMEL_RC_PATCH #ifdef CONFIG_ATMEL_RC_PATCH
@ -437,7 +435,7 @@ exit:
} }
// using pstapriv->sta_hash_lock to protect /* using pstapriv->sta_hash_lock to protect */
u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta) u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
{ {
int i; int i;
@ -465,62 +463,56 @@ u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
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;
//vo /* vo */
//_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));
phwxmit = pxmitpriv->hwxmits; phwxmit = pxmitpriv->hwxmits;
phwxmit->accnt -= pstaxmitpriv->vo_q.qcnt; phwxmit->accnt -= pstaxmitpriv->vo_q.qcnt;
pstaxmitpriv->vo_q.qcnt = 0; pstaxmitpriv->vo_q.qcnt = 0;
//_exit_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); /* _exit_critical_bh(&(pxmitpriv->vo_pending.lock), &irqL0); */
//vi /* vi */
//_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));
phwxmit = pxmitpriv->hwxmits+1; phwxmit = pxmitpriv->hwxmits+1;
phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt; phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt;
pstaxmitpriv->vi_q.qcnt = 0; pstaxmitpriv->vi_q.qcnt = 0;
//_exit_critical_bh(&(pxmitpriv->vi_pending.lock), &irqL0); /* _exit_critical_bh(&(pxmitpriv->vi_pending.lock), &irqL0); */
//be /* be */
//_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));
phwxmit = pxmitpriv->hwxmits+2; phwxmit = pxmitpriv->hwxmits+2;
phwxmit->accnt -= pstaxmitpriv->be_q.qcnt; phwxmit->accnt -= pstaxmitpriv->be_q.qcnt;
pstaxmitpriv->be_q.qcnt = 0; pstaxmitpriv->be_q.qcnt = 0;
//_exit_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); /* _exit_critical_bh(&(pxmitpriv->be_pending.lock), &irqL0); */
//bk /* bk */
//_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));
phwxmit = pxmitpriv->hwxmits+3; phwxmit = pxmitpriv->hwxmits+3;
phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt; phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt;
pstaxmitpriv->bk_q.qcnt = 0; pstaxmitpriv->bk_q.qcnt = 0;
//_exit_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); /* _exit_critical_bh(&(pxmitpriv->bk_pending.lock), &irqL0); */
_exit_critical_bh(&pxmitpriv->lock, &irqL0); _exit_critical_bh(&pxmitpriv->lock, &irqL0);
rtw_list_delete(&psta->hash_list); rtw_list_delete(&psta->hash_list);
RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("\n free number_%d stainfo with hwaddr = 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x \n",pstapriv->asoc_sta_count , psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5])); RT_TRACE(_module_rtl871x_sta_mgt_c_,_drv_err_,("\n free number_%d stainfo with hwaddr = 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x \n",pstapriv->asoc_sta_count , psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2],psta->hwaddr[3],psta->hwaddr[4],psta->hwaddr[5]));
pstapriv->asoc_sta_count --; pstapriv->asoc_sta_count --;
// re-init sta_info; 20061114 // will be init in alloc_stainfo
//_rtw_init_sta_xmit_priv(&psta->sta_xmitpriv);
//_rtw_init_sta_recv_priv(&psta->sta_recvpriv);
_cancel_timer_ex(&psta->addba_retry_timer); _cancel_timer_ex(&psta->addba_retry_timer);
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
@ -530,9 +522,9 @@ u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
_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;
@ -605,7 +597,7 @@ u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
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))
{ {
@ -613,19 +605,19 @@ u32 rtw_free_stainfo(struct adapter *padapter , struct sta_info *psta)
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 */
_rtw_spinlock_free(&psta->lock); _rtw_spinlock_free(&psta->lock);
//_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));
//_exit_critical_bh(&(pfree_sta_queue->lock), &irqL0); /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL0); */
exit: exit:
@ -635,7 +627,7 @@ exit:
} }
// free all stainfo which in sta_hash[all] /* free all stainfo which in sta_hash[all] */
void rtw_free_all_stainfo(struct adapter *padapter) void rtw_free_all_stainfo(struct adapter *padapter)
{ {
_irqL irqL; _irqL irqL;
@ -721,7 +713,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
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;
@ -743,7 +735,7 @@ u32 rtw_init_bcmc_stainfo(struct 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; */
; ;
@ -755,7 +747,7 @@ u32 rtw_init_bcmc_stainfo(struct adapter* padapter)
goto exit; goto exit;
} }
// default broadcast & multicast use macid 1 /* default broadcast & multicast use macid 1 */
psta->mac_id = 1; psta->mac_id = 1;
ptxservq= &(psta->sta_xmitpriv.be_q); ptxservq= &(psta->sta_xmitpriv.be_q);
@ -820,11 +812,11 @@ u8 rtw_access_ctrl(struct 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

@ -47,7 +47,7 @@ unsigned char REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20};
#define R2T_PHY_DELAY (0) #define R2T_PHY_DELAY (0)
//#define WAIT_FOR_BCN_TO_MIN (3000) /* define WAIT_FOR_BCN_TO_MIN (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)
@ -312,7 +312,7 @@ void UpdateBrateTbl(
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;
@ -440,7 +440,7 @@ void SelectChannel(struct adapter *padapter, unsigned char channel)
_enter_critical_mutex(&(adapter_to_dvobj(padapter)->setch_mutex), NULL); _enter_critical_mutex(&(adapter_to_dvobj(padapter)->setch_mutex), NULL);
//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);
@ -454,7 +454,7 @@ void SetBWMode(struct adapter *padapter, unsigned short bwmode, unsigned char ch
_enter_critical_mutex(&(adapter_to_dvobj(padapter)->setbw_mutex), NULL); _enter_critical_mutex(&(adapter_to_dvobj(padapter)->setbw_mutex), NULL);
//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);
@ -475,33 +475,33 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne
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 */
_enter_critical_mutex(&(adapter_to_dvobj(padapter)->setch_mutex), NULL); _enter_critical_mutex(&(adapter_to_dvobj(padapter)->setch_mutex), NULL);
//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 */
_exit_critical_mutex(&(adapter_to_dvobj(padapter)->setch_mutex), NULL); _exit_critical_mutex(&(adapter_to_dvobj(padapter)->setch_mutex), NULL);
@ -623,14 +623,14 @@ void invalidate_cam_all(struct adapter *padapter)
void read_cam(struct adapter *padapter ,u8 entry) void read_cam(struct adapter *padapter ,u8 entry)
{ {
u32 j,count = 0, addr; u32 j,count = 0, addr;
u32 cam_val[2]; //cam_val[0] is read_val, cam_val[1] is the address u32 cam_val[2]; /* cam_val[0] is read_val, cam_val[1] is the address */
addr = entry << 3; addr = entry << 3;
DBG_8192C("********* DUMP CAM Entry_#%02d***************\n",entry); DBG_8192C("********* DUMP CAM Entry_#%02d***************\n",entry);
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++)
{ {
//cmd = _ReadCAM(padapter ,addr+j); /* cmd = _ReadCAM(padapter ,addr+j); */
//HW_VAR_CAM_READ /* HW_VAR_CAM_READ */
cam_val[1]=addr+j; cam_val[1]=addr+j;
rtw_hal_get_hwreg(padapter, HW_VAR_CAM_READ, (u8 *)cam_val); rtw_hal_get_hwreg(padapter, HW_VAR_CAM_READ, (u8 *)cam_val);
DBG_8192C("offset:0x%02x => 0x%08x \n",addr+j,cam_val[0]); DBG_8192C("offset:0x%02x => 0x%08x \n",addr+j,cam_val[0]);
@ -741,7 +741,7 @@ int WFD_info_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
int WMM_param_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) int WMM_param_handler(struct 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);
@ -755,27 +755,6 @@ int WMM_param_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
pmlmeinfo->WMM_enable = 1; pmlmeinfo->WMM_enable = 1;
memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element)); 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;
_rtwmemcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element));
return true;
}
}
else
{
pmlmeinfo->WMM_enable = 0;
return _FAIL;
}*/
} }
void WMMOnAssocRsp(struct adapter *padapter) void WMMOnAssocRsp(struct adapter *padapter)
@ -808,7 +787,7 @@ void WMMOnAssocRsp(struct 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);
@ -827,7 +806,7 @@ void WMMOnAssocRsp(struct 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;
@ -858,19 +837,19 @@ void WMMOnAssocRsp(struct 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;
} }
@ -955,7 +934,7 @@ static void bwmode_update_check(struct adapter *padapter, PNDIS_802_11_VARIABLE_
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
@ -970,10 +949,10 @@ static void bwmode_update_check(struct adapter *padapter, PNDIS_802_11_VARIABLE_
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)
{ {
@ -981,7 +960,7 @@ static void bwmode_update_check(struct adapter *padapter, PNDIS_802_11_VARIABLE_
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;
} }
@ -992,11 +971,8 @@ static void bwmode_update_check(struct adapter *padapter, PNDIS_802_11_VARIABLE_
} }
} }
//pmlmeinfo->bwmode_updated = false;//bwmode_updated done, reset it!
} }
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
} }
void HT_caps_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE) void HT_caps_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
@ -1021,13 +997,13 @@ void HT_caps_handler(struct 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);
@ -1050,15 +1026,15 @@ void HT_caps_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
} }
} }
// Commented by Albert 2010/07/12 /* Commented by Albert 2010/07/12 */
// Have to handle the endian issue after copying. /* Have to handle the endian issue after copying. */
// HT_ext_caps didn't be used yet. /* HT_ext_caps didn't be used yet. */
pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info = pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info; pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info = pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info;
pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps = pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps; pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps = pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps;
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))
@ -1074,7 +1050,7 @@ void HT_caps_handler(struct 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
{ {
@ -1082,7 +1058,7 @@ void HT_caps_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
} }
#endif #endif
} }
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
return; return;
} }
@ -1104,7 +1080,7 @@ void HT_info_handler(struct adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
pmlmeinfo->HT_info_enable = 1; pmlmeinfo->HT_info_enable = 1;
memcpy(&(pmlmeinfo->HT_info), pIE->data, pIE->Length); memcpy(&(pmlmeinfo->HT_info), pIE->data, pIE->Length);
#endif //CONFIG_80211N_HT #endif /* CONFIG_80211N_HT */
return; return;
} }
@ -1112,7 +1088,7 @@ void HTOnAssocRsp(struct 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);
@ -1125,11 +1101,11 @@ void HTOnAssocRsp(struct 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
@ -1163,12 +1139,12 @@ void VCS_update(struct 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;
@ -1181,7 +1157,7 @@ void VCS_update(struct 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)))
{ {
@ -1208,7 +1184,7 @@ void VCS_update(struct 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)
{ {
@ -1221,7 +1197,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(struct adapter *Adapter, u8 *pframe, u32 packet_len) int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
{ {
@ -1229,7 +1205,7 @@ int rtw_check_bcn_info(struct 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;
@ -1301,12 +1277,12 @@ int rtw_check_bcn_info(struct 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_871X("%s bw mode change, disconnect\n", __func__); DBG_871X("%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 */
@ -1442,8 +1418,8 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru
#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);
@ -1452,8 +1428,8 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru
pIE = (PNDIS_802_11_VARIABLE_IEs)(pframe + (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN) + i); pIE = (PNDIS_802_11_VARIABLE_IEs)(pframe + (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN) + i);
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;
@ -1466,7 +1442,7 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru
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;
} }
@ -1503,7 +1479,7 @@ void process_csa_ie(struct 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(struct adapter *padapter) unsigned int is_ap_in_tkip(struct adapter *padapter)
{ {
@ -1802,27 +1778,27 @@ void enable_rate_adaptive(struct adapter *padapter, struct sta_info *psta)
void set_sta_rate(struct adapter *padapter, struct sta_info *psta) void set_sta_rate(struct adapter *padapter, struct sta_info *psta)
{ {
//rate adaptive /* rate adaptive */
enable_rate_adaptive(padapter, psta); enable_rate_adaptive(padapter, psta);
} }
// Update RRSR and Rate for USERATE /* Update RRSR and Rate for USERATE */
void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode) void update_tx_basic_rate(struct 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 */
memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX); memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX);
@ -1948,13 +1924,13 @@ void update_IOT_info(struct 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:
@ -1971,14 +1947,14 @@ void update_capinfo(struct adapter *Adapter, u16 updateCap)
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
BOOLEAN ShortPreamble; BOOLEAN 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;
@ -1986,8 +1962,8 @@ void update_capinfo(struct adapter *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;
@ -1997,23 +1973,23 @@ void update_capinfo(struct adapter *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;
@ -2026,7 +2002,7 @@ void update_capinfo(struct adapter *Adapter, u16 updateCap)
} }
else else
{ {
//B Mode /* B Mode */
pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME; pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME;
} }
} }
@ -2082,16 +2058,8 @@ void update_wireless_mode(struct adapter *padapter)
} }
pmlmeext->cur_wireless_mode = network_type & padapter->registrypriv.wireless_mode; pmlmeext->cur_wireless_mode = network_type & padapter->registrypriv.wireless_mode;
/* SIFS_Timer = 0x0a0a0808; /* 0x0808 -> for CCK, 0x0a0a -> for OFDM */
if((pmlmeext->cur_wireless_mode==WIRELESS_11G) || /* change this value if having IOT issues. */
(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
//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);
@ -2108,7 +2076,7 @@ void update_bmc_sta_support_rate(struct 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 */
memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), rtw_basic_rate_cck, 4); memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), rtw_basic_rate_cck, 4);
} }
else else
@ -2219,7 +2187,7 @@ int rtw_handle_dualmac(struct 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_871X("%s(): pbuddy_padapter exist, Exchange Information\n",__FUNCTION__); DBG_871X("%s(): pbuddy_padapter exist, Exchange Information\n",__FUNCTION__);
} }
@ -2297,4 +2265,4 @@ void rtw_set_sec_iv(struct adapter *padapter)
DBG_871X("%s: dot11txpn: 0x%016llx\n", __func__ ,psta->dot11txpn.val); DBG_871X("%s: dot11txpn: 0x%016llx\n", __func__ ,psta->dot11txpn.val);
} }
} }
#endif //CONFIG_WOWLAN #endif /* CONFIG_WOWLAN */

File diff suppressed because it is too large Load diff