diff options
Diffstat (limited to 'drivers/staging/bcm/Misc.c')
-rw-r--r-- | drivers/staging/bcm/Misc.c | 1833 |
1 files changed, 794 insertions, 1039 deletions
diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index c5b3a3666bc..e9f29d59751 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@ -1,113 +1,94 @@ #include "headers.h" -static int BcmFileDownload(PMINI_ADAPTER Adapter, const char *path, - unsigned int loc); +static int BcmFileDownload(PMINI_ADAPTER Adapter, const char *path, unsigned int loc); static VOID doPowerAutoCorrection(PMINI_ADAPTER psAdapter); -static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter,PUCHAR pucBuffer); +static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter, PUCHAR pucBuffer); static int bcm_parse_target_params(PMINI_ADAPTER Adapter); -static void beceem_protocol_reset (PMINI_ADAPTER Adapter); +static void beceem_protocol_reset(PMINI_ADAPTER Adapter); static VOID default_wimax_protocol_initialize(PMINI_ADAPTER Adapter) { + UINT uiLoopIndex; - UINT uiLoopIndex; - - for(uiLoopIndex=0; uiLoopIndex < NO_OF_QUEUES-1; uiLoopIndex++) - { - Adapter->PackInfo[uiLoopIndex].uiThreshold=TX_PACKET_THRESHOLD; - Adapter->PackInfo[uiLoopIndex].uiMaxAllowedRate=MAX_ALLOWED_RATE; - Adapter->PackInfo[uiLoopIndex].uiMaxBucketSize=20*1024*1024; - } - - Adapter->BEBucketSize=BE_BUCKET_SIZE; - Adapter->rtPSBucketSize=rtPS_BUCKET_SIZE; - Adapter->LinkStatus=SYNC_UP_REQUEST; - Adapter->TransferMode=IP_PACKET_ONLY_MODE; - Adapter->usBestEffortQueueIndex=-1; - return; -} + for (uiLoopIndex = 0; uiLoopIndex < NO_OF_QUEUES-1; uiLoopIndex++) { + Adapter->PackInfo[uiLoopIndex].uiThreshold = TX_PACKET_THRESHOLD; + Adapter->PackInfo[uiLoopIndex].uiMaxAllowedRate = MAX_ALLOWED_RATE; + Adapter->PackInfo[uiLoopIndex].uiMaxBucketSize = 20*1024*1024; + } + Adapter->BEBucketSize = BE_BUCKET_SIZE; + Adapter->rtPSBucketSize = rtPS_BUCKET_SIZE; + Adapter->LinkStatus = SYNC_UP_REQUEST; + Adapter->TransferMode = IP_PACKET_ONLY_MODE; + Adapter->usBestEffortQueueIndex = -1; + return; +} -INT -InitAdapter(PMINI_ADAPTER psAdapter) +INT InitAdapter(PMINI_ADAPTER psAdapter) { - int i = 0; - INT Status = STATUS_SUCCESS ; - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Initialising Adapter = %p", psAdapter); + int i = 0; + INT Status = STATUS_SUCCESS; + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Initialising Adapter = %p", psAdapter); - if(psAdapter == NULL) - { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Adapter is NULL"); + if (psAdapter == NULL) { + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Adapter is NULL"); return -EINVAL; } - sema_init(&psAdapter->NVMRdmWrmLock,1); -// psAdapter->ulFlashCalStart = FLASH_AUTO_INIT_BASE_ADDR; - + sema_init(&psAdapter->NVMRdmWrmLock, 1); sema_init(&psAdapter->rdmwrmsync, 1); spin_lock_init(&psAdapter->control_queue_lock); spin_lock_init(&psAdapter->txtransmitlock); - sema_init(&psAdapter->RxAppControlQueuelock, 1); -// sema_init(&psAdapter->data_packet_queue_lock, 1); - sema_init(&psAdapter->fw_download_sema, 1); - sema_init(&psAdapter->LowPowerModeSync,1); - - // spin_lock_init(&psAdapter->sleeper_lock); - - for(i=0;i<NO_OF_QUEUES; i++) - spin_lock_init(&psAdapter->PackInfo[i].SFQueueLock); - i=0; - - init_waitqueue_head(&psAdapter->process_rx_cntrlpkt); - init_waitqueue_head(&psAdapter->tx_packet_wait_queue); - init_waitqueue_head(&psAdapter->process_read_wait_queue); - init_waitqueue_head(&psAdapter->ioctl_fw_dnld_wait_queue); - init_waitqueue_head(&psAdapter->lowpower_mode_wait_queue); + sema_init(&psAdapter->RxAppControlQueuelock, 1); + sema_init(&psAdapter->fw_download_sema, 1); + sema_init(&psAdapter->LowPowerModeSync, 1); + + for (i = 0; i < NO_OF_QUEUES; i++) + spin_lock_init(&psAdapter->PackInfo[i].SFQueueLock); + i = 0; + + init_waitqueue_head(&psAdapter->process_rx_cntrlpkt); + init_waitqueue_head(&psAdapter->tx_packet_wait_queue); + init_waitqueue_head(&psAdapter->process_read_wait_queue); + init_waitqueue_head(&psAdapter->ioctl_fw_dnld_wait_queue); + init_waitqueue_head(&psAdapter->lowpower_mode_wait_queue); psAdapter->waiting_to_fw_download_done = TRUE; - //init_waitqueue_head(&psAdapter->device_wake_queue); - psAdapter->fw_download_done=FALSE; - + psAdapter->fw_download_done = FALSE; default_wimax_protocol_initialize(psAdapter); - for (i=0;i<MAX_CNTRL_PKTS;i++) - { + for (i = 0; i < MAX_CNTRL_PKTS; i++) { psAdapter->txctlpacket[i] = kmalloc(MAX_CNTL_PKT_SIZE, GFP_KERNEL); - if(!psAdapter->txctlpacket[i]) - { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "No More Cntl pkts got, max got is %d", i); + if (!psAdapter->txctlpacket[i]) { + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "No More Cntl pkts got, max got is %d", i); return -ENOMEM; } } - if(AllocAdapterDsxBuffer(psAdapter)) - { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to allocate DSX buffers"); + + if (AllocAdapterDsxBuffer(psAdapter)) { + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to allocate DSX buffers"); return -EINVAL; } - //Initialize PHS interface - if(phs_init(&psAdapter->stBCMPhsContext,psAdapter)!=0) - { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"%s:%s:%d:Error PHS Init Failed=====>\n", __FILE__, __FUNCTION__, __LINE__); + /* Initialize PHS interface */ + if (phs_init(&psAdapter->stBCMPhsContext, psAdapter) != 0) { + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "%s:%s:%d:Error PHS Init Failed=====>\n", __FILE__, __func__, __LINE__); return -ENOMEM; } Status = BcmAllocFlashCSStructure(psAdapter); - if(Status) - { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"Memory Allocation for Flash structure failed"); - return Status ; + if (Status) { + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Memory Allocation for Flash structure failed"); + return Status; } Status = vendorextnInit(psAdapter); - if(STATUS_SUCCESS != Status) - { - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL,"Vendor Init Failed"); - return Status ; + if (STATUS_SUCCESS != Status) { + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Vendor Init Failed"); + return Status; } - BCM_DEBUG_PRINT(psAdapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Adapter initialised"); - + BCM_DEBUG_PRINT(psAdapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Adapter initialised"); return STATUS_SUCCESS; } @@ -115,42 +96,37 @@ InitAdapter(PMINI_ADAPTER psAdapter) VOID AdapterFree(PMINI_ADAPTER Adapter) { int count; - beceem_protocol_reset(Adapter); - vendorextnExit(Adapter); - if(Adapter->control_packet_handler && !IS_ERR(Adapter->control_packet_handler)) - kthread_stop (Adapter->control_packet_handler); + if (Adapter->control_packet_handler && !IS_ERR(Adapter->control_packet_handler)) + kthread_stop(Adapter->control_packet_handler); - if(Adapter->transmit_packet_thread && !IS_ERR(Adapter->transmit_packet_thread)) - kthread_stop (Adapter->transmit_packet_thread); + if (Adapter->transmit_packet_thread && !IS_ERR(Adapter->transmit_packet_thread)) + kthread_stop(Adapter->transmit_packet_thread); wake_up(&Adapter->process_read_wait_queue); - if(Adapter->LEDInfo.led_thread_running & (BCM_LED_THREAD_RUNNING_ACTIVELY | BCM_LED_THREAD_RUNNING_INACTIVELY)) - kthread_stop (Adapter->LEDInfo.led_cntrl_threadid); + if (Adapter->LEDInfo.led_thread_running & (BCM_LED_THREAD_RUNNING_ACTIVELY | BCM_LED_THREAD_RUNNING_INACTIVELY)) + kthread_stop(Adapter->LEDInfo.led_cntrl_threadid); unregister_networkdev(Adapter); /* FIXME: use proper wait_event and refcounting */ - while(atomic_read(&Adapter->ApplicationRunning)) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Waiting for Application to close.. %d\n",atomic_read(&Adapter->ApplicationRunning)); + while (atomic_read(&Adapter->ApplicationRunning)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Waiting for Application to close.. %d\n", atomic_read(&Adapter->ApplicationRunning)); msleep(100); } unregister_control_device_interface(Adapter); - kfree(Adapter->pstargetparams); - for (count =0;count < MAX_CNTRL_PKTS;count++) + for (count = 0; count < MAX_CNTRL_PKTS; count++) kfree(Adapter->txctlpacket[count]); FreeAdapterDsxBuffer(Adapter); - kfree(Adapter->pvInterfaceAdapter); - //Free the PHS Interface + /* Free the PHS Interface */ PhsCleanup(&Adapter->stBCMPhsContext); BcmDeAllocFlashCSStructure(Adapter); @@ -160,20 +136,18 @@ VOID AdapterFree(PMINI_ADAPTER Adapter) static int create_worker_threads(PMINI_ADAPTER psAdapter) { - // Rx Control Packets Processing + /* Rx Control Packets Processing */ psAdapter->control_packet_handler = kthread_run((int (*)(void *)) control_packet_handler, psAdapter, "%s-rx", DRV_NAME); - if(IS_ERR(psAdapter->control_packet_handler)) - { + if (IS_ERR(psAdapter->control_packet_handler)) { pr_notice(DRV_NAME ": could not create control thread\n"); return PTR_ERR(psAdapter->control_packet_handler); } - // Tx Thread + /* Tx Thread */ psAdapter->transmit_packet_thread = kthread_run((int (*)(void *)) tx_pkt_handler, psAdapter, "%s-tx", DRV_NAME); - if(IS_ERR (psAdapter->transmit_packet_thread)) - { + if (IS_ERR(psAdapter->transmit_packet_thread)) { pr_notice(DRV_NAME ": could not creat transmit thread\n"); kthread_stop(psAdapter->control_packet_handler); return PTR_ERR(psAdapter->transmit_packet_thread); @@ -183,275 +157,248 @@ static int create_worker_threads(PMINI_ADAPTER psAdapter) static struct file *open_firmware_file(PMINI_ADAPTER Adapter, const char *path) { - struct file *flp=NULL; - mm_segment_t oldfs; - oldfs=get_fs(); + struct file *flp = NULL; + mm_segment_t oldfs; + oldfs = get_fs(); set_fs(get_ds()); - flp=filp_open(path, O_RDONLY, S_IRWXU); - set_fs(oldfs); - if(IS_ERR(flp)) - { - pr_err(DRV_NAME "Unable To Open File %s, err %ld", - path, PTR_ERR(flp)); - flp = NULL; - } - - if(Adapter->device_removed) - flp = NULL; - - return flp; -} + flp = filp_open(path, O_RDONLY, S_IRWXU); + set_fs(oldfs); + if (IS_ERR(flp)) { + pr_err(DRV_NAME "Unable To Open File %s, err %ld", path, PTR_ERR(flp)); + flp = NULL; + } + if (Adapter->device_removed) + flp = NULL; -static int BcmFileDownload(PMINI_ADAPTER Adapter,/**< Logical Adapter */ - const char *path, /**< path to image file */ - unsigned int loc /**< Download Address on the chip*/ - ) + return flp; +} + +/* Arguments: + * Logical Adapter + * Path to image file + * Download Address on the chip + */ +static int BcmFileDownload(PMINI_ADAPTER Adapter, const char *path, unsigned int loc) { - int errorno=0; - struct file *flp=NULL; - mm_segment_t oldfs; - struct timeval tv={0}; - - flp=open_firmware_file(Adapter, path); - if(!flp) - { - errorno = -ENOENT; - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path); - goto exit_download; - } - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path,(unsigned long)flp->f_dentry->d_inode->i_size, loc); - do_gettimeofday(&tv); - - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "download start %lx", ((tv.tv_sec * 1000) + - (tv.tv_usec/1000))); - if(Adapter->bcm_file_download(Adapter->pvInterfaceAdapter, flp, loc)) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to download the firmware with error\ - %x!!!", -EIO); - errorno=-EIO; - goto exit_download; - } - oldfs=get_fs();set_fs(get_ds()); - vfs_llseek(flp, 0, 0); - set_fs(oldfs); - if(Adapter->bcm_file_readback_from_chip(Adapter->pvInterfaceAdapter, - flp, loc)) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to read back firmware!"); - errorno=-EIO; - goto exit_download; - } + int errorno = 0; + struct file *flp = NULL; + mm_segment_t oldfs; + struct timeval tv = {0}; + + flp = open_firmware_file(Adapter, path); + if (!flp) { + errorno = -ENOENT; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path); + goto exit_download; + } + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path, (unsigned long)flp->f_dentry->d_inode->i_size, loc); + do_gettimeofday(&tv); + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "download start %lx", ((tv.tv_sec * 1000) + (tv.tv_usec / 1000))); + if (Adapter->bcm_file_download(Adapter->pvInterfaceAdapter, flp, loc)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to download the firmware with error %x!!!", -EIO); + errorno = -EIO; + goto exit_download; + } + oldfs = get_fs(); + set_fs(get_ds()); + vfs_llseek(flp, 0, 0); + set_fs(oldfs); + if (Adapter->bcm_file_readback_from_chip(Adapter->pvInterfaceAdapter, flp, loc)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to read back firmware!"); + errorno = -EIO; + goto exit_download; + } exit_download: - oldfs=get_fs();set_fs(get_ds()); - if(flp && !(IS_ERR(flp))) - filp_close(flp, current->files); - set_fs(oldfs); + oldfs = get_fs(); + set_fs(get_ds()); + if (flp && !(IS_ERR(flp))) + filp_close(flp, current->files); + set_fs(oldfs); - return errorno; + return errorno; } /** -@ingroup ctrl_pkt_functions -This function copies the contents of given buffer -to the control packet and queues it for transmission. -@note Do not acquire the spinock, as it it already acquired. -@return SUCCESS/FAILURE. -*/ -INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter,/**<Logical Adapter*/ - PVOID ioBuffer/**<Control Packet Buffer*/ - ) + * @ingroup ctrl_pkt_functions + * This function copies the contents of given buffer + * to the control packet and queues it for transmission. + * @note Do not acquire the spinock, as it it already acquired. + * @return SUCCESS/FAILURE. + * Arguments: + * Logical Adapter + * Control Packet Buffer + */ +INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter, PVOID ioBuffer) { - PLEADER pLeader=NULL; - INT Status=0; - unsigned char *ctrl_buff=NULL; - UINT pktlen=0; - PLINK_REQUEST pLinkReq = NULL; - PUCHAR pucAddIndication = NULL; - - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "======>"); - if(!ioBuffer) - { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Got Null Buffer\n"); + PLEADER pLeader = NULL; + INT Status = 0; + unsigned char *ctrl_buff = NULL; + UINT pktlen = 0; + PLINK_REQUEST pLinkReq = NULL; + PUCHAR pucAddIndication = NULL; + + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "======>"); + if (!ioBuffer) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Got Null Buffer\n"); return -EINVAL; } pLinkReq = (PLINK_REQUEST)ioBuffer; - pLeader=(PLEADER)ioBuffer; //ioBuffer Contains sw_Status and Payload + pLeader = (PLEADER)ioBuffer; /* ioBuffer Contains sw_Status and Payload */ - if(Adapter->bShutStatus == TRUE && + if (Adapter->bShutStatus == TRUE && pLinkReq->szData[0] == LINK_DOWN_REQ_PAYLOAD && - pLinkReq->szData[1] == LINK_SYNC_UP_SUBTYPE) - { - //Got sync down in SHUTDOWN..we could not process this. - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "SYNC DOWN Request in Shut Down Mode..\n"); + pLinkReq->szData[1] == LINK_SYNC_UP_SUBTYPE) { + + /* Got sync down in SHUTDOWN..we could not process this. */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "SYNC DOWN Request in Shut Down Mode..\n"); return STATUS_FAILURE; } - if((pLeader->Status == LINK_UP_CONTROL_REQ) && + if ((pLeader->Status == LINK_UP_CONTROL_REQ) && ((pLinkReq->szData[0] == LINK_UP_REQ_PAYLOAD && - (pLinkReq->szData[1] == LINK_SYNC_UP_SUBTYPE)) ||//Sync Up Command - pLinkReq->szData[0] == NETWORK_ENTRY_REQ_PAYLOAD)) //Net Entry Command - { - if(Adapter->LinkStatus > PHY_SYNC_ACHIVED) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL,"LinkStatus is Greater than PHY_SYN_ACHIEVED"); + (pLinkReq->szData[1] == LINK_SYNC_UP_SUBTYPE)) || /* Sync Up Command */ + pLinkReq->szData[0] == NETWORK_ENTRY_REQ_PAYLOAD)) /* Net Entry Command */ { + + if (Adapter->LinkStatus > PHY_SYNC_ACHIVED) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "LinkStatus is Greater than PHY_SYN_ACHIEVED"); return STATUS_FAILURE; } - if(TRUE == Adapter->bShutStatus) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "SYNC UP IN SHUTDOWN..Device WakeUp\n"); - if(Adapter->bTriedToWakeUpFromlowPowerMode == FALSE) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Waking up for the First Time..\n"); - Adapter->usIdleModePattern = ABORT_SHUTDOWN_MODE; // change it to 1 for current support. + + if (TRUE == Adapter->bShutStatus) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "SYNC UP IN SHUTDOWN..Device WakeUp\n"); + if (Adapter->bTriedToWakeUpFromlowPowerMode == FALSE) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Waking up for the First Time..\n"); + Adapter->usIdleModePattern = ABORT_SHUTDOWN_MODE; /* change it to 1 for current support. */ Adapter->bWakeUpDevice = TRUE; wake_up(&Adapter->process_rx_cntrlpkt); + Status = wait_event_interruptible_timeout(Adapter->lowpower_mode_wait_queue, !Adapter->bShutStatus, (5 * HZ)); - Status = wait_event_interruptible_timeout(Adapter->lowpower_mode_wait_queue, - !Adapter->bShutStatus, (5 * HZ)); - - if(Status == -ERESTARTSYS) + if (Status == -ERESTARTSYS) return Status; - if(Adapter->bShutStatus) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Shutdown Mode Wake up Failed - No Wake Up Received\n"); + if (Adapter->bShutStatus) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Shutdown Mode Wake up Failed - No Wake Up Received\n"); return STATUS_FAILURE; } - } - else - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Wakeup has been tried already...\n"); + } else { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Wakeup has been tried already...\n"); } } - } - if(TRUE == Adapter->IdleMode) - { - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Device is in Idle mode ... hence \n"); - if(pLeader->Status == LINK_UP_CONTROL_REQ || pLeader->Status == 0x80 || - pLeader->Status == CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ ) - { - if((pLeader->Status == LINK_UP_CONTROL_REQ) && (pLinkReq->szData[0]==LINK_DOWN_REQ_PAYLOAD)) - { - if((pLinkReq->szData[1] == LINK_SYNC_DOWN_SUBTYPE)) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Link Down Sent in Idle Mode\n"); - Adapter->usIdleModePattern = ABORT_IDLE_SYNCDOWN;//LINK DOWN sent in Idle Mode - } - else - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL,"ABORT_IDLE_MODE pattern is being written\n"); + if (TRUE == Adapter->IdleMode) { + /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Device is in Idle mode ... hence\n"); */ + if (pLeader->Status == LINK_UP_CONTROL_REQ || pLeader->Status == 0x80 || + pLeader->Status == CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ) { + + if ((pLeader->Status == LINK_UP_CONTROL_REQ) && (pLinkReq->szData[0] == LINK_DOWN_REQ_PAYLOAD)) { + if ((pLinkReq->szData[1] == LINK_SYNC_DOWN_SUBTYPE)) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Link Down Sent in Idle Mode\n"); + Adapter->usIdleModePattern = ABORT_IDLE_SYNCDOWN; /* LINK DOWN sent in Idle Mode */ + } else { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "ABORT_IDLE_MODE pattern is being written\n"); Adapter->usIdleModePattern = ABORT_IDLE_REG; } - } - else - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL,"ABORT_IDLE_MODE pattern is being written\n"); - Adapter->usIdleModePattern = ABORT_IDLE_MODE; + } else { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "ABORT_IDLE_MODE pattern is being written\n"); + Adapter->usIdleModePattern = ABORT_IDLE_MODE; } /*Setting bIdleMode_tx_from_host to TRUE to indicate LED control thread to represent - the wake up from idlemode is from host*/ - //Adapter->LEDInfo.bIdleMode_tx_from_host = TRUE; + * the wake up from idlemode is from host + */ + /* Adapter->LEDInfo.bIdleMode_tx_from_host = TRUE; */ Adapter->bWakeUpDevice = TRUE; wake_up(&Adapter->process_rx_cntrlpkt); - - - if(LINK_DOWN_REQ_PAYLOAD == pLinkReq->szData[0]) - { - // We should not send DREG message down while in idlemode. + /* We should not send DREG message down while in idlemode. */ + if (LINK_DOWN_REQ_PAYLOAD == pLinkReq->szData[0]) return STATUS_SUCCESS; - } - Status = wait_event_interruptible_timeout(Adapter->lowpower_mode_wait_queue, - !Adapter->IdleMode, (5 * HZ)); + Status = wait_event_interruptible_timeout(Adapter->lowpower_mode_wait_queue, !Adapter->IdleMode, (5 * HZ)); - if(Status == -ERESTARTSYS) + if (Status == -ERESTARTSYS) return Status; - if(Adapter->IdleMode) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Idle Mode Wake up Failed - No Wake Up Received\n"); + if (Adapter->IdleMode) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Idle Mode Wake up Failed - No Wake Up Received\n"); return STATUS_FAILURE; } - } - else + } else { return STATUS_SUCCESS; + } } - //The Driver has to send control messages with a particular VCID - pLeader->Vcid = VCID_CONTROL_PACKET;//VCID for control packet. + + /* The Driver has to send control messages with a particular VCID */ + pLeader->Vcid = VCID_CONTROL_PACKET; /* VCID for control packet. */ /* Allocate skb for Control Packet */ pktlen = pLeader->PLength; ctrl_buff = (char *)Adapter->txctlpacket[atomic_read(&Adapter->index_wr_txcntrlpkt)%MAX_CNTRL_PKTS]; - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Control packet to be taken =%d and address is =%pincoming address is =%p and packet len=%x", - atomic_read(&Adapter->index_wr_txcntrlpkt), ctrl_buff, ioBuffer, pktlen); - if(ctrl_buff) - { - if(pLeader) - { - if((pLeader->Status == 0x80) || - (pLeader->Status == CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ)) - { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Control packet to be taken =%d and address is =%pincoming address is =%p and packet len=%x", + atomic_read(&Adapter->index_wr_txcntrlpkt), ctrl_buff, ioBuffer, pktlen); + if (ctrl_buff) { + if (pLeader) { + if ((pLeader->Status == 0x80) || + (pLeader->Status == CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ)) { /* - //Restructure the DSX message to handle Multiple classifier Support - // Write the Service Flow param Structures directly to the target - //and embed the pointers in the DSX messages sent to target. - */ - //Lets store the current length of the control packet we are transmitting + * Restructure the DSX message to handle Multiple classifier Support + * Write the Service Flow param Structures directly to the target + * and embed the pointers in the DSX messages sent to target. + */ + /* Lets store the current length of the control packet we are transmitting */ pucAddIndication = (PUCHAR)ioBuffer + LEADER_SIZE; pktlen = pLeader->PLength; - Status = StoreCmControlResponseMessage(Adapter,pucAddIndication, &pktlen); - if(Status != 1) - { - ClearTargetDSXBuffer(Adapter,((stLocalSFAddIndicationAlt *)pucAddIndication)->u16TID, FALSE); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, " Error Restoring The DSX Control Packet. Dsx Buffers on Target may not be Setup Properly "); + Status = StoreCmControlResponseMessage(Adapter, pucAddIndication, &pktlen); + if (Status != 1) { + ClearTargetDSXBuffer(Adapter, ((stLocalSFAddIndicationAlt *)pucAddIndication)->u16TID, FALSE); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, " Error Restoring The DSX Control Packet. Dsx Buffers on Target may not be Setup Properly "); return STATUS_FAILURE; } /* - //update the leader to use the new length - //The length of the control packet is length of message being sent + Leader length - */ + * update the leader to use the new length + * The length of the control packet is length of message being sent + Leader length + */ pLeader->PLength = pktlen; } } + + if (pktlen + LEADER_SIZE > MAX_CNTL_PKT_SIZE) + return -EINVAL; + memset(ctrl_buff, 0, pktlen+LEADER_SIZE); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Copying the Control Packet Buffer with length=%d\n", pLeader->PLength); - *(PLEADER)ctrl_buff=*pLeader; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Copying the Control Packet Buffer with length=%d\n", pLeader->PLength); + *(PLEADER)ctrl_buff = *pLeader; memcpy(ctrl_buff + LEADER_SIZE, ((PUCHAR)ioBuffer + LEADER_SIZE), pLeader->PLength); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Enqueuing the Control Packet"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Enqueuing the Control Packet"); - /*Update the statistics counters */ + /* Update the statistics counters */ spin_lock_bh(&Adapter->PackInfo[HiPriority].SFQueueLock); - Adapter->PackInfo[HiPriority].uiCurrentBytesOnHost+=pLeader->PLength; + Adapter->PackInfo[HiPriority].uiCurrentBytesOnHost += pLeader->PLength; Adapter->PackInfo[HiPriority].uiCurrentPacketsOnHost++; atomic_inc(&Adapter->TotalPacketCount); spin_unlock_bh(&Adapter->PackInfo[HiPriority].SFQueueLock); - Adapter->PackInfo[HiPriority].bValid = TRUE; - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "CurrBytesOnHost: %x bValid: %x", - Adapter->PackInfo[HiPriority].uiCurrentBytesOnHost, - Adapter->PackInfo[HiPriority].bValid); - Status=STATUS_SUCCESS; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "CurrBytesOnHost: %x bValid: %x", + Adapter->PackInfo[HiPriority].uiCurrentBytesOnHost, + Adapter->PackInfo[HiPriority].bValid); + Status = STATUS_SUCCESS; /*Queue the packet for transmission */ atomic_inc(&Adapter->index_wr_txcntrlpkt); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL,DBG_LVL_ALL, "Calling transmit_packets"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Calling transmit_packets"); atomic_set(&Adapter->TxPktAvail, 1); wake_up(&Adapter->tx_packet_wait_queue); + } else { + Status = -ENOMEM; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "mem allocation Failed"); } - else - { - Status=-ENOMEM; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "mem allocation Failed"); - } - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "<===="); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "<===="); return Status; } @@ -460,33 +407,30 @@ INT CopyBufferToControlPacket(PMINI_ADAPTER Adapter,/**<Logical Adapter*/ * Function - SendStatisticsPointerRequest() * * Description - This function builds and forwards the Statistics -* Pointer Request control Packet. +* Pointer Request control Packet. * * Parameters - Adapter : Pointer to Adapter structure. -* - pstStatisticsPtrRequest : Pointer to link request. +* - pstStatisticsPtrRequest : Pointer to link request. * * Returns - None. *****************************************************************/ -static VOID SendStatisticsPointerRequest(PMINI_ADAPTER Adapter, - PLINK_REQUEST pstStatisticsPtrRequest) +static VOID SendStatisticsPointerRequest(PMINI_ADAPTER Adapter, PLINK_REQUEST pstStatisticsPtrRequest) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "======>"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "======>"); pstStatisticsPtrRequest->Leader.Status = STATS_POINTER_REQ_STATUS; - pstStatisticsPtrRequest->Leader.PLength = sizeof(ULONG);//minimum 4 bytes + pstStatisticsPtrRequest->Leader.PLength = sizeof(ULONG); /* minimum 4 bytes */ pstStatisticsPtrRequest->szData[0] = STATISTICS_POINTER_REQ; - - CopyBufferToControlPacket(Adapter,pstStatisticsPtrRequest); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "<====="); + CopyBufferToControlPacket(Adapter, pstStatisticsPtrRequest); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "<====="); return; } #endif - /****************************************************************** * Function - LinkMessage() * * Description - This function builds the Sync-up and Link-up request -* packet messages depending on the device Link status. +* packet messages depending on the device Link status. * * Parameters - Adapter: Pointer to the Adapter structure. * @@ -494,102 +438,90 @@ static VOID SendStatisticsPointerRequest(PMINI_ADAPTER Adapter, *******************************************************************/ VOID LinkMessage(PMINI_ADAPTER Adapter) { - PLINK_REQUEST pstLinkRequest=NULL; - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "=====>"); - if(Adapter->LinkStatus == SYNC_UP_REQUEST && Adapter->AutoSyncup) - { + PLINK_REQUEST pstLinkRequest = NULL; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "=====>"); + if (Adapter->LinkStatus == SYNC_UP_REQUEST && Adapter->AutoSyncup) { pstLinkRequest = kzalloc(sizeof(LINK_REQUEST), GFP_ATOMIC); - if(!pstLinkRequest) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!"); + if (!pstLinkRequest) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!"); return; } - //sync up request... - Adapter->LinkStatus = WAIT_FOR_SYNC;// current link status - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For SyncUp..."); - pstLinkRequest->szData[0]=LINK_UP_REQ_PAYLOAD; - pstLinkRequest->szData[1]=LINK_SYNC_UP_SUBTYPE; - pstLinkRequest->Leader.Status=LINK_UP_CONTROL_REQ; - pstLinkRequest->Leader.PLength=sizeof(ULONG); + /* sync up request... */ + Adapter->LinkStatus = WAIT_FOR_SYNC; /* current link status */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For SyncUp..."); + pstLinkRequest->szData[0] = LINK_UP_REQ_PAYLOAD; + pstLinkRequest->szData[1] = LINK_SYNC_UP_SUBTYPE; + pstLinkRequest->Leader.Status = LINK_UP_CONTROL_REQ; + pstLinkRequest->Leader.PLength = sizeof(ULONG); Adapter->bSyncUpRequestSent = TRUE; - } - else if(Adapter->LinkStatus == PHY_SYNC_ACHIVED && Adapter->AutoLinkUp) - { + + } else if (Adapter->LinkStatus == PHY_SYNC_ACHIVED && Adapter->AutoLinkUp) { pstLinkRequest = kzalloc(sizeof(LINK_REQUEST), GFP_ATOMIC); - if(!pstLinkRequest) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!"); + if (!pstLinkRequest) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Can not allocate memory for Link request!"); return; } - //LINK_UP_REQUEST - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For LinkUp..."); - pstLinkRequest->szData[0]=LINK_UP_REQ_PAYLOAD; - pstLinkRequest->szData[1]=LINK_NET_ENTRY; - pstLinkRequest->Leader.Status=LINK_UP_CONTROL_REQ; - pstLinkRequest->Leader.PLength=sizeof(ULONG); - } - if(pstLinkRequest) - { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Calling CopyBufferToControlPacket"); + /* LINK_UP_REQUEST */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Requesting For LinkUp..."); + pstLinkRequest->szData[0] = LINK_UP_REQ_PAYLOAD; + pstLinkRequest->szData[1] = LINK_NET_ENTRY; + pstLinkRequest->Leader.Status = LINK_UP_CONTROL_REQ; + pstLinkRequest->Leader.PLength = sizeof(ULONG); + } + if (pstLinkRequest) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "Calling CopyBufferToControlPacket"); CopyBufferToControlPacket(Adapter, pstLinkRequest); kfree(pstLinkRequest); } - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "LinkMessage <====="); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, LINK_UP_MSG, DBG_LVL_ALL, "LinkMessage <====="); return; } - /********************************************************************** * Function - StatisticsResponse() * * Description - This function handles the Statistics response packet. * * Parameters - Adapter : Pointer to the Adapter structure. -* - pvBuffer: Starting address of Statistic response data. +* - pvBuffer: Starting address of Statistic response data. * * Returns - None. ************************************************************************/ -VOID StatisticsResponse(PMINI_ADAPTER Adapter,PVOID pvBuffer) +VOID StatisticsResponse(PMINI_ADAPTER Adapter, PVOID pvBuffer) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "%s====>",__FUNCTION__); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "%s====>", __func__); Adapter->StatisticsPointer = ntohl(*(__be32 *)pvBuffer); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Stats at %x", (UINT)Adapter->StatisticsPointer); - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "%s <====",__FUNCTION__); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Stats at %x", (UINT)Adapter->StatisticsPointer); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "%s <====", __func__); return; } - /********************************************************************** * Function - LinkControlResponseMessage() * * Description - This function handles the Link response packets. * * Parameters - Adapter : Pointer to the Adapter structure. -* - pucBuffer: Starting address of Link response data. +* - pucBuffer: Starting address of Link response data. * * Returns - None. ***********************************************************************/ -VOID LinkControlResponseMessage(PMINI_ADAPTER Adapter,PUCHAR pucBuffer) +VOID LinkControlResponseMessage(PMINI_ADAPTER Adapter, PUCHAR pucBuffer) { - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "=====>"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "=====>"); - if(*pucBuffer==LINK_UP_ACK) - { - switch(*(pucBuffer+1)) - { - case PHY_SYNC_ACHIVED: //SYNCed UP - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "PHY_SYNC_ACHIVED"); + if (*pucBuffer == LINK_UP_ACK) { + switch (*(pucBuffer+1)) { + case PHY_SYNC_ACHIVED: /* SYNCed UP */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "PHY_SYNC_ACHIVED"); - if(Adapter->LinkStatus == LINKUP_DONE) - { + if (Adapter->LinkStatus == LINKUP_DONE) beceem_protocol_reset(Adapter); - } - Adapter->usBestEffortQueueIndex=INVALID_QUEUE_INDEX ; - Adapter->LinkStatus=PHY_SYNC_ACHIVED; + Adapter->usBestEffortQueueIndex = INVALID_QUEUE_INDEX; + Adapter->LinkStatus = PHY_SYNC_ACHIVED; - if(Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) - { + if (Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) { Adapter->DriverState = NO_NETWORK_ENTRY; wake_up(&Adapter->LEDInfo.notify_led_event); } @@ -597,161 +529,145 @@ VOID LinkControlResponseMessage(PMINI_ADAPTER Adapter,PUCHAR pucBuffer) LinkMessage(Adapter); break; - case LINKUP_DONE: - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "LINKUP_DONE"); - Adapter->LinkStatus=LINKUP_DONE; - Adapter->bPHSEnabled = *(pucBuffer+3); - Adapter->bETHCSEnabled = *(pucBuffer+4) & ETH_CS_MASK; - BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "PHS Support Status Received In LinkUp Ack : %x \n",Adapter->bPHSEnabled); - if((FALSE == Adapter->bShutStatus)&& - (FALSE == Adapter->IdleMode)) - { - if(Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) - { - Adapter->DriverState = NORMAL_OPERATION; - wake_up(&Adapter->LEDInfo.notify_led_event); - } + case LINKUP_DONE: + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "LINKUP_DONE"); + Adapter->LinkStatus = LINKUP_DONE; + Adapter->bPHSEnabled = *(pucBuffer+3); + Adapter->bETHCSEnabled = *(pucBuffer+4) & ETH_CS_MASK; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "PHS Support Status Received In LinkUp Ack : %x\n", Adapter->bPHSEnabled); + + if ((FALSE == Adapter->bShutStatus) && (FALSE == Adapter->IdleMode)) { + if (Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) { + Adapter->DriverState = NORMAL_OPERATION; + wake_up(&Adapter->LEDInfo.notify_led_event); } - LinkMessage(Adapter); - break; - case WAIT_FOR_SYNC: + } + LinkMessage(Adapter); + break; - /* - * Driver to ignore the DREG_RECEIVED - * WiMAX Application should handle this Message - */ - //Adapter->liTimeSinceLastNetEntry = 0; - Adapter->LinkUpStatus = 0; - Adapter->LinkStatus = 0; - Adapter->usBestEffortQueueIndex=INVALID_QUEUE_INDEX ; - Adapter->bTriedToWakeUpFromlowPowerMode = FALSE; - Adapter->IdleMode = FALSE; - beceem_protocol_reset(Adapter); + case WAIT_FOR_SYNC: + /* + * Driver to ignore the DREG_RECEIVED + * WiMAX Application should handle this Message + */ + /* Adapter->liTimeSinceLastNetEntry = 0; */ + Adapter->LinkUpStatus = 0; + Adapter->LinkStatus = 0; + Adapter->usBestEffortQueueIndex = INVALID_QUEUE_INDEX; + Adapter->bTriedToWakeUpFromlowPowerMode = FALSE; + Adapter->IdleMode = FA |