25 #define CMPK_DEBOUNCE_CNT 1
26 #define CMPK_PRINT(Address)\
31 memcpy(temp, Address, 40);\
32 for (i = 0; i < 40; i += 4)\
33 printk(KERN_INFO "\r\n %08x", temp[i]);\
39 u8 *code_virtual_address,
47 u16 frag_length = 0, frag_offset = 0;
50 unsigned char *seg_ptr;
61 if ((buffer_len - frag_offset) > frag_threshold) {
66 frag_length = (
u16)(buffer_len - frag_offset);
70 skb = dev_alloc_skb(frag_length +
71 priv->
rtllib->tx_headroom + 4);
78 memcpy((
unsigned char *)(skb->cb), &dev,
sizeof(dev));
88 memset(pTxFwInfo, 0x12, 8);
90 seg_ptr =
skb_put(skb, frag_length);
91 memcpy(seg_ptr, code_virtual_address, (
u32)frag_length);
93 priv->
rtllib->softmac_hard_start_xmit(skb, dev);
95 code_virtual_address += frag_length;
96 frag_offset += frag_length;
98 }
while (frag_offset < buffer_len);
106 cmpk_count_txstatistic(
115 (pu1Byte)(&rtState));
122 priv->
stats.txfeedbackok++;
123 priv->
stats.txoktotal++;
125 priv->
stats.txokinperiod++;
128 priv->
stats.txmulticast++;
131 priv->
stats.txbroadcast++;
134 priv->
stats.txunicast++;
138 priv->
stats.txfeedbackfail++;
139 priv->
stats.txerrtotal++;
143 priv->
stats.txerrmulticast++;
145 priv->
stats.txerrbroadcast++;
147 priv->
stats.txerrunicast++;
157 static void cmpk_handle_tx_feedback(
struct net_device *dev,
u8 *pmsg)
162 priv->
stats.txfeedback++;
166 cmpk_count_txstatistic(dev, &rx_tx_fb);
178 (!priv->
rtllib->pHTInfo->bCurSuppCCK))) {
180 DMESG(
"send beacon frame tx rate is 6Mbpm\n");
183 DMESG(
"send beacon frame tx rate is 1Mbpm\n");
188 static void cmpk_handle_interrupt_status(
struct net_device *dev,
u8 *pmsg)
193 DMESG(
"---> cmpk_Handle_Interrupt_Status()\n");
196 rx_intr_status.length = pmsg[1];
197 if (rx_intr_status.length != (
sizeof(
struct cmpk_intr_sta) - 2)) {
198 DMESG(
"cmpk_Handle_Interrupt_Status: wrong length!\n");
204 rx_intr_status.interrupt_status = *((
u32 *)(pmsg + 4));
206 DMESG(
"interrupt status = 0x%x\n",
207 rx_intr_status.interrupt_status);
209 if (rx_intr_status.interrupt_status &
ISR_TxBcnOk) {
210 priv->
rtllib->bibsscoordinator =
true;
211 priv->
stats.txbeaconokint++;
212 }
else if (rx_intr_status.interrupt_status &
ISR_TxBcnErr) {
213 priv->
rtllib->bibsscoordinator =
false;
214 priv->
stats.txbeaconerr++;
221 DMESG(
"<---- cmpk_handle_interrupt_status()\n");
226 static void cmpk_handle_query_config_rx(
struct net_device *dev,
u8 *pmsg)
231 rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000)>>31;
232 rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5;
233 rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3;
234 rx_query_cfg.cfg_page = (pmsg[6] & 0x0F) >> 0;
235 rx_query_cfg.cfg_offset = pmsg[7];
236 rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) |
237 (pmsg[10] << 8) | (pmsg[11] << 0);
238 rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) |
239 (pmsg[14] << 8) | (pmsg[15] << 0);
244 static void cmpk_count_tx_status(
struct net_device *dev,
254 (pu1Byte)(&rtState));
260 priv->
stats.txfeedbackok += pstx_status->
txok;
261 priv->
stats.txoktotal += pstx_status->
txok;
282 priv->
stats.last_packet_rate = pstx_status->
rate;
287 static void cmpk_handle_tx_status(
struct net_device *dev,
u8 *pmsg)
292 cmpk_count_tx_status(dev, &rx_tx_sts);
295 static void cmpk_handle_tx_rate_history(
struct net_device *dev,
u8 *pmsg)
306 (pu1Byte)(&rtState));
314 for (i = 0; i < (length / 4); i++) {
317 temp1 = ptemp[
i] & 0x0000FFFF;
318 temp2 = ptemp[
i] >> 16;
319 ptemp[
i] = (temp1 << 16) | temp2;
327 for (i = 0; i < 16; i++) {
334 for (j = 0; j < 4; j++)
335 priv->
stats.txrate.ht_mcs[j][i] +=
346 u8 cmd_length, exe_cnt = 0;
352 if (pstats ==
NULL) {
359 total_length = pstats->
Length;
363 element_id = pcmd_buff[0];
365 while (total_length > 0 || exe_cnt++ > 100) {
366 element_id = pcmd_buff[0];
368 switch (element_id) {
372 cmpk_handle_tx_feedback(dev, pcmd_buff);
377 "RX_INTERRUPT_STATUS\n");
378 cmpk_handle_interrupt_status(dev, pcmd_buff);
383 "BOTH_QUERY_CONFIG\n");
384 cmpk_handle_query_config_rx(dev, pcmd_buff);
390 cmpk_handle_tx_status(dev, pcmd_buff);
395 "RX_TX_PER_PKT_FEEDBACK\n");
401 cmpk_handle_tx_rate_history(dev, pcmd_buff);
407 "unknow CMD Element\n");
411 total_length -= cmd_length;
412 pcmd_buff += cmd_length;