3 static int BcmFileDownload(PMINI_ADAPTER Adapter
, const char *path
, unsigned int loc
);
4 static VOID
doPowerAutoCorrection(PMINI_ADAPTER psAdapter
);
5 static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter
, PUCHAR pucBuffer
);
6 static int bcm_parse_target_params(PMINI_ADAPTER Adapter
);
7 static void beceem_protocol_reset(PMINI_ADAPTER Adapter
);
9 static VOID
default_wimax_protocol_initialize(PMINI_ADAPTER Adapter
)
13 for (uiLoopIndex
= 0; uiLoopIndex
< NO_OF_QUEUES
-1; uiLoopIndex
++) {
14 Adapter
->PackInfo
[uiLoopIndex
].uiThreshold
= TX_PACKET_THRESHOLD
;
15 Adapter
->PackInfo
[uiLoopIndex
].uiMaxAllowedRate
= MAX_ALLOWED_RATE
;
16 Adapter
->PackInfo
[uiLoopIndex
].uiMaxBucketSize
= 20*1024*1024;
19 Adapter
->BEBucketSize
= BE_BUCKET_SIZE
;
20 Adapter
->rtPSBucketSize
= rtPS_BUCKET_SIZE
;
21 Adapter
->LinkStatus
= SYNC_UP_REQUEST
;
22 Adapter
->TransferMode
= IP_PACKET_ONLY_MODE
;
23 Adapter
->usBestEffortQueueIndex
= -1;
27 INT
InitAdapter(PMINI_ADAPTER psAdapter
)
30 INT Status
= STATUS_SUCCESS
;
31 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Initialising Adapter = %p", psAdapter
);
33 if (psAdapter
== NULL
) {
34 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Adapter is NULL");
38 sema_init(&psAdapter
->NVMRdmWrmLock
, 1);
39 sema_init(&psAdapter
->rdmwrmsync
, 1);
40 spin_lock_init(&psAdapter
->control_queue_lock
);
41 spin_lock_init(&psAdapter
->txtransmitlock
);
42 sema_init(&psAdapter
->RxAppControlQueuelock
, 1);
43 sema_init(&psAdapter
->fw_download_sema
, 1);
44 sema_init(&psAdapter
->LowPowerModeSync
, 1);
46 for (i
= 0; i
< NO_OF_QUEUES
; i
++)
47 spin_lock_init(&psAdapter
->PackInfo
[i
].SFQueueLock
);
50 init_waitqueue_head(&psAdapter
->process_rx_cntrlpkt
);
51 init_waitqueue_head(&psAdapter
->tx_packet_wait_queue
);
52 init_waitqueue_head(&psAdapter
->process_read_wait_queue
);
53 init_waitqueue_head(&psAdapter
->ioctl_fw_dnld_wait_queue
);
54 init_waitqueue_head(&psAdapter
->lowpower_mode_wait_queue
);
55 psAdapter
->waiting_to_fw_download_done
= TRUE
;
56 psAdapter
->fw_download_done
= FALSE
;
58 default_wimax_protocol_initialize(psAdapter
);
59 for (i
= 0; i
< MAX_CNTRL_PKTS
; i
++) {
60 psAdapter
->txctlpacket
[i
] = kmalloc(MAX_CNTL_PKT_SIZE
, GFP_KERNEL
);
61 if (!psAdapter
->txctlpacket
[i
]) {
62 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "No More Cntl pkts got, max got is %d", i
);
67 if (AllocAdapterDsxBuffer(psAdapter
)) {
68 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Failed to allocate DSX buffers");
72 /* Initialize PHS interface */
73 if (phs_init(&psAdapter
->stBCMPhsContext
, psAdapter
) != 0) {
74 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "%s:%s:%d:Error PHS Init Failed=====>\n", __FILE__
, __func__
, __LINE__
);
78 Status
= BcmAllocFlashCSStructure(psAdapter
);
80 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Memory Allocation for Flash structure failed");
84 Status
= vendorextnInit(psAdapter
);
86 if (STATUS_SUCCESS
!= Status
) {
87 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Vendor Init Failed");
91 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Adapter initialised");
93 return STATUS_SUCCESS
;
96 VOID
AdapterFree(PMINI_ADAPTER Adapter
)
99 beceem_protocol_reset(Adapter
);
100 vendorextnExit(Adapter
);
102 if (Adapter
->control_packet_handler
&& !IS_ERR(Adapter
->control_packet_handler
))
103 kthread_stop(Adapter
->control_packet_handler
);
105 if (Adapter
->transmit_packet_thread
&& !IS_ERR(Adapter
->transmit_packet_thread
))
106 kthread_stop(Adapter
->transmit_packet_thread
);
108 wake_up(&Adapter
->process_read_wait_queue
);
110 if (Adapter
->LEDInfo
.led_thread_running
& (BCM_LED_THREAD_RUNNING_ACTIVELY
| BCM_LED_THREAD_RUNNING_INACTIVELY
))
111 kthread_stop(Adapter
->LEDInfo
.led_cntrl_threadid
);
113 unregister_networkdev(Adapter
);
115 /* FIXME: use proper wait_event and refcounting */
116 while (atomic_read(&Adapter
->ApplicationRunning
)) {
117 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Waiting for Application to close.. %d\n", atomic_read(&Adapter
->ApplicationRunning
));
120 unregister_control_device_interface(Adapter
);
121 kfree(Adapter
->pstargetparams
);
123 for (count
= 0; count
< MAX_CNTRL_PKTS
; count
++)
124 kfree(Adapter
->txctlpacket
[count
]);
126 FreeAdapterDsxBuffer(Adapter
);
127 kfree(Adapter
->pvInterfaceAdapter
);
129 /* Free the PHS Interface */
130 PhsCleanup(&Adapter
->stBCMPhsContext
);
132 BcmDeAllocFlashCSStructure(Adapter
);
134 free_netdev(Adapter
->dev
);
137 static int create_worker_threads(PMINI_ADAPTER psAdapter
)
139 /* Rx Control Packets Processing */
140 psAdapter
->control_packet_handler
= kthread_run((int (*)(void *))
141 control_packet_handler
, psAdapter
, "%s-rx", DRV_NAME
);
142 if (IS_ERR(psAdapter
->control_packet_handler
)) {
143 pr_notice(DRV_NAME
": could not create control thread\n");
144 return PTR_ERR(psAdapter
->control_packet_handler
);
148 psAdapter
->transmit_packet_thread
= kthread_run((int (*)(void *))
149 tx_pkt_handler
, psAdapter
, "%s-tx", DRV_NAME
);
150 if (IS_ERR(psAdapter
->transmit_packet_thread
)) {
151 pr_notice(DRV_NAME
": could not creat transmit thread\n");
152 kthread_stop(psAdapter
->control_packet_handler
);
153 return PTR_ERR(psAdapter
->transmit_packet_thread
);
158 static struct file
*open_firmware_file(PMINI_ADAPTER Adapter
, const char *path
)
160 struct file
*flp
= NULL
;
164 flp
= filp_open(path
, O_RDONLY
, S_IRWXU
);
167 pr_err(DRV_NAME
"Unable To Open File %s, err %ld", path
, PTR_ERR(flp
));
171 if (Adapter
->device_removed
)
180 * Download Address on the chip
182 static int BcmFileDownload(PMINI_ADAPTER Adapter
, const char *path
, unsigned int loc
)
185 struct file
*flp
= NULL
;
187 struct timeval tv
= {0};
189 flp
= open_firmware_file(Adapter
, path
);
192 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Unable to Open %s\n", path
);
195 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
);
196 do_gettimeofday(&tv
);
198 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "download start %lx", ((tv
.tv_sec
* 1000) + (tv
.tv_usec
/ 1000)));
199 if (Adapter
->bcm_file_download(Adapter
->pvInterfaceAdapter
, flp
, loc
)) {
200 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Failed to download the firmware with error %x!!!", -EIO
);
206 vfs_llseek(flp
, 0, 0);
208 if (Adapter
->bcm_file_readback_from_chip(Adapter
->pvInterfaceAdapter
, flp
, loc
)) {
209 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Failed to read back firmware!");
217 if (flp
&& !(IS_ERR(flp
)))
218 filp_close(flp
, current
->files
);
225 * @ingroup ctrl_pkt_functions
226 * This function copies the contents of given buffer
227 * to the control packet and queues it for transmission.
228 * @note Do not acquire the spinock, as it it already acquired.
229 * @return SUCCESS/FAILURE.
232 * Control Packet Buffer
234 INT
CopyBufferToControlPacket(PMINI_ADAPTER Adapter
, PVOID ioBuffer
)
236 PLEADER pLeader
= NULL
;
238 unsigned char *ctrl_buff
= NULL
;
240 PLINK_REQUEST pLinkReq
= NULL
;
241 PUCHAR pucAddIndication
= NULL
;
243 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "======>");
245 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Got Null Buffer\n");
249 pLinkReq
= (PLINK_REQUEST
)ioBuffer
;
250 pLeader
= (PLEADER
)ioBuffer
; /* ioBuffer Contains sw_Status and Payload */
252 if (Adapter
->bShutStatus
== TRUE
&&
253 pLinkReq
->szData
[0] == LINK_DOWN_REQ_PAYLOAD
&&
254 pLinkReq
->szData
[1] == LINK_SYNC_UP_SUBTYPE
) {
256 /* Got sync down in SHUTDOWN..we could not process this. */
257 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "SYNC DOWN Request in Shut Down Mode..\n");
258 return STATUS_FAILURE
;
261 if ((pLeader
->Status
== LINK_UP_CONTROL_REQ
) &&
262 ((pLinkReq
->szData
[0] == LINK_UP_REQ_PAYLOAD
&&
263 (pLinkReq
->szData
[1] == LINK_SYNC_UP_SUBTYPE
)) || /* Sync Up Command */
264 pLinkReq
->szData
[0] == NETWORK_ENTRY_REQ_PAYLOAD
)) /* Net Entry Command */ {
266 if (Adapter
->LinkStatus
> PHY_SYNC_ACHIVED
) {
267 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "LinkStatus is Greater than PHY_SYN_ACHIEVED");
268 return STATUS_FAILURE
;
271 if (TRUE
== Adapter
->bShutStatus
) {
272 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "SYNC UP IN SHUTDOWN..Device WakeUp\n");
273 if (Adapter
->bTriedToWakeUpFromlowPowerMode
== FALSE
) {
274 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Waking up for the First Time..\n");
275 Adapter
->usIdleModePattern
= ABORT_SHUTDOWN_MODE
; /* change it to 1 for current support. */
276 Adapter
->bWakeUpDevice
= TRUE
;
277 wake_up(&Adapter
->process_rx_cntrlpkt
);
278 Status
= wait_event_interruptible_timeout(Adapter
->lowpower_mode_wait_queue
, !Adapter
->bShutStatus
, (5 * HZ
));
280 if (Status
== -ERESTARTSYS
)
283 if (Adapter
->bShutStatus
) {
284 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Shutdown Mode Wake up Failed - No Wake Up Received\n");
285 return STATUS_FAILURE
;
288 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Wakeup has been tried already...\n");
293 if (TRUE
== Adapter
->IdleMode
) {
294 /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Device is in Idle mode ... hence\n"); */
295 if (pLeader
->Status
== LINK_UP_CONTROL_REQ
|| pLeader
->Status
== 0x80 ||
296 pLeader
->Status
== CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ
) {
298 if ((pLeader
->Status
== LINK_UP_CONTROL_REQ
) && (pLinkReq
->szData
[0] == LINK_DOWN_REQ_PAYLOAD
)) {
299 if ((pLinkReq
->szData
[1] == LINK_SYNC_DOWN_SUBTYPE
)) {
300 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Link Down Sent in Idle Mode\n");
301 Adapter
->usIdleModePattern
= ABORT_IDLE_SYNCDOWN
; /* LINK DOWN sent in Idle Mode */
303 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "ABORT_IDLE_MODE pattern is being written\n");
304 Adapter
->usIdleModePattern
= ABORT_IDLE_REG
;
307 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "ABORT_IDLE_MODE pattern is being written\n");
308 Adapter
->usIdleModePattern
= ABORT_IDLE_MODE
;
311 /*Setting bIdleMode_tx_from_host to TRUE to indicate LED control thread to represent
312 * the wake up from idlemode is from host
314 /* Adapter->LEDInfo.bIdleMode_tx_from_host = TRUE; */
315 Adapter
->bWakeUpDevice
= TRUE
;
316 wake_up(&Adapter
->process_rx_cntrlpkt
);
318 /* We should not send DREG message down while in idlemode. */
319 if (LINK_DOWN_REQ_PAYLOAD
== pLinkReq
->szData
[0])
320 return STATUS_SUCCESS
;
322 Status
= wait_event_interruptible_timeout(Adapter
->lowpower_mode_wait_queue
, !Adapter
->IdleMode
, (5 * HZ
));
324 if (Status
== -ERESTARTSYS
)
327 if (Adapter
->IdleMode
) {
328 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Idle Mode Wake up Failed - No Wake Up Received\n");
329 return STATUS_FAILURE
;
332 return STATUS_SUCCESS
;
336 /* The Driver has to send control messages with a particular VCID */
337 pLeader
->Vcid
= VCID_CONTROL_PACKET
; /* VCID for control packet. */
339 /* Allocate skb for Control Packet */
340 pktlen
= pLeader
->PLength
;
341 ctrl_buff
= (char *)Adapter
->txctlpacket
[atomic_read(&Adapter
->index_wr_txcntrlpkt
)%MAX_CNTRL_PKTS
];
343 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",
344 atomic_read(&Adapter
->index_wr_txcntrlpkt
), ctrl_buff
, ioBuffer
, pktlen
);
347 if ((pLeader
->Status
== 0x80) ||
348 (pLeader
->Status
== CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ
)) {
350 * Restructure the DSX message to handle Multiple classifier Support
351 * Write the Service Flow param Structures directly to the target
352 * and embed the pointers in the DSX messages sent to target.
354 /* Lets store the current length of the control packet we are transmitting */
355 pucAddIndication
= (PUCHAR
)ioBuffer
+ LEADER_SIZE
;
356 pktlen
= pLeader
->PLength
;
357 Status
= StoreCmControlResponseMessage(Adapter
, pucAddIndication
, &pktlen
);
359 ClearTargetDSXBuffer(Adapter
, ((stLocalSFAddIndicationAlt
*)pucAddIndication
)->u16TID
, FALSE
);
360 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 ");
361 return STATUS_FAILURE
;
364 * update the leader to use the new length
365 * The length of the control packet is length of message being sent + Leader length
367 pLeader
->PLength
= pktlen
;
371 if (pktlen
+ LEADER_SIZE
> MAX_CNTL_PKT_SIZE
)
374 memset(ctrl_buff
, 0, pktlen
+LEADER_SIZE
);
375 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Copying the Control Packet Buffer with length=%d\n", pLeader
->PLength
);
376 *(PLEADER
)ctrl_buff
= *pLeader
;
377 memcpy(ctrl_buff
+ LEADER_SIZE
, ((PUCHAR
)ioBuffer
+ LEADER_SIZE
), pLeader
->PLength
);
378 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Enqueuing the Control Packet");
380 /* Update the statistics counters */
381 spin_lock_bh(&Adapter
->PackInfo
[HiPriority
].SFQueueLock
);
382 Adapter
->PackInfo
[HiPriority
].uiCurrentBytesOnHost
+= pLeader
->PLength
;
383 Adapter
->PackInfo
[HiPriority
].uiCurrentPacketsOnHost
++;
384 atomic_inc(&Adapter
->TotalPacketCount
);
385 spin_unlock_bh(&Adapter
->PackInfo
[HiPriority
].SFQueueLock
);
386 Adapter
->PackInfo
[HiPriority
].bValid
= TRUE
;
388 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "CurrBytesOnHost: %x bValid: %x",
389 Adapter
->PackInfo
[HiPriority
].uiCurrentBytesOnHost
,
390 Adapter
->PackInfo
[HiPriority
].bValid
);
391 Status
= STATUS_SUCCESS
;
392 /*Queue the packet for transmission */
393 atomic_inc(&Adapter
->index_wr_txcntrlpkt
);
394 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Calling transmit_packets");
395 atomic_set(&Adapter
->TxPktAvail
, 1);
396 wake_up(&Adapter
->tx_packet_wait_queue
);
399 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "mem allocation Failed");
401 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "<====");
406 /*****************************************************************
407 * Function - SendStatisticsPointerRequest()
409 * Description - This function builds and forwards the Statistics
410 * Pointer Request control Packet.
412 * Parameters - Adapter : Pointer to Adapter structure.
413 * - pstStatisticsPtrRequest : Pointer to link request.
416 *****************************************************************/
417 static VOID
SendStatisticsPointerRequest(PMINI_ADAPTER Adapter
, PLINK_REQUEST pstStatisticsPtrRequest
)
419 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "======>");
420 pstStatisticsPtrRequest
->Leader
.Status
= STATS_POINTER_REQ_STATUS
;
421 pstStatisticsPtrRequest
->Leader
.PLength
= sizeof(ULONG
); /* minimum 4 bytes */
422 pstStatisticsPtrRequest
->szData
[0] = STATISTICS_POINTER_REQ
;
423 CopyBufferToControlPacket(Adapter
, pstStatisticsPtrRequest
);
424 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "<=====");
429 /******************************************************************
430 * Function - LinkMessage()
432 * Description - This function builds the Sync-up and Link-up request
433 * packet messages depending on the device Link status.
435 * Parameters - Adapter: Pointer to the Adapter structure.
438 *******************************************************************/
439 VOID
LinkMessage(PMINI_ADAPTER Adapter
)
441 PLINK_REQUEST pstLinkRequest
= NULL
;
442 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "=====>");
443 if (Adapter
->LinkStatus
== SYNC_UP_REQUEST
&& Adapter
->AutoSyncup
) {
444 pstLinkRequest
= kzalloc(sizeof(LINK_REQUEST
), GFP_ATOMIC
);
445 if (!pstLinkRequest
) {
446 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Can not allocate memory for Link request!");
449 /* sync up request... */
450 Adapter
->LinkStatus
= WAIT_FOR_SYNC
; /* current link status */
451 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Requesting For SyncUp...");
452 pstLinkRequest
->szData
[0] = LINK_UP_REQ_PAYLOAD
;
453 pstLinkRequest
->szData
[1] = LINK_SYNC_UP_SUBTYPE
;
454 pstLinkRequest
->Leader
.Status
= LINK_UP_CONTROL_REQ
;
455 pstLinkRequest
->Leader
.PLength
= sizeof(ULONG
);
456 Adapter
->bSyncUpRequestSent
= TRUE
;
458 } else if (Adapter
->LinkStatus
== PHY_SYNC_ACHIVED
&& Adapter
->AutoLinkUp
) {
459 pstLinkRequest
= kzalloc(sizeof(LINK_REQUEST
), GFP_ATOMIC
);
460 if (!pstLinkRequest
) {
461 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Can not allocate memory for Link request!");
464 /* LINK_UP_REQUEST */
465 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Requesting For LinkUp...");
466 pstLinkRequest
->szData
[0] = LINK_UP_REQ_PAYLOAD
;
467 pstLinkRequest
->szData
[1] = LINK_NET_ENTRY
;
468 pstLinkRequest
->Leader
.Status
= LINK_UP_CONTROL_REQ
;
469 pstLinkRequest
->Leader
.PLength
= sizeof(ULONG
);
471 if (pstLinkRequest
) {
472 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Calling CopyBufferToControlPacket");
473 CopyBufferToControlPacket(Adapter
, pstLinkRequest
);
474 kfree(pstLinkRequest
);
476 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "LinkMessage <=====");
480 /**********************************************************************
481 * Function - StatisticsResponse()
483 * Description - This function handles the Statistics response packet.
485 * Parameters - Adapter : Pointer to the Adapter structure.
486 * - pvBuffer: Starting address of Statistic response data.
489 ************************************************************************/
490 VOID
StatisticsResponse(PMINI_ADAPTER Adapter
, PVOID pvBuffer
)
492 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "%s====>", __func__
);
493 Adapter
->StatisticsPointer
= ntohl(*(__be32
*)pvBuffer
);
494 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "Stats at %x", (UINT
)Adapter
->StatisticsPointer
);
495 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "%s <====", __func__
);
499 /**********************************************************************
500 * Function - LinkControlResponseMessage()
502 * Description - This function handles the Link response packets.
504 * Parameters - Adapter : Pointer to the Adapter structure.
505 * - pucBuffer: Starting address of Link response data.
508 ***********************************************************************/
509 VOID
LinkControlResponseMessage(PMINI_ADAPTER Adapter
, PUCHAR pucBuffer
)
511 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "=====>");
513 if (*pucBuffer
== LINK_UP_ACK
) {
514 switch (*(pucBuffer
+1)) {
515 case PHY_SYNC_ACHIVED
: /* SYNCed UP */
516 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "PHY_SYNC_ACHIVED");
518 if (Adapter
->LinkStatus
== LINKUP_DONE
)
519 beceem_protocol_reset(Adapter
);
521 Adapter
->usBestEffortQueueIndex
= INVALID_QUEUE_INDEX
;
522 Adapter
->LinkStatus
= PHY_SYNC_ACHIVED
;
524 if (Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
) {
525 Adapter
->DriverState
= NO_NETWORK_ENTRY
;
526 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
529 LinkMessage(Adapter
);
533 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "LINKUP_DONE");
534 Adapter
->LinkStatus
= LINKUP_DONE
;
535 Adapter
->bPHSEnabled
= *(pucBuffer
+3);
536 Adapter
->bETHCSEnabled
= *(pucBuffer
+4) & ETH_CS_MASK
;
537 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "PHS Support Status Received In LinkUp Ack : %x\n", Adapter
->bPHSEnabled
);
539 if ((FALSE
== Adapter
->bShutStatus
) && (FALSE
== Adapter
->IdleMode
)) {
540 if (Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
) {
541 Adapter
->DriverState
= NORMAL_OPERATION
;
542 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
545 LinkMessage(Adapter
);
550 * Driver to ignore the DREG_RECEIVED
551 * WiMAX Application should handle this Message
553 /* Adapter->liTimeSinceLastNetEntry = 0; */
554 Adapter
->LinkUpStatus
= 0;
555 Adapter
->LinkStatus
= 0;
556 Adapter
->usBestEffortQueueIndex
= INVALID_QUEUE_INDEX
;
557 Adapter
->bTriedToWakeUpFromlowPowerMode
= FALSE
;
558 Adapter
->IdleMode
= FALSE
;
559 beceem_protocol_reset(Adapter
);
562 case LINK_SHUTDOWN_REQ_FROM_FIRMWARE
:
563 case COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW
:
565 HandleShutDownModeRequest(Adapter
, pucBuffer
);
569 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "default case:LinkResponse %x", *(pucBuffer
+ 1));
572 } else if (SET_MAC_ADDRESS_RESPONSE
== *pucBuffer
) {
573 PUCHAR puMacAddr
= (pucBuffer
+ 1);
574 Adapter
->LinkStatus
= SYNC_UP_REQUEST
;
575 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "MAC address response, sending SYNC_UP");
576 LinkMessage(Adapter
);
577 memcpy(Adapter
->dev
->dev_addr
, puMacAddr
, MAC_ADDRESS_SIZE
);
579 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "%s <=====", __func__
);
583 void SendIdleModeResponse(PMINI_ADAPTER Adapter
)
585 INT status
= 0, NVMAccess
= 0, lowPwrAbortMsg
= 0;
587 CONTROL_MESSAGE stIdleResponse
= {{0} };
588 memset(&tv
, 0, sizeof(tv
));
589 stIdleResponse
.Leader
.Status
= IDLE_MESSAGE
;
590 stIdleResponse
.Leader
.PLength
= IDLE_MODE_PAYLOAD_LENGTH
;
591 stIdleResponse
.szData
[0] = GO_TO_IDLE_MODE_PAYLOAD
;
592 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, " ============>");
594 /*********************************
596 * if [ semaphore is available ]
597 * acquire semaphone and return value 0 ;
599 * return non-zero value ;
601 ***********************************/
603 NVMAccess
= down_trylock(&Adapter
->NVMRdmWrmLock
);
604 lowPwrAbortMsg
= down_trylock(&Adapter
->LowPowerModeSync
);
607 if ((NVMAccess
|| lowPwrAbortMsg
|| atomic_read(&Adapter
->TotalPacketCount
)) &&
608 (Adapter
->ulPowerSaveMode
!= DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
)) {
611 up(&Adapter
->NVMRdmWrmLock
);
614 up(&Adapter
->LowPowerModeSync
);
616 stIdleResponse
.szData
[1] = TARGET_CAN_NOT_GO_TO_IDLE_MODE
; /* NACK- device access is going on. */
617 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "HOST IS NACKING Idle mode To F/W!!!!!!!!");
618 Adapter
->bPreparingForLowPowerMode
= FALSE
;
620 stIdleResponse
.szData
[1] = TARGET_CAN_GO_TO_IDLE_MODE
; /* 2; Idle ACK */
621 Adapter
->StatisticsPointer
= 0;
623 /* Wait for the LED to TURN OFF before sending ACK response */
624 if (Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
) {
627 /* Wake the LED Thread with IDLEMODE_ENTER State */
628 Adapter
->DriverState
= LOWPOWER_MODE_ENTER
;
629 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
);
630 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
632 /* Wait for 1 SEC for LED to OFF */
633 iRetVal
= wait_event_timeout(Adapter
->LEDInfo
.idleModeSyncEvent
, Adapter
->LEDInfo
.bIdle_led_off
, msecs_to_jiffies(1000));
635 /* If Timed Out to Sync IDLE MODE Enter, do IDLE mode Exit and Send NACK to device */
637 stIdleResponse
.szData
[1] = TARGET_CAN_NOT_GO_TO_IDLE_MODE
; /* NACK- device access is going on. */
638 Adapter
->DriverState
= NORMAL_OPERATION
;
639 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
640 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "NACKING Idle mode as time out happen from LED side!!!!!!!!");
644 if (stIdleResponse
.szData
[1] == TARGET_CAN_GO_TO_IDLE_MODE
) {
645 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "ACKING IDLE MODE !!!!!!!!!");
646 down(&Adapter
->rdmwrmsync
);
647 Adapter
->bPreparingForLowPowerMode
= TRUE
;
648 up(&Adapter
->rdmwrmsync
);
649 /* Killing all URBS. */
650 if (Adapter
->bDoSuspend
== TRUE
)
651 Bcm_kill_all_URBs((PS_INTERFACE_ADAPTER
)(Adapter
->pvInterfaceAdapter
));
653 Adapter
->bPreparingForLowPowerMode
= FALSE
;
657 up(&Adapter
->NVMRdmWrmLock
);
660 up(&Adapter
->LowPowerModeSync
);
663 status
= CopyBufferToControlPacket(Adapter
, &stIdleResponse
);
664 if ((status
!= STATUS_SUCCESS
)) {
665 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "fail to send the Idle mode Request\n");
666 Adapter
->bPreparingForLowPowerMode
= FALSE
;
667 StartInterruptUrb((PS_INTERFACE_ADAPTER
)(Adapter
->pvInterfaceAdapter
));
669 do_gettimeofday(&tv
);
670 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);
673 /******************************************************************
674 * Function - DumpPackInfo()
676 * Description - This function dumps the all Queue(PackInfo[]) details.
678 * Parameters - Adapter: Pointer to the Adapter structure.
681 *******************************************************************/
682 VOID
DumpPackInfo(PMINI_ADAPTER Adapter
)
684 UINT uiLoopIndex
= 0;
686 UINT uiClsfrIndex
= 0;
687 S_CLASSIFIER_RULE
*pstClassifierEntry
= NULL
;
689 for (uiLoopIndex
= 0; uiLoopIndex
< NO_OF_QUEUES
; uiLoopIndex
++) {
690 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "*********** Showing Details Of Queue %d***** ******", uiLoopIndex
);
691 if (FALSE
== Adapter
->PackInfo
[uiLoopIndex
].bValid
) {
692 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "bValid is FALSE for %X index\n", uiLoopIndex
);
696 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, " Dumping SF Rule Entry For SFID %lX\n", Adapter
->PackInfo
[uiLoopIndex
].ulSFID
);
697 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, " ucDirection %X\n", Adapter
->PackInfo
[uiLoopIndex
].ucDirection
);
699 if (Adapter
->PackInfo
[uiLoopIndex
].ucIpVersion
== IPV6
)
700 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "Ipv6 Service Flow\n");
702 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "Ipv4 Service Flow\n");
704 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "SF Traffic Priority %X\n", Adapter
->PackInfo
[uiLoopIndex
].u8TrafficPriority
);
706 for (uiClsfrIndex
= 0; uiClsfrIndex
< MAX_CLASSIFIERS
; uiClsfrIndex
++) {
707 pstClassifierEntry
= &Adapter
->astClassifierTable
[uiClsfrIndex
];
708 if (!pstClassifierEntry
->bUsed
)
711 if (pstClassifierEntry
->ulSFID
!= Adapter
->PackInfo
[uiLoopIndex
].ulSFID
)
714 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
);
715 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
);
716 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
);
717 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
);
718 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
);
719 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
);
721 for (uiIndex
= 0; uiIndex
< MAX_PORT_RANGE
; uiIndex
++) {
722 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tusSrcPortRangeLo:%X\n", pstClassifierEntry
->usSrcPortRangeLo
[uiIndex
]);
723 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tusSrcPortRangeHi:%X\n", pstClassifierEntry
->usSrcPortRangeHi
[uiIndex
]);
724 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tusDestPortRangeLo:%X\n", pstClassifierEntry
->usDestPortRangeLo
[uiIndex
]);
725 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tusDestPortRangeHi:%X\n", pstClassifierEntry
->usDestPortRangeHi
[uiIndex
]);
728 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tucIPSourceAddressLength : 0x%x\n", pstClassifierEntry
->ucIPSourceAddressLength
);
729 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tucIPDestinationAddressLength : 0x%x\n", pstClassifierEntry
->ucIPDestinationAddressLength
);
730 for (uiIndex
= 0; uiIndex
< pstClassifierEntry
->ucIPSourceAddressLength
; uiIndex
++) {
731 if (Adapter
->PackInfo
[uiLoopIndex
].ucIpVersion
== IPV6
) {
732 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tIpv6 ulSrcIpAddr :\n");
733 DumpIpv6Address(pstClassifierEntry
->stSrcIpAddress
.ulIpv6Addr
);
734 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tIpv6 ulSrcIpMask :\n");
735 DumpIpv6Address(pstClassifierEntry
->stSrcIpAddress
.ulIpv6Mask
);
737 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tulSrcIpAddr:%lX\n", pstClassifierEntry
->stSrcIpAddress
.ulIpv4Addr
[uiIndex
]);
738 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tulSrcIpMask:%lX\n", pstClassifierEntry
->stSrcIpAddress
.ulIpv4Mask
[uiIndex
]);
742 for (uiIndex
= 0; uiIndex
< pstClassifierEntry
->ucIPDestinationAddressLength
; uiIndex
++) {
743 if (Adapter
->PackInfo
[uiLoopIndex
].ucIpVersion
== IPV6
) {
744 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tIpv6 ulDestIpAddr :\n");
745 DumpIpv6Address(pstClassifierEntry
->stDestIpAddress
.ulIpv6Addr
);
746 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tIpv6 ulDestIpMask :\n");
747 DumpIpv6Address(pstClassifierEntry
->stDestIpAddress
.ulIpv6Mask
);
749 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tulDestIpAddr:%lX\n", pstClassifierEntry
->stDestIpAddress
.ulIpv4Addr
[uiIndex
]);
750 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tulDestIpMask:%lX\n", pstClassifierEntry
->stDestIpAddress
.ulIpv4Mask
[uiIndex
]);
753 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tucProtocol:0x%X\n", pstClassifierEntry
->ucProtocol
[0]);
754 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "\tu8ClassifierRulePriority:%X\n", pstClassifierEntry
->u8ClassifierRulePriority
);
756 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "ulSFID:%lX\n", Adapter
->PackInfo
[uiLoopIndex
].ulSFID
);
757 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "usVCID_Value:%X\n", Adapter
->PackInfo
[uiLoopIndex
].usVCID_Value
);
758 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "PhsEnabled: 0x%X\n", Adapter
->PackInfo
[uiLoopIndex
].bHeaderSuppressionEnabled
);
759 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiThreshold:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiThreshold
);
761 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "bValid:%X\n", Adapter
->PackInfo
[uiLoopIndex
].bValid
);
762 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "bActive:%X\n", Adapter
->PackInfo
[uiLoopIndex
].bActive
);
763 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "ActivateReqSent: %x", Adapter
->PackInfo
[uiLoopIndex
].bActivateRequestSent
);
764 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "u8QueueType:%X\n", Adapter
->PackInfo
[uiLoopIndex
].u8QueueType
);
765 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiMaxBucketSize:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiMaxBucketSize
);
766 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiPerSFTxResourceCount:%X\n", atomic_read(&Adapter
->PackInfo
[uiLoopIndex
].uiPerSFTxResourceCount
));
767 /* DumpDebug(DUMP_INFO,("bCSSupport:%X\n",Adapter->PackInfo[uiLoopIndex].bCSSupport)); */
768 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "CurrQueueDepthOnTarget: %x\n", Adapter
->PackInfo
[uiLoopIndex
].uiCurrentQueueDepthOnTarget
);
769 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiCurrentBytesOnHost:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiCurrentBytesOnHost
);
770 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiCurrentPacketsOnHost:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiCurrentPacketsOnHost
);
771 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiDroppedCountBytes:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiDroppedCountBytes
);
772 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiDroppedCountPackets:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiDroppedCountPackets
);
773 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiSentBytes:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiSentBytes
);
774 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiSentPackets:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiSentPackets
);
775 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiCurrentDrainRate:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiCurrentDrainRate
);
776 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiThisPeriodSentBytes:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiThisPeriodSentBytes
);
777 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "liDrainCalculated:%llX\n", Adapter
->PackInfo
[uiLoopIndex
].liDrainCalculated
);
778 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiCurrentTokenCount:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiCurrentTokenCount
);
779 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "liLastUpdateTokenAt:%llX\n", Adapter
->PackInfo
[uiLoopIndex
].liLastUpdateTokenAt
);
780 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiMaxAllowedRate:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiMaxAllowedRate
);
781 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiPendedLast:%X\n", Adapter
->PackInfo
[uiLoopIndex
].uiPendedLast
);
782 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "NumOfPacketsSent:%X\n", Adapter
->PackInfo
[uiLoopIndex
].NumOfPacketsSent
);
783 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "Direction: %x\n", Adapter
->PackInfo
[uiLoopIndex
].ucDirection
);
784 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "CID: %x\n", Adapter
->PackInfo
[uiLoopIndex
].usCID
);
785 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "ProtocolValid: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bProtocolValid
);
786 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "TOSValid: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bTOSValid
);
787 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "DestIpValid: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bDestIpValid
);
788 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "SrcIpValid: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bSrcIpValid
);
789 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "ActiveSet: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bActiveSet
);
790 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "AdmittedSet: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bAdmittedSet
);
791 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "AuthzSet: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bAuthorizedSet
);
792 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "ClassifyPrority: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bClassifierPriority
);
793 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiMaxLatency: %x\n", Adapter
->PackInfo
[uiLoopIndex
].uiMaxLatency
);
794 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "ServiceClassName: %x %x %x %x\n", Adapter
->PackInfo
[uiLoopIndex
].ucServiceClassName
[0], Adapter
->PackInfo
[uiLoopIndex
].ucServiceClassName
[1], Adapter
->PackInfo
[uiLoopIndex
].ucServiceClassName
[2], Adapter
->PackInfo
[uiLoopIndex
].ucServiceClassName
[3]);
795 /* BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "bHeaderSuppressionEnabled :%X\n", Adapter->PackInfo[uiLoopIndex].bHeaderSuppressionEnabled);
796 * BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiTotalTxBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiTotalTxBytes);
797 * BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiTotalRxBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiTotalRxBytes);
798 * DumpDebug(DUMP_INFO,(" uiRanOutOfResCount:%X\n",Adapter->PackInfo[uiLoopIndex].uiRanOutOfResCount));
802 for (uiLoopIndex
= 0; uiLoopIndex
< MIBS_MAX_HIST_ENTRIES
; uiLoopIndex
++)
803 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "Adapter->aRxPktSizeHist[%x] = %x\n", uiLoopIndex
, Adapter
->aRxPktSizeHist
[uiLoopIndex
]);
805 for (uiLoopIndex
= 0; uiLoopIndex
< MIBS_MAX_HIST_ENTRIES
; uiLoopIndex
++)
806 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "Adapter->aTxPktSizeHist[%x] = %x\n", uiLoopIndex
, Adapter
->aTxPktSizeHist
[uiLoopIndex
]);
811 int reset_card_proc(PMINI_ADAPTER ps_adapter
)
813 int retval
= STATUS_SUCCESS
;
814 PMINI_ADAPTER Adapter
= GET_BCM_ADAPTER(gblpnetdev
);
815 PS_INTERFACE_ADAPTER psIntfAdapter
= NULL
;
816 unsigned int value
= 0, uiResetValue
= 0;
818 psIntfAdapter
= ((PS_INTERFACE_ADAPTER
)(ps_adapter
->pvInterfaceAdapter
));
819 ps_adapter
->bDDRInitDone
= FALSE
;
821 if (ps_adapter
->chip_id
>= T3LPB
) {
822 /* SYS_CFG register is write protected hence for modifying this reg value, it should be read twice before */
823 rdmalt(ps_adapter
, SYS_CFG
, &value
, sizeof(value
));
824 rdmalt(ps_adapter
, SYS_CFG
, &value
, sizeof(value
));
826 /* making bit[6...5] same as was before f/w download. this setting force the h/w to */
827 /* re-populated the SP RAM area with the string descriptor. */
828 value
= value
| (ps_adapter
->syscfgBefFwDld
& 0x00000060);
829 wrmalt(ps_adapter
, SYS_CFG
, &value
, sizeof(value
));
832 /* killing all submitted URBs. */
833 psIntfAdapter
->psAdapter
->StopAllXaction
= TRUE
;
834 Bcm_kill_all_URBs(psIntfAdapter
);
835 /* Reset the UMA-B Device */
836 if (ps_adapter
->chip_id
>= T3LPB
) {
837 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "Reseting UMA-B\n");
838 retval
= usb_reset_device(psIntfAdapter
->udev
);
839 psIntfAdapter
->psAdapter
->StopAllXaction
= FALSE
;
841 if (retval
!= STATUS_SUCCESS
) {
842 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "Reset failed with ret value :%d", retval
);
846 if (ps_adapter
->chip_id
== BCS220_2
||
847 ps_adapter
->chip_id
== BCS220_2BC
||
848 ps_adapter
->chip_id
== BCS250_BC
||
849 ps_adapter
->chip_id
== BCS220_3
) {
851 retval
= rdmalt(ps_adapter
, HPM_CONFIG_LDO145
, &value
, sizeof(value
));
853 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "read failed with status :%d", retval
);
856 /* setting 0th bit */
858 retval
= wrmalt(ps_adapter
, HPM_CONFIG_LDO145
, &value
, sizeof(value
));
860 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "write failed with status :%d", retval
);
865 retval
= rdmalt(ps_adapter
, 0x0f007018, &value
, sizeof(value
));
867 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "read failed with status :%d", retval
);
871 retval
= wrmalt(ps_adapter
, 0x0f007018, &value
, sizeof(value
));
873 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "write failed with status :%d", retval
);
877 /* Toggling the GPIO 8, 9 */
879 retval
= wrmalt(ps_adapter
, GPIO_OUTPUT_REGISTER
, &value
, sizeof(value
));
881 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "write failed with status :%d", retval
);
885 retval
= wrmalt(ps_adapter
, GPIO_MODE_REGISTER
, &value
, sizeof(value
));
887 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "write failed with status :%d", retval
);
893 /* ps_adapter->downloadDDR = false; */
894 if (ps_adapter
->bFlashBoot
) {
895 /* In flash boot mode MIPS state register has reverse polarity.
896 * So just or with setting bit 30.
897 * Make the MIPS in Reset state.
899 rdmalt(ps_adapter
, CLOCK_RESET_CNTRL_REG_1
, &uiResetValue
, sizeof(uiResetValue
));
900 uiResetValue
|= (1<<30);
901 wrmalt(ps_adapter
, CLOCK_RESET_CNTRL_REG_1
, &uiResetValue
, sizeof(uiResetValue
));
904 if (ps_adapter
->chip_id
>= T3LPB
) {
907 * WA for SYSConfig Issue.
908 * Read SYSCFG Twice to make it writable.
910 rdmalt(ps_adapter
, SYS_CFG
, &uiResetValue
, sizeof(uiResetValue
));
911 if (uiResetValue
& (1<<4)) {
913 rdmalt(ps_adapter
, SYS_CFG
, &uiResetValue
, sizeof(uiResetValue
)); /* 2nd read to make it writable. */
914 uiResetValue
&= (~(1<<4));
915 wrmalt(ps_adapter
, SYS_CFG
, &uiResetValue
, sizeof(uiResetValue
));
919 wrmalt(ps_adapter
, 0x0f01186c, &uiResetValue
, sizeof(uiResetValue
));
922 psIntfAdapter
->psAdapter
->StopAllXaction
= FALSE
;
926 int run_card_proc(PMINI_ADAPTER ps_adapter
)
928 unsigned int value
= 0;
930 if (rdmalt(ps_adapter
, CLOCK_RESET_CNTRL_REG_1
, &value
, sizeof(value
)) < 0) {
931 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "%s:%d\n", __func__
, __LINE__
);
932 return STATUS_FAILURE
;
935 if (ps_adapter
->bFlashBoot
)
940 if (wrmalt(ps_adapter
, CLOCK_RESET_CNTRL_REG_1
, &value
, sizeof(value
)) < 0) {
941 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "%s:%d\n", __func__
, __LINE__
);
942 return STATUS_FAILURE
;
945 return STATUS_SUCCESS
;
948 int InitCardAndDownloadFirmware(PMINI_ADAPTER ps_adapter
)
953 * Create the threads first and then download the
954 * Firm/DDR Settings..
956 status
= create_worker_threads(ps_adapter
);
960 status
= bcm_parse_target_params(ps_adapter
);
964 if (ps_adapter
->chip_id
>= T3LPB
) {
965 rdmalt(ps_adapter
, SYS_CFG
, &value
, sizeof(value
));
966 ps_adapter
->syscfgBefFwDld
= value
;
968 if ((value
& 0x60) == 0)
969 ps_adapter
->bFlashBoot
= TRUE
;
972 reset_card_proc(ps_adapter
);
974 /* Initializing the NVM. */
975 BcmInitNVM(ps_adapter
);
976 status
= ddr_init(ps_adapter
);
978 pr_err(DRV_NAME
"ddr_init Failed\n");
982 /* Download cfg file */
983 status
= buffDnldVerify(ps_adapter
,
984 (PUCHAR
)ps_adapter
->pstargetparams
,
985 sizeof(STARGETPARAMS
),
988 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Error downloading CFG file");
992 if (register_networkdev(ps_adapter
)) {
993 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Register Netdevice failed. Cleanup needs to be performed.");
997 if (FALSE
== ps_adapter
->AutoFirmDld
) {
998 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "AutoFirmDld Disabled in CFG File..\n");
999 /* If Auto f/w download is disable, register the control interface, */
1000 /* register the control interface after the mailbox. */
1001 if (register_control_device_interface(ps_adapter
) < 0) {
1002 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Register Control Device failed. Cleanup needs to be performed.");
1005 return STATUS_SUCCESS
;
1009 * Do the LED Settings here. It will be used by the Firmware Download
1014 * 1. If the LED Settings fails, do not stop and do the Firmware download.
1015 * 2. This init would happened only if the cfg file is present, else
1016 * call from the ioctl context.
1019 status
= InitLedSettings(ps_adapter
);
1021 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_PRINTK
, 0, 0, "INIT LED FAILED\n");
1025 if (ps_adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
) {
1026 ps_adapter
->DriverState
= DRIVER_INIT
;
1027 wake_up(&ps_adapter
->LEDInfo
.notify_led_event
);
1030 if (ps_adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
) {
1031 ps_adapter
->DriverState
= FW_DOWNLOAD
;
1032 wake_up(&ps_adapter
->LEDInfo
.notify_led_event
);
1036 wrmalt(ps_adapter
, EEPROM_CAL_DATA_INTERNAL_LOC
- 4, &value
, sizeof(value
));
1037 wrmalt(ps_adapter
, EEPROM_CAL_DATA_INTERNAL_LOC
- 8, &value
, sizeof(value
));
1039 if (ps_adapter
->eNVMType
== NVM_FLASH
) {
1040 status
= PropagateCalParamsFromFlashToMemory(ps_adapter
);
1042 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Propagation of Cal param failed ..");
1047 /* Download Firmare */
1048 status
= BcmFileDownload(ps_adapter
, BIN_FILE
, FIRMWARE_BEGIN_ADDR
);
1050 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "No Firmware File is present...\n");
1054 status
= run_card_proc(ps_adapter
);
1056 BCM_DEBUG_PRINT(ps_adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "run_card_proc Failed\n");
1060 ps_adapter
->fw_download_done
= TRUE
;
1064 if (ps_adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
) {
1065 ps_adapter
->DriverState
= FW_DOWNLOAD_DONE
;
1066 wake_up(&ps_adapter
->LEDInfo
.notify_led_event
);
1072 static int bcm_parse_target_params(PMINI_ADAPTER Adapter
)
1074 struct file
*flp
= NULL
;
1075 mm_segment_t oldfs
= {0};
1080 buff
= kmalloc(BUFFER_1K
, GFP_KERNEL
);
1084 Adapter
->pstargetparams
= kmalloc(sizeof(STARGETPARAMS
), GFP_KERNEL
);
1085 if (Adapter
->pstargetparams
== NULL
) {
1090 flp
= open_firmware_file(Adapter
, CFG_FILE
);
1092 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "NOT ABLE TO OPEN THE %s FILE\n", CFG_FILE
);
1094 kfree(Adapter
->pstargetparams
);
1095 Adapter
->pstargetparams
= NULL
;
1100 len
= vfs_read(flp
, (void __user __force
*)buff
, BUFFER_1K
, &pos
);
1103 if (len
!= sizeof(STARGETPARAMS
)) {
1104 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Mismatch in Target Param Structure!\n");
1106 kfree(Adapter
->pstargetparams
);
1107 Adapter
->pstargetparams
= NULL
;
1108 filp_close(flp
, current
->files
);
1111 filp_close(flp
, current
->files
);
1113 /* Check for autolink in config params */
1115 * Values in Adapter->pstargetparams are in network byte order
1117 memcpy(Adapter
->pstargetparams
, buff
, sizeof(STARGETPARAMS
));
1119 beceem_parse_target_struct(Adapter
);
1120 return STATUS_SUCCESS
;
1123 void beceem_parse_target_struct(PMINI_ADAPTER Adapter
)
1125 UINT uiHostDrvrCfg6
= 0, uiEEPROMFlag
= 0;
1127 if (ntohl(Adapter
->pstargetparams
->m_u32PhyParameter2
) & AUTO_SYNC_DISABLE
) {
1128 pr_info(DRV_NAME
": AutoSyncup is Disabled\n");
1129 Adapter
->AutoSyncup
= FALSE
;
1131 pr_info(DRV_NAME
": AutoSyncup is Enabled\n");
1132 Adapter
->AutoSyncup
= TRUE
;
1135 if (ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
) & AUTO_LINKUP_ENABLE
) {
1136 pr_info(DRV_NAME
": Enabling autolink up");
1137 Adapter
->AutoLinkUp
= TRUE
;
1139 pr_info(DRV_NAME
": Disabling autolink up");
1140 Adapter
->AutoLinkUp
= FALSE
;
1142 /* Setting the DDR Setting.. */
1143 Adapter
->DDRSetting
= (ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
) >> 8)&0x0F;
1144 Adapter
->ulPowerSaveMode
= (ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
)>>12)&0x0F;
1145 pr_info(DRV_NAME
": DDR Setting: %x\n", Adapter
->DDRSetting
);
1146 pr_info(DRV_NAME
": Power Save Mode: %lx\n", Adapter
->ulPowerSaveMode
);
1147 if (ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
) & AUTO_FIRM_DOWNLOAD
) {
1148 pr_info(DRV_NAME
": Enabling Auto Firmware Download\n");
1149 Adapter
->AutoFirmDld
= TRUE
;
1151 pr_info(DRV_NAME
": Disabling Auto Firmware Download\n");
1152 Adapter
->AutoFirmDld
= FALSE
;
1154 uiHostDrvrCfg6
= ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
);
1155 Adapter
->bMipsConfig
= (uiHostDrvrCfg6
>>20)&0x01;
1156 pr_info(DRV_NAME
": MIPSConfig : 0x%X\n", Adapter
->bMipsConfig
);
1157 /* used for backward compatibility. */
1158 Adapter
->bDPLLConfig
= (uiHostDrvrCfg6
>>19)&0x01;
1159 Adapter
->PmuMode
= (uiHostDrvrCfg6
>> 24) & 0x03;
1160 pr_info(DRV_NAME
": PMU MODE: %x", Adapter
->PmuMode
);
1162 if ((uiHostDrvrCfg6
>> HOST_BUS_SUSPEND_BIT
) & (0x01)) {
1163 Adapter
->bDoSuspend
= TRUE
;
1164 pr_info(DRV_NAME
": Making DoSuspend TRUE as per configFile");
1167 uiEEPROMFlag
= ntohl(Adapter
->pstargetparams
->m_u32EEPROMFlag
);
1168 pr_info(DRV_NAME
": uiEEPROMFlag : 0x%X\n", uiEEPROMFlag
);
1169 Adapter
->eNVMType
= (NVM_TYPE
)((uiEEPROMFlag
>>4)&0x3);
1170 Adapter
->bStatusWrite
= (uiEEPROMFlag
>>6)&0x1;
1171 Adapter
->uiSectorSizeInCFG
= 1024*(0xFFFF & ntohl(Adapter
->pstargetparams
->HostDrvrConfig4
));
1172 Adapter
->bSectorSizeOverride
= (bool) ((ntohl(Adapter
->pstargetparams
->HostDrvrConfig4
))>>16)&0x1;
1174 if (ntohl(Adapter
->pstargetparams
->m_u32PowerSavingModeOptions
) & 0x01)
1175 Adapter
->ulPowerSaveMode
= DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
;
1177 if (Adapter
->ulPowerSaveMode
!= DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
)
1178 doPowerAutoCorrection(Adapter
);
1181 static VOID
doPowerAutoCorrection(PMINI_ADAPTER psAdapter
)
1183 UINT reporting_mode
;
1185 reporting_mode
= ntohl(psAdapter
->pstargetparams
->m_u32PowerSavingModeOptions
) & 0x02;
1186 psAdapter
->bIsAutoCorrectEnabled
= !((char)(psAdapter
->ulPowerSaveMode
>> 3) & 0x1);
1188 if (reporting_mode
== TRUE
) {
1189 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "can't do suspen/resume as reporting mode is enable");
1190 psAdapter
->bDoSuspend
= FALSE
;
1193 if (psAdapter
->bIsAutoCorrectEnabled
&& (psAdapter
->chip_id
>= T3LPB
)) {
1194 /* If reporting mode is enable, switch PMU to PMC */
1196 psAdapter
->ulPowerSaveMode
= DEVICE_POWERSAVE_MODE_AS_PMU_CLOCK_GATING
;
1197 psAdapter
->bDoSuspend
= FALSE
;
1200 /* clearing space bit[15..12] */
1201 psAdapter
->pstargetparams
->HostDrvrConfig6
&= ~(htonl((0xF << 12)));
1202 /* placing the power save mode option */
1203 psAdapter
->pstargetparams
->HostDrvrConfig6
|= htonl((psAdapter
->ulPowerSaveMode
<< 12));
1204 } else if (psAdapter
->bIsAutoCorrectEnabled
== FALSE
) {
1205 /* remove the autocorrect disable bit set before dumping. */
1206 psAdapter
->ulPowerSaveMode
&= ~(1 << 3);
1207 psAdapter
->pstargetparams
->HostDrvrConfig6
&= ~(htonl(1 << 15));
1208 BCM_DEBUG_PRINT(psAdapter
, DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Using Forced User Choice: %lx\n", psAdapter
->ulPowerSaveMode
);
1213 static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter
, ulong dwAddress
)
1215 int status
= 0, i
= 0;
1216 unsigned int temp
= 0;
1217 unsigned char *pucmacaddr
= kmalloc(MAC_ADDRESS_SIZE
, GFP_KERNEL
);
1220 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "No Buffers to Read the EEPROM Address\n");
1224 dwAddress
|= 0x5b000000;
1225 status
= wrmalt(Adapter
, EEPROM_COMMAND_Q_REG
, (PUINT
)&dwAddress
, sizeof(UINT
));
1226 if (status
!= STATUS_SUCCESS
) {
1227 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "wrm Failed..\n");
1233 for (i
= 0; i
< MAC_ADDRESS_SIZE
; i
++) {
1234 status
= rdmalt(Adapter
, EEPROM_READ_DATA_Q_REG
, &temp
, sizeof(temp
));
1235 if (status
!= STATUS_SUCCESS
) {
1236 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "rdm Failed..\n");
1241 pucmacaddr
[i
] = temp
& 0xff;
1242 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_INITEXIT
, DRV_ENTRY
, DBG_LVL_ALL
, "%x\n", pucmacaddr
[i
]);
1249 static void convertEndian(B_UINT8 rwFlag
, PUINT puiBuffer
, UINT uiByteCount
)
1253 if (RWM_WRITE
== rwFlag
) {
1254 for (uiIndex
= 0; uiIndex
< (uiByteCount
/sizeof(UINT
)); uiIndex
++)
1255 puiBuffer
[uiIndex
] = htonl(puiBuffer
[uiIndex
]);
1257 for (uiIndex
= 0; uiIndex
< (uiByteCount
/sizeof(UINT
)); uiIndex
++)
1258 puiBuffer
[uiIndex
] = ntohl(puiBuffer
[uiIndex
]);
1262 #define CACHE_ADDRESS_MASK 0x80000000
1263 #define UNCACHE_ADDRESS_MASK 0xa0000000
1265 int rdm(PMINI_ADAPTER Adapter
, UINT uiAddress
, PCHAR pucBuff
, size_t sSize
)
1267 return Adapter
->interface_rdm(Adapter
->pvInterfaceAdapter
,
1268 uiAddress
, pucBuff
, sSize
);
1271 int wrm(PMINI_ADAPTER Adapter
, UINT uiAddress
, PCHAR pucBuff
, size_t sSize
)
1275 iRetVal
= Adapter
->interface_wrm(Adapter
->pvInterfaceAdapter
,
1276 uiAddress
, pucBuff
, sSize
);
1280 int wrmalt(PMINI_ADAPTER Adapter
, UINT uiAddress
, PUINT pucBuff
, size_t size
)
1282 convertEndian(RWM_WRITE
, pucBuff
, size
);
1283 return wrm(Adapter
, uiAddress
, (PUCHAR
)pucBuff
, size
);
1286 int rdmalt(PMINI_ADAPTER Adapter
, UINT uiAddress
, PUINT pucBuff
, size_t size
)
1290 uiRetVal
= rdm(Adapter
, uiAddress
, (PUCHAR
)pucBuff
, size
);
1291 convertEndian(RWM_READ
, (PUINT
)pucBuff
, size
);
1296 int wrmWithLock(PMINI_ADAPTER Adapter
, UINT uiAddress
, PCHAR pucBuff
, size_t sSize
)
1298 INT status
= STATUS_SUCCESS
;
1299 down(&Adapter
->rdmwrmsync
);
1301 if ((Adapter
->IdleMode
== TRUE
) ||
1302 (Adapter
->bShutStatus
== TRUE
) ||
1303 (Adapter
->bPreparingForLowPowerMode
== TRUE
)) {
1309 status
= wrm(Adapter
, uiAddress
, pucBuff
, sSize
);
1311 up(&Adapter
->rdmwrmsync
);
1315 int wrmaltWithLock(PMINI_ADAPTER Adapter
, UINT uiAddress
, PUINT pucBuff
, size_t size
)
1317 int iRetVal
= STATUS_SUCCESS
;
1319 down(&Adapter
->rdmwrmsync
);
1321 if ((Adapter
->IdleMode
== TRUE
) ||
1322 (Adapter
->bShutStatus
== TRUE
) ||
1323 (Adapter
->bPreparingForLowPowerMode
== TRUE
)) {
1329 iRetVal
= wrmalt(Adapter
, uiAddress
, pucBuff
, size
);
1331 up(&Adapter
->rdmwrmsync
);
1335 int rdmaltWithLock(PMINI_ADAPTER Adapter
, UINT uiAddress
, PUINT pucBuff
, size_t size
)
1337 INT uiRetVal
= STATUS_SUCCESS
;
1339 down(&Adapter
->rdmwrmsync
);
1340 if ((Adapter
->IdleMode
== TRUE
) ||
1341 (Adapter
->bShutStatus
== TRUE
) ||
1342 (Adapter
->bPreparingForLowPowerMode
== TRUE
)) {
1348 uiRetVal
= rdmalt(Adapter
, uiAddress
, pucBuff
, size
);
1350 up(&Adapter
->rdmwrmsync
);
1354 static VOID
HandleShutDownModeWakeup(PMINI_ADAPTER Adapter
)
1356 int clear_abort_pattern
= 0, Status
= 0;
1357 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "====>\n");
1358 /* target has woken up From Shut Down */
1359 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "Clearing Shut Down Software abort pattern\n");
1360 Status
= wrmalt(Adapter
, SW_ABORT_IDLEMODE_LOC
, (PUINT
)&clear_abort_pattern
, sizeof(clear_abort_pattern
));
1362 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "WRM to SW_ABORT_IDLEMODE_LOC failed with err:%d", Status
);
1366 if (Adapter
->ulPowerSaveMode
!= DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
) {
1368 InterfaceHandleShutdownModeWakeup(Adapter
);
1372 if (Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
) {
1373 Adapter
->DriverState
= NO_NETWORK_ENTRY
;
1374 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
1377 Adapter
->bTriedToWakeUpFromlowPowerMode
= FALSE
;
1378 Adapter
->bShutStatus
= FALSE
;
1379 wake_up(&Adapter
->lowpower_mode_wait_queue
);
1380 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "<====\n");
1383 static VOID
SendShutModeResponse(PMINI_ADAPTER Adapter
)
1385 CONTROL_MESSAGE stShutdownResponse
;
1386 UINT NVMAccess
= 0, lowPwrAbortMsg
= 0;
1389 memset(&stShutdownResponse
, 0, sizeof(CONTROL_MESSAGE
));
1390 stShutdownResponse
.Leader
.Status
= LINK_UP_CONTROL_REQ
;
1391 stShutdownResponse
.Leader
.PLength
= 8; /* 8 bytes; */
1392 stShutdownResponse
.szData
[0] = LINK_UP_ACK
;
1393 stShutdownResponse
.szData
[1] = LINK_SHUTDOWN_REQ_FROM_FIRMWARE
;
1395 /*********************************
1397 * if [ semaphore is available ]
1398 * acquire semaphone and return value 0 ;
1400 * return non-zero value ;
1402 ***********************************/
1404 NVMAccess
= down_trylock(&Adapter
->NVMRdmWrmLock
);
1405 lowPwrAbortMsg
= down_trylock(&Adapter
->LowPowerModeSync
);
1407 if (NVMAccess
|| lowPwrAbortMsg
|| atomic_read(&Adapter
->TotalPacketCount
)) {
1409 up(&Adapter
->NVMRdmWrmLock
);
1411 if (!lowPwrAbortMsg
)
1412 up(&Adapter
->LowPowerModeSync
);
1414 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "Device Access is going on NACK the Shut Down MODE\n");
1415 stShutdownResponse
.szData
[2] = SHUTDOWN_NACK_FROM_DRIVER
; /* NACK- device access is going on. */
1416 Adapter
->bPreparingForLowPowerMode
= FALSE
;
1418 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "Sending SHUTDOWN MODE ACK\n");
1419 stShutdownResponse
.szData
[2] = SHUTDOWN_ACK_FROM_DRIVER
; /* ShutDown ACK */
1421 /* Wait for the LED to TURN OFF before sending ACK response */
1422 if (Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
) {
1425 /* Wake the LED Thread with LOWPOWER_MODE_ENTER State */
1426 Adapter
->DriverState
= LOWPOWER_MODE_ENTER
;
1427 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
1429 /* Wait for 1 SEC for LED to OFF */
1430 iRetVal
= wait_event_timeout(Adapter
->LEDInfo
.idleModeSyncEvent
, Adapter
->LEDInfo
.bIdle_led_off
, msecs_to_jiffies(1000));
1432 /* If Timed Out to Sync IDLE MODE Enter, do IDLE mode Exit and Send NACK to device */
1434 stShutdownResponse
.szData
[1] = SHUTDOWN_NACK_FROM_DRIVER
; /* NACK- device access is going on. */
1435 Adapter
->DriverState
= NO_NETWORK_ENTRY
;
1436 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
1440 if (stShutdownResponse
.szData
[2] == SHUTDOWN_ACK_FROM_DRIVER
) {
1441 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "ACKING SHUTDOWN MODE !!!!!!!!!");
1442 down(&Adapter
->rdmwrmsync
);
1443 Adapter
->bPreparingForLowPowerMode
= TRUE
;
1444 up(&Adapter
->rdmwrmsync
);
1445 /* Killing all URBS. */
1446 if (Adapter
->bDoSuspend
== TRUE
)
1447 Bcm_kill_all_URBs((PS_INTERFACE_ADAPTER
)(Adapter
->pvInterfaceAdapter
));
1449 Adapter
->bPreparingForLowPowerMode
= FALSE
;
1453 up(&Adapter
->NVMRdmWrmLock
);
1455 if (!lowPwrAbortMsg
)
1456 up(&Adapter
->LowPowerModeSync
);
1459 Status
= CopyBufferToControlPacket(Adapter
, &stShutdownResponse
);
1460 if ((Status
!= STATUS_SUCCESS
)) {
1461 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "fail to send the Idle mode Request\n");
1462 Adapter
->bPreparingForLowPowerMode
= FALSE
;
1463 StartInterruptUrb((PS_INTERFACE_ADAPTER
)(Adapter
->pvInterfaceAdapter
));
1467 static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter
, PUCHAR pucBuffer
)
1469 B_UINT32 uiResetValue
= 0;
1471 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "====>\n");
1473 if (*(pucBuffer
+1) == COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW
) {
1474 HandleShutDownModeWakeup(Adapter
);
1475 } else if (*(pucBuffer
+1) == LINK_SHUTDOWN_REQ_FROM_FIRMWARE
) {
1476 /* Target wants to go to Shut Down Mode */
1477 /* InterfacePrepareForShutdown(Adapter); */
1478 if (Adapter
->chip_id
== BCS220_2
||
1479 Adapter
->chip_id
== BCS220_2BC
||
1480 Adapter
->chip_id
== BCS250_BC
||
1481 Adapter
->chip_id
== BCS220_3
) {
1483 rdmalt(Adapter
, HPM_CONFIG_MSW
, &uiResetValue
, 4);
1484 uiResetValue
|= (1<<17);
1485 wrmalt(Adapter
, HPM_CONFIG_MSW
, &uiResetValue
, 4);
1488 SendShutModeResponse(Adapter
);
1489 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "ShutDownModeResponse:Notification received: Sending the response(Ack/Nack)\n");
1492 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "<====\n");
1496 VOID
ResetCounters(PMINI_ADAPTER Adapter
)
1498 beceem_protocol_reset(Adapter
);
1499 Adapter
->CurrNumRecvDescs
= 0;
1500 Adapter
->PrevNumRecvDescs
= 0;
1501 Adapter
->LinkUpStatus
= 0;
1502 Adapter
->LinkStatus
= 0;
1503 atomic_set(&Adapter
->cntrlpktCnt
, 0);
1504 atomic_set(&Adapter
->TotalPacketCount
, 0);
1505 Adapter
->fw_download_done
= FALSE
;
1506 Adapter
->LinkStatus
= 0;
1507 Adapter
->AutoLinkUp
= FALSE
;
1508 Adapter
->IdleMode
= FALSE
;
1509 Adapter
->bShutStatus
= FALSE
;
1512 S_CLASSIFIER_RULE
*GetFragIPClsEntry(PMINI_ADAPTER Adapter
, USHORT usIpIdentification
, ULONG SrcIP
)
1515 for (uiIndex
= 0; uiIndex
< MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES
; uiIndex
++) {
1516 if ((Adapter
->astFragmentedPktClassifierTable
[uiIndex
].bUsed
) &&
1517 (Adapter
->astFragmentedPktClassifierTable
[uiIndex
].usIpIdentification
== usIpIdentification
) &&
1518 (Adapter
->astFragmentedPktClassifierTable
[uiIndex
].ulSrcIpAddress
== SrcIP
) &&
1519 !Adapter
->astFragmentedPktClassifierTable
[uiIndex
].bOutOfOrderFragment
)
1521 return Adapter
->astFragmentedPktClassifierTable
[uiIndex
].pstMatchedClassifierEntry
;
1526 void AddFragIPClsEntry(PMINI_ADAPTER Adapter
, PS_FRAGMENTED_PACKET_INFO psFragPktInfo
)
1529 for (uiIndex
= 0; uiIndex
< MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES
; uiIndex
++) {
1530 if (!Adapter
->astFragmentedPktClassifierTable
[uiIndex
].bUsed
) {
1531 memcpy(&Adapter
->astFragmentedPktClassifierTable
[uiIndex
], psFragPktInfo
, sizeof(S_FRAGMENTED_PACKET_INFO
));
1537 void DelFragIPClsEntry(PMINI_ADAPTER Adapter
, USHORT usIpIdentification
, ULONG SrcIp
)
1540 for (uiIndex
= 0; uiIndex
< MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES
; uiIndex
++) {
1541 if ((Adapter
->astFragmentedPktClassifierTable
[uiIndex
].bUsed
) &&
1542 (Adapter
->astFragmentedPktClassifierTable
[uiIndex
].usIpIdentification
== usIpIdentification
) &&
1543 (Adapter
->astFragmentedPktClassifierTable
[uiIndex
].ulSrcIpAddress
== SrcIp
))
1545 memset(&Adapter
->astFragmentedPktClassifierTable
[uiIndex
], 0, sizeof(S_FRAGMENTED_PACKET_INFO
));
1549 void update_per_cid_rx(PMINI_ADAPTER Adapter
)
1553 if ((jiffies
- Adapter
->liDrainCalculated
) < XSECONDS
)
1556 for (qindex
= 0; qindex
< HiPriority
; qindex
++) {
1557 if (Adapter
->PackInfo
[qindex
].ucDirection
== 0) {
1558 Adapter
->PackInfo
[qindex
].uiCurrentRxRate
=
1559 (Adapter
->PackInfo
[qindex
].uiCurrentRxRate
+
1560 Adapter
->PackInfo
[qindex
].uiThisPeriodRxBytes
) / 2;
1562 Adapter
->PackInfo
[qindex
].uiThisPeriodRxBytes
= 0;
1564 Adapter
->PackInfo
[qindex
].uiCurrentDrainRate
=
1565 (Adapter
->PackInfo
[qindex
].uiCurrentDrainRate
+
1566 Adapter
->PackInfo
[qindex
].uiThisPeriodSentBytes
) / 2;
1567 Adapter
->PackInfo
[qindex
].uiThisPeriodSentBytes
= 0;
1570 Adapter
->liDrainCalculated
= jiffies
;
1573 void update_per_sf_desc_cnts(PMINI_ADAPTER Adapter
)
1576 u32 uibuff
[MAX_TARGET_DSX_BUFFERS
];
1578 if (!atomic_read(&Adapter
->uiMBupdate
))
1581 if (rdmaltWithLock(Adapter
, TARGET_SFID_TXDESC_MAP_LOC
, (PUINT
)uibuff
, sizeof(UINT
) * MAX_TARGET_DSX_BUFFERS
) < 0) {
1582 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "rdm failed\n");
1586 for (iIndex
= 0; iIndex
< HiPriority
; iIndex
++) {
1587 if (Adapter
->PackInfo
[iIndex
].bValid
&& Adapter
->PackInfo
[iIndex
].ucDirection
) {
1588 if (Adapter
->PackInfo
[iIndex
].usVCID_Value
< MAX_TARGET_DSX_BUFFERS
)
1589 atomic_set(&Adapter
->PackInfo
[iIndex
].uiPerSFTxResourceCount
, uibuff
[Adapter
->PackInfo
[iIndex
].usVCID_Value
]);
1591 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_PRINTK
, 0, 0, "Invalid VCID : %x\n", Adapter
->PackInfo
[iIndex
].usVCID_Value
);
1594 atomic_set(&Adapter
->uiMBupdate
, FALSE
);
1597 void flush_queue(PMINI_ADAPTER Adapter
, UINT iQIndex
)
1599 struct sk_buff
*PacketToDrop
= NULL
;
1600 struct net_device_stats
*netstats
= &Adapter
->dev
->stats
;
1601 spin_lock_bh(&Adapter
->PackInfo
[iQIndex
].SFQueueLock
);
1603 while (Adapter
->PackInfo
[iQIndex
].FirstTxQueue
&& atomic_read(&Adapter
->TotalPacketCount
)) {
1604 PacketToDrop
= Adapter
->PackInfo
[iQIndex
].FirstTxQueue
;
1605 if (PacketToDrop
&& PacketToDrop
->len
) {
1606 netstats
->tx_dropped
++;
1607 DEQUEUEPACKET(Adapter
->PackInfo
[iQIndex
].FirstTxQueue
, Adapter
->PackInfo
[iQIndex
].LastTxQueue
);
1608 Adapter
->PackInfo
[iQIndex
].uiCurrentPacketsOnHost
--;
1609 Adapter
->PackInfo
[iQIndex
].uiCurrentBytesOnHost
-= PacketToDrop
->len
;
1611 /* Adding dropped statistics */
1612 Adapter
->PackInfo
[iQIndex
].uiDroppedCountBytes
+= PacketToDrop
->len
;
1613 Adapter
->PackInfo
[iQIndex
].uiDroppedCountPackets
++;
1614 dev_kfree_skb(PacketToDrop
);
1615 atomic_dec(&Adapter
->TotalPacketCount
);
1618 spin_unlock_bh(&Adapter
->PackInfo
[iQIndex
].SFQueueLock
);
1621 static void beceem_protocol_reset(PMINI_ADAPTER Adapter
)
1624 if (netif_msg_link(Adapter
))
1625 pr_notice(PFX
"%s: protocol reset\n", Adapter
->dev
->name
);
1627 netif_carrier_off(Adapter
->dev
);
1628 netif_stop_queue(Adapter
->dev
);
1630 Adapter
->IdleMode
= FALSE
;
1631 Adapter
->LinkUpStatus
= FALSE
;
1632 ClearTargetDSXBuffer(Adapter
, 0, TRUE
);
1633 /* Delete All Classifier Rules */
1635 for (i
= 0; i
< HiPriority
; i
++)
1636 DeleteAllClassifiersForSF(Adapter
, i
);
1638 flush_all_queues(Adapter
);
1640 if (Adapter
->TimerActive
== TRUE
)
1641 Adapter
->TimerActive
= FALSE
;
1643 memset(Adapter
->astFragmentedPktClassifierTable
, 0, sizeof(S_FRAGMENTED_PACKET_INFO
) * MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES
);
1645 for (i
= 0; i
< HiPriority
; i
++) {
1646 /* resetting only the first size (S_MIBS_SERVICEFLOW_TABLE) for the SF. */
1647 /* It is same between MIBs and SF. */
1648 memset(&Adapter
->PackInfo
[i
].stMibsExtServiceFlowTable
, 0, sizeof(S_MIBS_EXTSERVICEFLOW_PARAMETERS
));