28 #define CMPK_DEBOUNCE_CNT 1
30 #define CMPK_PRINT(Address)\
35 memcpy(temp, Address, 40);\
36 for (i = 0; i <40; i+=4)\
37 printk("\r\n %08x", temp[i]);\
52 unsigned char *ptr_buf;
59 memcpy((
unsigned char *)(skb->cb),&dev,
sizeof(dev));
65 ptr_buf =
skb_put(skb, DataLen);
66 memcpy(ptr_buf,pData,DataLen);
72 RT_TRACE(
COMP_FIRMWARE,
"===================NULL packet==================================> tx full!\n");
75 priv->
ieee80211->softmac_hard_start_xmit(skb,dev);
104 u8* codevirtualaddress,
115 u16 frag_length, frag_offset = 0;
121 unsigned char *seg_ptr;
129 if((buffer_len - frag_offset) > frag_threshold) {
134 frag_length = buffer_len - frag_offset;
145 skb = dev_alloc_skb(frag_length + 4);
147 memcpy((
unsigned char *)(skb->cb),&dev,
sizeof(dev));
157 seg_ptr =
skb_put(skb, buffer_len);
162 memcpy(seg_ptr,codevirtualaddress,buffer_len);
172 priv->
ieee80211->softmac_hard_start_xmit(skb,dev);
175 codevirtualaddress += frag_length;
176 frag_offset += frag_length;
178 }
while(frag_offset < buffer_len);
204 cmpk_count_txstatistic(
212 pAdapter->HalFunc.GetHwRegHandler(pAdapter,
HW_VAR_RF_STATE, (pu1Byte)(&rtState));
224 if(pAdapter->bInHctTest)
232 priv->
stats.txfeedbackok++;
233 priv->
stats.txoktotal++;
235 priv->
stats.txokinperiod++;
240 priv->
stats.txmulticast++;
245 priv->
stats.txbroadcast++;
250 priv->
stats.txunicast++;
256 priv->
stats.txfeedbackfail++;
257 priv->
stats.txerrtotal++;
263 priv->
stats.txerrmulticast++;
267 priv->
stats.txerrbroadcast++;
271 priv->
stats.txerrunicast++;
304 cmpk_handle_tx_feedback(
308 struct r8192_priv *priv = ieee80211_priv(dev);
311 priv->
stats.txfeedback++;
324 cmpk_count_txstatistic(dev, &rx_tx_fb);
338 struct r8192_priv *priv = ieee80211_priv(dev);
349 DMESG(
"send beacon frame tx rate is 6Mbpm\n");
354 DMESG(
"send beacon frame tx rate is 1Mbpm\n");
387 cmpk_handle_interrupt_status(
392 struct r8192_priv *priv = ieee80211_priv(dev);
394 DMESG(
"---> cmpk_Handle_Interrupt_Status()\n");
405 rx_intr_status.
length = pmsg[1];
408 DMESG(
"cmpk_Handle_Interrupt_Status: wrong length!\n");
424 priv->
ieee80211->bibsscoordinator =
true;
425 priv->
stats.txbeaconokint++;
429 priv->
ieee80211->bibsscoordinator =
false;
430 priv->
stats.txbeaconerr++;
443 DMESG(
"<---- cmpk_handle_interrupt_status()\n");
468 cmpk_handle_query_config_rx(
483 rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000)>>31;
484 rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5;
485 rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3;
486 rx_query_cfg.cfg_page = (pmsg[6] & 0x0F) >> 0;
487 rx_query_cfg.cfg_offset = pmsg[7];
488 rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) |
489 (pmsg[10] << 8) | (pmsg[11] << 0);
490 rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) |
491 (pmsg[14] << 8) | (pmsg[15] << 0);
513 static void cmpk_count_tx_status(
struct net_device *dev,
514 cmpk_tx_status_t *pstx_status)
516 struct r8192_priv *priv = ieee80211_priv(dev);
522 pAdapter->HalFunc.GetHwRegHandler(pAdapter,
HW_VAR_RF_STATE, (pu1Byte)(&rtState));
533 priv->
stats.txfeedbackok += pstx_status->txok;
534 priv->
stats.txoktotal += pstx_status->txok;
536 priv->
stats.txfeedbackfail += pstx_status->txfail;
537 priv->
stats.txerrtotal += pstx_status->txfail;
539 priv->
stats.txretrycount += pstx_status->txretry;
540 priv->
stats.txfeedbackretry += pstx_status->txretry;
546 priv->
stats.txmulticast += pstx_status->txmcok;
547 priv->
stats.txbroadcast += pstx_status->txbcok;
548 priv->
stats.txunicast += pstx_status->txucok;
550 priv->
stats.txerrmulticast += pstx_status->txmcfail;
551 priv->
stats.txerrbroadcast += pstx_status->txbcfail;
552 priv->
stats.txerrunicast += pstx_status->txucfail;
554 priv->
stats.txbytesmulticast += pstx_status->txmclength;
555 priv->
stats.txbytesbroadcast += pstx_status->txbclength;
556 priv->
stats.txbytesunicast += pstx_status->txuclength;
558 priv->
stats.last_packet_rate = pstx_status->rate;
581 cmpk_handle_tx_status(
585 cmpk_tx_status_t rx_tx_sts;
587 memcpy((
void*)&rx_tx_sts, (
void*)pmsg,
sizeof(cmpk_tx_status_t));
589 cmpk_count_tx_status(dev, &rx_tx_sts);
611 cmpk_handle_tx_rate_history(
615 cmpk_tx_rahis_t *ptxrate;
620 struct r8192_priv *priv = ieee80211_priv(dev);
624 pAdapter->HalFunc.GetHwRegHandler(pAdapter,
HW_VAR_RF_STATE, (pu1Byte)(&rtState));
641 for (i = 0; i < (length/4); i++)
645 temp1 = ptemp[
i]&0x0000FFFF;
646 temp2 = ptemp[
i]>>16;
647 ptemp[
i] = (temp1<<16)|temp2;
650 ptxrate = (cmpk_tx_rahis_t *)pmsg;
652 if (ptxrate ==
NULL )
657 for (i = 0; i < 16; i++)
661 priv->
stats.txrate.cck[
i] += ptxrate->cck[
i];
665 priv->
stats.txrate.ofdm[
i] += ptxrate->ofdm[
i];
667 for (j = 0; j < 4; j++)
668 priv->
stats.txrate.ht_mcs[j][i] += ptxrate->ht_mcs[j][i];
701 u8 cmd_length, exe_cnt = 0;
716 total_length = pstats->
Length;
722 element_id = pcmd_buff[0];
730 while (total_length > 0 || exe_cnt++ >100)
733 element_id = pcmd_buff[0];
738 cmpk_handle_tx_feedback (dev, pcmd_buff);
743 cmpk_handle_interrupt_status(dev, pcmd_buff);
748 cmpk_handle_query_config_rx(dev, pcmd_buff);
753 cmpk_handle_tx_status(dev, pcmd_buff);
766 cmpk_handle_tx_rate_history(dev, pcmd_buff);
781 total_length -= cmd_length;
782 pcmd_buff += cmd_length;