2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
31 Create and register network interface.
35 -------- ---------- ----------------------------------------------
36 Sample Mar/21/07 Merge RT2870 and RT2860 drivers.
39 #include "rt_config.h"
41 #define FORTY_MHZ_INTOLERANT_INTERVAL (60*1000) // 1 min
43 #ifdef MULTIPLE_CARD_SUPPORT
44 // record whether the card in the card list is used in the card file
45 UINT8 MC_CardUsed[MAX_NUM_OF_MULTIPLE_CARD];
46 // record used card mac address in the card list
47 static UINT8 MC_CardMac[MAX_NUM_OF_MULTIPLE_CARD][6];
48 #endif // MULTIPLE_CARD_SUPPORT //
50 #ifdef CONFIG_APSTA_MIXED_SUPPORT
51 UINT32 CW_MAX_IN_BITS;
52 #endif // CONFIG_APSTA_MIXED_SUPPORT //
54 /*---------------------------------------------------------------------*/
55 /* Private Variables Used */
56 /*---------------------------------------------------------------------*/
57 //static RALINK_TIMER_STRUCT PeriodicTimer;
59 char *mac = ""; // default 00:00:00:00:00:00
60 char *hostname = ""; // default CMPC
61 module_param (mac, charp, 0);
62 MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr");
65 /*---------------------------------------------------------------------*/
66 /* Prototypes of Functions Used */
67 /*---------------------------------------------------------------------*/
68 #ifdef DOT11_N_SUPPORT
69 extern BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num);
70 extern void ba_reordering_resource_release(PRTMP_ADAPTER pAd);
71 #endif // DOT11_N_SUPPORT //
72 extern NDIS_STATUS NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd);
75 extern void init_thread_task(PRTMP_ADAPTER pAd);
78 // public function prototype
79 INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p,
80 IN UINT argc, OUT PRTMP_ADAPTER *ppAd);
82 // private function prototype
83 static int rt28xx_init(IN struct net_device *net_dev);
84 INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev);
86 static void CfgInitHook(PRTMP_ADAPTER pAd);
88 #ifdef CONFIG_STA_SUPPORT
89 extern const struct iw_handler_def rt28xx_iw_handler_def;
90 #endif // CONFIG_STA_SUPPORT //
92 #ifdef CONFIG_APSTA_MIXED_SUPPORT
93 extern const struct iw_handler_def rt28xx_ap_iw_handler_def;
94 #endif // CONFIG_APSTA_MIXED_SUPPORT //
96 #if WIRELESS_EXT >= 12
97 // This function will be called when query /proc
98 struct iw_statistics *rt28xx_get_wireless_stats(
99 IN struct net_device *net_dev);
102 struct net_device_stats *RT28xx_get_ether_stats(
103 IN struct net_device *net_dev);
106 ========================================================================
108 Close raxx interface.
111 *net_dev the raxx interface pointer
118 1. if open fail, kernel will not call the close function.
120 (1) Mlme Memory Handler: MlmeHalt()
121 (2) TX & RX: RTMPFreeTxRxRingMemory()
122 (3) BA Reordering: ba_reordering_resource_release()
123 ========================================================================
125 int MainVirtualIF_close(IN struct net_device *net_dev)
127 RTMP_ADAPTER *pAd = net_dev->ml_priv;
129 // Sanity check for pAd
131 return 0; // close ok
133 netif_carrier_off(pAd->net_dev);
134 netif_stop_queue(pAd->net_dev);
137 VIRTUAL_IF_DOWN(pAd);
139 RT_MOD_DEC_USE_COUNT();
141 return 0; // close ok
145 ========================================================================
150 *net_dev the raxx interface pointer
157 1. if open fail, kernel will not call the close function.
159 (1) Mlme Memory Handler: MlmeHalt()
160 (2) TX & RX: RTMPFreeTxRxRingMemory()
161 (3) BA Reordering: ba_reordering_resource_release()
162 ========================================================================
164 int MainVirtualIF_open(IN struct net_device *net_dev)
166 RTMP_ADAPTER *pAd = net_dev->ml_priv;
168 // Sanity check for pAd
170 return 0; // close ok
172 if (VIRTUAL_IF_UP(pAd) != 0)
175 // increase MODULE use count
176 RT_MOD_INC_USE_COUNT();
178 netif_start_queue(net_dev);
179 netif_carrier_on(net_dev);
180 netif_wake_queue(net_dev);
186 ========================================================================
188 Close raxx interface.
191 *net_dev the raxx interface pointer
198 1. if open fail, kernel will not call the close function.
200 (1) Mlme Memory Handler: MlmeHalt()
201 (2) TX & RX: RTMPFreeTxRxRingMemory()
202 (3) BA Reordering: ba_reordering_resource_release()
203 ========================================================================
205 int rt28xx_close(IN PNET_DEV dev)
207 struct net_device * net_dev = (struct net_device *)dev;
208 RTMP_ADAPTER *pAd = net_dev->ml_priv;
209 BOOLEAN Cancelled = FALSE;
213 DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n"));
215 // Sanity check for pAd
217 return 0; // close ok
222 #endif // WDS_SUPPORT //
224 #ifdef CONFIG_STA_SUPPORT
225 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
227 // If dirver doesn't wake up firmware here,
228 // NICLoadFirmware will hang forever when interface is up again.
229 if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) ||
230 RTMP_SET_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) ||
231 RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))
233 AsicForceWakeup(pAd, RTMP_HALT);
236 #ifdef QOS_DLS_SUPPORT
237 // send DLS-TEAR_DOWN message,
238 if (pAd->CommonCfg.bDLSCapable)
242 // tear down local dls table entry
243 for (i=0; i<MAX_NUM_OF_INIT_DLS_ENTRY; i++)
245 if (pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH))
247 RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr);
248 pAd->StaCfg.DLSEntry[i].Status = DLS_NONE;
249 pAd->StaCfg.DLSEntry[i].Valid = FALSE;
253 // tear down peer dls table entry
254 for (i=MAX_NUM_OF_INIT_DLS_ENTRY; i<MAX_NUM_OF_DLS_ENTRY; i++)
256 if (pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH))
258 RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr);
259 pAd->StaCfg.DLSEntry[i].Status = DLS_NONE;
260 pAd->StaCfg.DLSEntry[i].Valid = FALSE;
263 RT28XX_MLME_HANDLER(pAd);
265 #endif // QOS_DLS_SUPPORT //
268 (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)))
270 MLME_DISASSOC_REQ_STRUCT DisReq;
271 MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG);
273 COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid);
274 DisReq.Reason = REASON_DEAUTH_STA_LEAVING;
276 MsgElem->Machine = ASSOC_STATE_MACHINE;
277 MsgElem->MsgType = MT2_MLME_DISASSOC_REQ;
278 MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT);
279 NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT));
281 // Prevent to connect AP again in STAMlmePeriodicExec
282 pAd->MlmeAux.AutoReconnectSsidLen= 32;
283 NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen);
285 pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC;
286 MlmeDisassocReqAction(pAd, MsgElem);
294 RTMPCancelTimer(&pAd->StaCfg.LeapAuthTimer, &Cancelled);
297 RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled);
298 RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled);
300 #ifdef WPA_SUPPLICANT_SUPPORT
301 #ifndef NATIVE_WPA_SUPPLICANT_SUPPORT
303 union iwreq_data wrqu;
304 // send wireless event to wpa_supplicant for infroming interface down.
305 memset(&wrqu, 0, sizeof(wrqu));
306 wrqu.data.flags = RT_INTERFACE_DOWN;
307 wireless_send_event(pAd->net_dev, IWEVCUSTOM, &wrqu, NULL);
309 #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
310 #endif // WPA_SUPPLICANT_SUPPORT //
314 pAd->bPCIclkOff = FALSE;
317 #endif // CONFIG_STA_SUPPORT //
319 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
321 for (i = 0 ; i < NUM_OF_TX_RING; i++)
323 while (pAd->DeQueueRunning[i] == TRUE)
325 printk("Waiting for TxQueue[%d] done..........\n", i);
330 // Stop Mlme state machine
333 // Close kernel threads or tasklets
334 kill_thread_task(pAd);
337 #ifdef CONFIG_STA_SUPPORT
338 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
342 #endif // CONFIG_STA_SUPPORT //
345 MeasureReqTabExit(pAd);
350 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
352 NICDisableInterrupt(pAd);
355 // Disable Rx, register value supposed will remain after reset
359 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE))
361 // Deregister interrupt function
362 RT28XX_IRQ_RELEASE(net_dev)
363 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
368 // Free Ring or USB buffers
369 RTMPFreeTxRxRingMemory(pAd);
371 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
373 #ifdef DOT11_N_SUPPORT
374 // Free BA reorder resource
375 ba_reordering_resource_release(pAd);
376 #endif // DOT11_N_SUPPORT //
379 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP);
381 return 0; // close ok
382 } /* End of rt28xx_close */
384 static int rt28xx_init(IN struct net_device *net_dev)
386 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)net_dev->ml_priv;
393 #ifdef DOT11_N_SUPPORT
394 // Allocate BA Reordering memory
395 ba_reordering_resource_init(pAd, MAX_REORDERING_MPDU_NUM);
396 #endif // DOT11_N_SUPPORT //
398 // Make sure MAC gets ready.
402 RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0);
403 pAd->MACVersion = MacCsr0;
405 if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF))
409 } while (index++ < 100);
411 DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion));
414 RT28XXDMADisable(pAd);
417 // Load 8051 firmware
418 Status = NICLoadFirmware(pAd);
419 if (Status != NDIS_STATUS_SUCCESS)
421 DBGPRINT_ERR(("NICLoadFirmware failed, Status[=0x%08x]\n", Status));
425 NICLoadRateSwitchingParams(pAd);
427 // Disable interrupts here which is as soon as possible
428 // This statement should never be true. We might consider to remove it later
430 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
432 NICDisableInterrupt(pAd);
436 Status = RTMPAllocTxRxRingMemory(pAd);
437 if (Status != NDIS_STATUS_SUCCESS)
439 DBGPRINT_ERR(("RTMPAllocDMAMemory failed, Status[=0x%08x]\n", Status));
443 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
448 Status = MlmeInit(pAd);
449 if (Status != NDIS_STATUS_SUCCESS)
451 DBGPRINT_ERR(("MlmeInit failed, Status[=0x%08x]\n", Status));
455 // Initialize pAd->StaCfg, pAd->ApCfg, pAd->CommonCfg to manufacture default
460 RT28XX_TASK_THREAD_INIT(pAd, Status);
461 if (Status != NDIS_STATUS_SUCCESS)
468 initblockQueueTab(pAd);
469 #endif // BLOCK_NET_IF //
471 #ifdef CONFIG_STA_SUPPORT
472 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
473 NdisAllocateSpinLock(&pAd->MacTabLock);
474 #endif // CONFIG_STA_SUPPORT //
476 MeasureReqTabInit(pAd);
480 // Init the hardware, we need to init asic before read registry, otherwise mac register will be reset
482 Status = NICInitializeAdapter(pAd, TRUE);
483 if (Status != NDIS_STATUS_SUCCESS)
485 DBGPRINT_ERR(("NICInitializeAdapter failed, Status[=0x%08x]\n", Status));
486 if (Status != NDIS_STATUS_SUCCESS)
490 // Read parameters from Config File
491 Status = RTMPReadParametersHook(pAd);
493 printk("1. Phy Mode = %d\n", pAd->CommonCfg.PhyMode);
494 if (Status != NDIS_STATUS_SUCCESS)
496 DBGPRINT_ERR(("NICReadRegParameters failed, Status[=0x%08x]\n",Status));
502 //Init Ba Capability parameters.
503 #ifdef DOT11_N_SUPPORT
504 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
505 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
506 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
507 pAd->CommonCfg.DesiredHtPhy.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
509 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
510 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
511 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
512 #endif // DOT11_N_SUPPORT //
514 printk("2. Phy Mode = %d\n", pAd->CommonCfg.PhyMode);
516 // We should read EEPROM for all cases. rt2860b
517 NICReadEEPROMParameters(pAd, mac);
519 printk("3. Phy Mode = %d\n", pAd->CommonCfg.PhyMode);
521 NICInitAsicFromEEPROM(pAd); //rt2860b
523 // Set PHY to appropriate mode
524 TmpPhy = pAd->CommonCfg.PhyMode;
525 pAd->CommonCfg.PhyMode = 0xff;
526 RTMPSetPhyMode(pAd, TmpPhy);
527 #ifdef DOT11_N_SUPPORT
529 #endif // DOT11_N_SUPPORT //
531 // No valid channels.
532 if (pAd->ChannelListNum == 0)
534 printk("Wrong configuration. No valid channel found. Check \"ContryCode\" and \"ChannelGeography\" setting.\n");
538 #ifdef DOT11_N_SUPPORT
539 printk("MCS Set = %02x %02x %02x %02x %02x\n", pAd->CommonCfg.HtCapability.MCSSet[0],
540 pAd->CommonCfg.HtCapability.MCSSet[1], pAd->CommonCfg.HtCapability.MCSSet[2],
541 pAd->CommonCfg.HtCapability.MCSSet[3], pAd->CommonCfg.HtCapability.MCSSet[4]);
542 #endif // DOT11_N_SUPPORT //
545 VR_IKANOS_FP_Init(pAd->ApCfg.BssidNum, pAd->PermanentAddress);
546 #endif // IKANOS_VX_1X0 //
549 // Initialize RF register to default value
551 AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
552 AsicLockChannel(pAd, pAd->CommonCfg.Channel);
554 // 8051 firmware require the signal during booting time.
555 AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00);
557 if (pAd && (Status != NDIS_STATUS_SUCCESS))
560 // Undo everything if it failed
562 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE))
564 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
569 // Microsoft HCT require driver send a disconnect event after driver initialization.
570 OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
571 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE);
572 DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event B!\n"));
578 DBGPRINT_S(Status, ("<==== RTMPInitialize, Status=%x\n", Status));
587 RTMPFreeTxRxRingMemory(pAd);
590 #ifdef DOT11_N_SUPPORT
591 os_free_mem(pAd, pAd->mpdu_blk_pool.mem); // free BA pool
592 #endif // DOT11_N_SUPPORT //
593 RT28XX_IRQ_RELEASE(net_dev);
595 // shall not set ml_priv to NULL here because the ml_priv didn't been free yet.
596 //net_dev->ml_priv = 0;
599 #endif // INF_AMAZON_SE //
600 printk("!!! %s Initialized fail !!!\n", RT28xx_CHIP_NAME);
602 } /* End of rt28xx_init */
606 ========================================================================
611 *net_dev the raxx interface pointer
618 ========================================================================
620 int rt28xx_open(IN PNET_DEV dev)
622 struct net_device * net_dev = (struct net_device *)dev;
623 PRTMP_ADAPTER pAd = net_dev->ml_priv;
628 // Sanity check for pAd
631 /* if 1st open fail, pAd will be free;
632 So the net_dev->ml_priv will be NULL in 2rd open */
636 #ifdef CONFIG_APSTA_MIXED_SUPPORT
637 if (pAd->OpMode == OPMODE_AP)
641 else if (pAd->OpMode == OPMODE_STA)
646 #if WIRELESS_EXT >= 12
647 if (net_dev->priv_flags == INT_MAIN)
649 if (pAd->OpMode == OPMODE_AP)
650 net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_ap_iw_handler_def;
651 else if (pAd->OpMode == OPMODE_STA)
652 net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_iw_handler_def;
654 #endif // WIRELESS_EXT >= 12 //
655 #endif // CONFIG_APSTA_MIXED_SUPPORT //
658 pObj = (POS_COOKIE)pAd->OS_Cookie;
660 // reset Adapter flags
661 RTMP_CLEAR_FLAGS(pAd);
663 // Request interrupt service routine for PCI device
664 // register the interrupt routine with the os
665 RT28XX_IRQ_REQUEST(net_dev);
668 // Init BssTab & ChannelInfo tabbles for auto channel select.
672 if (rt28xx_init(net_dev) == FALSE)
675 #ifdef CONFIG_STA_SUPPORT
676 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
678 NdisZeroMemory(pAd->StaCfg.dev_name, 16);
679 NdisMoveMemory(pAd->StaCfg.dev_name, net_dev->name, strlen(net_dev->name));
681 #endif // CONFIG_STA_SUPPORT //
683 // Set up the Mac address
684 NdisMoveMemory(net_dev->dev_addr, (void *) pAd->CurrentAddress, 6);
686 // Init IRQ parameters
687 RT28XX_IRQ_INIT(pAd);
689 // Various AP function init
691 #ifdef CONFIG_STA_SUPPORT
692 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
694 #ifdef WPA_SUPPLICANT_SUPPORT
695 #ifndef NATIVE_WPA_SUPPLICANT_SUPPORT
697 union iwreq_data wrqu;
698 // send wireless event to wpa_supplicant for infroming interface down.
699 memset(&wrqu, 0, sizeof(wrqu));
700 wrqu.data.flags = RT_INTERFACE_UP;
701 wireless_send_event(pAd->net_dev, IWEVCUSTOM, &wrqu, NULL);
703 #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
704 #endif // WPA_SUPPLICANT_SUPPORT //
707 #endif // CONFIG_STA_SUPPORT //
710 RT28XX_IRQ_ENABLE(pAd);
714 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP);
718 RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts
719 printk("0x1300 = %08x\n", reg);
722 #ifdef CONFIG_STA_SUPPORT
724 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
725 RTMPInitPCIeLinkCtrlValue(pAd);
727 #endif // CONFIG_STA_SUPPORT //
733 } /* End of rt28xx_open */
736 /* Must not be called for mdev and apdev */
737 static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER pAd)
741 CHAR slot_name[IFNAMSIZ];
742 struct net_device *device;
746 dev->hard_start_xmit = rt28xx_send_packets;
749 dev->hard_start_xmit = IKANOS_DataFramesTx;
750 #endif // IKANOS_VX_1X0 //
752 #ifdef CONFIG_STA_SUPPORT
753 #if WIRELESS_EXT >= 12
754 if (pAd->OpMode == OPMODE_STA)
756 dev->wireless_handlers = &rt28xx_iw_handler_def;
758 #endif //WIRELESS_EXT >= 12
759 #endif // CONFIG_STA_SUPPORT //
761 #ifdef CONFIG_APSTA_MIXED_SUPPORT
762 #if WIRELESS_EXT >= 12
763 if (pAd->OpMode == OPMODE_AP)
765 dev->wireless_handlers = &rt28xx_ap_iw_handler_def;
767 #endif //WIRELESS_EXT >= 12
768 #endif // CONFIG_APSTA_MIXED_SUPPORT //
770 #if WIRELESS_EXT < 21
771 dev->get_wireless_stats = rt28xx_get_wireless_stats;
773 dev->get_stats = RT28xx_get_ether_stats;
774 dev->open = MainVirtualIF_open; //rt28xx_open;
775 dev->stop = MainVirtualIF_close; //rt28xx_close;
776 dev->priv_flags = INT_MAIN;
777 dev->do_ioctl = rt28xx_ioctl;
778 dev->validate_addr = NULL;
779 // find available device name
780 for (i = 0; i < 8; i++)
782 #ifdef MULTIPLE_CARD_SUPPORT
783 if (pAd->MC_RowID >= 0)
784 sprintf(slot_name, "ra%02d_%d", pAd->MC_RowID, i);
786 #endif // MULTIPLE_CARD_SUPPORT //
787 sprintf(slot_name, "ra%d", i);
789 device = dev_get_by_name(dev_net(dev), slot_name);
799 DBGPRINT(RT_DEBUG_ERROR, ("No available slot name\n"));
800 Status = NDIS_STATUS_FAILURE;
804 #ifdef MULTIPLE_CARD_SUPPORT
805 if (pAd->MC_RowID >= 0)
806 sprintf(dev->name, "ra%02d_%d", pAd->MC_RowID, i);
808 #endif // MULTIPLE_CARD_SUPPORT //
809 sprintf(dev->name, "ra%d", i);
810 Status = NDIS_STATUS_SUCCESS;
818 #ifdef MULTIPLE_CARD_SUPPORT
820 ========================================================================
822 Get card profile path.
828 TRUE - Find a card profile
829 FALSE - use default profile
832 ========================================================================
834 extern INT RTMPGetKeyParameter(
840 BOOLEAN RTMP_CardInfoRead(
841 IN PRTMP_ADAPTER pAd)
843 #define MC_SELECT_CARDID 0 /* use CARD ID (0 ~ 31) to identify different cards */
844 #define MC_SELECT_MAC 1 /* use CARD MAC to identify different cards */
845 #define MC_SELECT_CARDTYPE 2 /* use CARD type (abgn or bgn) to identify different cards */
847 #define LETTER_CASE_TRANSLATE(txt_p, card_id) \
848 { UINT32 _len; char _char; \
849 for(_len=0; _len<strlen(card_id); _len++) { \
850 _char = *(txt_p + _len); \
851 if (('A' <= _char) && (_char <= 'Z')) \
852 *(txt_p+_len) = 'a'+(_char-'A'); \
856 INT retval, orgfsuid, orgfsgid;
858 CHAR *buffer, *tmpbuf, card_id_buf[30], RFIC_word[30];
859 BOOLEAN flg_match_ok = FALSE;
860 INT32 card_select_method;
861 INT32 card_free_id, card_nouse_id, card_same_mac_id, card_match_id;
862 EEPROM_ANTENNA_STRUC antenna;
863 USHORT addr01, addr23, addr45;
865 UINT32 data, card_index;
870 buffer = kmalloc(MAX_INI_BUFFER_SIZE, MEM_ALLOC_FLAG);
874 tmpbuf = kmalloc(MAX_PARAM_BUFFER_SIZE, MEM_ALLOC_FLAG);
878 return NDIS_STATUS_FAILURE;
881 orgfsuid = current->fsuid;
882 orgfsgid = current->fsgid;
883 current->fsuid = current->fsgid = 0;
888 RTMP_IO_READ32(pAd, E2PROM_CSR, &data);
890 if ((data & 0x30) == 0)
891 pAd->EEPROMAddressNum = 6; // 93C46
892 else if ((data & 0x30) == 0x10)
893 pAd->EEPROMAddressNum = 8; // 93C66
895 pAd->EEPROMAddressNum = 8; // 93C86
897 RT28xx_EEPROM_READ16(pAd, EEPROM_NIC1_OFFSET, antenna.word);
899 if ((antenna.field.RfIcType == RFIC_2850) ||
900 (antenna.field.RfIcType == RFIC_2750))
903 strcpy(RFIC_word, "abgn");
908 strcpy(RFIC_word, "bgn");
912 RT28xx_EEPROM_READ16(pAd, 0x04, addr01);
913 RT28xx_EEPROM_READ16(pAd, 0x06, addr23);
914 RT28xx_EEPROM_READ16(pAd, 0x08, addr45);
916 mac[0] = (UCHAR)(addr01 & 0xff);
917 mac[1] = (UCHAR)(addr01 >> 8);
918 mac[2] = (UCHAR)(addr23 & 0xff);
919 mac[3] = (UCHAR)(addr23 >> 8);
920 mac[4] = (UCHAR)(addr45 & 0xff);
921 mac[5] = (UCHAR)(addr45 >> 8);
923 // open card information file
924 srcf = filp_open(CARD_INFO_PATH, O_RDONLY, 0);
927 /* card information file does not exist */
928 DBGPRINT(RT_DEBUG_TRACE,
929 ("--> Error %ld opening %s\n", -PTR_ERR(srcf), CARD_INFO_PATH));
933 if (srcf->f_op && srcf->f_op->read)
935 /* card information file exists so reading the card information */
936 memset(buffer, 0x00, MAX_INI_BUFFER_SIZE);
937 retval = srcf->f_op->read(srcf, buffer, MAX_INI_BUFFER_SIZE, &srcf->f_pos);
941 DBGPRINT(RT_DEBUG_TRACE,
942 ("--> Read %s error %d\n", CARD_INFO_PATH, -retval));
946 /* get card selection method */
947 memset(tmpbuf, 0x00, MAX_PARAM_BUFFER_SIZE);
948 card_select_method = MC_SELECT_CARDTYPE; // default
950 if (RTMPGetKeyParameter("SELECT", tmpbuf, 256, buffer))
952 if (strcmp(tmpbuf, "CARDID") == 0)
953 card_select_method = MC_SELECT_CARDID;
954 else if (strcmp(tmpbuf, "MAC") == 0)
955 card_select_method = MC_SELECT_MAC;
956 else if (strcmp(tmpbuf, "CARDTYPE") == 0)
957 card_select_method = MC_SELECT_CARDTYPE;
960 DBGPRINT(RT_DEBUG_TRACE,
961 ("MC> Card Selection = %d\n", card_select_method));
966 card_same_mac_id = -1;
969 // search current card information records
971 card_index<MAX_NUM_OF_MULTIPLE_CARD;
974 if ((*(UINT32 *)&MC_CardMac[card_index][0] == 0) &&
975 (*(UINT16 *)&MC_CardMac[card_index][4] == 0))
977 // MAC is all-0 so the entry is available
978 MC_CardUsed[card_index] = 0;
980 if (card_free_id < 0)
981 card_free_id = card_index; // 1st free entry
985 if (memcmp(MC_CardMac[card_index], mac, 6) == 0)
987 // we find the entry with same MAC
988 if (card_same_mac_id < 0)
989 card_same_mac_id = card_index; // 1st same entry
993 // MAC is not all-0 but used flag == 0
994 if ((MC_CardUsed[card_index] == 0) &&
997 card_nouse_id = card_index; // 1st available entry
1003 DBGPRINT(RT_DEBUG_TRACE,
1004 ("MC> Free = %d, Same = %d, NOUSE = %d\n",
1005 card_free_id, card_same_mac_id, card_nouse_id));
1007 if ((card_same_mac_id >= 0) &&
1008 ((card_select_method == MC_SELECT_CARDID) ||
1009 (card_select_method == MC_SELECT_CARDTYPE)))
1011 // same MAC entry is found
1012 card_match_id = card_same_mac_id;
1014 if (card_select_method == MC_SELECT_CARDTYPE)
1017 sprintf(card_id_buf, "%02dCARDTYPE%s",
1018 card_match_id, RFIC_word);
1020 if ((start_ptr=rtstrstruncasecmp(buffer, card_id_buf)) != NULL)
1022 // we found the card ID
1023 LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
1029 // the card is 1st plug-in, try to find the match card profile
1030 switch(card_select_method)
1032 case MC_SELECT_CARDID: // CARDID
1034 if (card_free_id >= 0)
1035 card_match_id = card_free_id;
1037 card_match_id = card_nouse_id;
1040 case MC_SELECT_MAC: // MAC
1041 sprintf(card_id_buf, "MAC%02x:%02x:%02x:%02x:%02x:%02x",
1042 mac[0], mac[1], mac[2],
1043 mac[3], mac[4], mac[5]);
1045 /* try to find the key word in the card file */
1046 if ((start_ptr=rtstrstruncasecmp(buffer, card_id_buf)) != NULL)
1048 LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
1050 /* get the row ID (2 ASCII characters) */
1052 card_id_buf[0] = *(start_ptr);
1053 card_id_buf[1] = *(start_ptr+1);
1054 card_id_buf[2] = 0x00;
1056 card_match_id = simple_strtol(card_id_buf, 0, 10);
1060 case MC_SELECT_CARDTYPE: // CARDTYPE
1064 card_index<MAX_NUM_OF_MULTIPLE_CARD;
1067 sprintf(card_id_buf, "%02dCARDTYPE%s",
1068 card_index, RFIC_word);
1070 if ((start_ptr=rtstrstruncasecmp(buffer,
1071 card_id_buf)) != NULL)
1073 LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
1075 if (MC_CardUsed[card_index] == 0)
1077 /* current the card profile is not used */
1078 if ((*(UINT32 *)&MC_CardMac[card_index][0] == 0) &&
1079 (*(UINT16 *)&MC_CardMac[card_index][4] == 0))
1081 // find it and no previous card use it
1082 card_match_id = card_index;
1087 // ever a card use it
1088 if (card_nouse_id < 0)
1089 card_nouse_id = card_index;
1095 // if not find a free one, use the available one
1096 if (card_match_id < 0)
1097 card_match_id = card_nouse_id;
1102 if (card_match_id >= 0)
1104 // make up search keyword
1105 switch(card_select_method)
1107 case MC_SELECT_CARDID: // CARDID
1108 sprintf(card_id_buf, "%02dCARDID", card_match_id);
1111 case MC_SELECT_MAC: // MAC
1112 sprintf(card_id_buf,
1113 "%02dmac%02x:%02x:%02x:%02x:%02x:%02x",
1115 mac[0], mac[1], mac[2],
1116 mac[3], mac[4], mac[5]);
1119 case MC_SELECT_CARDTYPE: // CARDTYPE
1121 sprintf(card_id_buf, "%02dcardtype%s",
1122 card_match_id, RFIC_word);
1126 DBGPRINT(RT_DEBUG_TRACE, ("Search Keyword = %s\n", card_id_buf));
1128 // read card file path
1129 if (RTMPGetKeyParameter(card_id_buf, tmpbuf, 256, buffer))
1131 if (strlen(tmpbuf) < sizeof(pAd->MC_FileName))
1133 // backup card information
1134 pAd->MC_RowID = card_match_id; /* base 0 */
1135 MC_CardUsed[card_match_id] = 1;
1136 memcpy(MC_CardMac[card_match_id], mac, sizeof(mac));
1138 // backup card file path
1139 NdisMoveMemory(pAd->MC_FileName, tmpbuf , strlen(tmpbuf));
1140 pAd->MC_FileName[strlen(tmpbuf)] = '\0';
1141 flg_match_ok = TRUE;
1143 DBGPRINT(RT_DEBUG_TRACE,
1144 ("Card Profile Name = %s\n", pAd->MC_FileName));
1148 DBGPRINT(RT_DEBUG_ERROR,
1149 ("Card Profile Name length too large!\n"));
1154 DBGPRINT(RT_DEBUG_ERROR,
1155 ("Can not find search key word in card.dat!\n"));
1158 if ((flg_match_ok != TRUE) &&
1159 (card_match_id < MAX_NUM_OF_MULTIPLE_CARD))
1161 MC_CardUsed[card_match_id] = 0;
1162 memset(MC_CardMac[card_match_id], 0, sizeof(mac));
1164 } // if (card_match_id >= 0)
1169 retval = filp_close(srcf, NULL);
1171 current->fsuid = orgfsuid;
1172 current->fsgid = orgfsgid;
1175 return flg_match_ok;
1177 #endif // MULTIPLE_CARD_SUPPORT //
1181 ========================================================================
1182 Routine Description:
1183 Probe RT28XX chipset.
1186 _dev_p Point to the PCI or USB device
1187 _dev_id_p Point to the PCI or USB device ID
1194 ========================================================================
1196 INT __devinit rt28xx_probe(
1200 OUT PRTMP_ADAPTER *ppAd)
1202 struct net_device *net_dev;
1203 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL;
1207 struct pci_dev *dev_p = (struct pci_dev *)_dev_p;
1211 #ifdef CONFIG_STA_SUPPORT
1212 DBGPRINT(RT_DEBUG_TRACE, ("STA Driver version-%s\n", STA_DRIVER_VERSION));
1213 #endif // CONFIG_STA_SUPPORT //
1215 net_dev = alloc_etherdev(sizeof(PRTMP_ADAPTER));
1216 if (net_dev == NULL)
1218 printk("alloc_netdev failed\n");
1223 netif_stop_queue(net_dev);
1224 #ifdef NATIVE_WPA_SUPPLICANT_SUPPORT
1225 /* for supporting Network Manager */
1226 /* Set the sysfs physical device reference for the network logical device
1227 * if set prior to registration will cause a symlink during initialization.
1229 SET_NETDEV_DEV(net_dev, &(dev_p->dev));
1230 #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
1232 // Allocate RTMP_ADAPTER miniport adapter structure
1233 handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL);
1234 RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p);
1236 status = RTMPAllocAdapterBlock(handle, &pAd);
1237 if (status != NDIS_STATUS_SUCCESS)
1238 goto err_out_free_netdev;
1240 net_dev->ml_priv = (PVOID)pAd;
1241 pAd->net_dev = net_dev; // must be before RT28XXNetDevInit()
1243 RT28XXNetDevInit(_dev_p, net_dev, pAd);
1245 #ifdef CONFIG_STA_SUPPORT
1246 pAd->StaCfg.OriDevType = net_dev->type;
1247 #endif // CONFIG_STA_SUPPORT //
1250 if (RT28XXProbePostConfig(_dev_p, pAd, 0) == FALSE)
1253 #ifdef CONFIG_STA_SUPPORT
1254 pAd->OpMode = OPMODE_STA;
1255 #endif // CONFIG_STA_SUPPORT //
1258 #ifdef MULTIPLE_CARD_SUPPORT
1259 // find its profile path
1260 pAd->MC_RowID = -1; // use default profile path
1261 RTMP_CardInfoRead(pAd);
1263 if (pAd->MC_RowID == -1)
1264 #ifdef CONFIG_STA_SUPPORT
1265 strcpy(pAd->MC_FileName, STA_PROFILE_PATH);
1266 #endif // CONFIG_STA_SUPPORT //
1268 DBGPRINT(RT_DEBUG_TRACE,
1269 ("MC> ROW = %d, PATH = %s\n", pAd->MC_RowID, pAd->MC_FileName));
1270 #endif // MULTIPLE_CARD_SUPPORT //
1273 if (rt_ieee80211_if_setup(net_dev, pAd) != NDIS_STATUS_SUCCESS)
1276 // Register this device
1277 status = register_netdev(net_dev);
1282 RT28XX_DRVDATA_SET(_dev_p);
1285 return 0; // probe ok
1288 /* --------------------------- ERROR HANDLE --------------------------- */
1290 RTMPFreeAdapter(pAd);
1293 err_out_free_netdev:
1294 free_netdev(net_dev);
1297 RT28XX_PUT_DEVICE(dev_p);
1299 return -ENODEV; /* probe fail */
1300 } /* End of rt28xx_probe */
1304 ========================================================================
1305 Routine Description:
1306 The entry point for Linux kernel sent packet to our driver.
1309 sk_buff *skb the pointer refer to a sk_buffer.
1315 This function is the entry point of Tx Path for Os delivery packet to
1316 our driver. You only can put OS-depened & STA/AP common handle procedures
1318 ========================================================================
1320 int rt28xx_packet_xmit(struct sk_buff *skb)
1322 struct net_device *net_dev = skb->dev;
1323 PRTMP_ADAPTER pAd = net_dev->ml_priv;
1325 PNDIS_PACKET pPacket = (PNDIS_PACKET) skb;
1327 /* RT2870STA does this in RTMPSendPackets() */
1331 RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_RESOURCES);
1334 #endif // RALINK_ATE //
1336 #ifdef CONFIG_STA_SUPPORT
1337 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1339 // Drop send request since we are in monitor mode
1340 if (MONITOR_ON(pAd))
1342 RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
1346 #endif // CONFIG_STA_SUPPORT //
1348 // EapolStart size is 18
1351 //printk("bad packet size: %d\n", pkt->len);
1352 hex_dump("bad packet", skb->data, skb->len);
1353 RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
1357 RTMP_SET_PACKET_5VT(pPacket, 0);
1358 #ifdef CONFIG_5VT_ENHANCE
1359 if (*(int*)(skb->cb) == BRIDGE_TAG) {
1360 RTMP_SET_PACKET_5VT(pPacket, 1);
1366 #ifdef CONFIG_STA_SUPPORT
1367 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1370 STASendPackets((NDIS_HANDLE)pAd, (PPNDIS_PACKET) &pPacket, 1);
1373 #endif // CONFIG_STA_SUPPORT //
1383 ========================================================================
1384 Routine Description:
1385 Send a packet to WLAN.
1388 skb_p points to our adapter
1389 dev_p which WLAN network interface
1392 0: transmit successfully
1393 otherwise: transmit fail
1396 ========================================================================
1398 INT rt28xx_send_packets(
1399 IN struct sk_buff *skb_p,
1400 IN struct net_device *net_dev)
1402 RTMP_ADAPTER *pAd = net_dev->ml_priv;
1403 if (!(net_dev->flags & IFF_UP))
1405 RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET)skb_p, NDIS_STATUS_FAILURE);
1409 NdisZeroMemory((PUCHAR)&skb_p->cb[CB_OFF], 15);
1410 RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID);
1412 return rt28xx_packet_xmit(skb_p);
1414 } /* End of MBSS_VirtualIF_PacketSend */
1419 void CfgInitHook(PRTMP_ADAPTER pAd)
1421 pAd->bBroadComHT = TRUE;
1422 } /* End of CfgInitHook */
1425 #if WIRELESS_EXT >= 12
1426 // This function will be called when query /proc
1427 struct iw_statistics *rt28xx_get_wireless_stats(
1428 IN struct net_device *net_dev)
1430 PRTMP_ADAPTER pAd = net_dev->ml_priv;
1433 DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n"));
1435 pAd->iw_stats.status = 0; // Status - device dependent for now
1438 pAd->iw_stats.qual.qual = ((pAd->Mlme.ChannelQuality * 12)/10 + 10);
1439 if(pAd->iw_stats.qual.qual > 100)
1440 pAd->iw_stats.qual.qual = 100;
1442 #ifdef CONFIG_STA_SUPPORT
1443 if (pAd->OpMode == OPMODE_STA)
1444 pAd->iw_stats.qual.level = RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2);
1445 #endif // CONFIG_STA_SUPPORT //
1447 pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm)
1449 pAd->iw_stats.qual.noise += 256 - 143;
1450 pAd->iw_stats.qual.updated = 1; // Flags to know if updated
1452 pAd->iw_stats.qual.updated |= IW_QUAL_DBM; // Level + Noise are dBm
1453 #endif // IW_QUAL_DBM //
1455 pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid
1456 pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe
1458 DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n"));
1459 return &pAd->iw_stats;
1460 } /* End of rt28xx_get_wireless_stats */
1461 #endif // WIRELESS_EXT //
1465 void tbtt_tasklet(unsigned long data)
1467 #define MAX_TX_IN_TBTT (16)
1472 IN struct net_device *net_dev,
1473 IN OUT struct ifreq *rq,
1476 VIRTUAL_ADAPTER *pVirtualAd = NULL;
1477 RTMP_ADAPTER *pAd = NULL;
1480 if (net_dev->priv_flags == INT_MAIN)
1482 pAd = net_dev->ml_priv;
1486 pVirtualAd = net_dev->ml_priv;
1487 pAd = pVirtualAd->RtmpDev->ml_priv;
1492 /* if 1st open fail, pAd will be free;
1493 So the net_dev->ml_priv will be NULL in 2rd open */
1498 #ifdef CONFIG_STA_SUPPORT
1499 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1501 ret = rt28xx_sta_ioctl(net_dev, rq, cmd);
1503 #endif // CONFIG_STA_SUPPORT //
1509 ========================================================================
1511 Routine Description:
1512 return ethernet statistics counter
1515 net_dev Pointer to net_device
1522 ========================================================================
1524 struct net_device_stats *RT28xx_get_ether_stats(
1525 IN struct net_device *net_dev)
1527 RTMP_ADAPTER *pAd = NULL;
1530 pAd = net_dev->ml_priv;
1535 pAd->stats.rx_packets = pAd->WlanCounters.ReceivedFragmentCount.QuadPart;
1536 pAd->stats.tx_packets = pAd->WlanCounters.TransmittedFragmentCount.QuadPart;
1538 pAd->stats.rx_bytes = pAd->RalinkCounters.ReceivedByteCount;
1539 pAd->stats.tx_bytes = pAd->RalinkCounters.TransmittedByteCount;
1541 pAd->stats.rx_errors = pAd->Counters8023.RxErrors;
1542 pAd->stats.tx_errors = pAd->Counters8023.TxErrors;
1544 pAd->stats.rx_dropped = 0;
1545 pAd->stats.tx_dropped = 0;
1547 pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received
1548 pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets
1550 pAd->stats.rx_length_errors = 0;
1551 pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow
1552 pAd->stats.rx_crc_errors = 0;//pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error
1553 pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error
1554 pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun
1555 pAd->stats.rx_missed_errors = 0; // receiver missed packet
1557 // detailed tx_errors
1558 pAd->stats.tx_aborted_errors = 0;
1559 pAd->stats.tx_carrier_errors = 0;
1560 pAd->stats.tx_fifo_errors = 0;
1561 pAd->stats.tx_heartbeat_errors = 0;
1562 pAd->stats.tx_window_errors = 0;
1565 pAd->stats.rx_compressed = 0;
1566 pAd->stats.tx_compressed = 0;