diff --git a/drivers/staging/bcm/HandleControlPacket.c b/drivers/staging/bcm/HandleControlPacket.c index f17530b3a732..b058e30b2ca6 100644 --- a/drivers/staging/bcm/HandleControlPacket.c +++ b/drivers/staging/bcm/HandleControlPacket.c @@ -26,26 +26,33 @@ static VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, struct sk_buff *skb) switch (usStatus) { case CM_RESPONSES: /* 0xA0 */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "MAC Version Seems to be Non Multi-Classifier, rejected by Driver"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, + DBG_LVL_ALL, + "MAC Version Seems to be Non Multi-Classifier, rejected by Driver"); HighPriorityMessage = TRUE; break; case CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP: HighPriorityMessage = TRUE; if (Adapter->LinkStatus == LINKUP_DONE) - CmControlResponseMessage(Adapter, (skb->data + sizeof(USHORT))); + CmControlResponseMessage(Adapter, + (skb->data + sizeof(USHORT))); break; case LINK_CONTROL_RESP: /* 0xA2 */ case STATUS_RSP: /* 0xA1 */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "LINK_CONTROL_RESP"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, + DBG_LVL_ALL, "LINK_CONTROL_RESP"); HighPriorityMessage = TRUE; - LinkControlResponseMessage(Adapter, (skb->data + sizeof(USHORT))); + LinkControlResponseMessage(Adapter, + (skb->data + sizeof(USHORT))); break; case STATS_POINTER_RESP: /* 0xA6 */ HighPriorityMessage = TRUE; StatisticsResponse(Adapter, (skb->data + sizeof(USHORT))); break; case IDLE_MODE_STATUS: /* 0xA3 */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "IDLE_MODE_STATUS Type Message Got from F/W"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, + DBG_LVL_ALL, + "IDLE_MODE_STATUS Type Message Got from F/W"); InterfaceIdleModeRespond(Adapter, (PUINT)(skb->data + sizeof(USHORT))); HighPriorityMessage = TRUE; @@ -56,7 +63,8 @@ static VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, struct sk_buff *skb) break; default: - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "Got Default Response"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, + DBG_LVL_ALL, "Got Default Response"); /* Let the Application Deal with This Packet */ break; } @@ -85,8 +93,11 @@ static VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, struct sk_buff *skb) if (pTarang->RxCntrlMsgBitMask & (1 << cntrl_msg_mask_bit)) drop_pkt_flag = FALSE; - if ((drop_pkt_flag == TRUE) || (pTarang->AppCtrlQueueLen > MAX_APP_QUEUE_LEN) || - ((pTarang->AppCtrlQueueLen > MAX_APP_QUEUE_LEN / 2) && (HighPriorityMessage == FALSE))) { + if ((drop_pkt_flag == TRUE) || + (pTarang->AppCtrlQueueLen > MAX_APP_QUEUE_LEN) + || ((pTarang->AppCtrlQueueLen > + MAX_APP_QUEUE_LEN / 2) && + (HighPriorityMessage == FALSE))) { /* * Assumption:- * 1. every tarang manages it own dropped pkt @@ -100,7 +111,7 @@ static VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, struct sk_buff *skb) pTarang->stDroppedAppCntrlMsgs.cm_responses++; break; case CM_CONTROL_NEWDSX_MULTICLASSIFIER_RESP: - pTarang->stDroppedAppCntrlMsgs.cm_control_newdsx_multiclassifier_resp++; + pTarang->stDroppedAppCntrlMsgs.cm_control_newdsx_multiclassifier_resp++; break; case LINK_CONTROL_RESP: pTarang->stDroppedAppCntrlMsgs.link_control_resp++; @@ -128,14 +139,15 @@ static VOID handle_rx_control_packet(PMINI_ADAPTER Adapter, struct sk_buff *skb) newPacket = skb_clone(skb, GFP_KERNEL); if (!newPacket) break; - ENQUEUEPACKET(pTarang->RxAppControlHead, pTarang->RxAppControlTail, - newPacket); + ENQUEUEPACKET(pTarang->RxAppControlHead, + pTarang->RxAppControlTail, newPacket); pTarang->AppCtrlQueueLen++; } up(&Adapter->RxAppControlQueuelock); wake_up(&Adapter->process_read_wait_queue); dev_kfree_skb(skb); - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "After wake_up_interruptible"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, + "After wake_up_interruptible"); } /** @@ -148,23 +160,28 @@ int control_packet_handler(PMINI_ADAPTER Adapter /* pointer to adapter object*/) unsigned long flags = 0; /* struct timeval tv; */ /* int *puiBuffer = NULL; */ - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "Entering to make thread wait on control packet event!"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, + "Entering to make thread wait on control packet event!"); while (1) { wait_event_interruptible(Adapter->process_rx_cntrlpkt, - atomic_read(&Adapter->cntrlpktCnt) || - Adapter->bWakeUpDevice || - kthread_should_stop()); + atomic_read(&Adapter->cntrlpktCnt) || + Adapter->bWakeUpDevice || + kthread_should_stop()); if (kthread_should_stop()) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "Exiting\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, + DBG_LVL_ALL, "Exiting\n"); return 0; } if (TRUE == Adapter->bWakeUpDevice) { Adapter->bWakeUpDevice = FALSE; - if ((FALSE == Adapter->bTriedToWakeUpFromlowPowerMode) && - ((TRUE == Adapter->IdleMode) || (TRUE == Adapter->bShutStatus))) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CP_CTRL_PKT, DBG_LVL_ALL, "Calling InterfaceAbortIdlemode\n"); + if ((FALSE == Adapter->bTriedToWakeUpFromlowPowerMode) + && ((TRUE == Adapter->IdleMode) || + (TRUE == Adapter->bShutStatus))) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, + CP_CTRL_PKT, DBG_LVL_ALL, + "Calling InterfaceAbortIdlemode\n"); /* * Adapter->bTriedToWakeUpFromlowPowerMode * = TRUE; @@ -178,11 +195,13 @@ int control_packet_handler(PMINI_ADAPTER Adapter /* pointer to adapter object*/) spin_lock_irqsave(&Adapter->control_queue_lock, flags); ctrl_packet = Adapter->RxControlHead; if (ctrl_packet) { - DEQUEUEPACKET(Adapter->RxControlHead, Adapter->RxControlTail); + DEQUEUEPACKET(Adapter->RxControlHead, + Adapter->RxControlTail); /* Adapter->RxControlHead=ctrl_packet->next; */ } - spin_unlock_irqrestore(&Adapter->control_queue_lock, flags); + spin_unlock_irqrestore(&Adapter->control_queue_lock, + flags); handle_rx_control_packet(Adapter, ctrl_packet); atomic_dec(&Adapter->cntrlpktCnt); } @@ -200,12 +219,14 @@ INT flushAllAppQ(void) for (pTarang = Adapter->pTarangs; pTarang; pTarang = pTarang->next) { while (pTarang->RxAppControlHead != NULL) { PacketToDrop = pTarang->RxAppControlHead; - DEQUEUEPACKET(pTarang->RxAppControlHead, pTarang->RxAppControlTail); + DEQUEUEPACKET(pTarang->RxAppControlHead, + pTarang->RxAppControlTail); dev_kfree_skb(PacketToDrop); } pTarang->AppCtrlQueueLen = 0; /* dropped contrl packet statistics also should be reset. */ - memset((PVOID)&pTarang->stDroppedAppCntrlMsgs, 0, sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES)); + memset((PVOID)&pTarang->stDroppedAppCntrlMsgs, 0, + sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES)); } return STATUS_SUCCESS;