diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-12-11 12:23:13 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 12:23:13 -0800 |
commit | 66cd8d6ec97bbfac53b5e67df9ef4668c3f96085 (patch) | |
tree | c02aa3e30ffa985055c417819fce0600b6fc95f4 /drivers/staging/rt2860/rt_main_dev.c | |
parent | 460bb8df1e910a8c5d36ad363fbc1f0164cf0b85 (diff) |
Staging: rt28x0: run *.c files through Lindent
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rt2860/rt_main_dev.c')
-rw-r--r-- | drivers/staging/rt2860/rt_main_dev.c | 399 |
1 files changed, 187 insertions, 212 deletions
diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index 3a735717bcf6..8f65e469b512 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c @@ -37,17 +37,14 @@ #include "rt_config.h" - - /*---------------------------------------------------------------------*/ /* Private Variables Used */ /*---------------------------------------------------------------------*/ -PSTRING mac = ""; // default 00:00:00:00:00:00 -PSTRING hostname = ""; // default CMPC -module_param (mac, charp, 0); -MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr"); - +PSTRING mac = ""; // default 00:00:00:00:00:00 +PSTRING hostname = ""; // default CMPC +module_param(mac, charp, 0); +MODULE_PARM_DESC(mac, "rt28xx: wireless mac addr"); /*---------------------------------------------------------------------*/ /* Prototypes of Functions Used */ @@ -58,11 +55,11 @@ int rt28xx_close(IN struct net_device *net_dev); int rt28xx_open(struct net_device *net_dev); // private function prototype -static INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev); - +static INT rt28xx_send_packets(IN struct sk_buff *skb_p, + IN struct net_device *net_dev); -static struct net_device_stats *RT28xx_get_ether_stats( - IN struct net_device *net_dev); +static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device + *net_dev); /* ======================================================================== @@ -86,57 +83,66 @@ Note: */ int MainVirtualIF_close(IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = NULL; + RTMP_ADAPTER *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); // Sanity check for pAd if (pAd == NULL) - return 0; // close ok + return 0; // close ok netif_carrier_off(pAd->net_dev); netif_stop_queue(pAd->net_dev); { - BOOLEAN Cancelled; + BOOLEAN Cancelled; if (INFRA_ON(pAd) && - (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) - { - MLME_DISASSOC_REQ_STRUCT DisReq; - MLME_QUEUE_ELEM *MsgElem = (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), MEM_ALLOC_FLAG); - - if (MsgElem) - { - COPY_MAC_ADDR(DisReq.Addr, pAd->CommonCfg.Bssid); - DisReq.Reason = REASON_DEAUTH_STA_LEAVING; - - MsgElem->Machine = ASSOC_STATE_MACHINE; - MsgElem->MsgType = MT2_MLME_DISASSOC_REQ; - MsgElem->MsgLen = sizeof(MLME_DISASSOC_REQ_STRUCT); - NdisMoveMemory(MsgElem->Msg, &DisReq, sizeof(MLME_DISASSOC_REQ_STRUCT)); - - // Prevent to connect AP again in STAMlmePeriodicExec - pAd->MlmeAux.AutoReconnectSsidLen= 32; - NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, pAd->MlmeAux.AutoReconnectSsidLen); - - pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_OID_DISASSOC; - MlmeDisassocReqAction(pAd, MsgElem); - kfree(MsgElem); + (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))) { + MLME_DISASSOC_REQ_STRUCT DisReq; + MLME_QUEUE_ELEM *MsgElem = + (MLME_QUEUE_ELEM *) kmalloc(sizeof(MLME_QUEUE_ELEM), + MEM_ALLOC_FLAG); + + if (MsgElem) { + COPY_MAC_ADDR(DisReq.Addr, + pAd->CommonCfg.Bssid); + DisReq.Reason = REASON_DEAUTH_STA_LEAVING; + + MsgElem->Machine = ASSOC_STATE_MACHINE; + MsgElem->MsgType = MT2_MLME_DISASSOC_REQ; + MsgElem->MsgLen = + sizeof(MLME_DISASSOC_REQ_STRUCT); + NdisMoveMemory(MsgElem->Msg, &DisReq, + sizeof + (MLME_DISASSOC_REQ_STRUCT)); + + // Prevent to connect AP again in STAMlmePeriodicExec + pAd->MlmeAux.AutoReconnectSsidLen = 32; + NdisZeroMemory(pAd->MlmeAux.AutoReconnectSsid, + pAd->MlmeAux. + AutoReconnectSsidLen); + + pAd->Mlme.CntlMachine.CurrState = + CNTL_WAIT_OID_DISASSOC; + MlmeDisassocReqAction(pAd, MsgElem); + kfree(MsgElem); } RTMPusecDelay(1000); } - RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, &Cancelled); - RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled); + RTMPCancelTimer(&pAd->StaCfg.StaQuickResponeForRateUpTimer, + &Cancelled); + RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, + &Cancelled); } VIRTUAL_IF_DOWN(pAd); RT_MOD_DEC_USE_COUNT(); - return 0; // close ok + return 0; // close ok } /* @@ -161,13 +167,13 @@ Note: */ int MainVirtualIF_open(IN struct net_device *net_dev) { - RTMP_ADAPTER *pAd = NULL; + RTMP_ADAPTER *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); // Sanity check for pAd if (pAd == NULL) - return 0; // close ok + return 0; // close ok if (VIRTUAL_IF_UP(pAd) != 0) return -1; @@ -204,10 +210,10 @@ Note: */ int rt28xx_close(IN PNET_DEV dev) { - struct net_device * net_dev = (struct net_device *)dev; - RTMP_ADAPTER *pAd = NULL; - BOOLEAN Cancelled; - UINT32 i = 0; + struct net_device *net_dev = (struct net_device *)dev; + RTMP_ADAPTER *pAd = NULL; + BOOLEAN Cancelled; + UINT32 i = 0; #ifdef RTMP_MAC_USB DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup); @@ -216,12 +222,12 @@ int rt28xx_close(IN PNET_DEV dev) GET_PAD_FROM_NET_DEV(pAd, net_dev); - DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n")); + DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n")); Cancelled = FALSE; // Sanity check for pAd if (pAd == NULL) - return 0; // close ok + return 0; // close ok { #ifdef RTMP_MAC_PCI @@ -230,13 +236,11 @@ int rt28xx_close(IN PNET_DEV dev) // If dirver doesn't wake up firmware here, // NICLoadFirmware will hang forever when interface is up again. - if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) - { - AsicForceWakeup(pAd, TRUE); - } - + if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)) { + AsicForceWakeup(pAd, TRUE); + } #ifdef RTMP_MAC_USB - RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); + RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS); #endif // RTMP_MAC_USB // MlmeRadioOff(pAd); @@ -247,30 +251,28 @@ int rt28xx_close(IN PNET_DEV dev) RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS); - for (i = 0 ; i < NUM_OF_TX_RING; i++) - { - while (pAd->DeQueueRunning[i] == TRUE) - { - DBGPRINT(RT_DEBUG_TRACE, ("Waiting for TxQueue[%d] done..........\n", i)); + for (i = 0; i < NUM_OF_TX_RING; i++) { + while (pAd->DeQueueRunning[i] == TRUE) { + DBGPRINT(RT_DEBUG_TRACE, + ("Waiting for TxQueue[%d] done..........\n", + i)); RTMPusecDelay(1000); } } #ifdef RTMP_MAC_USB // ensure there are no more active urbs. - add_wait_queue (&unlink_wakeup, &wait); + add_wait_queue(&unlink_wakeup, &wait); pAd->wait = &unlink_wakeup; // maybe wait for deletions to finish. i = 0; //while((i < 25) && atomic_read(&pAd->PendingRx) > 0) - while(i < 25) - { + while (i < 25) { unsigned long IrqFlags; RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags); - if (pAd->PendingRx == 0) - { + if (pAd->PendingRx == 0) { RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); break; } @@ -280,7 +282,7 @@ int rt28xx_close(IN PNET_DEV dev) i++; } pAd->wait = NULL; - remove_wait_queue (&unlink_wakeup, &wait); + remove_wait_queue(&unlink_wakeup, &wait); #endif // RTMP_MAC_USB // // Stop Mlme state machine @@ -293,42 +295,37 @@ int rt28xx_close(IN PNET_DEV dev) MacTableReset(pAd); } - MeasureReqTabExit(pAd); TpcReqTabExit(pAd); - // Close kernel threads RtmpMgmtTaskExit(pAd); #ifdef RTMP_MAC_PCI { - BOOLEAN brc; - // ULONG Value; - - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) - { - RTMP_ASIC_INTERRUPT_DISABLE(pAd); - } - - // Receive packets to clear DMA index after disable interrupt. - //RTMPHandleRxDoneInterrupt(pAd); - // put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all - // register access before Radio off. + BOOLEAN brc; + // ULONG Value; + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { + RTMP_ASIC_INTERRUPT_DISABLE(pAd); + } + // Receive packets to clear DMA index after disable interrupt. + //RTMPHandleRxDoneInterrupt(pAd); + // put to radio off to save power when driver unload. After radiooff, can't write /read register. So need to finish all + // register access before Radio off. - brc=RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0); + brc = RT28xxPciAsicRadioOff(pAd, RTMP_HALT, 0); //In solution 3 of 3090F, the bPCIclkOff will be set to TRUE after calling RT28xxPciAsicRadioOff - pAd->bPCIclkOff = FALSE; + pAd->bPCIclkOff = FALSE; - if (brc==FALSE) - { - DBGPRINT(RT_DEBUG_ERROR,("%s call RT28xxPciAsicRadioOff fail !!\n", __func__)); - } + if (brc == FALSE) { + DBGPRINT(RT_DEBUG_ERROR, + ("%s call RT28xxPciAsicRadioOff fail !!\n", + __func__)); + } } - /* if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE)) { @@ -341,15 +338,13 @@ int rt28xx_close(IN PNET_DEV dev) #endif // RTMP_MAC_PCI // // Free IRQ - if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) - { + if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE)) { #ifdef RTMP_MAC_PCI // Deregister interrupt function RtmpOSIRQRelease(net_dev); #endif // RTMP_MAC_PCI // - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); - } - + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE); + } // Free Ring or USB buffers RTMPFreeTxRxRingMemory(pAd); @@ -358,7 +353,6 @@ int rt28xx_close(IN PNET_DEV dev) // Free BA reorder resource ba_reordering_resource_release(pAd); - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_START_UP); /*+++Modify by woody to solve the bulk fail+++*/ @@ -366,9 +360,8 @@ int rt28xx_close(IN PNET_DEV dev) } DBGPRINT(RT_DEBUG_TRACE, ("<=== rt28xx_close\n")); - return 0; // close ok -} /* End of rt28xx_close */ - + return 0; // close ok +} /* End of rt28xx_close */ /* ======================================================================== @@ -387,7 +380,7 @@ Note: */ int rt28xx_open(IN PNET_DEV dev) { - struct net_device * net_dev = (struct net_device *)dev; + struct net_device *net_dev = (struct net_device *)dev; PRTMP_ADAPTER pAd = NULL; int retval = 0; //POS_COOKIE pObj; @@ -395,24 +388,21 @@ int rt28xx_open(IN PNET_DEV dev) GET_PAD_FROM_NET_DEV(pAd, net_dev); // Sanity check for pAd - if (pAd == NULL) - { + if (pAd == NULL) { /* if 1st open fail, pAd will be free; So the net_dev->ml_priv will be NULL in 2rd open */ return -1; } - if (net_dev->priv_flags == INT_MAIN) - { + if (net_dev->priv_flags == INT_MAIN) { if (pAd->OpMode == OPMODE_STA) - net_dev->wireless_handlers = (struct iw_handler_def *) &rt28xx_iw_handler_def; + net_dev->wireless_handlers = + (struct iw_handler_def *)&rt28xx_iw_handler_def; } - // Request interrupt service routine for PCI device // register the interrupt routine with the os RtmpOSIRQRequest(net_dev); - // Init IRQ parameters stored in pAd RTMP_IRQ_INIT(pAd); @@ -420,7 +410,6 @@ int rt28xx_open(IN PNET_DEV dev) if (rt28xx_init(pAd, mac, hostname) == FALSE) goto err; - // Enable Interrupt RTMP_IRQ_ENABLE(pAd); @@ -429,25 +418,25 @@ int rt28xx_open(IN PNET_DEV dev) RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_START_UP); { - UINT32 reg = 0; - RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts - printk("0x1300 = %08x\n", reg); + UINT32 reg = 0; + RTMP_IO_READ32(pAd, 0x1300, ®); // clear garbage interrupts + printk("0x1300 = %08x\n", reg); } { -// u32 reg; -// UINT8 byte; -// u16 tmp; +// u32 reg; +// UINT8 byte; +// u16 tmp; -// RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®); +// RTMP_IO_READ32(pAd, XIFS_TIME_CFG, ®); -// tmp = 0x0805; -// reg = (reg & 0xffff0000) | tmp; -// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg); +// tmp = 0x0805; +// reg = (reg & 0xffff0000) | tmp; +// RTMP_IO_WRITE32(pAd, XIFS_TIME_CFG, reg); } #ifdef RTMP_MAC_PCI - RTMPInitPCIeLinkCtrlValue(pAd); + RTMPInitPCIeLinkCtrlValue(pAd); #endif // RTMP_MAC_PCI // return (retval); @@ -457,39 +446,41 @@ err: RtmpOSIRQRelease(net_dev); //---Add by shiang, move from rt28xx_init() to here. return (-1); -} /* End of rt28xx_open */ +} /* End of rt28xx_open */ static const struct net_device_ops rt2860_netdev_ops = { - .ndo_open = MainVirtualIF_open, - .ndo_stop = MainVirtualIF_close, - .ndo_do_ioctl = rt28xx_sta_ioctl, - .ndo_get_stats = RT28xx_get_ether_stats, - .ndo_validate_addr = NULL, - .ndo_set_mac_address = eth_mac_addr, - .ndo_change_mtu = eth_change_mtu, - .ndo_start_xmit = rt28xx_send_packets, + .ndo_open = MainVirtualIF_open, + .ndo_stop = MainVirtualIF_close, + .ndo_do_ioctl = rt28xx_sta_ioctl, + .ndo_get_stats = RT28xx_get_ether_stats, + .ndo_validate_addr = NULL, + .ndo_set_mac_address = eth_mac_addr, + .ndo_change_mtu = eth_change_mtu, + .ndo_start_xmit = rt28xx_send_packets, }; -PNET_DEV RtmpPhyNetDevInit( - IN RTMP_ADAPTER *pAd, - IN RTMP_OS_NETDEV_OP_HOOK *pNetDevHook) +PNET_DEV RtmpPhyNetDevInit(IN RTMP_ADAPTER * pAd, + IN RTMP_OS_NETDEV_OP_HOOK * pNetDevHook) { - struct net_device *net_dev = NULL; -// NDIS_STATUS Status; - - net_dev = RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), INF_MAIN_DEV_NAME); - if (net_dev == NULL) - { - printk("RtmpPhyNetDevInit(): creation failed for main physical net device!\n"); + struct net_device *net_dev = NULL; +// NDIS_STATUS Status; + + net_dev = + RtmpOSNetDevCreate(pAd, INT_MAIN, 0, sizeof(PRTMP_ADAPTER), + INF_MAIN_DEV_NAME); + if (net_dev == NULL) { + printk + ("RtmpPhyNetDevInit(): creation failed for main physical net device!\n"); return NULL; - } + } - NdisZeroMemory((unsigned char *)pNetDevHook, sizeof(RTMP_OS_NETDEV_OP_HOOK)); + NdisZeroMemory((unsigned char *)pNetDevHook, + sizeof(RTMP_OS_NETDEV_OP_HOOK)); pNetDevHook->netdev_ops = &rt2860_netdev_ops; pNetDevHook->priv_flags = INT_MAIN; pNetDevHook->needProtcted = FALSE; - net_dev->ml_priv = (PVOID)pAd; + net_dev->ml_priv = (PVOID) pAd; pAd->net_dev = net_dev; netif_stop_queue(net_dev); @@ -498,7 +489,6 @@ PNET_DEV RtmpPhyNetDevInit( } - /* ======================================================================== Routine Description: @@ -529,16 +519,14 @@ int rt28xx_packet_xmit(struct sk_buff *skb) { // Drop send request since we are in monitor mode - if (MONITOR_ON(pAd)) - { + if (MONITOR_ON(pAd)) { RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); goto done; } } - // EapolStart size is 18 - if (skb->len < 14) - { + // EapolStart size is 18 + if (skb->len < 14) { //printk("bad packet size: %d\n", pkt->len); hex_dump("bad packet", skb->data, skb->len); RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE); @@ -546,7 +534,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb) } RTMP_SET_PACKET_5VT(pPacket, 0); - STASendPackets((NDIS_HANDLE)pAd, (PPNDIS_PACKET) &pPacket, 1); + STASendPackets((NDIS_HANDLE) pAd, (PPNDIS_PACKET) & pPacket, 1); status = NETDEV_TX_OK; done: @@ -554,7 +542,6 @@ done: return status; } - /* ======================================================================== Routine Description: @@ -571,30 +558,27 @@ Return Value: Note: ======================================================================== */ -static int rt28xx_send_packets( - IN struct sk_buff *skb_p, - IN struct net_device *net_dev) +static int rt28xx_send_packets(IN struct sk_buff *skb_p, + IN struct net_device *net_dev) { RTMP_ADAPTER *pAd = NULL; GET_PAD_FROM_NET_DEV(pAd, net_dev); - if (!(net_dev->flags & IFF_UP)) - { - RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET)skb_p, NDIS_STATUS_FAILURE); + if (!(net_dev->flags & IFF_UP)) { + RELEASE_NDIS_PACKET(pAd, (PNDIS_PACKET) skb_p, + NDIS_STATUS_FAILURE); return NETDEV_TX_OK; } - NdisZeroMemory((PUCHAR)&skb_p->cb[CB_OFF], 15); + NdisZeroMemory((PUCHAR) & skb_p->cb[CB_OFF], 15); RTMP_SET_PACKET_NET_DEVICE_MBSSID(skb_p, MAIN_MBSSID); return rt28xx_packet_xmit(skb_p); } - // This function will be called when query /proc -struct iw_statistics *rt28xx_get_wireless_stats( - IN struct net_device *net_dev) +struct iw_statistics *rt28xx_get_wireless_stats(IN struct net_device *net_dev) { PRTMP_ADAPTER pAd = NULL; @@ -602,42 +586,41 @@ struct iw_statistics *rt28xx_get_wireless_stats( DBGPRINT(RT_DEBUG_TRACE, ("rt28xx_get_wireless_stats --->\n")); - pAd->iw_stats.status = 0; // Status - device dependent for now + pAd->iw_stats.status = 0; // Status - device dependent for now // link quality if (pAd->OpMode == OPMODE_STA) - pAd->iw_stats.qual.qual = ((pAd->Mlme.ChannelQuality * 12)/10 + 10); + pAd->iw_stats.qual.qual = + ((pAd->Mlme.ChannelQuality * 12) / 10 + 10); - if(pAd->iw_stats.qual.qual > 100) + if (pAd->iw_stats.qual.qual > 100) pAd->iw_stats.qual.qual = 100; - if (pAd->OpMode == OPMODE_STA) - { + if (pAd->OpMode == OPMODE_STA) { pAd->iw_stats.qual.level = - RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, - pAd->StaCfg.RssiSample.LastRssi1, - pAd->StaCfg.RssiSample.LastRssi2); + RTMPMaxRssi(pAd, pAd->StaCfg.RssiSample.LastRssi0, + pAd->StaCfg.RssiSample.LastRssi1, + pAd->StaCfg.RssiSample.LastRssi2); } - pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm) + pAd->iw_stats.qual.noise = pAd->BbpWriteLatch[66]; // noise level (dBm) pAd->iw_stats.qual.noise += 256 - 143; - pAd->iw_stats.qual.updated = 1; // Flags to know if updated + pAd->iw_stats.qual.updated = 1; // Flags to know if updated #ifdef IW_QUAL_DBM pAd->iw_stats.qual.updated |= IW_QUAL_DBM; // Level + Noise are dBm #endif // IW_QUAL_DBM // - pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid - pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe + pAd->iw_stats.discard.nwid = 0; // Rx : Wrong nwid/essid + pAd->iw_stats.miss.beacon = 0; // Missed beacons/superframe DBGPRINT(RT_DEBUG_TRACE, ("<--- rt28xx_get_wireless_stats\n")); return &pAd->iw_stats; } - void tbtt_tasklet(unsigned long data) { -//#define MAX_TX_IN_TBTT (16) +//#define MAX_TX_IN_TBTT (16) } @@ -657,19 +640,20 @@ void tbtt_tasklet(unsigned long data) ======================================================================== */ -static struct net_device_stats *RT28xx_get_ether_stats( - IN struct net_device *net_dev) +static struct net_device_stats *RT28xx_get_ether_stats(IN struct net_device + *net_dev) { - RTMP_ADAPTER *pAd = NULL; + RTMP_ADAPTER *pAd = NULL; if (net_dev) GET_PAD_FROM_NET_DEV(pAd, net_dev); - if (pAd) - { + if (pAd) { - pAd->stats.rx_packets = pAd->WlanCounters.ReceivedFragmentCount.QuadPart; - pAd->stats.tx_packets = pAd->WlanCounters.TransmittedFragmentCount.QuadPart; + pAd->stats.rx_packets = + pAd->WlanCounters.ReceivedFragmentCount.QuadPart; + pAd->stats.tx_packets = + pAd->WlanCounters.TransmittedFragmentCount.QuadPart; pAd->stats.rx_bytes = pAd->RalinkCounters.ReceivedByteCount; pAd->stats.tx_bytes = pAd->RalinkCounters.TransmittedByteCount; @@ -680,45 +664,40 @@ static struct net_device_stats *RT28xx_get_ether_stats( pAd->stats.rx_dropped = 0; pAd->stats.tx_dropped = 0; - pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received - pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets + pAd->stats.multicast = pAd->WlanCounters.MulticastReceivedFrameCount.QuadPart; // multicast packets received + pAd->stats.collisions = pAd->Counters8023.OneCollision + pAd->Counters8023.MoreCollisions; // Collision packets - pAd->stats.rx_length_errors = 0; - pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow - pAd->stats.rx_crc_errors = 0;//pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error - pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error - pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun - pAd->stats.rx_missed_errors = 0; // receiver missed packet + pAd->stats.rx_length_errors = 0; + pAd->stats.rx_over_errors = pAd->Counters8023.RxNoBuffer; // receiver ring buff overflow + pAd->stats.rx_crc_errors = 0; //pAd->WlanCounters.FCSErrorCount; // recved pkt with crc error + pAd->stats.rx_frame_errors = pAd->Counters8023.RcvAlignmentErrors; // recv'd frame alignment error + pAd->stats.rx_fifo_errors = pAd->Counters8023.RxNoBuffer; // recv'r fifo overrun + pAd->stats.rx_missed_errors = 0; // receiver missed packet - // detailed tx_errors - pAd->stats.tx_aborted_errors = 0; - pAd->stats.tx_carrier_errors = 0; - pAd->stats.tx_fifo_errors = 0; - pAd->stats.tx_heartbeat_errors = 0; - pAd->stats.tx_window_errors = 0; + // detailed tx_errors + pAd->stats.tx_aborted_errors = 0; + pAd->stats.tx_carrier_errors = 0; + pAd->stats.tx_fifo_errors = 0; + pAd->stats.tx_heartbeat_errors = 0; + pAd->stats.tx_window_errors = 0; - // for cslip etc - pAd->stats.rx_compressed = 0; - pAd->stats.tx_compressed = 0; + // for cslip etc + pAd->stats.rx_compressed = 0; + pAd->stats.tx_compressed = 0; return &pAd->stats; - } - else - return NULL; + } else + return NULL; } - -BOOLEAN RtmpPhyNetDevExit( - IN RTMP_ADAPTER *pAd, - IN PNET_DEV net_dev) +BOOLEAN RtmpPhyNetDevExit(IN RTMP_ADAPTER * pAd, IN PNET_DEV net_dev) { - - // Unregister network device - if (net_dev != NULL) - { - printk("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", net_dev->name); + if (net_dev != NULL) { + printk + ("RtmpOSNetDevDetach(): RtmpOSNetDeviceDetach(), dev->name=%s!\n", + net_dev->name); RtmpOSNetDevDetach(net_dev); } @@ -726,7 +705,6 @@ BOOLEAN RtmpPhyNetDevExit( } - /* ======================================================================== Routine Description: @@ -743,17 +721,14 @@ Return Value: Note: ======================================================================== */ -NDIS_STATUS AdapterBlockAllocateMemory( - IN PVOID handle, - OUT PVOID *ppAd) +NDIS_STATUS AdapterBlockAllocateMemory(IN PVOID handle, OUT PVOID * ppAd) { - *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); + *ppAd = (PVOID) vmalloc(sizeof(RTMP_ADAPTER)); //pci_alloc_consistent(pci_dev, sizeof(RTMP_ADAPTER), phy_addr); - if (*ppAd) - { + if (*ppAd) { NdisZeroMemory(*ppAd, sizeof(RTMP_ADAPTER)); - ((PRTMP_ADAPTER)*ppAd)->OS_Cookie = handle; + ((PRTMP_ADAPTER) * ppAd)->OS_Cookie = handle; return (NDIS_STATUS_SUCCESS); } else { return (NDIS_STATUS_FAILURE); |