diff options
Diffstat (limited to 'drivers/staging/bcm/Misc.c')
-rw-r--r-- | drivers/staging/bcm/Misc.c | 1587 |
1 files changed, 0 insertions, 1587 deletions
diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c deleted file mode 100644 index 883f7394dee6..000000000000 --- a/drivers/staging/bcm/Misc.c +++ /dev/null @@ -1,1587 +0,0 @@ -#include "headers.h" - -static int BcmFileDownload(struct bcm_mini_adapter *Adapter, const char *path, unsigned int loc); -static void doPowerAutoCorrection(struct bcm_mini_adapter *psAdapter); -static void HandleShutDownModeRequest(struct bcm_mini_adapter *Adapter, PUCHAR pucBuffer); -static int bcm_parse_target_params(struct bcm_mini_adapter *Adapter); -static void beceem_protocol_reset(struct bcm_mini_adapter *Adapter); - -static void default_wimax_protocol_initialize(struct bcm_mini_adapter *Adapter) -{ - unsigned int 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; -} - -int InitAdapter(struct bcm_mini_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); - - 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); - 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->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; - psAdapter->fw_download_done = false; - - default_wimax_protocol_initialize(psAdapter); - 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); - return -ENOMEM; - } - } - - 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__, __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; - } - - Status = vendorextnInit(psAdapter); - - 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"); - - return STATUS_SUCCESS; -} - -void AdapterFree(struct bcm_mini_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->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); - - 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)); - msleep(100); - } - unregister_control_device_interface(Adapter); - kfree(Adapter->pstargetparams); - - for (count = 0; count < MAX_CNTRL_PKTS; count++) - kfree(Adapter->txctlpacket[count]); - - FreeAdapterDsxBuffer(Adapter); - kfree(Adapter->pvInterfaceAdapter); - - /* Free the PHS Interface */ - PhsCleanup(&Adapter->stBCMPhsContext); - - BcmDeAllocFlashCSStructure(Adapter); - - free_netdev(Adapter->dev); -} - -static int create_worker_threads(struct bcm_mini_adapter *psAdapter) -{ - /* 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)) { - pr_notice(DRV_NAME ": could not create control thread\n"); - return PTR_ERR(psAdapter->control_packet_handler); - } - - /* 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)) { - pr_notice(DRV_NAME ": could not creat transmit thread\n"); - kthread_stop(psAdapter->control_packet_handler); - return PTR_ERR(psAdapter->transmit_packet_thread); - } - return 0; -} - -static struct file *open_firmware_file(struct bcm_mini_adapter *Adapter, const char *path) -{ - struct file *flp = filp_open(path, O_RDONLY, S_IRWXU); - - 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; -} - -/* Arguments: - * Logical Adapter - * Path to image file - * Download Address on the chip - */ -static int BcmFileDownload(struct bcm_mini_adapter *Adapter, const char *path, unsigned int loc) -{ - int errorno = 0; - struct file *flp = NULL; - struct timeval tv = {0}; - - flp = open_firmware_file(Adapter, path); - if (!flp) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path); - return -ENOENT; - } - 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)file_inode(flp)->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; - } - vfs_llseek(flp, 0, 0); - 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: - filp_close(flp, NULL); - 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 spinlock, as it it already acquired. - * @return SUCCESS/FAILURE. - * Arguments: - * Logical Adapter - * Control Packet Buffer - */ -int CopyBufferToControlPacket(struct bcm_mini_adapter *Adapter, void *ioBuffer) -{ - struct bcm_leader *pLeader = NULL; - int Status = 0; - unsigned char *ctrl_buff; - unsigned int pktlen = 0; - struct bcm_link_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 = (struct bcm_link_request *)ioBuffer; - pLeader = (struct bcm_leader *)ioBuffer; /* ioBuffer Contains sw_Status and Payload */ - - 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"); - return STATUS_FAILURE; - } - - 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"); - return STATUS_FAILURE; - } - - if (Adapter->bShutStatus == TRUE) { - 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)); - - 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"); - return STATUS_FAILURE; - } - } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "Wakeup has been tried already...\n"); - } - } - } - - if (Adapter->IdleMode == TRUE) { - /* 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; - } - - /*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; */ - Adapter->bWakeUpDevice = TRUE; - wake_up(&Adapter->process_rx_cntrlpkt); - - /* 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)); - - 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"); - return STATUS_FAILURE; - } - } else { - return STATUS_SUCCESS; - } - } - - /* 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]; - - if (!ctrl_buff) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "mem allocation Failed"); - return -ENOMEM; - } - - 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 (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 */ - pucAddIndication = (PUCHAR)ioBuffer + LEADER_SIZE; - pktlen = pLeader->PLength; - Status = StoreCmControlResponseMessage(Adapter, pucAddIndication, &pktlen); - if (Status != 1) { - ClearTargetDSXBuffer(Adapter, ((struct bcm_add_indication_alt *)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 - */ - 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); - *(struct bcm_leader *)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"); - - /* Update the statistics counters */ - spin_lock_bh(&Adapter->PackInfo[HiPriority].SFQueueLock); - 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; - /*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"); - atomic_set(&Adapter->TxPktAvail, 1); - wake_up(&Adapter->tx_packet_wait_queue); - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_CONTROL, DBG_LVL_ALL, "<===="); - return Status; -} - -/****************************************************************** -* Function - LinkMessage() -* -* Description - This function builds the Sync-up and Link-up request -* packet messages depending on the device Link status. -* -* Parameters - Adapter: Pointer to the Adapter structure. -* -* Returns - None. -*******************************************************************/ -void LinkMessage(struct bcm_mini_adapter *Adapter) -{ - struct bcm_link_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(struct bcm_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!"); - 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); - Adapter->bSyncUpRequestSent = TRUE; - - } else if (Adapter->LinkStatus == PHY_SYNC_ACHIVED && Adapter->AutoLinkUp) { - pstLinkRequest = kzalloc(sizeof(struct bcm_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!"); - 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"); - CopyBufferToControlPacket(Adapter, pstLinkRequest); - kfree(pstLinkRequest); - } - 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. -* -* Returns - None. -************************************************************************/ -void StatisticsResponse(struct bcm_mini_adapter *Adapter, void *pvBuffer) -{ - 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", (unsigned int)Adapter->StatisticsPointer); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "%s <====", __func__); -} - -/********************************************************************** -* Function - LinkControlResponseMessage() -* -* Description - This function handles the Link response packets. -* -* Parameters - Adapter : Pointer to the Adapter structure. -* - pucBuffer: Starting address of Link response data. -* -* Returns - None. -***********************************************************************/ -void LinkControlResponseMessage(struct bcm_mini_adapter *Adapter, PUCHAR pucBuffer) -{ - 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 (Adapter->LinkStatus == LINKUP_DONE) - beceem_protocol_reset(Adapter); - - Adapter->usBestEffortQueueIndex = INVALID_QUEUE_INDEX; - Adapter->LinkStatus = PHY_SYNC_ACHIVED; - - if (Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) { - Adapter->DriverState = NO_NETWORK_ENTRY; - wake_up(&Adapter->LEDInfo.notify_led_event); - } - - 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); - } - } - LinkMessage(Adapter); - break; - - 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 = false; - beceem_protocol_reset(Adapter); - - break; - case LINK_SHUTDOWN_REQ_FROM_FIRMWARE: - case COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW: - { - HandleShutDownModeRequest(Adapter, pucBuffer); - } - break; - default: - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "default case:LinkResponse %x", *(pucBuffer + 1)); - break; - } - } else if (SET_MAC_ADDRESS_RESPONSE == *pucBuffer) { - PUCHAR puMacAddr = (pucBuffer + 1); - - Adapter->LinkStatus = SYNC_UP_REQUEST; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "MAC address response, sending SYNC_UP"); - LinkMessage(Adapter); - memcpy(Adapter->dev->dev_addr, puMacAddr, MAC_ADDRESS_SIZE); - } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "%s <=====", __func__); -} - -void SendIdleModeResponse(struct bcm_mini_adapter *Adapter) -{ - int status = 0, NVMAccess = 0, lowPwrAbortMsg = 0; - struct timeval tv; - struct bcm_link_request stIdleResponse = {{0} }; - - memset(&tv, 0, sizeof(tv)); - stIdleResponse.Leader.Status = IDLE_MESSAGE; - stIdleResponse.Leader.PLength = IDLE_MODE_PAYLOAD_LENGTH; - stIdleResponse.szData[0] = GO_TO_IDLE_MODE_PAYLOAD; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, " ============>"); - - /********************************* - *down_trylock - - * if [ semaphore is available ] - * acquire semaphone and return value 0 ; - * else - * return non-zero value ; - * - ***********************************/ - - NVMAccess = down_trylock(&Adapter->NVMRdmWrmLock); - lowPwrAbortMsg = down_trylock(&Adapter->LowPowerModeSync); - - - if ((NVMAccess || lowPwrAbortMsg || atomic_read(&Adapter->TotalPacketCount)) && - (Adapter->ulPowerSaveMode != DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE)) { - - if (!NVMAccess) - up(&Adapter->NVMRdmWrmLock); - - if (!lowPwrAbortMsg) - up(&Adapter->LowPowerModeSync); - - stIdleResponse.szData[1] = TARGET_CAN_NOT_GO_TO_IDLE_MODE; /* NACK- device access is going on. */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "HOST IS NACKING Idle mode To F/W!!!!!!!!"); - Adapter->bPreparingForLowPowerMode = false; - } else { - stIdleResponse.szData[1] = TARGET_CAN_GO_TO_IDLE_MODE; /* 2; Idle ACK */ - Adapter->StatisticsPointer = 0; - - /* Wait for the LED to TURN OFF before sending ACK response */ - if (Adapter->LEDInfo.led_thread_running & BCM_LED_THREAD_RUNNING_ACTIVELY) { - int iRetVal = 0; - - /* Wake the LED Thread with IDLEMODE_ENTER State */ - Adapter->DriverState = LOWPOWER_MODE_ENTER; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "LED Thread is Running..Hence Setting LED Event as IDLEMODE_ENTER jiffies:%ld", jiffies); - wake_up(&Adapter->LEDInfo.notify_led_event); - - /* Wait for 1 SEC for LED to OFF */ - iRetVal = wait_event_timeout(Adapter->LEDInfo.idleModeSyncEvent, Adapter->LEDInfo.bIdle_led_off, msecs_to_jiffies(1000)); - - /* If Timed Out to Sync IDLE MODE Enter, do IDLE mode Exit and Send NACK to device */ - if (iRetVal <= 0) { - stIdleResponse.szData[1] = TARGET_CAN_NOT_GO_TO_IDLE_MODE; /* NACK- device access is going on. */ - Adapter->DriverState = NORMAL_OPERATION; - wake_up(&Adapter->LEDInfo.notify_led_event); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "NACKING Idle mode as time out happen from LED side!!!!!!!!"); - } - } - - if (stIdleResponse.szData[1] == TARGET_CAN_GO_TO_IDLE_MODE) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "ACKING IDLE MODE !!!!!!!!!"); - down(&Adapter->rdmwrmsync); - Adapter->bPreparingForLowPowerMode = TRUE; - up(&Adapter->rdmwrmsync); - /* Killing all URBS. */ - if (Adapter->bDoSuspend == TRUE) - Bcm_kill_all_URBs((struct bcm_interface_adapter *)(Adapter->pvInterfaceAdapter)); - } else { - Adapter->bPreparingForLowPowerMode = false; - } - - if (!NVMAccess) - up(&Adapter->NVMRdmWrmLock); - - if (!lowPwrAbortMsg) - up(&Adapter->LowPowerModeSync); - } - - status = CopyBufferToControlPacket(Adapter, &stIdleResponse); - if (status != STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "fail to send the Idle mode Request\n"); - Adapter->bPreparingForLowPowerMode = false; - StartInterruptUrb((struct bcm_interface_adapter *)(Adapter->pvInterfaceAdapter)); - } - do_gettimeofday(&tv); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, "IdleMode Msg submitter to Q :%ld ms", tv.tv_sec * 1000 + tv.tv_usec / 1000); -} - -/****************************************************************** -* Function - DumpPackInfo() -* -* Description - This function dumps the all Queue(PackInfo[]) details. -* -* Parameters - Adapter: Pointer to the Adapter structure. -* -* Returns - None. -*******************************************************************/ -void DumpPackInfo(struct bcm_mini_adapter *Adapter) -{ - unsigned int uiLoopIndex = 0; - unsigned int uiIndex = 0; - unsigned int uiClsfrIndex = 0; - struct bcm_classifier_rule *pstClassifierEntry = NULL; - - for (uiLoopIndex = 0; uiLoopIndex < NO_OF_QUEUES; uiLoopIndex++) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "*********** Showing Details Of Queue %d***** ******", uiLoopIndex); - if (false == Adapter->PackInfo[uiLoopIndex].bValid) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "bValid is false for %X index\n", uiLoopIndex); - continue; - } - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, " Dumping SF Rule Entry For SFID %lX\n", Adapter->PackInfo[uiLoopIndex].ulSFID); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, " ucDirection %X\n", Adapter->PackInfo[uiLoopIndex].ucDirection); - - if (Adapter->PackInfo[uiLoopIndex].ucIpVersion == IPV6) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Ipv6 Service Flow\n"); - else - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Ipv4 Service Flow\n"); - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "SF Traffic Priority %X\n", Adapter->PackInfo[uiLoopIndex].u8TrafficPriority); - - for (uiClsfrIndex = 0; uiClsfrIndex < MAX_CLASSIFIERS; uiClsfrIndex++) { - pstClassifierEntry = &Adapter->astClassifierTable[uiClsfrIndex]; - if (!pstClassifierEntry->bUsed) - continue; - - if (pstClassifierEntry->ulSFID != Adapter->PackInfo[uiLoopIndex].ulSFID) - continue; - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tDumping Classifier Rule Entry For Index: %X Classifier Rule ID : %X\n", uiClsfrIndex, pstClassifierEntry->uiClassifierRuleIndex); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tDumping Classifier Rule Entry For Index: %X usVCID_Value : %X\n", uiClsfrIndex, pstClassifierEntry->usVCID_Value); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tDumping Classifier Rule Entry For Index: %X bProtocolValid : %X\n", uiClsfrIndex, pstClassifierEntry->bProtocolValid); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tDumping Classifier Rule Entry For Index: %X bTOSValid : %X\n", uiClsfrIndex, pstClassifierEntry->bTOSValid); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tDumping Classifier Rule Entry For Index: %X bDestIpValid : %X\n", uiClsfrIndex, pstClassifierEntry->bDestIpValid); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tDumping Classifier Rule Entry For Index: %X bSrcIpValid : %X\n", uiClsfrIndex, pstClassifierEntry->bSrcIpValid); - - for (uiIndex = 0; uiIndex < MAX_PORT_RANGE; uiIndex++) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tusSrcPortRangeLo:%X\n", pstClassifierEntry->usSrcPortRangeLo[uiIndex]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tusSrcPortRangeHi:%X\n", pstClassifierEntry->usSrcPortRangeHi[uiIndex]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tusDestPortRangeLo:%X\n", pstClassifierEntry->usDestPortRangeLo[uiIndex]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tusDestPortRangeHi:%X\n", pstClassifierEntry->usDestPortRangeHi[uiIndex]); - } - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tucIPSourceAddressLength : 0x%x\n", pstClassifierEntry->ucIPSourceAddressLength); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tucIPDestinationAddressLength : 0x%x\n", pstClassifierEntry->ucIPDestinationAddressLength); - for (uiIndex = 0; uiIndex < pstClassifierEntry->ucIPSourceAddressLength; uiIndex++) { - if (Adapter->PackInfo[uiLoopIndex].ucIpVersion == IPV6) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tIpv6 ulSrcIpAddr :\n"); - DumpIpv6Address(pstClassifierEntry->stSrcIpAddress.ulIpv6Addr); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tIpv6 ulSrcIpMask :\n"); - DumpIpv6Address(pstClassifierEntry->stSrcIpAddress.ulIpv6Mask); - } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tulSrcIpAddr:%lX\n", pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[uiIndex]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tulSrcIpMask:%lX\n", pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[uiIndex]); - } - } - - for (uiIndex = 0; uiIndex < pstClassifierEntry->ucIPDestinationAddressLength; uiIndex++) { - if (Adapter->PackInfo[uiLoopIndex].ucIpVersion == IPV6) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tIpv6 ulDestIpAddr :\n"); - DumpIpv6Address(pstClassifierEntry->stDestIpAddress.ulIpv6Addr); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tIpv6 ulDestIpMask :\n"); - DumpIpv6Address(pstClassifierEntry->stDestIpAddress.ulIpv6Mask); - } else { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tulDestIpAddr:%lX\n", pstClassifierEntry->stDestIpAddress.ulIpv4Addr[uiIndex]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tulDestIpMask:%lX\n", pstClassifierEntry->stDestIpAddress.ulIpv4Mask[uiIndex]); - } - } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tucProtocol:0x%X\n", pstClassifierEntry->ucProtocol[0]); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "\tu8ClassifierRulePriority:%X\n", pstClassifierEntry->u8ClassifierRulePriority); - } - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "ulSFID:%lX\n", Adapter->PackInfo[uiLoopIndex].ulSFID); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "usVCID_Value:%X\n", Adapter->PackInfo[uiLoopIndex].usVCID_Value); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "PhsEnabled: 0x%X\n", Adapter->PackInfo[uiLoopIndex].bHeaderSuppressionEnabled); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiThreshold:%X\n", Adapter->PackInfo[uiLoopIndex].uiThreshold); - - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "bValid:%X\n", Adapter->PackInfo[uiLoopIndex].bValid); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "bActive:%X\n", Adapter->PackInfo[uiLoopIndex].bActive); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "ActivateReqSent: %x", Adapter->PackInfo[uiLoopIndex].bActivateRequestSent); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "u8QueueType:%X\n", Adapter->PackInfo[uiLoopIndex].u8QueueType); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiMaxBucketSize:%X\n", Adapter->PackInfo[uiLoopIndex].uiMaxBucketSize); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiPerSFTxResourceCount:%X\n", atomic_read(&Adapter->PackInfo[uiLoopIndex].uiPerSFTxResourceCount)); - /* DumpDebug(DUMP_INFO,("bCSSupport:%X\n",Adapter->PackInfo[uiLoopIndex].bCSSupport)); */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "CurrQueueDepthOnTarget: %x\n", Adapter->PackInfo[uiLoopIndex].uiCurrentQueueDepthOnTarget); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiCurrentBytesOnHost:%X\n", Adapter->PackInfo[uiLoopIndex].uiCurrentBytesOnHost); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiCurrentPacketsOnHost:%X\n", Adapter->PackInfo[uiLoopIndex].uiCurrentPacketsOnHost); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiDroppedCountBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiDroppedCountBytes); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiDroppedCountPackets:%X\n", Adapter->PackInfo[uiLoopIndex].uiDroppedCountPackets); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiSentBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiSentBytes); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiSentPackets:%X\n", Adapter->PackInfo[uiLoopIndex].uiSentPackets); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiCurrentDrainRate:%X\n", Adapter->PackInfo[uiLoopIndex].uiCurrentDrainRate); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiThisPeriodSentBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiThisPeriodSentBytes); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "liDrainCalculated:%llX\n", Adapter->PackInfo[uiLoopIndex].liDrainCalculated); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiCurrentTokenCount:%X\n", Adapter->PackInfo[uiLoopIndex].uiCurrentTokenCount); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "liLastUpdateTokenAt:%llX\n", Adapter->PackInfo[uiLoopIndex].liLastUpdateTokenAt); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiMaxAllowedRate:%X\n", Adapter->PackInfo[uiLoopIndex].uiMaxAllowedRate); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiPendedLast:%X\n", Adapter->PackInfo[uiLoopIndex].uiPendedLast); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "NumOfPacketsSent:%X\n", Adapter->PackInfo[uiLoopIndex].NumOfPacketsSent); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Direction: %x\n", Adapter->PackInfo[uiLoopIndex].ucDirection); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "CID: %x\n", Adapter->PackInfo[uiLoopIndex].usCID); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "ProtocolValid: %x\n", Adapter->PackInfo[uiLoopIndex].bProtocolValid); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "TOSValid: %x\n", Adapter->PackInfo[uiLoopIndex].bTOSValid); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "DestIpValid: %x\n", Adapter->PackInfo[uiLoopIndex].bDestIpValid); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "SrcIpValid: %x\n", Adapter->PackInfo[uiLoopIndex].bSrcIpValid); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "ActiveSet: %x\n", Adapter->PackInfo[uiLoopIndex].bActiveSet); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "AdmittedSet: %x\n", Adapter->PackInfo[uiLoopIndex].bAdmittedSet); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "AuthzSet: %x\n", Adapter->PackInfo[uiLoopIndex].bAuthorizedSet); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "ClassifyPrority: %x\n", Adapter->PackInfo[uiLoopIndex].bClassifierPriority); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiMaxLatency: %x\n", Adapter->PackInfo[uiLoopIndex].uiMaxLatency); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, - DBG_LVL_ALL, "ServiceClassName: %*ph\n", - 4, Adapter->PackInfo[uiLoopIndex]. - ucServiceClassName); -/* BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "bHeaderSuppressionEnabled :%X\n", Adapter->PackInfo[uiLoopIndex].bHeaderSuppressionEnabled); - * BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiTotalTxBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiTotalTxBytes); - * BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiTotalRxBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiTotalRxBytes); - * DumpDebug(DUMP_INFO,(" uiRanOutOfResCount:%X\n",Adapter->PackInfo[uiLoopIndex].uiRanOutOfResCount)); - */ - } - - for (uiLoopIndex = 0; uiLoopIndex < MIBS_MAX_HIST_ENTRIES; uiLoopIndex++) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Adapter->aRxPktSizeHist[%x] = %x\n", uiLoopIndex, Adapter->aRxPktSizeHist[uiLoopIndex]); - - for (uiLoopIndex = 0; uiLoopIndex < MIBS_MAX_HIST_ENTRIES; uiLoopIndex++) - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "Adapter->aTxPktSizeHist[%x] = %x\n", uiLoopIndex, Adapter->aTxPktSizeHist[uiLoopIndex]); -} - -int reset_card_proc(struct bcm_mini_adapter *ps_adapter) -{ - int retval = STATUS_SUCCESS; - struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); - struct bcm_interface_adapter *psIntfAdapter = NULL; - unsigned int value = 0, uiResetValue = 0; - int bytes; - - psIntfAdapter = ((struct bcm_interface_adapter *)(ps_adapter->pvInterfaceAdapter)); - ps_adapter->bDDRInitDone = false; - - if (ps_adapter->chip_id >= T3LPB) { - /* SYS_CFG register is write protected hence for modifying this reg value, it should be read twice before */ - rdmalt(ps_adapter, SYS_CFG, &value, sizeof(value)); - rdmalt(ps_adapter, SYS_CFG, &value, sizeof(value)); - - /* making bit[6...5] same as was before f/w download. this setting force the h/w to */ - /* re-populated the SP RAM area with the string descriptor. */ - value = value | (ps_adapter->syscfgBefFwDld & 0x00000060); - wrmalt(ps_adapter, SYS_CFG, &value, sizeof(value)); - } - - /* killing all submitted URBs. */ - psIntfAdapter->psAdapter->StopAllXaction = TRUE; - Bcm_kill_all_URBs(psIntfAdapter); - /* Reset the UMA-B Device */ - if (ps_adapter->chip_id >= T3LPB) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Resetting UMA-B\n"); - retval = usb_reset_device(psIntfAdapter->udev); - psIntfAdapter->psAdapter->StopAllXaction = false; - - if (retval != STATUS_SUCCESS) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Reset failed with ret value :%d", retval); - goto err_exit; - } - - if (ps_adapter->chip_id == BCS220_2 || - ps_adapter->chip_id == BCS220_2BC || - ps_adapter->chip_id == BCS250_BC || - ps_adapter->chip_id == BCS220_3) { - - bytes = rdmalt(ps_adapter, HPM_CONFIG_LDO145, &value, sizeof(value)); - if (bytes < 0) { - retval = bytes; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "read failed with status :%d", retval); - goto err_exit; - } - /* setting 0th bit */ - value |= (1<<0); - retval = wrmalt(ps_adapter, HPM_CONFIG_LDO145, &value, sizeof(value)); - if (retval < 0) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "write failed with status :%d", retval); - goto err_exit; - } - } - } else { - bytes = rdmalt(ps_adapter, 0x0f007018, &value, sizeof(value)); - if (bytes < 0) { - retval = bytes; - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "read failed with status :%d", retval); - goto err_exit; - } - value &= (~(1<<16)); - retval = wrmalt(ps_adapter, 0x0f007018, &value, sizeof(value)); - if (retval < 0) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "write failed with status :%d", retval); - goto err_exit; |