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 -------- ---------- ----------------------------------------------
38 #include "rt_config.h"
41 #ifdef CONFIG_APSTA_MIXED_SUPPORT
42 UINT32 CW_MAX_IN_BITS;
43 #endif // CONFIG_APSTA_MIXED_SUPPORT //
45 /*---------------------------------------------------------------------*/
46 /* Private Variables Used */
47 /*---------------------------------------------------------------------*/
49 PSTRING mac = ""; // default 00:00:00:00:00:00
50 PSTRING hostname = ""; // default CMPC
51 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12)
52 MODULE_PARM (mac, "s");
54 module_param (mac, charp, 0);
56 MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr");
59 /*---------------------------------------------------------------------*/
60 /* Prototypes of Functions Used */
61 /*---------------------------------------------------------------------*/
63 // public function prototype
64 int rt28xx_close(IN struct net_device *net_dev);
65 int rt28xx_open(struct net_device *net_dev);
67 // private function prototype
68 static INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev);
71 static struct net_device_stats *RT28xx_get_ether_stats(
72 IN struct net_device *net_dev);
75 ========================================================================
80 *net_dev the raxx interface pointer
87 1. if open fail, kernel will not call the close function.
89 (1) Mlme Memory Handler: MlmeHalt()
90 (2) TX & RX: RTMPFreeTxRxRingMemory()
91 (3) BA Reordering: ba_reordering_resource_release()
92 ========================================================================
94 int MainVirtualIF_close(IN struct net_device *net_dev)
96 RTMP_ADAPTER *pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
98 // Sanity check for pAd
100 return 0; // close ok
102 netif_carrier_off(pAd->net_dev);
103 netif_stop_queue(pAd->net_dev);
108 #ifdef CONFIG_STA_SUPPORT
109 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
112 #ifdef QOS_DLS_SUPPORT
113 // send DLS-TEAR_DOWN message,
114 if (pAd->CommonCfg.bDLSCapable)
118 // tear down local dls table entry
119 for (i=0; i<MAX_NUM_OF_INIT_DLS_ENTRY; i++)
121 if (pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH))
123 RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr);
124 pAd->StaCfg.DLSEntry[i].Status = DLS_NONE;
125 pAd->StaCfg.DLSEntry[i].Valid = FALSE;
129 // tear down peer dls table entry
130 for (i=MAX_NUM_OF_INIT_DLS_ENTRY; i<MAX_NUM_OF_DLS_ENTRY; i++)
132 if (pAd->StaCfg.DLSEntry[i].Valid && (pAd->StaCfg.DLSEntry[i].Status == DLS_FINISH))
134 RTMPSendDLSTearDownFrame(pAd, pAd->StaCfg.DLSEntry[i].MacAddr);
135 pAd->StaCfg.DLSEntry[i].Status = DLS_NONE;
136 pAd->StaCfg.DLSEntry[i].Valid = FALSE;
139 RTMP_MLME_HANDLER(pAd);
141 #endif // QOS_DLS_SUPPORT //
144 (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)))
146 MLME_DISASSOC_REQ_STRUCT DisReq;
147 MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG);
151 COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid);
152 DisReq.Reason = REASON_DEAUTH_STA_LEAVING;
154 MsgElem->Machine = ASSOC_STATE_MACHINE;
155 MsgElem->MsgType = MT2_MLME_DISASSOC_REQ;
156 MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT);
157 NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT));
159 // Prevent to connect AP again in STAMlmePeriodicExec
160 pAd->MlmeAux.AutoReconnectSsidLen= 32;
161 NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen);
163 pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC;
164 MlmeDisassocReqAction(pAd, MsgElem);
171 RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled);
172 RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled);
174 #ifdef WPA_SUPPLICANT_SUPPORT
175 #ifndef NATIVE_WPA_SUPPLICANT_SUPPORT
176 // send wireless event to wpa_supplicant for infroming interface down.
177 RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, RT_INTERFACE_DOWN, NULL, NULL, 0);
178 #endif // NATIVE_WPA_SUPPLICANT_SUPPORT //
179 #endif // WPA_SUPPLICANT_SUPPORT //
183 #endif // CONFIG_STA_SUPPORT //
185 VIRTUAL_IF_DOWN(pAd);
187 RT_MOD_DEC_USE_COUNT();
189 return 0; // close ok
193 ========================================================================
198 *net_dev the raxx interface pointer
205 1. if open fail, kernel will not call the close function.
207 (1) Mlme Memory Handler: MlmeHalt()
208 (2) TX & RX: RTMPFreeTxRxRingMemory()
209 (3) BA Reordering: ba_reordering_resource_release()
210 ========================================================================
212 int MainVirtualIF_open(IN struct net_device *net_dev)
214 RTMP_ADAPTER *pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
216 // Sanity check for pAd
218 return 0; // close ok
220 if (VIRTUAL_IF_UP(pAd) != 0)
223 // increase MODULE use count
224 RT_MOD_INC_USE_COUNT();
226 netif_start_queue(net_dev);
227 netif_carrier_on(net_dev);
228 netif_wake_queue(net_dev);
234 ========================================================================
236 Close raxx interface.
239 *net_dev the raxx interface pointer
246 1. if open fail, kernel will not call the close function.
248 (1) Mlme Memory Handler: MlmeHalt()
249 (2) TX & RX: RTMPFreeTxRxRingMemory()
250 (3) BA Reordering: ba_reordering_resource_release()
251 ========================================================================
253 int rt28xx_close(IN PNET_DEV dev)
255 struct net_device * net_dev = (struct net_device *)dev;
256 RTMP_ADAPTER *pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
261 DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n"));
264 // Sanity check for pAd
266 return 0; // close ok
272 #endif // WDS_SUPPORT //
274 #ifdef CONFIG_STA_SUPPORT
275 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
278 RTMPPCIeLinkCtrlValueRestore(pAd, RESTORE_CLOSE);
279 #endif // RTMP_MAC_PCI //
281 // If dirver doesn't wake up firmware here,
282 // NICLoadFirmware will hang forever when interface is up again.
283 if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
285 AsicForceWakeup(pAd, TRUE);
291 pAd->bPCIclkOff = FALSE;
292 #endif // RTMP_MAC_PCI //
294 #endif // CONFIG_STA_SUPPORT //
296 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
298 for (i = 0 ; i < NUM_OF_TX_RING; i++)
300 while (pAd->DeQueueRunning[i] == TRUE)
302 DBGPRINT(RT_DEBUG_TRACE, ("Waiting for TxQueue[%d] done..........\n", i));
309 // Stop Mlme state machine
312 // Close net tasklets
313 RtmpNetTaskExit(pAd);
316 #ifdef CONFIG_STA_SUPPORT
317 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
321 #endif // CONFIG_STA_SUPPORT //
324 MeasureReqTabExit(pAd);
328 // Close kernel threads
329 RtmpMgmtTaskExit(pAd);
336 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
338 RTMP_ASIC_INTERRUPT_DISABLE(pAd);
341 // Receive packets to clear DMA index after disable interrupt.
342 //RTMPHandleRxDoneInterrupt(pAd);
343 // put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all
344 // register access before Radio off.
347 brc=RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0);
349 //In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff
350 pAd->bPCIclkOff = FALSE;
354 DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __FUNCTION__));
360 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
362 RTMP_ASIC_INTERRUPT_DISABLE(pAd);
365 // Disable Rx, register value supposed will remain after reset
368 #endif // RTMP_MAC_PCI //
371 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE))
374 // Deregister interrupt function
375 RTMP_IRQ_RELEASE(net_dev)
376 #endif // RTMP_MAC_PCI //
377 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
380 // Free Ring or USB buffers
381 RTMPFreeTxRxRingMemory(pAd);
383 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
385 #ifdef DOT11_N_SUPPORT
386 // Free BA reorder resource
387 ba_reordering_resource_release(pAd);
388 #endif // DOT11_N_SUPPORT //
390 #ifdef CONFIG_STA_SUPPORT
391 #endif // CONFIG_STA_SUPPORT //
393 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP);
395 /*+++Modify by woody to solve the bulk fail+++*/
396 #ifdef CONFIG_STA_SUPPORT
397 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
400 #endif // CONFIG_STA_SUPPORT //
402 DBGPRINT(RT_DEBUG_TRACE, ("<=== rt28xx_close\n"));
403 return 0; // close ok
404 } /* End of rt28xx_close */
408 ========================================================================
413 *net_dev the raxx interface pointer
420 ========================================================================
422 int rt28xx_open(IN PNET_DEV dev)
424 struct net_device * net_dev = (struct net_device *)dev;
425 PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
430 // Sanity check for pAd
433 /* if 1st open fail, pAd will be free;
434 So the net_dev->priv will be NULL in 2rd open */
438 #ifdef CONFIG_APSTA_MIXED_SUPPORT
439 if (pAd->OpMode == OPMODE_AP)
443 else if (pAd->OpMode == OPMODE_STA)
447 #endif // CONFIG_APSTA_MIXED_SUPPORT //
449 #if WIRELESS_EXT >= 12
450 if (net_dev->priv_flags == INT_MAIN)
452 #ifdef CONFIG_APSTA_MIXED_SUPPORT
453 if (pAd->OpMode == OPMODE_AP)
454 net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_ap_iw_handler_def;
455 #endif // CONFIG_APSTA_MIXED_SUPPORT //
456 #ifdef CONFIG_STA_SUPPORT
457 if (pAd->OpMode == OPMODE_STA)
458 net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_iw_handler_def;
459 #endif // CONFIG_STA_SUPPORT //
461 #endif // WIRELESS_EXT >= 12 //
463 // Request interrupt service routine for PCI device
464 // register the interrupt routine with the os
465 RTMP_IRQ_REQUEST(net_dev);
467 // Init IRQ parameters stored in pAd
471 if (rt28xx_init(pAd, mac, hostname) == FALSE)
474 #ifdef CONFIG_STA_SUPPORT
475 #endif // CONFIG_STA_SUPPORT //
478 RTMP_IRQ_ENABLE(pAd);
482 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP);
486 RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts
487 printk("0x1300 = %08x\n", reg);
495 // RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®);
498 // reg = (reg & 0xffff0000) | tmp;
499 // RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg);
504 #ifdef CONFIG_STA_SUPPORT
506 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
507 RTMPInitPCIeLinkCtrlValue(pAd);
508 #endif // RTMP_MAC_PCI //
509 #endif // CONFIG_STA_SUPPORT //
514 //+++Add by shiang, move from rt28xx_init() to here.
515 RTMP_IRQ_RELEASE(net_dev);
516 //---Add by shiang, move from rt28xx_init() to here.
518 } /* End of rt28xx_open */
520 static const struct net_device_ops rt3090_netdev_ops = {
521 .ndo_open = MainVirtualIF_open,
522 .ndo_stop = MainVirtualIF_close,
523 .ndo_do_ioctl = rt28xx_ioctl,
524 .ndo_get_stats = RT28xx_get_ether_stats,
525 .ndo_set_mac_address = eth_mac_addr,
526 .ndo_change_mtu = eth_change_mtu,
528 .ndo_start_xmit = IKANOS_DataFramesTx,
530 .ndo_start_xmit = rt28xx_send_packets,
534 PNET_DEV RtmpPhyNetDevInit(
535 IN RTMP_ADAPTER *pAd,
536 IN RTMP_OS_NETDEV_OP_HOOK *pNetDevHook)
538 struct net_device *net_dev = NULL;
539 // NDIS_STATUS Status;
541 net_dev = RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), INF_MAIN_DEV_NAME);
544 printk("RtmpPhyNetDevInit(): creation failed for main physical net device!\n");
548 NdisZeroMemory((unsigned char *)pNetDevHook, sizeof(RTMP_OS_NETDEV_OP_HOOK));
549 pNetDevHook->netdev_ops = &rt3090_netdev_ops;
550 pNetDevHook->priv_flags = INT_MAIN;
551 pNetDevHook->needProtcted = FALSE;
553 RTMP_OS_NETDEV_SET_PRIV(net_dev, pAd);
554 //net_dev->priv = (PVOID)pAd;
555 pAd->net_dev = net_dev;
559 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
560 SET_MODULE_OWNER(net_dev);
563 netif_stop_queue(net_dev);
571 ========================================================================
573 The entry point for Linux kernel sent packet to our driver.
576 sk_buff *skb the pointer refer to a sk_buffer.
582 This function is the entry point of Tx Path for Os delivery packet to
583 our driver. You only can put OS-depened & STA/AP common handle procedures
585 ========================================================================
587 int rt28xx_packet_xmit(struct sk_buff *skb)
589 struct net_device *net_dev = skb->dev;
590 PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
592 PNDIS_PACKET pPacket = (PNDIS_PACKET) skb;
594 /* RT2870STA does this in RTMPSendPackets() */
598 RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_RESOURCES);
601 #endif // RALINK_ATE //
603 #ifdef CONFIG_STA_SUPPORT
604 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
606 // Drop send request since we are in monitor mode
609 RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
613 #endif // CONFIG_STA_SUPPORT //
615 // EapolStart size is 18
618 //printk("bad packet size: %d\n", pkt->len);
619 hex_dump("bad packet", skb->data, skb->len);
620 RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
626 RTMP_SET_PACKET_5VT(pPacket, 0);
627 // MiniportMMRequest(pAd, pkt->data, pkt->len);
628 #ifdef CONFIG_5VT_ENHANCE
629 if (*(int*)(skb->cb) == BRIDGE_TAG) {
630 RTMP_SET_PACKET_5VT(pPacket, 1);
636 #ifdef CONFIG_STA_SUPPORT
637 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
640 STASendPackets((NDIS_HANDLE)pAd, (PPNDIS_PACKET) &pPacket, 1);
643 #endif // CONFIG_STA_SUPPORT //
653 ========================================================================
655 Send a packet to WLAN.
658 skb_p points to our adapter
659 dev_p which WLAN network interface
662 0: transmit successfully
663 otherwise: transmit fail
666 ========================================================================
668 static int rt28xx_send_packets(
669 IN struct sk_buff *skb_p,
670 IN struct net_device *net_dev)
672 RTMP_ADAPTER *pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
674 if (!(net_dev->flags & IFF_UP))
676 RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET)skb_p, NDIS_STATUS_FAILURE);
680 NdisZeroMemory((PUCHAR)&skb_p->cb[CB_OFF], 15);
681 RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID);
683 return rt28xx_packet_xmit(skb_p);
687 #if WIRELESS_EXT >= 12
688 // This function will be called when query /proc
689 struct iw_statistics *rt28xx_get_wireless_stats(
690 IN struct net_device *net_dev)
692 PRTMP_ADAPTER pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
696 DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n"));
698 pAd->iw_stats.status = 0; // Status - device dependent for now
701 #ifdef CONFIG_STA_SUPPORT
702 if (pAd->OpMode == OPMODE_STA)
703 pAd->iw_stats.qual.qual = ((pAd->Mlme.ChannelQuality * 12)/10 + 10);
704 #endif // CONFIG_STA_SUPPORT //
706 if(pAd->iw_stats.qual.qual > 100)
707 pAd->iw_stats.qual.qual = 100;
709 #ifdef CONFIG_STA_SUPPORT
710 if (pAd->OpMode == OPMODE_STA)
712 pAd->iw_stats.qual.level =
713 RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0,
714 pAd->StaCfg.RssiSample.LastRssi1,
715 pAd->StaCfg.RssiSample.LastRssi2);
717 #endif // CONFIG_STA_SUPPORT //
719 pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm)
721 pAd->iw_stats.qual.noise += 256 - 143;
722 pAd->iw_stats.qual.updated = 1; // Flags to know if updated
724 pAd->iw_stats.qual.updated |= IW_QUAL_DBM; // Level + Noise are dBm
725 #endif // IW_QUAL_DBM //
727 pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid
728 pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe
730 DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n"));
731 return &pAd->iw_stats;
733 #endif // WIRELESS_EXT //
736 void tbtt_tasklet(unsigned long data)
738 //#define MAX_TX_IN_TBTT (16)
744 IN OUT struct ifreq *rq,
747 RTMP_ADAPTER *pAd = NULL;
750 pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
753 /* if 1st open fail, pAd will be free;
754 So the net_dev->priv will be NULL in 2rd open */
759 #ifdef CONFIG_STA_SUPPORT
760 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
762 ret = rt28xx_sta_ioctl(net_dev, rq, cmd);
764 #endif // CONFIG_STA_SUPPORT //
771 ========================================================================
774 return ethernet statistics counter
777 net_dev Pointer to net_device
784 ========================================================================
786 static struct net_device_stats *RT28xx_get_ether_stats(
787 IN struct net_device *net_dev)
789 RTMP_ADAPTER *pAd = NULL;
792 pAd = RTMP_OS_NETDEV_GET_PRIV(net_dev);
797 pAd->stats.rx_packets = pAd->WlanCounters.ReceivedFragmentCount.QuadPart;
798 pAd->stats.tx_packets = pAd->WlanCounters.TransmittedFragmentCount.QuadPart;
800 pAd->stats.rx_bytes = pAd->RalinkCounters.ReceivedByteCount;
801 pAd->stats.tx_bytes = pAd->RalinkCounters.TransmittedByteCount;
803 pAd->stats.rx_errors = pAd->Counters8023.RxErrors;
804 pAd->stats.tx_errors = pAd->Counters8023.TxErrors;
806 pAd->stats.rx_dropped = 0;
807 pAd->stats.tx_dropped = 0;
809 pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received
810 pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets
812 pAd->stats.rx_length_errors = 0;
813 pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow
814 pAd->stats.rx_crc_errors = 0;//pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error
815 pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error
816 pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun
817 pAd->stats.rx_missed_errors = 0; // receiver missed packet
819 // detailed tx_errors
820 pAd->stats.tx_aborted_errors = 0;
821 pAd->stats.tx_carrier_errors = 0;
822 pAd->stats.tx_fifo_errors = 0;
823 pAd->stats.tx_heartbeat_errors = 0;
824 pAd->stats.tx_window_errors = 0;
827 pAd->stats.rx_compressed = 0;
828 pAd->stats.tx_compressed = 0;
837 BOOLEAN RtmpPhyNetDevExit(
838 IN RTMP_ADAPTER *pAd,
844 #ifdef INF_AMAZON_PPA
845 if (ppa_hook_directpath_register_dev_fn && pAd->PPAEnable==TRUE)
848 status=ppa_hook_directpath_register_dev_fn(&pAd->g_if_id, pAd->net_dev, NULL, PPA_F_DIRECTPATH_DEREGISTER);
849 printk("unregister PPA:g_if_id=%d status=%d\n",pAd->g_if_id,status);
851 kfree(pAd->pDirectpathCb);
852 #endif // INF_AMAZON_PPA //
854 // Unregister network device
857 printk("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", net_dev->name);
858 RtmpOSNetDevDetach(net_dev);
867 ========================================================================
869 Allocate memory for adapter control block.
872 pAd Pointer to our adapter
877 NDIS_STATUS_RESOURCES
880 ========================================================================
882 NDIS_STATUS AdapterBlockAllocateMemory(
887 *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr);
891 NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER));
892 ((PRTMP_ADAPTER)*ppAd)->OS_Cookie = handle;
893 return (NDIS_STATUS_SUCCESS);
895 return (NDIS_STATUS_FAILURE);