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);
74 extern void init_thread_task(PRTMP_ADAPTER pAd);
76 // public function prototype
77 INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p,
78 IN UINT argc, OUT PRTMP_ADAPTER *ppAd);
80 // private function prototype
81 static int rt28xx_init(IN struct net_device *net_dev);
82 INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev);
84 static void CfgInitHook(PRTMP_ADAPTER pAd);
86 #ifdef CONFIG_STA_SUPPORT
87 extern const struct iw_handler_def rt28xx_iw_handler_def;
88 #endif // CONFIG_STA_SUPPORT //
90 #ifdef CONFIG_APSTA_MIXED_SUPPORT
91 extern const struct iw_handler_def rt28xx_ap_iw_handler_def;
92 #endif // CONFIG_APSTA_MIXED_SUPPORT //
94 #if WIRELESS_EXT >= 12
95 // This function will be called when query /proc
96 struct iw_statistics *rt28xx_get_wireless_stats(
97 IN struct net_device *net_dev);
100 struct net_device_stats *RT28xx_get_ether_stats(
101 IN struct net_device *net_dev);
104 ========================================================================
106 Close raxx interface.
109 *net_dev the raxx interface pointer
116 1. if open fail, kernel will not call the close function.
118 (1) Mlme Memory Handler: MlmeHalt()
119 (2) TX & RX: RTMPFreeTxRxRingMemory()
120 (3) BA Reordering: ba_reordering_resource_release()
121 ========================================================================
123 int MainVirtualIF_close(IN struct net_device *net_dev)
125 RTMP_ADAPTER *pAd = net_dev->ml_priv;
127 // Sanity check for pAd
129 return 0; // close ok
131 netif_carrier_off(pAd->net_dev);
132 netif_stop_queue(pAd->net_dev);
135 VIRTUAL_IF_DOWN(pAd);
137 RT_MOD_DEC_USE_COUNT();
139 return 0; // close ok
143 ========================================================================
148 *net_dev the raxx interface pointer
155 1. if open fail, kernel will not call the close function.
157 (1) Mlme Memory Handler: MlmeHalt()
158 (2) TX & RX: RTMPFreeTxRxRingMemory()
159 (3) BA Reordering: ba_reordering_resource_release()
160 ========================================================================
162 int MainVirtualIF_open(IN struct net_device *net_dev)
164 RTMP_ADAPTER *pAd = net_dev->ml_priv;
166 // Sanity check for pAd
168 return 0; // close ok
170 if (VIRTUAL_IF_UP(pAd) != 0)
173 // increase MODULE use count
174 RT_MOD_INC_USE_COUNT();
176 netif_start_queue(net_dev);
177 netif_carrier_on(net_dev);
178 netif_wake_queue(net_dev);
184 ========================================================================
186 Close raxx interface.
189 *net_dev the raxx interface pointer
196 1. if open fail, kernel will not call the close function.
198 (1) Mlme Memory Handler: MlmeHalt()
199 (2) TX & RX: RTMPFreeTxRxRingMemory()
200 (3) BA Reordering: ba_reordering_resource_release()
201 ========================================================================
203 int rt28xx_close(IN PNET_DEV dev)
205 struct net_device * net_dev = (struct net_device *)dev;
206 RTMP_ADAPTER *pAd = net_dev->ml_priv;
207 BOOLEAN Cancelled = FALSE;
211 DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n"));
213 // Sanity check for pAd
215 return 0; // close ok
220 #endif // WDS_SUPPORT //
222 #ifdef CONFIG_STA_SUPPORT
223 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
225 // If dirver doesn't wake up firmware here,
226 // NICLoadFirmware will hang forever when interface is up again.
227 if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) ||
228 RTMP_SET_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) ||
229 RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))
231 AsicForceWakeup(pAd, RTMP_HALT);
234 #ifdef QOS_DLS_SUPPORT
235 // send DLS-TEAR_DOWN message,
236 if (pAd->CommonCfg.bDLSCapable)
240 // tear down local dls table entry
241 for (i=0; i<MAX_NUM_OF_INIT_DLS_ENTRY; i++)
243 if (pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH))
245 RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr);
246 pAd->StaCfg.DLSEntry[i].Status = DLS_NONE;
247 pAd->StaCfg.DLSEntry[i].Valid = FALSE;
251 // tear down peer dls table entry
252 for (i=MAX_NUM_OF_INIT_DLS_ENTRY; i<MAX_NUM_OF_DLS_ENTRY; i++)
254 if (pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH))
256 RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr);
257 pAd->StaCfg.DLSEntry[i].Status = DLS_NONE;
258 pAd->StaCfg.DLSEntry[i].Valid = FALSE;
261 RT28XX_MLME_HANDLER(pAd);
263 #endif // QOS_DLS_SUPPORT //
266 (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)))
268 MLME_DISASSOC_REQ_STRUCT DisReq;
269 MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG);
271 COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid);
272 DisReq.Reason = REASON_DEAUTH_STA_LEAVING;
274 MsgElem->Machine = ASSOC_STATE_MACHINE;
275 MsgElem->MsgType = MT2_MLME_DISASSOC_REQ;
276 MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT);
277 NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT));
279 // Prevent to connect AP again in STAMlmePeriodicExec
280 pAd->MlmeAux.AutoReconnectSsidLen= 32;
281 NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen);
283 pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC;
284 MlmeDisassocReqAction(pAd, MsgElem);
292 RTMPCancelTimer(&pAd->StaCfg.LeapAuthTimer, &Cancelled);
295 RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled);
296 RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled);
298 #ifdef WPA_SUPPLICANT_SUPPORT
299 #ifndef NATIVE_WPA_SUPPLICANT_SUPPORT
301 union iwreq_data wrqu;
302 // send wireless event to wpa_supplicant for infroming interface down.
303 memset(&wrqu, 0, sizeof(wrqu));
304 wrqu.data.flags = RT_INTERFACE_DOWN;
305 wireless_send_event(pAd->net_dev, IWEVCUSTOM, &wrqu, NULL);
307 #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
308 #endif // WPA_SUPPLICANT_SUPPORT //
311 pAd->bPCIclkOff = FALSE;
313 #endif // CONFIG_STA_SUPPORT //
315 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
317 for (i = 0 ; i < NUM_OF_TX_RING; i++)
319 while (pAd->DeQueueRunning[i] == TRUE)
321 printk("Waiting for TxQueue[%d] done..........\n", i);
326 // Stop Mlme state machine
329 // Close kernel threads or tasklets
330 kill_thread_task(pAd);
333 #ifdef CONFIG_STA_SUPPORT
334 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
338 #endif // CONFIG_STA_SUPPORT //
341 MeasureReqTabExit(pAd);
345 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
347 NICDisableInterrupt(pAd);
350 // Disable Rx, register value supposed will remain after reset
354 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE))
356 // Deregister interrupt function
357 RT28XX_IRQ_RELEASE(net_dev)
358 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
362 // Free Ring or USB buffers
363 RTMPFreeTxRxRingMemory(pAd);
365 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
367 #ifdef DOT11_N_SUPPORT
368 // Free BA reorder resource
369 ba_reordering_resource_release(pAd);
370 #endif // DOT11_N_SUPPORT //
373 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP);
375 return 0; // close ok
376 } /* End of rt28xx_close */
378 static int rt28xx_init(IN struct net_device *net_dev)
380 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)net_dev->ml_priv;
387 #ifdef DOT11_N_SUPPORT
388 // Allocate BA Reordering memory
389 ba_reordering_resource_init(pAd, MAX_REORDERING_MPDU_NUM);
390 #endif // DOT11_N_SUPPORT //
392 // Make sure MAC gets ready.
396 RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0);
397 pAd->MACVersion = MacCsr0;
399 if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF))
403 } while (index++ < 100);
405 DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion));
408 RT28XXDMADisable(pAd);
411 // Load 8051 firmware
412 Status = NICLoadFirmware(pAd);
413 if (Status != NDIS_STATUS_SUCCESS)
415 DBGPRINT_ERR(("NICLoadFirmware failed, Status[=0x%08x]\n", Status));
419 NICLoadRateSwitchingParams(pAd);
421 // Disable interrupts here which is as soon as possible
422 // This statement should never be true. We might consider to remove it later
423 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
425 NICDisableInterrupt(pAd);
428 Status = RTMPAllocTxRxRingMemory(pAd);
429 if (Status != NDIS_STATUS_SUCCESS)
431 DBGPRINT_ERR(("RTMPAllocDMAMemory failed, Status[=0x%08x]\n", Status));
435 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
440 Status = MlmeInit(pAd);
441 if (Status != NDIS_STATUS_SUCCESS)
443 DBGPRINT_ERR(("MlmeInit failed, Status[=0x%08x]\n", Status));
447 // Initialize pAd->StaCfg, pAd->ApCfg, pAd->CommonCfg to manufacture default
452 RT28XX_TASK_THREAD_INIT(pAd, Status);
453 if (Status != NDIS_STATUS_SUCCESS)
460 initblockQueueTab(pAd);
461 #endif // BLOCK_NET_IF //
463 #ifdef CONFIG_STA_SUPPORT
464 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
465 NdisAllocateSpinLock(&pAd->MacTabLock);
466 #endif // CONFIG_STA_SUPPORT //
468 MeasureReqTabInit(pAd);
472 // Init the hardware, we need to init asic before read registry, otherwise mac register will be reset
474 Status = NICInitializeAdapter(pAd, TRUE);
475 if (Status != NDIS_STATUS_SUCCESS)
477 DBGPRINT_ERR(("NICInitializeAdapter failed, Status[=0x%08x]\n", Status));
478 if (Status != NDIS_STATUS_SUCCESS)
482 // Read parameters from Config File
483 Status = RTMPReadParametersHook(pAd);
485 printk("1. Phy Mode = %d\n", pAd->CommonCfg.PhyMode);
486 if (Status != NDIS_STATUS_SUCCESS)
488 DBGPRINT_ERR(("NICReadRegParameters failed, Status[=0x%08x]\n",Status));
494 //Init Ba Capability parameters.
495 #ifdef DOT11_N_SUPPORT
496 pAd->CommonCfg.DesiredHtPhy.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
497 pAd->CommonCfg.DesiredHtPhy.AmsduEnable = (USHORT)pAd->CommonCfg.BACapability.field.AmsduEnable;
498 pAd->CommonCfg.DesiredHtPhy.AmsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
499 pAd->CommonCfg.DesiredHtPhy.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
501 pAd->CommonCfg.HtCapability.HtCapInfo.MimoPs = (USHORT)pAd->CommonCfg.BACapability.field.MMPSmode;
502 pAd->CommonCfg.HtCapability.HtCapInfo.AMsduSize = (USHORT)pAd->CommonCfg.BACapability.field.AmsduSize;
503 pAd->CommonCfg.HtCapability.HtCapParm.MpduDensity = (UCHAR)pAd->CommonCfg.BACapability.field.MpduDensity;
504 #endif // DOT11_N_SUPPORT //
506 printk("2. Phy Mode = %d\n", pAd->CommonCfg.PhyMode);
508 // We should read EEPROM for all cases. rt2860b
509 NICReadEEPROMParameters(pAd, mac);
511 printk("3. Phy Mode = %d\n", pAd->CommonCfg.PhyMode);
513 NICInitAsicFromEEPROM(pAd); //rt2860b
515 // Set PHY to appropriate mode
516 TmpPhy = pAd->CommonCfg.PhyMode;
517 pAd->CommonCfg.PhyMode = 0xff;
518 RTMPSetPhyMode(pAd, TmpPhy);
519 #ifdef DOT11_N_SUPPORT
521 #endif // DOT11_N_SUPPORT //
523 // No valid channels.
524 if (pAd->ChannelListNum == 0)
526 printk("Wrong configuration. No valid channel found. Check \"ContryCode\" and \"ChannelGeography\" setting.\n");
530 #ifdef DOT11_N_SUPPORT
531 printk("MCS Set = %02x %02x %02x %02x %02x\n", pAd->CommonCfg.HtCapability.MCSSet[0],
532 pAd->CommonCfg.HtCapability.MCSSet[1], pAd->CommonCfg.HtCapability.MCSSet[2],
533 pAd->CommonCfg.HtCapability.MCSSet[3], pAd->CommonCfg.HtCapability.MCSSet[4]);
534 #endif // DOT11_N_SUPPORT //
537 VR_IKANOS_FP_Init(pAd->ApCfg.BssidNum, pAd->PermanentAddress);
538 #endif // IKANOS_VX_1X0 //
541 // Initialize RF register to default value
543 AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
544 AsicLockChannel(pAd, pAd->CommonCfg.Channel);
546 // 8051 firmware require the signal during booting time.
547 AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00);
549 if (pAd && (Status != NDIS_STATUS_SUCCESS))
552 // Undo everything if it failed
554 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE))
556 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
561 // Microsoft HCT require driver send a disconnect event after driver initialization.
562 OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
563 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE);
564 DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event B!\n"));
570 DBGPRINT_S(Status, ("<==== RTMPInitialize, Status=%x\n", Status));
579 RTMPFreeTxRxRingMemory(pAd);
582 #ifdef DOT11_N_SUPPORT
583 os_free_mem(pAd, pAd->mpdu_blk_pool.mem); // free BA pool
584 #endif // DOT11_N_SUPPORT //
585 RT28XX_IRQ_RELEASE(net_dev);
587 // shall not set ml_priv to NULL here because the ml_priv didn't been free yet.
588 //net_dev->ml_priv = 0;
591 #endif // INF_AMAZON_SE //
592 printk("!!! %s Initialized fail !!!\n", RT28xx_CHIP_NAME);
594 } /* End of rt28xx_init */
598 ========================================================================
603 *net_dev the raxx interface pointer
610 ========================================================================
612 int rt28xx_open(IN PNET_DEV dev)
614 struct net_device * net_dev = (struct net_device *)dev;
615 PRTMP_ADAPTER pAd = net_dev->ml_priv;
620 // Sanity check for pAd
623 /* if 1st open fail, pAd will be free;
624 So the net_dev->ml_priv will be NULL in 2rd open */
628 #ifdef CONFIG_APSTA_MIXED_SUPPORT
629 if (pAd->OpMode == OPMODE_AP)
633 else if (pAd->OpMode == OPMODE_STA)
638 #if WIRELESS_EXT >= 12
639 if (net_dev->priv_flags == INT_MAIN)
641 if (pAd->OpMode == OPMODE_AP)
642 net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_ap_iw_handler_def;
643 else if (pAd->OpMode == OPMODE_STA)
644 net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_iw_handler_def;
646 #endif // WIRELESS_EXT >= 12 //
647 #endif // CONFIG_APSTA_MIXED_SUPPORT //
650 pObj = (POS_COOKIE)pAd->OS_Cookie;
652 // reset Adapter flags
653 RTMP_CLEAR_FLAGS(pAd);
655 // Request interrupt service routine for PCI device
656 // register the interrupt routine with the os
657 RT28XX_IRQ_REQUEST(net_dev);
660 // Init BssTab & ChannelInfo tabbles for auto channel select.
664 if (rt28xx_init(net_dev) == FALSE)
667 #ifdef CONFIG_STA_SUPPORT
668 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
670 NdisZeroMemory(pAd->StaCfg.dev_name, 16);
671 NdisMoveMemory(pAd->StaCfg.dev_name, net_dev->name, strlen(net_dev->name));
673 #endif // CONFIG_STA_SUPPORT //
675 // Set up the Mac address
676 NdisMoveMemory(net_dev->dev_addr, (void *) pAd->CurrentAddress, 6);
678 // Init IRQ parameters
679 RT28XX_IRQ_INIT(pAd);
681 // Various AP function init
683 #ifdef CONFIG_STA_SUPPORT
684 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
686 #ifdef WPA_SUPPLICANT_SUPPORT
687 #ifndef NATIVE_WPA_SUPPLICANT_SUPPORT
689 union iwreq_data wrqu;
690 // send wireless event to wpa_supplicant for infroming interface down.
691 memset(&wrqu, 0, sizeof(wrqu));
692 wrqu.data.flags = RT_INTERFACE_UP;
693 wireless_send_event(pAd->net_dev, IWEVCUSTOM, &wrqu, NULL);
695 #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
696 #endif // WPA_SUPPLICANT_SUPPORT //
699 #endif // CONFIG_STA_SUPPORT //
702 RT28XX_IRQ_ENABLE(pAd);
706 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP);
710 RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts
711 printk("0x1300 = %08x\n", reg);
714 #ifdef CONFIG_STA_SUPPORT
715 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
716 RTMPInitPCIeLinkCtrlValue(pAd);
717 #endif // CONFIG_STA_SUPPORT //
723 } /* End of rt28xx_open */
726 /* Must not be called for mdev and apdev */
727 static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER pAd)
731 CHAR slot_name[IFNAMSIZ];
732 struct net_device *device;
736 dev->hard_start_xmit = rt28xx_send_packets;
739 dev->hard_start_xmit = IKANOS_DataFramesTx;
740 #endif // IKANOS_VX_1X0 //
742 #ifdef CONFIG_STA_SUPPORT
743 #if WIRELESS_EXT >= 12
744 if (pAd->OpMode == OPMODE_STA)
746 dev->wireless_handlers = &rt28xx_iw_handler_def;
748 #endif //WIRELESS_EXT >= 12
749 #endif // CONFIG_STA_SUPPORT //
751 #ifdef CONFIG_APSTA_MIXED_SUPPORT
752 #if WIRELESS_EXT >= 12
753 if (pAd->OpMode == OPMODE_AP)
755 dev->wireless_handlers = &rt28xx_ap_iw_handler_def;
757 #endif //WIRELESS_EXT >= 12
758 #endif // CONFIG_APSTA_MIXED_SUPPORT //
760 #if WIRELESS_EXT < 21
761 dev->get_wireless_stats = rt28xx_get_wireless_stats;
763 dev->get_stats = RT28xx_get_ether_stats;
764 dev->open = MainVirtualIF_open; //rt28xx_open;
765 dev->stop = MainVirtualIF_close; //rt28xx_close;
766 dev->priv_flags = INT_MAIN;
767 dev->do_ioctl = rt28xx_ioctl;
768 dev->validate_addr = NULL;
769 // find available device name
770 for (i = 0; i < 8; i++)
772 #ifdef MULTIPLE_CARD_SUPPORT
773 if (pAd->MC_RowID >= 0)
774 sprintf(slot_name, "ra%02d_%d", pAd->MC_RowID, i);
776 #endif // MULTIPLE_CARD_SUPPORT //
777 sprintf(slot_name, "ra%d", i);
779 device = dev_get_by_name(dev_net(dev), slot_name);
789 DBGPRINT(RT_DEBUG_ERROR, ("No available slot name\n"));
790 Status = NDIS_STATUS_FAILURE;
794 #ifdef MULTIPLE_CARD_SUPPORT
795 if (pAd->MC_RowID >= 0)
796 sprintf(dev->name, "ra%02d_%d", pAd->MC_RowID, i);
798 #endif // MULTIPLE_CARD_SUPPORT //
799 sprintf(dev->name, "ra%d", i);
800 Status = NDIS_STATUS_SUCCESS;
808 #ifdef MULTIPLE_CARD_SUPPORT
810 ========================================================================
812 Get card profile path.
818 TRUE - Find a card profile
819 FALSE - use default profile
822 ========================================================================
824 extern INT RTMPGetKeyParameter(
830 BOOLEAN RTMP_CardInfoRead(
831 IN PRTMP_ADAPTER pAd)
833 #define MC_SELECT_CARDID 0 /* use CARD ID (0 ~ 31) to identify different cards */
834 #define MC_SELECT_MAC 1 /* use CARD MAC to identify different cards */
835 #define MC_SELECT_CARDTYPE 2 /* use CARD type (abgn or bgn) to identify different cards */
837 #define LETTER_CASE_TRANSLATE(txt_p, card_id) \
838 { UINT32 _len; char _char; \
839 for(_len=0; _len<strlen(card_id); _len++) { \
840 _char = *(txt_p + _len); \
841 if (('A' <= _char) && (_char <= 'Z')) \
842 *(txt_p+_len) = 'a'+(_char-'A'); \
846 INT retval, orgfsuid, orgfsgid;
848 CHAR *buffer, *tmpbuf, card_id_buf[30], RFIC_word[30];
849 BOOLEAN flg_match_ok = FALSE;
850 INT32 card_select_method;
851 INT32 card_free_id, card_nouse_id, card_same_mac_id, card_match_id;
852 EEPROM_ANTENNA_STRUC antenna;
853 USHORT addr01, addr23, addr45;
855 UINT32 data, card_index;
860 buffer = kmalloc(MAX_INI_BUFFER_SIZE, MEM_ALLOC_FLAG);
864 tmpbuf = kmalloc(MAX_PARAM_BUFFER_SIZE, MEM_ALLOC_FLAG);
868 return NDIS_STATUS_FAILURE;
871 orgfsuid = current->fsuid;
872 orgfsgid = current->fsgid;
873 current->fsuid = current->fsgid = 0;
878 RTMP_IO_READ32(pAd, E2PROM_CSR, &data);
880 if ((data & 0x30) == 0)
881 pAd->EEPROMAddressNum = 6; // 93C46
882 else if ((data & 0x30) == 0x10)
883 pAd->EEPROMAddressNum = 8; // 93C66
885 pAd->EEPROMAddressNum = 8; // 93C86
887 RT28xx_EEPROM_READ16(pAd, EEPROM_NIC1_OFFSET, antenna.word);
889 if ((antenna.field.RfIcType == RFIC_2850) ||
890 (antenna.field.RfIcType == RFIC_2750))
893 strcpy(RFIC_word, "abgn");
898 strcpy(RFIC_word, "bgn");
902 RT28xx_EEPROM_READ16(pAd, 0x04, addr01);
903 RT28xx_EEPROM_READ16(pAd, 0x06, addr23);
904 RT28xx_EEPROM_READ16(pAd, 0x08, addr45);
906 mac[0] = (UCHAR)(addr01 & 0xff);
907 mac[1] = (UCHAR)(addr01 >> 8);
908 mac[2] = (UCHAR)(addr23 & 0xff);
909 mac[3] = (UCHAR)(addr23 >> 8);
910 mac[4] = (UCHAR)(addr45 & 0xff);
911 mac[5] = (UCHAR)(addr45 >> 8);
913 // open card information file
914 srcf = filp_open(CARD_INFO_PATH, O_RDONLY, 0);
917 /* card information file does not exist */
918 DBGPRINT(RT_DEBUG_TRACE,
919 ("--> Error %ld opening %s\n", -PTR_ERR(srcf), CARD_INFO_PATH));
923 if (srcf->f_op && srcf->f_op->read)
925 /* card information file exists so reading the card information */
926 memset(buffer, 0x00, MAX_INI_BUFFER_SIZE);
927 retval = srcf->f_op->read(srcf, buffer, MAX_INI_BUFFER_SIZE, &srcf->f_pos);
931 DBGPRINT(RT_DEBUG_TRACE,
932 ("--> Read %s error %d\n", CARD_INFO_PATH, -retval));
936 /* get card selection method */
937 memset(tmpbuf, 0x00, MAX_PARAM_BUFFER_SIZE);
938 card_select_method = MC_SELECT_CARDTYPE; // default
940 if (RTMPGetKeyParameter("SELECT", tmpbuf, 256, buffer))
942 if (strcmp(tmpbuf, "CARDID") == 0)
943 card_select_method = MC_SELECT_CARDID;
944 else if (strcmp(tmpbuf, "MAC") == 0)
945 card_select_method = MC_SELECT_MAC;
946 else if (strcmp(tmpbuf, "CARDTYPE") == 0)
947 card_select_method = MC_SELECT_CARDTYPE;
950 DBGPRINT(RT_DEBUG_TRACE,
951 ("MC> Card Selection = %d\n", card_select_method));
956 card_same_mac_id = -1;
959 // search current card information records
961 card_index<MAX_NUM_OF_MULTIPLE_CARD;
964 if ((*(UINT32 *)&MC_CardMac[card_index][0] == 0) &&
965 (*(UINT16 *)&MC_CardMac[card_index][4] == 0))
967 // MAC is all-0 so the entry is available
968 MC_CardUsed[card_index] = 0;
970 if (card_free_id < 0)
971 card_free_id = card_index; // 1st free entry
975 if (memcmp(MC_CardMac[card_index], mac, 6) == 0)
977 // we find the entry with same MAC
978 if (card_same_mac_id < 0)
979 card_same_mac_id = card_index; // 1st same entry
983 // MAC is not all-0 but used flag == 0
984 if ((MC_CardUsed[card_index] == 0) &&
987 card_nouse_id = card_index; // 1st available entry
993 DBGPRINT(RT_DEBUG_TRACE,
994 ("MC> Free = %d, Same = %d, NOUSE = %d\n",
995 card_free_id, card_same_mac_id, card_nouse_id));
997 if ((card_same_mac_id >= 0) &&
998 ((card_select_method == MC_SELECT_CARDID) ||
999 (card_select_method == MC_SELECT_CARDTYPE)))
1001 // same MAC entry is found
1002 card_match_id = card_same_mac_id;
1004 if (card_select_method == MC_SELECT_CARDTYPE)
1007 sprintf(card_id_buf, "%02dCARDTYPE%s",
1008 card_match_id, RFIC_word);
1010 if ((start_ptr=rtstrstruncasecmp(buffer, card_id_buf)) != NULL)
1012 // we found the card ID
1013 LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
1019 // the card is 1st plug-in, try to find the match card profile
1020 switch(card_select_method)
1022 case MC_SELECT_CARDID: // CARDID
1024 if (card_free_id >= 0)
1025 card_match_id = card_free_id;
1027 card_match_id = card_nouse_id;
1030 case MC_SELECT_MAC: // MAC
1031 sprintf(card_id_buf, "MAC%02x:%02x:%02x:%02x:%02x:%02x",
1032 mac[0], mac[1], mac[2],
1033 mac[3], mac[4], mac[5]);
1035 /* try to find the key word in the card file */
1036 if ((start_ptr=rtstrstruncasecmp(buffer, card_id_buf)) != NULL)
1038 LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
1040 /* get the row ID (2 ASCII characters) */
1042 card_id_buf[0] = *(start_ptr);
1043 card_id_buf[1] = *(start_ptr+1);
1044 card_id_buf[2] = 0x00;
1046 card_match_id = simple_strtol(card_id_buf, 0, 10);
1050 case MC_SELECT_CARDTYPE: // CARDTYPE
1054 card_index<MAX_NUM_OF_MULTIPLE_CARD;
1057 sprintf(card_id_buf, "%02dCARDTYPE%s",
1058 card_index, RFIC_word);
1060 if ((start_ptr=rtstrstruncasecmp(buffer,
1061 card_id_buf)) != NULL)
1063 LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
1065 if (MC_CardUsed[card_index] == 0)
1067 /* current the card profile is not used */
1068 if ((*(UINT32 *)&MC_CardMac[card_index][0] == 0) &&
1069 (*(UINT16 *)&MC_CardMac[card_index][4] == 0))
1071 // find it and no previous card use it
1072 card_match_id = card_index;
1077 // ever a card use it
1078 if (card_nouse_id < 0)
1079 card_nouse_id = card_index;
1085 // if not find a free one, use the available one
1086 if (card_match_id < 0)
1087 card_match_id = card_nouse_id;
1092 if (card_match_id >= 0)
1094 // make up search keyword
1095 switch(card_select_method)
1097 case MC_SELECT_CARDID: // CARDID
1098 sprintf(card_id_buf, "%02dCARDID", card_match_id);
1101 case MC_SELECT_MAC: // MAC
1102 sprintf(card_id_buf,
1103 "%02dmac%02x:%02x:%02x:%02x:%02x:%02x",
1105 mac[0], mac[1], mac[2],
1106 mac[3], mac[4], mac[5]);
1109 case MC_SELECT_CARDTYPE: // CARDTYPE
1111 sprintf(card_id_buf, "%02dcardtype%s",
1112 card_match_id, RFIC_word);
1116 DBGPRINT(RT_DEBUG_TRACE, ("Search Keyword = %s\n", card_id_buf));
1118 // read card file path
1119 if (RTMPGetKeyParameter(card_id_buf, tmpbuf, 256, buffer))
1121 if (strlen(tmpbuf) < sizeof(pAd->MC_FileName))
1123 // backup card information
1124 pAd->MC_RowID = card_match_id; /* base 0 */
1125 MC_CardUsed[card_match_id] = 1;
1126 memcpy(MC_CardMac[card_match_id], mac, sizeof(mac));
1128 // backup card file path
1129 NdisMoveMemory(pAd->MC_FileName, tmpbuf , strlen(tmpbuf));
1130 pAd->MC_FileName[strlen(tmpbuf)] = '\0';
1131 flg_match_ok = TRUE;
1133 DBGPRINT(RT_DEBUG_TRACE,
1134 ("Card Profile Name = %s\n", pAd->MC_FileName));
1138 DBGPRINT(RT_DEBUG_ERROR,
1139 ("Card Profile Name length too large!\n"));
1144 DBGPRINT(RT_DEBUG_ERROR,
1145 ("Can not find search key word in card.dat!\n"));
1148 if ((flg_match_ok != TRUE) &&
1149 (card_match_id < MAX_NUM_OF_MULTIPLE_CARD))
1151 MC_CardUsed[card_match_id] = 0;
1152 memset(MC_CardMac[card_match_id], 0, sizeof(mac));
1154 } // if (card_match_id >= 0)
1159 retval = filp_close(srcf, NULL);
1161 current->fsuid = orgfsuid;
1162 current->fsgid = orgfsgid;
1165 return flg_match_ok;
1167 #endif // MULTIPLE_CARD_SUPPORT //
1171 ========================================================================
1172 Routine Description:
1173 Probe RT28XX chipset.
1176 _dev_p Point to the PCI or USB device
1177 _dev_id_p Point to the PCI or USB device ID
1184 ========================================================================
1186 INT __devinit rt28xx_probe(
1190 OUT PRTMP_ADAPTER *ppAd)
1192 struct net_device *net_dev;
1193 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL;
1196 struct pci_dev *dev_p = (struct pci_dev *)_dev_p;
1199 #ifdef CONFIG_STA_SUPPORT
1200 DBGPRINT(RT_DEBUG_TRACE, ("STA Driver version-%s\n", STA_DRIVER_VERSION));
1201 #endif // CONFIG_STA_SUPPORT //
1203 net_dev = alloc_etherdev(sizeof(PRTMP_ADAPTER));
1204 if (net_dev == NULL)
1206 printk("alloc_netdev failed\n");
1211 netif_stop_queue(net_dev);
1212 #ifdef NATIVE_WPA_SUPPLICANT_SUPPORT
1213 /* for supporting Network Manager */
1214 /* Set the sysfs physical device reference for the network logical device
1215 * if set prior to registration will cause a symlink during initialization.
1217 SET_NETDEV_DEV(net_dev, &(dev_p->dev));
1218 #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
1220 // Allocate RTMP_ADAPTER miniport adapter structure
1221 handle = kmalloc(sizeof(struct os_cookie), GFP_KERNEL);
1222 RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p);
1224 status = RTMPAllocAdapterBlock(handle, &pAd);
1225 if (status != NDIS_STATUS_SUCCESS)
1226 goto err_out_free_netdev;
1228 net_dev->ml_priv = (PVOID)pAd;
1229 pAd->net_dev = net_dev; // must be before RT28XXNetDevInit()
1231 RT28XXNetDevInit(_dev_p, net_dev, pAd);
1233 #ifdef CONFIG_STA_SUPPORT
1234 pAd->StaCfg.OriDevType = net_dev->type;
1235 #endif // CONFIG_STA_SUPPORT //
1238 if (RT28XXProbePostConfig(_dev_p, pAd, 0) == FALSE)
1241 #ifdef CONFIG_STA_SUPPORT
1242 pAd->OpMode = OPMODE_STA;
1243 #endif // CONFIG_STA_SUPPORT //
1246 #ifdef MULTIPLE_CARD_SUPPORT
1247 // find its profile path
1248 pAd->MC_RowID = -1; // use default profile path
1249 RTMP_CardInfoRead(pAd);
1251 if (pAd->MC_RowID == -1)
1252 #ifdef CONFIG_STA_SUPPORT
1253 strcpy(pAd->MC_FileName, STA_PROFILE_PATH);
1254 #endif // CONFIG_STA_SUPPORT //
1256 DBGPRINT(RT_DEBUG_TRACE,
1257 ("MC> ROW = %d, PATH = %s\n", pAd->MC_RowID, pAd->MC_FileName));
1258 #endif // MULTIPLE_CARD_SUPPORT //
1261 if (rt_ieee80211_if_setup(net_dev, pAd) != NDIS_STATUS_SUCCESS)
1264 // Register this device
1265 status = register_netdev(net_dev);
1270 RT28XX_DRVDATA_SET(_dev_p);
1273 return 0; // probe ok
1276 /* --------------------------- ERROR HANDLE --------------------------- */
1278 RTMPFreeAdapter(pAd);
1281 err_out_free_netdev:
1282 free_netdev(net_dev);
1285 RT28XX_PUT_DEVICE(dev_p);
1287 return -ENODEV; /* probe fail */
1288 } /* End of rt28xx_probe */
1292 ========================================================================
1293 Routine Description:
1294 The entry point for Linux kernel sent packet to our driver.
1297 sk_buff *skb the pointer refer to a sk_buffer.
1303 This function is the entry point of Tx Path for Os delivery packet to
1304 our driver. You only can put OS-depened & STA/AP common handle procedures
1306 ========================================================================
1308 int rt28xx_packet_xmit(struct sk_buff *skb)
1310 struct net_device *net_dev = skb->dev;
1311 PRTMP_ADAPTER pAd = net_dev->ml_priv;
1313 PNDIS_PACKET pPacket = (PNDIS_PACKET) skb;
1315 /* RT2870STA does this in RTMPSendPackets() */
1319 RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_RESOURCES);
1322 #endif // RALINK_ATE //
1324 #ifdef CONFIG_STA_SUPPORT
1325 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1327 // Drop send request since we are in monitor mode
1328 if (MONITOR_ON(pAd))
1330 RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
1334 #endif // CONFIG_STA_SUPPORT //
1336 // EapolStart size is 18
1339 //printk("bad packet size: %d\n", pkt->len);
1340 hex_dump("bad packet", skb->data, skb->len);
1341 RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
1345 RTMP_SET_PACKET_5VT(pPacket, 0);
1346 #ifdef CONFIG_5VT_ENHANCE
1347 if (*(int*)(skb->cb) == BRIDGE_TAG) {
1348 RTMP_SET_PACKET_5VT(pPacket, 1);
1354 #ifdef CONFIG_STA_SUPPORT
1355 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1358 STASendPackets((NDIS_HANDLE)pAd, (PPNDIS_PACKET) &pPacket, 1);
1361 #endif // CONFIG_STA_SUPPORT //
1371 ========================================================================
1372 Routine Description:
1373 Send a packet to WLAN.
1376 skb_p points to our adapter
1377 dev_p which WLAN network interface
1380 0: transmit successfully
1381 otherwise: transmit fail
1384 ========================================================================
1386 INT rt28xx_send_packets(
1387 IN struct sk_buff *skb_p,
1388 IN struct net_device *net_dev)
1390 RTMP_ADAPTER *pAd = net_dev->ml_priv;
1391 if (!(net_dev->flags & IFF_UP))
1393 RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET)skb_p, NDIS_STATUS_FAILURE);
1397 NdisZeroMemory((PUCHAR)&skb_p->cb[CB_OFF], 15);
1398 RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID);
1400 return rt28xx_packet_xmit(skb_p);
1402 } /* End of MBSS_VirtualIF_PacketSend */
1407 void CfgInitHook(PRTMP_ADAPTER pAd)
1409 pAd->bBroadComHT = TRUE;
1410 } /* End of CfgInitHook */
1413 #if WIRELESS_EXT >= 12
1414 // This function will be called when query /proc
1415 struct iw_statistics *rt28xx_get_wireless_stats(
1416 IN struct net_device *net_dev)
1418 PRTMP_ADAPTER pAd = net_dev->ml_priv;
1421 DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n"));
1423 pAd->iw_stats.status = 0; // Status - device dependent for now
1426 pAd->iw_stats.qual.qual = ((pAd->Mlme.ChannelQuality * 12)/10 + 10);
1427 if(pAd->iw_stats.qual.qual > 100)
1428 pAd->iw_stats.qual.qual = 100;
1430 #ifdef CONFIG_STA_SUPPORT
1431 if (pAd->OpMode == OPMODE_STA)
1432 pAd->iw_stats.qual.level = RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, pAd->StaCfg.RssiSample.LastRssi1, pAd->StaCfg.RssiSample.LastRssi2);
1433 #endif // CONFIG_STA_SUPPORT //
1435 pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm)
1437 pAd->iw_stats.qual.noise += 256 - 143;
1438 pAd->iw_stats.qual.updated = 1; // Flags to know if updated
1440 pAd->iw_stats.qual.updated |= IW_QUAL_DBM; // Level + Noise are dBm
1441 #endif // IW_QUAL_DBM //
1443 pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid
1444 pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe
1446 DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n"));
1447 return &pAd->iw_stats;
1448 } /* End of rt28xx_get_wireless_stats */
1449 #endif // WIRELESS_EXT //
1453 void tbtt_tasklet(unsigned long data)
1455 #define MAX_TX_IN_TBTT (16)
1460 IN struct net_device *net_dev,
1461 IN OUT struct ifreq *rq,
1464 VIRTUAL_ADAPTER *pVirtualAd = NULL;
1465 RTMP_ADAPTER *pAd = NULL;
1468 if (net_dev->priv_flags == INT_MAIN)
1470 pAd = net_dev->ml_priv;
1474 pVirtualAd = net_dev->ml_priv;
1475 pAd = pVirtualAd->RtmpDev->ml_priv;
1480 /* if 1st open fail, pAd will be free;
1481 So the net_dev->ml_priv will be NULL in 2rd open */
1486 #ifdef CONFIG_STA_SUPPORT
1487 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
1489 ret = rt28xx_sta_ioctl(net_dev, rq, cmd);
1491 #endif // CONFIG_STA_SUPPORT //
1497 ========================================================================
1499 Routine Description:
1500 return ethernet statistics counter
1503 net_dev Pointer to net_device
1510 ========================================================================
1512 struct net_device_stats *RT28xx_get_ether_stats(
1513 IN struct net_device *net_dev)
1515 RTMP_ADAPTER *pAd = NULL;
1518 pAd = net_dev->ml_priv;
1523 pAd->stats.rx_packets = pAd->WlanCounters.ReceivedFragmentCount.QuadPart;
1524 pAd->stats.tx_packets = pAd->WlanCounters.TransmittedFragmentCount.QuadPart;
1526 pAd->stats.rx_bytes = pAd->RalinkCounters.ReceivedByteCount;
1527 pAd->stats.tx_bytes = pAd->RalinkCounters.TransmittedByteCount;
1529 pAd->stats.rx_errors = pAd->Counters8023.RxErrors;
1530 pAd->stats.tx_errors = pAd->Counters8023.TxErrors;
1532 pAd->stats.rx_dropped = 0;
1533 pAd->stats.tx_dropped = 0;
1535 pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received
1536 pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets
1538 pAd->stats.rx_length_errors = 0;
1539 pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow
1540 pAd->stats.rx_crc_errors = 0;//pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error
1541 pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error
1542 pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun
1543 pAd->stats.rx_missed_errors = 0; // receiver missed packet
1545 // detailed tx_errors
1546 pAd->stats.tx_aborted_errors = 0;
1547 pAd->stats.tx_carrier_errors = 0;
1548 pAd->stats.tx_fifo_errors = 0;
1549 pAd->stats.tx_heartbeat_errors = 0;
1550 pAd->stats.tx_window_errors = 0;
1553 pAd->stats.rx_compressed = 0;
1554 pAd->stats.tx_compressed = 0;