3 static int BcmFileDownload(PMINI_ADAPTER Adapter
, const char *path
,
5 static VOID
doPowerAutoCorrection(PMINI_ADAPTER psAdapter
);
6 static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter
,PUCHAR pucBuffer
);
7 static int bcm_parse_target_params(PMINI_ADAPTER Adapter
);
8 static void beceem_protocol_reset (PMINI_ADAPTER Adapter
);
10 static VOID
default_wimax_protocol_initialize(PMINI_ADAPTER Adapter
)
15 for(uiLoopIndex
=0; uiLoopIndex
< NO_OF_QUEUES
-1; uiLoopIndex
++)
17 Adapter
->PackInfo
[uiLoopIndex
].uiThreshold
=TX_PACKET_THRESHOLD
;
18 Adapter
->PackInfo
[uiLoopIndex
].uiMaxAllowedRate
=MAX_ALLOWED_RATE
;
19 Adapter
->PackInfo
[uiLoopIndex
].uiMaxBucketSize
=20*1024*1024;
22 Adapter
->BEBucketSize
=BE_BUCKET_SIZE
;
23 Adapter
->rtPSBucketSize
=rtPS_BUCKET_SIZE
;
24 Adapter
->LinkStatus
=SYNC_UP_REQUEST
;
25 Adapter
->TransferMode
=IP_PACKET_ONLY_MODE
;
26 Adapter
->usBestEffortQueueIndex
=-1;
32 InitAdapter(PMINI_ADAPTER psAdapter
)
35 INT Status
= STATUS_SUCCESS
;
36 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Initialising Adapter = %p", psAdapter
);
40 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Adapter is NULL");
44 sema_init(&psAdapter
->NVMRdmWrmLock
,1);
45 // psAdapter->ulFlashCalStart = FLASH_AUTO_INIT_BASE_ADDR;
47 sema_init(&psAdapter
->rdmwrmsync
, 1);
48 spin_lock_init(&psAdapter
->control_queue_lock
);
49 spin_lock_init(&psAdapter
->txtransmitlock
);
50 sema_init(&psAdapter
->RxAppControlQueuelock
, 1);
51 // sema_init(&psAdapter->data_packet_queue_lock, 1);
52 sema_init(&psAdapter
->fw_download_sema
, 1);
53 sema_init(&psAdapter
->LowPowerModeSync
,1);
55 // spin_lock_init(&psAdapter->sleeper_lock);
57 for(i
=0;i
<NO_OF_QUEUES
; i
++)
58 spin_lock_init(&psAdapter
->PackInfo
[i
].SFQueueLock
);
61 init_waitqueue_head(&psAdapter
->process_rx_cntrlpkt
);
62 init_waitqueue_head(&psAdapter
->tx_packet_wait_queue
);
63 init_waitqueue_head(&psAdapter
->process_read_wait_queue
);
64 init_waitqueue_head(&psAdapter
->ioctl_fw_dnld_wait_queue
);
65 init_waitqueue_head(&psAdapter
->lowpower_mode_wait_queue
);
66 psAdapter
->waiting_to_fw_download_done
= TRUE
;
67 //init_waitqueue_head(&psAdapter->device_wake_queue);
68 psAdapter
->fw_download_done
=FALSE
;
71 default_wimax_protocol_initialize(psAdapter
);
72 for (i
=0;i
<MAX_CNTRL_PKTS
;i
++)
74 psAdapter
->txctlpacket
[i
] = kmalloc(MAX_CNTL_PKT_SIZE
, GFP_KERNEL
);
75 if(!psAdapter
->txctlpacket
[i
])
77 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "No More Cntl pkts got, max got is %d", i
);
81 if(AllocAdapterDsxBuffer(psAdapter
))
83 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Failed to allocate DSX buffers");
87 //Initialize PHS interface
88 if(phs_init(&psAdapter
->stBCMPhsContext
,psAdapter
)!=0)
90 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
,"%s:%s:%d:Error PHS Init Failed=====>\n", __FILE__
, __FUNCTION__
, __LINE__
);
94 Status
= BcmAllocFlashCSStructure(psAdapter
);
97 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
,"Memory Allocation for Flash structure failed");
101 Status
= vendorextnInit(psAdapter
);
103 if(STATUS_SUCCESS
!= Status
)
105 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
,"Vendor Init Failed");
109 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Adapter initialised");
112 return STATUS_SUCCESS
;
115 VOID
AdapterFree(PMINI_ADAPTER Adapter
)
119 beceem_protocol_reset(Adapter
);
121 vendorextnExit(Adapter
);
123 if(Adapter
->control_packet_handler
&& !IS_ERR(Adapter
->control_packet_handler
))
124 kthread_stop (Adapter
->control_packet_handler
);
126 if(Adapter
->transmit_packet_thread
&& !IS_ERR(Adapter
->transmit_packet_thread
))
127 kthread_stop (Adapter
->transmit_packet_thread
);
129 wake_up(&Adapter
->process_read_wait_queue
);
131 if(Adapter
->LEDInfo
.led_thread_running
& (BCM_LED_THREAD_RUNNING_ACTIVELY
| BCM_LED_THREAD_RUNNING_INACTIVELY
))
132 kthread_stop (Adapter
->LEDInfo
.led_cntrl_threadid
);
134 unregister_networkdev(Adapter
);
136 /* FIXME: use proper wait_event and refcounting */
137 while(atomic_read(&Adapter
->ApplicationRunning
))
139 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Waiting for Application to close.. %d\n",atomic_read(&Adapter
->ApplicationRunning
));
142 unregister_control_device_interface(Adapter
);
144 kfree(Adapter
->pstargetparams
);
146 for (count
=0;count
< MAX_CNTRL_PKTS
;count
++)
147 kfree(Adapter
->txctlpacket
[count
]);
149 FreeAdapterDsxBuffer(Adapter
);
151 kfree(Adapter
->pvInterfaceAdapter
);
153 //Free the PHS Interface
154 PhsCleanup(&Adapter
->stBCMPhsContext
);
156 BcmDeAllocFlashCSStructure(Adapter
);
158 free_netdev(Adapter
->dev
);
161 static int create_worker_threads(PMINI_ADAPTER psAdapter
)
163 // Rx Control Packets Processing
164 psAdapter
->control_packet_handler
= kthread_run((int (*)(void *))
165 control_packet_handler
, psAdapter
, "%s-rx", DRV_NAME
);
166 if(IS_ERR(psAdapter
->control_packet_handler
))
168 pr_notice(DRV_NAME
": could not create control thread\n");
169 return PTR_ERR(psAdapter
->control_packet_handler
);
173 psAdapter
->transmit_packet_thread
= kthread_run((int (*)(void *))
174 tx_pkt_handler
, psAdapter
, "%s-tx", DRV_NAME
);
175 if(IS_ERR (psAdapter
->transmit_packet_thread
))
177 pr_notice(DRV_NAME
": could not creat transmit thread\n");
178 kthread_stop(psAdapter
->control_packet_handler
);
179 return PTR_ERR(psAdapter
->transmit_packet_thread
);
184 static struct file
*open_firmware_file(PMINI_ADAPTER Adapter
, const char *path
)
186 struct file
*flp
=NULL
;
190 flp
=filp_open(path
, O_RDONLY
, S_IRWXU
);
194 pr_err(DRV_NAME
"Unable To Open File %s, err %ld",
199 if(Adapter
->device_removed
)
206 static int BcmFileDownload(PMINI_ADAPTER Adapter
,/**< Logical Adapter */
207 const char *path
, /**< path to image file */
208 unsigned int loc
/**< Download Address on the chip*/
212 struct file
*flp
=NULL
;
214 struct timeval tv
={0};
216 flp
=open_firmware_file(Adapter
, path
);
220 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Unable to Open %s\n", path
);
223 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
);
224 do_gettimeofday(&tv
);
226 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "download start %lx", ((tv
.tv_sec
* 1000) +
228 if(Adapter
->bcm_file_download(Adapter
->pvInterfaceAdapter
, flp
, loc
))
230 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Failed to download the firmware with error\
235 oldfs
=get_fs();set_fs(get_ds());
236 vfs_llseek(flp
, 0, 0);
238 if(Adapter
->bcm_file_readback_from_chip(Adapter
->pvInterfaceAdapter
,
241 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Failed to read back firmware!");
247 oldfs
=get_fs();set_fs(get_ds());
248 if(flp
&& !(IS_ERR(flp
)))
249 filp_close(flp
, current
->files
);
256 @ingroup ctrl_pkt_functions
257 This function copies the contents of given buffer
258 to the control packet and queues it for transmission.
259 @note Do not acquire the spinock, as it it already acquired.
260 @return SUCCESS/FAILURE.
262 INT
CopyBufferToControlPacket(PMINI_ADAPTER Adapter
,/**<Logical Adapter*/
263 PVOID ioBuffer
/**<Control Packet Buffer*/
266 PLEADER pLeader
=NULL
;
268 unsigned char *ctrl_buff
=NULL
;
270 PLINK_REQUEST pLinkReq
= NULL
;
271 PUCHAR pucAddIndication
= NULL
;
273 BCM_DEBUG_PRINT( Adapter
,DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "======>");
276 BCM_DEBUG_PRINT( Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
, "Got Null Buffer\n");
280 pLinkReq
= (PLINK_REQUEST
)ioBuffer
;
281 pLeader
=(PLEADER
)ioBuffer
; //ioBuffer Contains sw_Status and Payload
283 if(Adapter
->bShutStatus
== TRUE
&&
284 pLinkReq
->szData
[0] == LINK_DOWN_REQ_PAYLOAD
&&
285 pLinkReq
->szData
[1] == LINK_SYNC_UP_SUBTYPE
)
287 //Got sync down in SHUTDOWN..we could not process this.
288 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
, "SYNC DOWN Request in Shut Down Mode..\n");
289 return STATUS_FAILURE
;
292 if((pLeader
->Status
== LINK_UP_CONTROL_REQ
) &&
293 ((pLinkReq
->szData
[0] == LINK_UP_REQ_PAYLOAD
&&
294 (pLinkReq
->szData
[1] == LINK_SYNC_UP_SUBTYPE
)) ||//Sync Up Command
295 pLinkReq
->szData
[0] == NETWORK_ENTRY_REQ_PAYLOAD
)) //Net Entry Command
297 if(Adapter
->LinkStatus
> PHY_SYNC_ACHIVED
)
299 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
,"LinkStatus is Greater than PHY_SYN_ACHIEVED");
300 return STATUS_FAILURE
;
302 if(TRUE
== Adapter
->bShutStatus
)
304 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
, "SYNC UP IN SHUTDOWN..Device WakeUp\n");
305 if(Adapter
->bTriedToWakeUpFromlowPowerMode
== FALSE
)
307 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
, "Waking up for the First Time..\n");
308 Adapter
->usIdleModePattern
= ABORT_SHUTDOWN_MODE
; // change it to 1 for current support.
309 Adapter
->bWakeUpDevice
= TRUE
;
310 wake_up(&Adapter
->process_rx_cntrlpkt
);
312 Status
= wait_event_interruptible_timeout(Adapter
->lowpower_mode_wait_queue
,
313 !Adapter
->bShutStatus
, (5 * HZ
));
315 if(Status
== -ERESTARTSYS
)
318 if(Adapter
->bShutStatus
)
320 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
, "Shutdown Mode Wake up Failed - No Wake Up Received\n");
321 return STATUS_FAILURE
;
326 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
, "Wakeup has been tried already...\n");
331 if(TRUE
== Adapter
->IdleMode
)
333 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Device is in Idle mode ... hence \n");
334 if(pLeader
->Status
== LINK_UP_CONTROL_REQ
|| pLeader
->Status
== 0x80 ||
335 pLeader
->Status
== CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ
)
338 if((pLeader
->Status
== LINK_UP_CONTROL_REQ
) && (pLinkReq
->szData
[0]==LINK_DOWN_REQ_PAYLOAD
))
340 if((pLinkReq
->szData
[1] == LINK_SYNC_DOWN_SUBTYPE
))
342 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
, "Link Down Sent in Idle Mode\n");
343 Adapter
->usIdleModePattern
= ABORT_IDLE_SYNCDOWN
;//LINK DOWN sent in Idle Mode
347 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
,"ABORT_IDLE_MODE pattern is being written\n");
348 Adapter
->usIdleModePattern
= ABORT_IDLE_REG
;
353 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
,"ABORT_IDLE_MODE pattern is being written\n");
354 Adapter
->usIdleModePattern
= ABORT_IDLE_MODE
;
357 /*Setting bIdleMode_tx_from_host to TRUE to indicate LED control thread to represent
358 the wake up from idlemode is from host*/
359 //Adapter->LEDInfo.bIdleMode_tx_from_host = TRUE;
360 Adapter
->bWakeUpDevice
= TRUE
;
361 wake_up(&Adapter
->process_rx_cntrlpkt
);
365 if(LINK_DOWN_REQ_PAYLOAD
== pLinkReq
->szData
[0])
367 // We should not send DREG message down while in idlemode.
368 return STATUS_SUCCESS
;
371 Status
= wait_event_interruptible_timeout(Adapter
->lowpower_mode_wait_queue
,
372 !Adapter
->IdleMode
, (5 * HZ
));
374 if(Status
== -ERESTARTSYS
)
377 if(Adapter
->IdleMode
)
379 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
, "Idle Mode Wake up Failed - No Wake Up Received\n");
380 return STATUS_FAILURE
;
384 return STATUS_SUCCESS
;
386 //The Driver has to send control messages with a particular VCID
387 pLeader
->Vcid
= VCID_CONTROL_PACKET
;//VCID for control packet.
389 /* Allocate skb for Control Packet */
390 pktlen
= pLeader
->PLength
;
391 ctrl_buff
= (char *)Adapter
->txctlpacket
[atomic_read(&Adapter
->index_wr_txcntrlpkt
)%MAX_CNTRL_PKTS
];
393 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",
394 atomic_read(&Adapter
->index_wr_txcntrlpkt
), ctrl_buff
, ioBuffer
, pktlen
);
399 if((pLeader
->Status
== 0x80) ||
400 (pLeader
->Status
== CM_CONTROL_NEWDSX_MULTICLASSIFIER_REQ
))
403 //Restructure the DSX message to handle Multiple classifier Support
404 // Write the Service Flow param Structures directly to the target
405 //and embed the pointers in the DSX messages sent to target.
407 //Lets store the current length of the control packet we are transmitting
408 pucAddIndication
= (PUCHAR
)ioBuffer
+ LEADER_SIZE
;
409 pktlen
= pLeader
->PLength
;
410 Status
= StoreCmControlResponseMessage(Adapter
,pucAddIndication
, &pktlen
);
413 ClearTargetDSXBuffer(Adapter
,((stLocalSFAddIndicationAlt
*)pucAddIndication
)->u16TID
, FALSE
);
414 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 ");
415 return STATUS_FAILURE
;
418 //update the leader to use the new length
419 //The length of the control packet is length of message being sent + Leader length
421 pLeader
->PLength
= pktlen
;
424 memset(ctrl_buff
, 0, pktlen
+LEADER_SIZE
);
425 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Copying the Control Packet Buffer with length=%d\n", pLeader
->PLength
);
426 *(PLEADER
)ctrl_buff
=*pLeader
;
427 memcpy(ctrl_buff
+ LEADER_SIZE
, ((PUCHAR
)ioBuffer
+ LEADER_SIZE
), pLeader
->PLength
);
428 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "Enqueuing the Control Packet");
430 /*Update the statistics counters */
431 spin_lock_bh(&Adapter
->PackInfo
[HiPriority
].SFQueueLock
);
432 Adapter
->PackInfo
[HiPriority
].uiCurrentBytesOnHost
+=pLeader
->PLength
;
433 Adapter
->PackInfo
[HiPriority
].uiCurrentPacketsOnHost
++;
434 atomic_inc(&Adapter
->TotalPacketCount
);
435 spin_unlock_bh(&Adapter
->PackInfo
[HiPriority
].SFQueueLock
);
437 Adapter
->PackInfo
[HiPriority
].bValid
= TRUE
;
439 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "CurrBytesOnHost: %x bValid: %x",
440 Adapter
->PackInfo
[HiPriority
].uiCurrentBytesOnHost
,
441 Adapter
->PackInfo
[HiPriority
].bValid
);
442 Status
=STATUS_SUCCESS
;
443 /*Queue the packet for transmission */
444 atomic_inc(&Adapter
->index_wr_txcntrlpkt
);
445 BCM_DEBUG_PRINT( Adapter
,DBG_TYPE_TX
, TX_CONTROL
,DBG_LVL_ALL
, "Calling transmit_packets");
446 atomic_set(&Adapter
->TxPktAvail
, 1);
447 wake_up(&Adapter
->tx_packet_wait_queue
);
452 BCM_DEBUG_PRINT( Adapter
,DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "mem allocation Failed");
454 BCM_DEBUG_PRINT( Adapter
,DBG_TYPE_TX
, TX_CONTROL
, DBG_LVL_ALL
, "<====");
459 /*****************************************************************
460 * Function - SendStatisticsPointerRequest()
462 * Description - This function builds and forwards the Statistics
463 * Pointer Request control Packet.
465 * Parameters - Adapter : Pointer to Adapter structure.
466 * - pstStatisticsPtrRequest : Pointer to link request.
469 *****************************************************************/
470 static VOID
SendStatisticsPointerRequest(PMINI_ADAPTER Adapter
,
471 PLINK_REQUEST pstStatisticsPtrRequest
)
473 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "======>");
474 pstStatisticsPtrRequest
->Leader
.Status
= STATS_POINTER_REQ_STATUS
;
475 pstStatisticsPtrRequest
->Leader
.PLength
= sizeof(ULONG
);//minimum 4 bytes
476 pstStatisticsPtrRequest
->szData
[0] = STATISTICS_POINTER_REQ
;
478 CopyBufferToControlPacket(Adapter
,pstStatisticsPtrRequest
);
479 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "<=====");
485 /******************************************************************
486 * Function - LinkMessage()
488 * Description - This function builds the Sync-up and Link-up request
489 * packet messages depending on the device Link status.
491 * Parameters - Adapter: Pointer to the Adapter structure.
494 *******************************************************************/
495 VOID
LinkMessage(PMINI_ADAPTER Adapter
)
497 PLINK_REQUEST pstLinkRequest
=NULL
;
498 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "=====>");
499 if(Adapter
->LinkStatus
== SYNC_UP_REQUEST
&& Adapter
->AutoSyncup
)
501 pstLinkRequest
= kzalloc(sizeof(LINK_REQUEST
), GFP_ATOMIC
);
504 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Can not allocate memory for Link request!");
508 Adapter
->LinkStatus
= WAIT_FOR_SYNC
;// current link status
509 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Requesting For SyncUp...");
510 pstLinkRequest
->szData
[0]=LINK_UP_REQ_PAYLOAD
;
511 pstLinkRequest
->szData
[1]=LINK_SYNC_UP_SUBTYPE
;
512 pstLinkRequest
->Leader
.Status
=LINK_UP_CONTROL_REQ
;
513 pstLinkRequest
->Leader
.PLength
=sizeof(ULONG
);
514 Adapter
->bSyncUpRequestSent
= TRUE
;
516 else if(Adapter
->LinkStatus
== PHY_SYNC_ACHIVED
&& Adapter
->AutoLinkUp
)
518 pstLinkRequest
= kzalloc(sizeof(LINK_REQUEST
), GFP_ATOMIC
);
521 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Can not allocate memory for Link request!");
525 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Requesting For LinkUp...");
526 pstLinkRequest
->szData
[0]=LINK_UP_REQ_PAYLOAD
;
527 pstLinkRequest
->szData
[1]=LINK_NET_ENTRY
;
528 pstLinkRequest
->Leader
.Status
=LINK_UP_CONTROL_REQ
;
529 pstLinkRequest
->Leader
.PLength
=sizeof(ULONG
);
533 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "Calling CopyBufferToControlPacket");
534 CopyBufferToControlPacket(Adapter
, pstLinkRequest
);
535 kfree(pstLinkRequest
);
537 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, LINK_UP_MSG
, DBG_LVL_ALL
, "LinkMessage <=====");
542 /**********************************************************************
543 * Function - StatisticsResponse()
545 * Description - This function handles the Statistics response packet.
547 * Parameters - Adapter : Pointer to the Adapter structure.
548 * - pvBuffer: Starting address of Statistic response data.
551 ************************************************************************/
552 VOID
StatisticsResponse(PMINI_ADAPTER Adapter
,PVOID pvBuffer
)
554 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "%s====>",__FUNCTION__
);
555 Adapter
->StatisticsPointer
= ntohl(*(__be32
*)pvBuffer
);
556 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "Stats at %x", (UINT
)Adapter
->StatisticsPointer
);
557 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "%s <====",__FUNCTION__
);
562 /**********************************************************************
563 * Function - LinkControlResponseMessage()
565 * Description - This function handles the Link response packets.
567 * Parameters - Adapter : Pointer to the Adapter structure.
568 * - pucBuffer: Starting address of Link response data.
571 ***********************************************************************/
572 VOID
LinkControlResponseMessage(PMINI_ADAPTER Adapter
,PUCHAR pucBuffer
)
574 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "=====>");
576 if(*pucBuffer
==LINK_UP_ACK
)
578 switch(*(pucBuffer
+1))
580 case PHY_SYNC_ACHIVED
: //SYNCed UP
581 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "PHY_SYNC_ACHIVED");
583 if(Adapter
->LinkStatus
== LINKUP_DONE
)
585 beceem_protocol_reset(Adapter
);
588 Adapter
->usBestEffortQueueIndex
=INVALID_QUEUE_INDEX
;
589 Adapter
->LinkStatus
=PHY_SYNC_ACHIVED
;
591 if(Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
)
593 Adapter
->DriverState
= NO_NETWORK_ENTRY
;
594 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
597 LinkMessage(Adapter
);
601 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "LINKUP_DONE");
602 Adapter
->LinkStatus
=LINKUP_DONE
;
603 Adapter
->bPHSEnabled
= *(pucBuffer
+3);
604 Adapter
->bETHCSEnabled
= *(pucBuffer
+4) & ETH_CS_MASK
;
605 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "PHS Support Status Received In LinkUp Ack : %x \n",Adapter
->bPHSEnabled
);
606 if((FALSE
== Adapter
->bShutStatus
)&&
607 (FALSE
== Adapter
->IdleMode
))
609 if(Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
)
611 Adapter
->DriverState
= NORMAL_OPERATION
;
612 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
615 LinkMessage(Adapter
);
620 * Driver to ignore the DREG_RECEIVED
621 * WiMAX Application should handle this Message
623 //Adapter->liTimeSinceLastNetEntry = 0;
624 Adapter
->LinkUpStatus
= 0;
625 Adapter
->LinkStatus
= 0;
626 Adapter
->usBestEffortQueueIndex
=INVALID_QUEUE_INDEX
;
627 Adapter
->bTriedToWakeUpFromlowPowerMode
= FALSE
;
628 Adapter
->IdleMode
= FALSE
;
629 beceem_protocol_reset(Adapter
);
632 case LINK_SHUTDOWN_REQ_FROM_FIRMWARE
:
633 case COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW
:
635 HandleShutDownModeRequest(Adapter
, pucBuffer
);
639 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "default case:LinkResponse %x",*(pucBuffer
+1));
643 else if(SET_MAC_ADDRESS_RESPONSE
==*pucBuffer
)
645 PUCHAR puMacAddr
= (pucBuffer
+ 1);
646 Adapter
->LinkStatus
=SYNC_UP_REQUEST
;
647 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "MAC address response, sending SYNC_UP");
648 LinkMessage(Adapter
);
649 memcpy(Adapter
->dev
->dev_addr
, puMacAddr
, MAC_ADDRESS_SIZE
);
651 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "%s <=====",__FUNCTION__
);
655 void SendIdleModeResponse(PMINI_ADAPTER Adapter
)
657 INT status
= 0, NVMAccess
= 0,lowPwrAbortMsg
= 0;
659 CONTROL_MESSAGE stIdleResponse
= {{0}};
660 memset(&tv
, 0, sizeof(tv
));
661 stIdleResponse
.Leader
.Status
= IDLE_MESSAGE
;
662 stIdleResponse
.Leader
.PLength
= IDLE_MODE_PAYLOAD_LENGTH
;
663 stIdleResponse
.szData
[0] = GO_TO_IDLE_MODE_PAYLOAD
;
664 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
," ============>");
666 /*********************************
668 ** if [ semaphore is available ]
669 ** acquire semaphone and return value 0 ;
671 ** return non-zero value ;
673 ***********************************/
675 NVMAccess
= down_trylock(&Adapter
->NVMRdmWrmLock
);
677 lowPwrAbortMsg
= down_trylock(&Adapter
->LowPowerModeSync
);
680 if((NVMAccess
|| lowPwrAbortMsg
|| atomic_read(&Adapter
->TotalPacketCount
)) &&
681 (Adapter
->ulPowerSaveMode
!= DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
) )
684 up(&Adapter
->NVMRdmWrmLock
);
687 up(&Adapter
->LowPowerModeSync
);
689 stIdleResponse
.szData
[1] = TARGET_CAN_NOT_GO_TO_IDLE_MODE
;//NACK- device access is going on.
690 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "HOST IS NACKING Idle mode To F/W!!!!!!!!");
691 Adapter
->bPreparingForLowPowerMode
= FALSE
;
695 stIdleResponse
.szData
[1] = TARGET_CAN_GO_TO_IDLE_MODE
; //2;//Idle ACK
696 Adapter
->StatisticsPointer
= 0;
698 /* Wait for the LED to TURN OFF before sending ACK response */
699 if(Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
)
703 /* Wake the LED Thread with IDLEMODE_ENTER State */
704 Adapter
->DriverState
= LOWPOWER_MODE_ENTER
;
705 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
);
706 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
708 /* Wait for 1 SEC for LED to OFF */
709 iRetVal
= wait_event_timeout(Adapter
->LEDInfo
.idleModeSyncEvent
, \
710 Adapter
->LEDInfo
.bIdle_led_off
, msecs_to_jiffies(1000));
713 /* If Timed Out to Sync IDLE MODE Enter, do IDLE mode Exit and Send NACK to device */
716 stIdleResponse
.szData
[1] = TARGET_CAN_NOT_GO_TO_IDLE_MODE
;//NACK- device access is going on.
717 Adapter
->DriverState
= NORMAL_OPERATION
;
718 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
719 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
, "NACKING Idle mode as time out happen from LED side!!!!!!!!");
722 if(stIdleResponse
.szData
[1] == TARGET_CAN_GO_TO_IDLE_MODE
)
724 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_RX
, RX_DPC
, DBG_LVL_ALL
,"ACKING IDLE MODE !!!!!!!!!");
725 down(&Adapter
->rdmwrmsync
);
726 Adapter
->bPreparingForLowPowerMode
= TRUE
;
727 up(&Adapter
->rdmwrmsync
);
729 if(Adapter
->bDoSuspend
== TRUE
)
730 Bcm_kill_all_URBs((PS_INTERFACE_ADAPTER
)(Adapter
->pvInterfaceAdapter
));
735 Adapter
->bPreparingForLowPowerMode
= FALSE
;
739 up(&Adapter
->NVMRdmWrmLock
);
742 up(&Adapter
->LowPowerModeSync
);
745 status
= CopyBufferToControlPacket(Adapter
,&stIdleResponse
);
746 if((status
!= STATUS_SUCCESS
))
748 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0,"fail to send the Idle mode Request \n");
749 Adapter
->bPreparingForLowPowerMode
= FALSE
;
750 StartInterruptUrb((PS_INTERFACE_ADAPTER
)(Adapter
->pvInterfaceAdapter
));
752 do_gettimeofday(&tv
);
753 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);
757 /******************************************************************
758 * Function - DumpPackInfo()
760 * Description - This function dumps the all Queue(PackInfo[]) details.
762 * Parameters - Adapter: Pointer to the Adapter structure.
765 *******************************************************************/
766 VOID
DumpPackInfo(PMINI_ADAPTER Adapter
)
769 UINT uiLoopIndex
= 0;
771 UINT uiClsfrIndex
= 0;
772 S_CLASSIFIER_RULE
*pstClassifierEntry
= NULL
;
774 for(uiLoopIndex
=0;uiLoopIndex
<NO_OF_QUEUES
;uiLoopIndex
++)
776 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"*********** Showing Details Of Queue %d***** ******",uiLoopIndex
);
777 if(FALSE
== Adapter
->PackInfo
[uiLoopIndex
].bValid
)
779 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"bValid is FALSE for %X index\n",uiLoopIndex
);
783 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
," Dumping SF Rule Entry For SFID %lX \n",Adapter
->PackInfo
[uiLoopIndex
].ulSFID
);
784 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
," ucDirection %X \n",Adapter
->PackInfo
[uiLoopIndex
].ucDirection
);
785 if(Adapter
->PackInfo
[uiLoopIndex
].ucIpVersion
== IPV6
)
787 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"Ipv6 Service Flow \n");
791 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"Ipv4 Service Flow \n");
793 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
," SF Traffic Priority %X \n",Adapter
->PackInfo
[uiLoopIndex
].u8TrafficPriority
);
795 for(uiClsfrIndex
=0;uiClsfrIndex
<MAX_CLASSIFIERS
;uiClsfrIndex
++)
797 pstClassifierEntry
= &Adapter
->astClassifierTable
[uiClsfrIndex
];
798 if(!pstClassifierEntry
->bUsed
)
801 if(pstClassifierEntry
->ulSFID
!= Adapter
->PackInfo
[uiLoopIndex
].ulSFID
)
804 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
);
805 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
);
806 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
);
807 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
);
808 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
);
809 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
);
812 for(uiIndex
=0;uiIndex
<MAX_PORT_RANGE
;uiIndex
++)
814 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tusSrcPortRangeLo:%X\n",pstClassifierEntry
->usSrcPortRangeLo
[uiIndex
]);
815 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tusSrcPortRangeHi:%X\n",pstClassifierEntry
->usSrcPortRangeHi
[uiIndex
]);
816 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tusDestPortRangeLo:%X\n",pstClassifierEntry
->usDestPortRangeLo
[uiIndex
]);
817 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tusDestPortRangeHi:%X\n",pstClassifierEntry
->usDestPortRangeHi
[uiIndex
]);
820 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
," \tucIPSourceAddressLength : 0x%x\n",pstClassifierEntry
->ucIPSourceAddressLength
);
821 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tucIPDestinationAddressLength : 0x%x\n",pstClassifierEntry
->ucIPDestinationAddressLength
);
822 for(uiIndex
=0;uiIndex
<pstClassifierEntry
->ucIPSourceAddressLength
;uiIndex
++)
824 if(Adapter
->PackInfo
[uiLoopIndex
].ucIpVersion
== IPV6
)
826 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tIpv6 ulSrcIpAddr :\n");
827 DumpIpv6Address(pstClassifierEntry
->stSrcIpAddress
.ulIpv6Addr
);
828 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tIpv6 ulSrcIpMask :\n");
829 DumpIpv6Address(pstClassifierEntry
->stSrcIpAddress
.ulIpv6Mask
);
833 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tulSrcIpAddr:%lX\n",pstClassifierEntry
->stSrcIpAddress
.ulIpv4Addr
[uiIndex
]);
834 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tulSrcIpMask:%lX\n",pstClassifierEntry
->stSrcIpAddress
.ulIpv4Mask
[uiIndex
]);
837 for(uiIndex
=0;uiIndex
<pstClassifierEntry
->ucIPDestinationAddressLength
;uiIndex
++)
839 if(Adapter
->PackInfo
[uiLoopIndex
].ucIpVersion
== IPV6
)
841 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tIpv6 ulDestIpAddr :\n");
842 DumpIpv6Address(pstClassifierEntry
->stDestIpAddress
.ulIpv6Addr
);
843 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tIpv6 ulDestIpMask :\n");
844 DumpIpv6Address(pstClassifierEntry
->stDestIpAddress
.ulIpv6Mask
);
849 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tulDestIpAddr:%lX\n",pstClassifierEntry
->stDestIpAddress
.ulIpv4Addr
[uiIndex
]);
850 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tulDestIpMask:%lX\n",pstClassifierEntry
->stDestIpAddress
.ulIpv4Mask
[uiIndex
]);
853 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tucProtocol:0x%X\n",pstClassifierEntry
->ucProtocol
[0]);
854 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"\tu8ClassifierRulePriority:%X\n",pstClassifierEntry
->u8ClassifierRulePriority
);
858 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"ulSFID:%lX\n",Adapter
->PackInfo
[uiLoopIndex
].ulSFID
);
859 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"usVCID_Value:%X\n",Adapter
->PackInfo
[uiLoopIndex
].usVCID_Value
);
860 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"PhsEnabled: 0x%X\n",Adapter
->PackInfo
[uiLoopIndex
].bHeaderSuppressionEnabled
);
861 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiThreshold:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiThreshold
);
864 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"bValid:%X\n",Adapter
->PackInfo
[uiLoopIndex
].bValid
);
865 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"bActive:%X\n",Adapter
->PackInfo
[uiLoopIndex
].bActive
);
866 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"ActivateReqSent: %x", Adapter
->PackInfo
[uiLoopIndex
].bActivateRequestSent
);
867 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"u8QueueType:%X\n",Adapter
->PackInfo
[uiLoopIndex
].u8QueueType
);
868 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiMaxBucketSize:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiMaxBucketSize
);
869 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiPerSFTxResourceCount:%X\n",atomic_read(&Adapter
->PackInfo
[uiLoopIndex
].uiPerSFTxResourceCount
));
870 //DumpDebug(DUMP_INFO,(" bCSSupport:%X\n",Adapter->PackInfo[uiLoopIndex].bCSSupport));
871 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"CurrQueueDepthOnTarget: %x\n", Adapter
->PackInfo
[uiLoopIndex
].uiCurrentQueueDepthOnTarget
);
872 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiCurrentBytesOnHost:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiCurrentBytesOnHost
);
873 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiCurrentPacketsOnHost:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiCurrentPacketsOnHost
);
874 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiDroppedCountBytes:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiDroppedCountBytes
);
875 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiDroppedCountPackets:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiDroppedCountPackets
);
876 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiSentBytes:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiSentBytes
);
877 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiSentPackets:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiSentPackets
);
878 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiCurrentDrainRate:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiCurrentDrainRate
);
879 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiThisPeriodSentBytes:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiThisPeriodSentBytes
);
880 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"liDrainCalculated:%llX\n",Adapter
->PackInfo
[uiLoopIndex
].liDrainCalculated
);
881 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiCurrentTokenCount:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiCurrentTokenCount
);
882 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"liLastUpdateTokenAt:%llX\n",Adapter
->PackInfo
[uiLoopIndex
].liLastUpdateTokenAt
);
883 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiMaxAllowedRate:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiMaxAllowedRate
);
884 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"uiPendedLast:%X\n",Adapter
->PackInfo
[uiLoopIndex
].uiPendedLast
);
885 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"NumOfPacketsSent:%X\n",Adapter
->PackInfo
[uiLoopIndex
].NumOfPacketsSent
);
886 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "Direction: %x\n", Adapter
->PackInfo
[uiLoopIndex
].ucDirection
);
887 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "CID: %x\n", Adapter
->PackInfo
[uiLoopIndex
].usCID
);
888 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "ProtocolValid: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bProtocolValid
);
889 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "TOSValid: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bTOSValid
);
890 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "DestIpValid: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bDestIpValid
);
891 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "SrcIpValid: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bSrcIpValid
);
892 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "ActiveSet: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bActiveSet
);
893 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "AdmittedSet: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bAdmittedSet
);
894 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "AuthzSet: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bAuthorizedSet
);
895 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "ClassifyPrority: %x\n", Adapter
->PackInfo
[uiLoopIndex
].bClassifierPriority
);
896 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
, "uiMaxLatency: %x\n",Adapter
->PackInfo
[uiLoopIndex
].uiMaxLatency
);
897 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]);
898 // BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "bHeaderSuppressionEnabled :%X\n", Adapter->PackInfo[uiLoopIndex].bHeaderSuppressionEnabled);
899 // BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiTotalTxBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiTotalTxBytes);
900 // BCM_DEBUG_PRINT (Adapter, DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "uiTotalRxBytes:%X\n", Adapter->PackInfo[uiLoopIndex].uiTotalRxBytes);
901 // DumpDebug(DUMP_INFO,(" uiRanOutOfResCount:%X\n",Adapter->PackInfo[uiLoopIndex].uiRanOutOfResCount));
904 for(uiLoopIndex
= 0 ; uiLoopIndex
< MIBS_MAX_HIST_ENTRIES
; uiLoopIndex
++)
905 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"Adapter->aRxPktSizeHist[%x] = %x\n",uiLoopIndex
,Adapter
->aRxPktSizeHist
[uiLoopIndex
]);
907 for(uiLoopIndex
= 0 ; uiLoopIndex
< MIBS_MAX_HIST_ENTRIES
; uiLoopIndex
++)
908 BCM_DEBUG_PRINT (Adapter
, DBG_TYPE_OTHERS
, DUMP_INFO
, DBG_LVL_ALL
,"Adapter->aTxPktSizeHist[%x] = %x\n",uiLoopIndex
,Adapter
->aTxPktSizeHist
[uiLoopIndex
]);
917 int reset_card_proc(PMINI_ADAPTER ps_adapter
)
919 int retval
= STATUS_SUCCESS
;
921 PMINI_ADAPTER Adapter
= GET_BCM_ADAPTER(gblpnetdev
);
922 PS_INTERFACE_ADAPTER psIntfAdapter
= NULL
;
923 unsigned int value
= 0, uiResetValue
= 0;
925 psIntfAdapter
= ((PS_INTERFACE_ADAPTER
)(ps_adapter
->pvInterfaceAdapter
)) ;
927 ps_adapter
->bDDRInitDone
= FALSE
;
929 if(ps_adapter
->chip_id
>= T3LPB
)
931 //SYS_CFG register is write protected hence for modifying this reg value, it should be read twice before
932 rdmalt(ps_adapter
,SYS_CFG
, &value
, sizeof(value
));
933 rdmalt(ps_adapter
,SYS_CFG
, &value
, sizeof(value
));
935 //making bit[6...5] same as was before f/w download. this setting force the h/w to
936 //re-populated the SP RAM area with the string descriptor .
937 value
= value
| (ps_adapter
->syscfgBefFwDld
& 0x00000060) ;
938 wrmalt(ps_adapter
, SYS_CFG
, &value
, sizeof(value
));
941 //killing all submitted URBs.
942 psIntfAdapter
->psAdapter
->StopAllXaction
= TRUE
;
943 Bcm_kill_all_URBs(psIntfAdapter
);
944 /* Reset the UMA-B Device */
945 if(ps_adapter
->chip_id
>= T3LPB
)
947 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "Reseting UMA-B \n");
948 retval
= usb_reset_device(psIntfAdapter
->udev
);
950 psIntfAdapter
->psAdapter
->StopAllXaction
= FALSE
;
952 if(retval
!= STATUS_SUCCESS
)
954 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "Reset failed with ret value :%d", retval
);
957 if (ps_adapter
->chip_id
== BCS220_2
||
958 ps_adapter
->chip_id
== BCS220_2BC
||
959 ps_adapter
->chip_id
== BCS250_BC
||
960 ps_adapter
->chip_id
== BCS220_3
)
962 retval
= rdmalt(ps_adapter
,HPM_CONFIG_LDO145
, &value
, sizeof(value
));
965 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0,"read failed with status :%d",retval
);
970 retval
= wrmalt(ps_adapter
, HPM_CONFIG_LDO145
, &value
, sizeof(value
));
973 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0,"write failed with status :%d",retval
);
981 retval
= rdmalt(ps_adapter
,0x0f007018, &value
, sizeof(value
));
983 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0,"read failed with status :%d",retval
);
987 retval
= wrmalt(ps_adapter
, 0x0f007018, &value
, sizeof(value
)) ;
989 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0,"write failed with status :%d",retval
);
993 // Toggling the GPIO 8, 9
995 retval
= wrmalt(ps_adapter
, GPIO_OUTPUT_REGISTER
, &value
, sizeof(value
));
997 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0,"write failed with status :%d",retval
);
1001 retval
= wrmalt(ps_adapter
, GPIO_MODE_REGISTER
, &value
, sizeof(value
)) ;
1003 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0,"write failed with status :%d",retval
);
1009 //ps_adapter->downloadDDR = false;
1011 if(ps_adapter
->bFlashBoot
)
1013 //In flash boot mode MIPS state register has reverse polarity.
1014 // So just or with setting bit 30.
1015 //Make the MIPS in Reset state.
1016 rdmalt(ps_adapter
, CLOCK_RESET_CNTRL_REG_1
, &uiResetValue
, sizeof(uiResetValue
));
1018 uiResetValue
|=(1<<30);
1019 wrmalt(ps_adapter
, CLOCK_RESET_CNTRL_REG_1
, &uiResetValue
, sizeof(uiResetValue
));
1022 if(ps_adapter
->chip_id
>= T3LPB
)
1026 // WA for SYSConfig Issue.
1027 // Read SYSCFG Twice to make it writable.
1029 rdmalt(ps_adapter
, SYS_CFG
, &uiResetValue
, sizeof(uiResetValue
));
1030 if(uiResetValue
& (1<<4))
1033 rdmalt(ps_adapter
, SYS_CFG
, &uiResetValue
, sizeof(uiResetValue
));//2nd read to make it writable.
1034 uiResetValue
&= (~(1<<4));
1035 wrmalt(ps_adapter
,SYS_CFG
, &uiResetValue
, sizeof(uiResetValue
));
1040 wrmalt(ps_adapter
, 0x0f01186c, &uiResetValue
, sizeof(uiResetValue
));
1043 psIntfAdapter
->psAdapter
->StopAllXaction
= FALSE
;
1047 int run_card_proc(PMINI_ADAPTER ps_adapter
)
1049 unsigned int value
=0;
1052 if(rdmalt(ps_adapter
, CLOCK_RESET_CNTRL_REG_1
, &value
, sizeof(value
)) < 0) {
1053 BCM_DEBUG_PRINT(ps_adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
,"%s:%d\n", __FUNCTION__
, __LINE__
);
1054 return STATUS_FAILURE
;
1057 if(ps_adapter
->bFlashBoot
)
1067 if(wrmalt(ps_adapter
, CLOCK_RESET_CNTRL_REG_1
, &value
, sizeof(value
)) < 0) {
1068 BCM_DEBUG_PRINT(ps_adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
,"%s:%d\n", __FUNCTION__
, __LINE__
);
1069 return STATUS_FAILURE
;
1072 return STATUS_SUCCESS
;
1075 int InitCardAndDownloadFirmware(PMINI_ADAPTER ps_adapter
)
1081 * Create the threads first and then download the
1082 * Firm/DDR Settings..
1085 status
= create_worker_threads(ps_adapter
);
1090 * For Downloading the Firm, parse the cfg file first.
1092 status
= bcm_parse_target_params (ps_adapter
);
1097 if(ps_adapter
->chip_id
>= T3LPB
)
1099 rdmalt(ps_adapter
, SYS_CFG
, &value
, sizeof (value
));
1100 ps_adapter
->syscfgBefFwDld
= value
;
1101 if((value
& 0x60)== 0)
1103 ps_adapter
->bFlashBoot
= TRUE
;
1107 reset_card_proc(ps_adapter
);
1109 //Initializing the NVM.
1110 BcmInitNVM(ps_adapter
);
1111 status
= ddr_init(ps_adapter
);
1114 pr_err(DRV_NAME
"ddr_init Failed\n");
1118 /* Download cfg file */
1119 status
= buffDnldVerify(ps_adapter
,
1120 (PUCHAR
)ps_adapter
->pstargetparams
,
1121 sizeof(STARGETPARAMS
),
1125 BCM_DEBUG_PRINT(ps_adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Error downloading CFG file");
1129 if(register_networkdev(ps_adapter
))
1131 BCM_DEBUG_PRINT(ps_adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Register Netdevice failed. Cleanup needs to be performed.");
1135 if(FALSE
== ps_adapter
->AutoFirmDld
)
1137 BCM_DEBUG_PRINT(ps_adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "AutoFirmDld Disabled in CFG File..\n");
1138 //If Auto f/w download is disable, register the control interface,
1139 //register the control interface after the mailbox.
1140 if(register_control_device_interface(ps_adapter
) < 0)
1142 BCM_DEBUG_PRINT(ps_adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "Register Control Device failed. Cleanup needs to be performed.");
1146 return STATUS_SUCCESS
;
1150 * Do the LED Settings here. It will be used by the Firmware Download
1155 * 1. If the LED Settings fails, do not stop and do the Firmware download.
1156 * 2. This init would happened only if the cfg file is present, else
1157 * call from the ioctl context.
1160 status
= InitLedSettings (ps_adapter
);
1164 BCM_DEBUG_PRINT(ps_adapter
,DBG_TYPE_PRINTK
, 0, 0,"INIT LED FAILED\n");
1167 if(ps_adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
)
1169 ps_adapter
->DriverState
= DRIVER_INIT
;
1170 wake_up(&ps_adapter
->LEDInfo
.notify_led_event
);
1173 if(ps_adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
)
1175 ps_adapter
->DriverState
= FW_DOWNLOAD
;
1176 wake_up(&ps_adapter
->LEDInfo
.notify_led_event
);
1180 wrmalt(ps_adapter
, EEPROM_CAL_DATA_INTERNAL_LOC
- 4, &value
, sizeof(value
));
1181 wrmalt(ps_adapter
, EEPROM_CAL_DATA_INTERNAL_LOC
- 8, &value
, sizeof(value
));
1183 if(ps_adapter
->eNVMType
== NVM_FLASH
)
1185 status
= PropagateCalParamsFromFlashToMemory(ps_adapter
);
1188 BCM_DEBUG_PRINT(ps_adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
," Propagation of Cal param failed .." );
1193 /* Download Firmare */
1194 if ((status
= BcmFileDownload( ps_adapter
, BIN_FILE
, FIRMWARE_BEGIN_ADDR
)))
1196 BCM_DEBUG_PRINT(ps_adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "No Firmware File is present... \n");
1200 status
= run_card_proc(ps_adapter
);
1203 BCM_DEBUG_PRINT (ps_adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "run_card_proc Failed\n");
1208 ps_adapter
->fw_download_done
= TRUE
;
1212 if(ps_adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
)
1214 ps_adapter
->DriverState
= FW_DOWNLOAD_DONE
;
1215 wake_up(&ps_adapter
->LEDInfo
.notify_led_event
);
1222 static int bcm_parse_target_params(PMINI_ADAPTER Adapter
)
1224 struct file
*flp
=NULL
;
1225 mm_segment_t oldfs
={0};
1230 buff
=kmalloc(BUFFER_1K
, GFP_KERNEL
);
1235 if((Adapter
->pstargetparams
=
1236 kmalloc(sizeof(STARGETPARAMS
), GFP_KERNEL
)) == NULL
)
1241 flp
=open_firmware_file(Adapter
, CFG_FILE
);
1243 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
, "NOT ABLE TO OPEN THE %s FILE \n", CFG_FILE
);
1245 kfree(Adapter
->pstargetparams
);
1246 Adapter
->pstargetparams
= NULL
;
1249 oldfs
=get_fs(); set_fs(get_ds());
1250 len
=vfs_read(flp
, (void __user __force
*)buff
, BUFFER_1K
, &pos
);
1253 if(len
!= sizeof(STARGETPARAMS
))
1255 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
,"Mismatch in Target Param Structure!\n");
1257 kfree(Adapter
->pstargetparams
);
1258 Adapter
->pstargetparams
= NULL
;
1259 filp_close(flp
, current
->files
);
1262 filp_close(flp
, current
->files
);
1264 /* Check for autolink in config params */
1266 * Values in Adapter->pstargetparams are in network byte order
1268 memcpy(Adapter
->pstargetparams
, buff
, sizeof(STARGETPARAMS
));
1270 beceem_parse_target_struct(Adapter
);
1271 return STATUS_SUCCESS
;
1274 void beceem_parse_target_struct(PMINI_ADAPTER Adapter
)
1276 UINT uiHostDrvrCfg6
=0, uiEEPROMFlag
= 0;
1278 if(ntohl(Adapter
->pstargetparams
->m_u32PhyParameter2
) & AUTO_SYNC_DISABLE
)
1280 pr_info(DRV_NAME
": AutoSyncup is Disabled\n");
1281 Adapter
->AutoSyncup
= FALSE
;
1285 pr_info(DRV_NAME
": AutoSyncup is Enabled\n");
1286 Adapter
->AutoSyncup
= TRUE
;
1289 if(ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
) & AUTO_LINKUP_ENABLE
)
1291 pr_info(DRV_NAME
": Enabling autolink up");
1292 Adapter
->AutoLinkUp
= TRUE
;
1296 pr_info(DRV_NAME
": Disabling autolink up");
1297 Adapter
->AutoLinkUp
= FALSE
;
1299 // Setting the DDR Setting..
1300 Adapter
->DDRSetting
=
1301 (ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
) >>8)&0x0F;
1302 Adapter
->ulPowerSaveMode
=
1303 (ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
)>>12)&0x0F;
1305 pr_info(DRV_NAME
": DDR Setting: %x\n", Adapter
->DDRSetting
);
1306 pr_info(DRV_NAME
": Power Save Mode: %lx\n", Adapter
->ulPowerSaveMode
);
1307 if(ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
) & AUTO_FIRM_DOWNLOAD
)
1309 pr_info(DRV_NAME
": Enabling Auto Firmware Download\n");
1310 Adapter
->AutoFirmDld
= TRUE
;
1314 pr_info(DRV_NAME
": Disabling Auto Firmware Download\n");
1315 Adapter
->AutoFirmDld
= FALSE
;
1317 uiHostDrvrCfg6
= ntohl(Adapter
->pstargetparams
->HostDrvrConfig6
);
1318 Adapter
->bMipsConfig
= (uiHostDrvrCfg6
>>20)&0x01;
1319 pr_info(DRV_NAME
": MIPSConfig : 0x%X\n",Adapter
->bMipsConfig
);
1320 //used for backward compatibility.
1321 Adapter
->bDPLLConfig
= (uiHostDrvrCfg6
>>19)&0x01;
1323 Adapter
->PmuMode
= (uiHostDrvrCfg6
>> 24 ) & 0x03;
1324 pr_info(DRV_NAME
": PMU MODE: %x", Adapter
->PmuMode
);
1326 if((uiHostDrvrCfg6
>> HOST_BUS_SUSPEND_BIT
) & (0x01))
1328 Adapter
->bDoSuspend
= TRUE
;
1329 pr_info(DRV_NAME
": Making DoSuspend TRUE as per configFile");
1332 uiEEPROMFlag
= ntohl(Adapter
->pstargetparams
->m_u32EEPROMFlag
);
1333 pr_info(DRV_NAME
": uiEEPROMFlag : 0x%X\n",uiEEPROMFlag
);
1334 Adapter
->eNVMType
= (NVM_TYPE
)((uiEEPROMFlag
>>4)&0x3);
1336 Adapter
->bStatusWrite
= (uiEEPROMFlag
>>6)&0x1;
1338 Adapter
->uiSectorSizeInCFG
= 1024*(0xFFFF & ntohl(Adapter
->pstargetparams
->HostDrvrConfig4
));
1340 Adapter
->bSectorSizeOverride
=(bool) ((ntohl(Adapter
->pstargetparams
->HostDrvrConfig4
))>>16)&0x1;
1342 if(ntohl(Adapter
->pstargetparams
->m_u32PowerSavingModeOptions
) &0x01)
1343 Adapter
->ulPowerSaveMode
= DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
;
1345 if(Adapter
->ulPowerSaveMode
!= DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
)
1346 doPowerAutoCorrection(Adapter
);
1350 static VOID
doPowerAutoCorrection(PMINI_ADAPTER psAdapter
)
1352 UINT reporting_mode
;
1354 reporting_mode
= ntohl(psAdapter
->pstargetparams
->m_u32PowerSavingModeOptions
) &0x02 ;
1355 psAdapter
->bIsAutoCorrectEnabled
= !((char)(psAdapter
->ulPowerSaveMode
>> 3) & 0x1);
1357 if(reporting_mode
== TRUE
)
1359 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
,"can't do suspen/resume as reporting mode is enable");
1360 psAdapter
->bDoSuspend
= FALSE
;
1363 if (psAdapter
->bIsAutoCorrectEnabled
&& (psAdapter
->chip_id
>= T3LPB
))
1365 //If reporting mode is enable, switch PMU to PMC
1367 psAdapter
->ulPowerSaveMode
= DEVICE_POWERSAVE_MODE_AS_PMU_CLOCK_GATING
;
1368 psAdapter
->bDoSuspend
=FALSE
;
1372 //clearing space bit[15..12]
1373 psAdapter
->pstargetparams
->HostDrvrConfig6
&= ~(htonl((0xF << 12)));
1374 //placing the power save mode option
1375 psAdapter
->pstargetparams
->HostDrvrConfig6
|= htonl((psAdapter
->ulPowerSaveMode
<< 12));
1378 else if (psAdapter
->bIsAutoCorrectEnabled
== FALSE
)
1381 // remove the autocorrect disable bit set before dumping.
1382 psAdapter
->ulPowerSaveMode
&= ~(1 << 3);
1383 psAdapter
->pstargetparams
->HostDrvrConfig6
&= ~(htonl(1 << 15));
1384 BCM_DEBUG_PRINT(psAdapter
,DBG_TYPE_INITEXIT
, MP_INIT
, DBG_LVL_ALL
,"Using Forced User Choice: %lx\n", psAdapter
->ulPowerSaveMode
);
1389 static unsigned char *ReadMacAddrEEPROM(PMINI_ADAPTER Adapter
, ulong dwAddress
)
1391 int status
= 0, i
= 0;
1392 unsigned int temp
= 0;
1393 unsigned char *pucmacaddr
= kmalloc(MAC_ADDRESS_SIZE
, GFP_KERNEL
);
1397 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "No Buffers to Read the EEPROM Address\n");
1401 dwAddress
|= 0x5b000000;
1402 status
= wrmalt(Adapter
, EEPROM_COMMAND_Q_REG
,
1403 (PUINT
)&dwAddress
, sizeof(UINT
));
1404 if(status
!= STATUS_SUCCESS
)
1406 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "wrm Failed..\n");
1411 for(i
=0;i
<MAC_ADDRESS_SIZE
;i
++)
1413 status
= rdmalt(Adapter
, EEPROM_READ_DATA_Q_REG
, &temp
,sizeof(temp
));
1414 if(status
!= STATUS_SUCCESS
)
1416 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "rdm Failed..\n");
1421 pucmacaddr
[i
] = temp
& 0xff;
1422 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_INITEXIT
, DRV_ENTRY
, DBG_LVL_ALL
,"%x \n", pucmacaddr
[i
]);
1430 static void convertEndian(B_UINT8 rwFlag
, PUINT puiBuffer
, UINT uiByteCount
)
1434 if(RWM_WRITE
== rwFlag
) {
1435 for(uiIndex
=0; uiIndex
< (uiByteCount
/sizeof(UINT
)); uiIndex
++) {
1436 puiBuffer
[uiIndex
] = htonl(puiBuffer
[uiIndex
]);
1439 for(uiIndex
=0; uiIndex
< (uiByteCount
/sizeof(UINT
)); uiIndex
++) {
1440 puiBuffer
[uiIndex
] = ntohl(puiBuffer
[uiIndex
]);
1445 #define CACHE_ADDRESS_MASK 0x80000000
1446 #define UNCACHE_ADDRESS_MASK 0xa0000000
1448 int rdm(PMINI_ADAPTER Adapter
, UINT uiAddress
, PCHAR pucBuff
, size_t sSize
)
1450 return Adapter
->interface_rdm(Adapter
->pvInterfaceAdapter
,
1451 uiAddress
, pucBuff
, sSize
);
1454 int wrm(PMINI_ADAPTER Adapter
, UINT uiAddress
, PCHAR pucBuff
, size_t sSize
)
1458 iRetVal
= Adapter
->interface_wrm(Adapter
->pvInterfaceAdapter
,
1459 uiAddress
, pucBuff
, sSize
);
1465 int wrmalt (PMINI_ADAPTER Adapter
, UINT uiAddress
, PUINT pucBuff
, size_t size
)
1467 convertEndian(RWM_WRITE
, pucBuff
, size
);
1468 return wrm(Adapter
, uiAddress
, (PUCHAR
)pucBuff
, size
);
1471 int rdmalt (PMINI_ADAPTER Adapter
, UINT uiAddress
, PUINT pucBuff
, size_t size
)
1475 uiRetVal
= rdm(Adapter
,uiAddress
,(PUCHAR
)pucBuff
,size
);
1476 convertEndian(RWM_READ
, (PUINT
)pucBuff
, size
);
1482 int wrmWithLock(PMINI_ADAPTER Adapter
, UINT uiAddress
, PCHAR pucBuff
, size_t sSize
)
1484 INT status
= STATUS_SUCCESS
;
1485 down(&Adapter
->rdmwrmsync
);
1487 if((Adapter
->IdleMode
== TRUE
) ||
1488 (Adapter
->bShutStatus
==TRUE
) ||
1489 (Adapter
->bPreparingForLowPowerMode
==TRUE
))
1495 status
=wrm(Adapter
, uiAddress
, pucBuff
, sSize
);
1498 up(&Adapter
->rdmwrmsync
);
1502 int wrmaltWithLock (PMINI_ADAPTER Adapter
, UINT uiAddress
, PUINT pucBuff
, size_t size
)
1504 int iRetVal
= STATUS_SUCCESS
;
1506 down(&Adapter
->rdmwrmsync
);
1508 if((Adapter
->IdleMode
== TRUE
) ||
1509 (Adapter
->bShutStatus
==TRUE
) ||
1510 (Adapter
->bPreparingForLowPowerMode
==TRUE
))
1516 iRetVal
= wrmalt(Adapter
,uiAddress
,pucBuff
,size
);
1519 up(&Adapter
->rdmwrmsync
);
1523 int rdmaltWithLock (PMINI_ADAPTER Adapter
, UINT uiAddress
, PUINT pucBuff
, size_t size
)
1525 INT uiRetVal
=STATUS_SUCCESS
;
1527 down(&Adapter
->rdmwrmsync
);
1529 if((Adapter
->IdleMode
== TRUE
) ||
1530 (Adapter
->bShutStatus
==TRUE
) ||
1531 (Adapter
->bPreparingForLowPowerMode
==TRUE
))
1537 uiRetVal
= rdmalt(Adapter
,uiAddress
, pucBuff
, size
);
1540 up(&Adapter
->rdmwrmsync
);
1545 static VOID
HandleShutDownModeWakeup(PMINI_ADAPTER Adapter
)
1547 int clear_abort_pattern
= 0,Status
= 0;
1548 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "====>\n");
1549 //target has woken up From Shut Down
1550 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "Clearing Shut Down Software abort pattern\n");
1551 Status
= wrmalt(Adapter
,SW_ABORT_IDLEMODE_LOC
, (PUINT
)&clear_abort_pattern
, sizeof(clear_abort_pattern
));
1554 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
,"WRM to SW_ABORT_IDLEMODE_LOC failed with err:%d", Status
);
1557 if(Adapter
->ulPowerSaveMode
!= DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE
)
1560 InterfaceHandleShutdownModeWakeup(Adapter
);
1563 if(Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
)
1565 Adapter
->DriverState
= NO_NETWORK_ENTRY
;
1566 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
1569 Adapter
->bTriedToWakeUpFromlowPowerMode
= FALSE
;
1570 Adapter
->bShutStatus
= FALSE
;
1571 wake_up(&Adapter
->lowpower_mode_wait_queue
);
1572 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "<====\n");
1575 static VOID
SendShutModeResponse(PMINI_ADAPTER Adapter
)
1577 CONTROL_MESSAGE stShutdownResponse
;
1578 UINT NVMAccess
= 0,lowPwrAbortMsg
= 0;
1581 memset (&stShutdownResponse
, 0, sizeof(CONTROL_MESSAGE
));
1582 stShutdownResponse
.Leader
.Status
= LINK_UP_CONTROL_REQ
;
1583 stShutdownResponse
.Leader
.PLength
= 8;//8 bytes;
1584 stShutdownResponse
.szData
[0] = LINK_UP_ACK
;
1585 stShutdownResponse
.szData
[1] = LINK_SHUTDOWN_REQ_FROM_FIRMWARE
;
1587 /*********************************
1589 ** if [ semaphore is available ]
1590 ** acquire semaphone and return value 0 ;
1592 ** return non-zero value ;
1594 ***********************************/
1596 NVMAccess
= down_trylock(&Adapter
->NVMRdmWrmLock
);
1598 lowPwrAbortMsg
= down_trylock(&Adapter
->LowPowerModeSync
);
1601 if(NVMAccess
|| lowPwrAbortMsg
|| atomic_read(&Adapter
->TotalPacketCount
))
1604 up(&Adapter
->NVMRdmWrmLock
);
1607 up(&Adapter
->LowPowerModeSync
);
1609 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "Device Access is going on NACK the Shut Down MODE\n");
1610 stShutdownResponse
.szData
[2] = SHUTDOWN_NACK_FROM_DRIVER
;//NACK- device access is going on.
1611 Adapter
->bPreparingForLowPowerMode
= FALSE
;
1615 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "Sending SHUTDOWN MODE ACK\n");
1616 stShutdownResponse
.szData
[2] = SHUTDOWN_ACK_FROM_DRIVER
;//ShutDown ACK
1618 /* Wait for the LED to TURN OFF before sending ACK response */
1619 if(Adapter
->LEDInfo
.led_thread_running
& BCM_LED_THREAD_RUNNING_ACTIVELY
)
1623 /* Wake the LED Thread with LOWPOWER_MODE_ENTER State */
1624 Adapter
->DriverState
= LOWPOWER_MODE_ENTER
;
1625 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
1627 /* Wait for 1 SEC for LED to OFF */
1628 iRetVal
= wait_event_timeout(Adapter
->LEDInfo
.idleModeSyncEvent
,\
1629 Adapter
->LEDInfo
.bIdle_led_off
, msecs_to_jiffies(1000));
1631 /* If Timed Out to Sync IDLE MODE Enter, do IDLE mode Exit and Send NACK to device */
1634 stShutdownResponse
.szData
[1] = SHUTDOWN_NACK_FROM_DRIVER
;//NACK- device access is going on.
1636 Adapter
->DriverState
= NO_NETWORK_ENTRY
;
1637 wake_up(&Adapter
->LEDInfo
.notify_led_event
);
1641 if(stShutdownResponse
.szData
[2] == SHUTDOWN_ACK_FROM_DRIVER
)
1643 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
,"ACKING SHUTDOWN MODE !!!!!!!!!");
1644 down(&Adapter
->rdmwrmsync
);
1645 Adapter
->bPreparingForLowPowerMode
= TRUE
;
1646 up(&Adapter
->rdmwrmsync
);
1648 if(Adapter
->bDoSuspend
== TRUE
)
1649 Bcm_kill_all_URBs((PS_INTERFACE_ADAPTER
)(Adapter
->pvInterfaceAdapter
));
1653 Adapter
->bPreparingForLowPowerMode
= FALSE
;
1657 up(&Adapter
->NVMRdmWrmLock
);
1660 up(&Adapter
->LowPowerModeSync
);
1662 Status
= CopyBufferToControlPacket(Adapter
,&stShutdownResponse
);
1663 if((Status
!= STATUS_SUCCESS
))
1665 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
,"fail to send the Idle mode Request \n");
1666 Adapter
->bPreparingForLowPowerMode
= FALSE
;
1668 StartInterruptUrb((PS_INTERFACE_ADAPTER
)(Adapter
->pvInterfaceAdapter
));
1673 static void HandleShutDownModeRequest(PMINI_ADAPTER Adapter
,PUCHAR pucBuffer
)
1675 B_UINT32 uiResetValue
= 0;
1677 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "====>\n");
1679 if(*(pucBuffer
+1) == COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW
)
1681 HandleShutDownModeWakeup(Adapter
);
1683 else if(*(pucBuffer
+1) == LINK_SHUTDOWN_REQ_FROM_FIRMWARE
)
1685 //Target wants to go to Shut Down Mode
1686 //InterfacePrepareForShutdown(Adapter);
1687 if(Adapter
->chip_id
== BCS220_2
||
1688 Adapter
->chip_id
== BCS220_2BC
||
1689 Adapter
->chip_id
== BCS250_BC
||
1690 Adapter
->chip_id
== BCS220_3
)
1692 rdmalt(Adapter
,HPM_CONFIG_MSW
, &uiResetValue
, 4);
1693 uiResetValue
|= (1<<17);
1694 wrmalt(Adapter
, HPM_CONFIG_MSW
, &uiResetValue
, 4);
1697 SendShutModeResponse(Adapter
);
1698 BCM_DEBUG_PRINT (Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
,"ShutDownModeResponse:Notification received: Sending the response(Ack/Nack)\n");
1701 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, MP_SHUTDOWN
, DBG_LVL_ALL
, "<====\n");
1706 VOID
ResetCounters(PMINI_ADAPTER Adapter
)
1709 beceem_protocol_reset(Adapter
);
1711 Adapter
->CurrNumRecvDescs
= 0;
1712 Adapter
->PrevNumRecvDescs
= 0;
1713 Adapter
->LinkUpStatus
= 0;
1714 Adapter
->LinkStatus
= 0;
1715 atomic_set(&Adapter
->cntrlpktCnt
,0);
1716 atomic_set (&Adapter
->TotalPacketCount
,0);
1717 Adapter
->fw_download_done
=FALSE
;
1718 Adapter
->LinkStatus
= 0;
1719 Adapter
->AutoLinkUp
= FALSE
;
1720 Adapter
->IdleMode
= FALSE
;
1721 Adapter
->bShutStatus
= FALSE
;
1724 S_CLASSIFIER_RULE
*GetFragIPClsEntry(PMINI_ADAPTER Adapter
,USHORT usIpIdentification
,ULONG SrcIP
)
1727 for(uiIndex
=0;uiIndex
<MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES
;uiIndex
++)
1729 if((Adapter
->astFragmentedPktClassifierTable
[uiIndex
].bUsed
)&&
1730 (Adapter
->astFragmentedPktClassifierTable
[uiIndex
].usIpIdentification
== usIpIdentification
)&&
1731 (Adapter
->astFragmentedPktClassifierTable
[uiIndex
].ulSrcIpAddress
== SrcIP
)&&
1732 !Adapter
->astFragmentedPktClassifierTable
[uiIndex
].bOutOfOrderFragment
)
1733 return Adapter
->astFragmentedPktClassifierTable
[uiIndex
].pstMatchedClassifierEntry
;
1738 void AddFragIPClsEntry(PMINI_ADAPTER Adapter
,PS_FRAGMENTED_PACKET_INFO psFragPktInfo
)
1741 for(uiIndex
=0;uiIndex
<MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES
;uiIndex
++)
1743 if(!Adapter
->astFragmentedPktClassifierTable
[uiIndex
].bUsed
)
1745 memcpy(&Adapter
->astFragmentedPktClassifierTable
[uiIndex
],psFragPktInfo
,sizeof(S_FRAGMENTED_PACKET_INFO
));
1752 void DelFragIPClsEntry(PMINI_ADAPTER Adapter
,USHORT usIpIdentification
,ULONG SrcIp
)
1755 for(uiIndex
=0;uiIndex
<MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES
;uiIndex
++)
1757 if((Adapter
->astFragmentedPktClassifierTable
[uiIndex
].bUsed
)&&
1758 (Adapter
->astFragmentedPktClassifierTable
[uiIndex
].usIpIdentification
== usIpIdentification
)&&
1759 (Adapter
->astFragmentedPktClassifierTable
[uiIndex
].ulSrcIpAddress
== SrcIp
))
1760 memset(&Adapter
->astFragmentedPktClassifierTable
[uiIndex
],0,sizeof(S_FRAGMENTED_PACKET_INFO
));
1764 void update_per_cid_rx (PMINI_ADAPTER Adapter
)
1768 if((jiffies
- Adapter
->liDrainCalculated
) < XSECONDS
)
1771 for(qindex
= 0; qindex
< HiPriority
; qindex
++)
1773 if(Adapter
->PackInfo
[qindex
].ucDirection
== 0)
1775 Adapter
->PackInfo
[qindex
].uiCurrentRxRate
=
1776 (Adapter
->PackInfo
[qindex
].uiCurrentRxRate
+
1777 Adapter
->PackInfo
[qindex
].uiThisPeriodRxBytes
)/2;
1779 Adapter
->PackInfo
[qindex
].uiThisPeriodRxBytes
= 0;
1783 Adapter
->PackInfo
[qindex
].uiCurrentDrainRate
=
1784 (Adapter
->PackInfo
[qindex
].uiCurrentDrainRate
+
1785 Adapter
->PackInfo
[qindex
].uiThisPeriodSentBytes
)/2;
1787 Adapter
->PackInfo
[qindex
].uiThisPeriodSentBytes
=0;
1790 Adapter
->liDrainCalculated
=jiffies
;
1792 void update_per_sf_desc_cnts( PMINI_ADAPTER Adapter
)
1795 u32 uibuff
[MAX_TARGET_DSX_BUFFERS
];
1797 if(!atomic_read (&Adapter
->uiMBupdate
))
1800 if(rdmaltWithLock(Adapter
, TARGET_SFID_TXDESC_MAP_LOC
, (PUINT
)uibuff
, sizeof(UINT
) * MAX_TARGET_DSX_BUFFERS
)<0)
1802 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "rdm failed\n");
1805 for(iIndex
= 0;iIndex
< HiPriority
; iIndex
++)
1807 if(Adapter
->PackInfo
[iIndex
].bValid
&& Adapter
->PackInfo
[iIndex
].ucDirection
)
1809 if(Adapter
->PackInfo
[iIndex
].usVCID_Value
< MAX_TARGET_DSX_BUFFERS
)
1811 atomic_set(&Adapter
->PackInfo
[iIndex
].uiPerSFTxResourceCount
, uibuff
[Adapter
->PackInfo
[iIndex
].usVCID_Value
]);
1815 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_PRINTK
, 0, 0, "Invalid VCID : %x \n",
1816 Adapter
->PackInfo
[iIndex
].usVCID_Value
);
1820 atomic_set (&Adapter
->uiMBupdate
, FALSE
);
1823 void flush_queue(PMINI_ADAPTER Adapter
, UINT iQIndex
)
1825 struct sk_buff
* PacketToDrop
=NULL
;
1826 struct net_device_stats
* netstats
= &Adapter
->dev
->stats
;
1828 spin_lock_bh(&Adapter
->PackInfo
[iQIndex
].SFQueueLock
);
1830 while(Adapter
->PackInfo
[iQIndex
].FirstTxQueue
&&
1831 atomic_read(&Adapter
->TotalPacketCount
))
1833 PacketToDrop
= Adapter
->PackInfo
[iQIndex
].FirstTxQueue
;
1834 if(PacketToDrop
&& PacketToDrop
->len
)
1836 netstats
->tx_dropped
++;
1837 DEQUEUEPACKET(Adapter
->PackInfo
[iQIndex
].FirstTxQueue
, \
1838 Adapter
->PackInfo
[iQIndex
].LastTxQueue
);
1840 Adapter
->PackInfo
[iQIndex
].uiCurrentPacketsOnHost
--;
1841 Adapter
->PackInfo
[iQIndex
].uiCurrentBytesOnHost
-= PacketToDrop
->len
;
1843 //Adding dropped statistics
1844 Adapter
->PackInfo
[iQIndex
].uiDroppedCountBytes
+= PacketToDrop
->len
;
1845 Adapter
->PackInfo
[iQIndex
].uiDroppedCountPackets
++;
1847 dev_kfree_skb(PacketToDrop
);
1848 atomic_dec(&Adapter
->TotalPacketCount
);
1851 spin_unlock_bh(&Adapter
->PackInfo
[iQIndex
].SFQueueLock
);
1855 static void beceem_protocol_reset (PMINI_ADAPTER Adapter
)
1859 if (netif_msg_link(Adapter
))
1860 pr_notice(PFX
"%s: protocol reset\n", Adapter
->dev
->name
);
1862 netif_carrier_off(Adapter
->dev
);
1863 netif_stop_queue(Adapter
->dev
);
1865 Adapter
->IdleMode
= FALSE
;
1866 Adapter
->LinkUpStatus
= FALSE
;
1867 ClearTargetDSXBuffer(Adapter
,0, TRUE
);
1868 //Delete All Classifier Rules
1870 for(i
= 0;i
<HiPriority
;i
++)
1872 DeleteAllClassifiersForSF(Adapter
,i
);
1875 flush_all_queues(Adapter
);
1877 if(Adapter
->TimerActive
== TRUE
)
1878 Adapter
->TimerActive
= FALSE
;
1880 memset(Adapter
->astFragmentedPktClassifierTable
, 0,
1881 sizeof(S_FRAGMENTED_PACKET_INFO
) * MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES
);
1883 for(i
= 0;i
<HiPriority
;i
++)
1885 //resetting only the first size (S_MIBS_SERVICEFLOW_TABLE) for the SF.
1886 // It is same between MIBs and SF.
1887 memset(&Adapter
->PackInfo
[i
].stMibsExtServiceFlowTable
,
1888 0, sizeof(S_MIBS_EXTSERVICEFLOW_PARAMETERS
));