--- a/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlanLogicalChannel.cpp Fri May 14 17:41:09 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlanLogicalChannel.cpp Thu May 27 14:33:33 2010 +0300
@@ -16,7 +16,7 @@
*/
/*
-* %version: 59 %
+* %version: 60 %
*/
#include "WlLddWlanLddConfig.h"
@@ -41,7 +41,8 @@
const TUint32 KDmaTxMemSize = 4096; // equals to 1 MMU page on most systems
// ---------------------------------------------------------------------------
-//
+// Note! This method is executed in the context of the user mode client
+// thread, but in supervisor mode
// ---------------------------------------------------------------------------
//
#ifndef RD_WLAN_DDK
@@ -271,6 +272,9 @@
}
// ---------------------------------------------------------------------------
+// Note! This method is executed in the context of the user mode client
+// thread, but in supervisor mode
+//
// If an error occurs in this method, we set iPdd to NULL to prevent
// PDD object destruction in base class (DLogicalChannelBase) destructor.
// DLogicalChannelBase destructor gets called as this logical channel instance
@@ -606,10 +610,11 @@
// ---------------------------------------------------------------------------
-//
+// Note! This method is executed in the context of the user mode client
+// thread, but in supervisor mode
// ---------------------------------------------------------------------------
//
-TAny* DWlanLogicalChannel::DoControlFast( TInt aFunction, TAny* param )
+TAny* DWlanLogicalChannel::DoControlFast( TInt aFunction, TAny* aParam )
{
TAny* ret( NULL );
TBool triggerTx ( EFalse );
@@ -621,9 +626,6 @@
iClient));
TraceDump(WLM_CMD_DETAILS, (("WLANLDD: function: 0x%x"), aFunction));
- // Note! We are executing in the context of the client's thread, but
- // in supervisor mode
-
// acquire mutex
// Enter critical section before requesting the mutex as
// we are executing in the context of a user mode thread
@@ -638,70 +640,24 @@
TraceDump(MUTEX,
(("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex acquired")));
- switch ( aFunction )
+ if ( iUnit == KUnitWlan )
+ {
+ ret = OnMgmtSideControlFast( aFunction, aParam );
+ }
+ else if ( iUnit == KUnitEthernet )
{
- case RPcmNetCardIf::EControlFastAllocTxBuffer:
- ret = iEthernetFrameMemMngr->AllocTxBuffer(
- reinterpret_cast<TUint>(param) );
-
- if ( !ret && iAddTxFrameAllowed )
- {
- iAddTxFrameAllowed = EFalse;
-
- TraceDump( NWSA_TX,
- ("WLANLDD: DWlanLogicalChannel::DoControlFast: stop flow from protocol stack") );
- }
- break;
-
- case RPcmNetCardIf::EControlFastAddTxFrame:
- {
-#ifndef NDEBUG
- if ( !iAddTxFrameAllowed )
- {
- TraceDump(ERROR_LEVEL,
- ("WLANLDD: DWlanLogicalChannel::DoControlFast: WARNING: AddTxFrame req. when flow ctrl is on"));
- }
+ ret = OnEthernetSideControlFast( aFunction, aParam, triggerTx );
+ }
+ else
+ {
+ // unknown unit
+#ifndef NDEBUG
+ TraceDump(ERROR_LEVEL,
+ ("WLANLDD: DWlanLogicalChannel::DoControlFast: unknown unit"));
+ TraceDump(ERROR_LEVEL, (("WLANLDD: aFunction: %d"), aFunction));
+ TraceDump(ERROR_LEVEL, (("WLANLDD: unit: %d"), iUnit));
+ os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ );
#endif
- if ( iEthernetFrameMemMngr->AllTxQueuesEmpty() )
- {
- triggerTx = ETrue;
- }
-
- TDataBuffer* discardFrame ( NULL );
-
- ret = reinterpret_cast<TAny*>(iEthernetFrameMemMngr->AddTxFrame(
- reinterpret_cast<TDataBuffer*>(param),
- discardFrame,
- iUmac.UserDataTxEnabled() ));
-
- if ( discardFrame )
- {
- TraceDump( NWSA_TX_DETAILS,
- (("WLANLDD: DWlanLogicalChannel::DoControlFast: have to drop tx frame of UP: %d"),
- reinterpret_cast<TDataBuffer*>(param)->UserPriority()) );
-
- iEthernetFrameMemMngr->FreeTxPacket( discardFrame );
- }
-
- if ( !ret )
- {
- iAddTxFrameAllowed = EFalse;
-
- TraceDump( NWSA_TX,
- ("WLANLDD: DWlanLogicalChannel::DoControlFast: stop flow from protocol stack") );
- }
- break;
- }
- default:
-#ifndef NDEBUG
- TraceDump(ERROR_LEVEL, (("WLANLDD: unknown request: %d"),
- aFunction));
- os_assert(
- (TUint8*)("WLANLDD: panic"),
- (TUint8*)(WLAN_FILE),
- __LINE__ );
-#endif
- break;
}
// release mutex
@@ -728,7 +684,7 @@
// the lower priority thread will get paused and the higher priority
// thread will get scheduled (to execute the DFC), we don't want the
// higher priority thread to need to wait for the mutex. So we
- // released the mutex first in this code block and after that enque
+ // released the mutex first in this code block and after that enqueue
// the DFC request.
if ( !( iFlags & KTxTriggerArmed ) )
{
@@ -741,6 +697,162 @@
}
// ---------------------------------------------------------------------------
+// Note! This method is executed in the context of the user mode client
+// thread, but in supervisor mode
+// ---------------------------------------------------------------------------
+//
+TAny* DWlanLogicalChannel::OnMgmtSideControlFast(
+ TInt aFunction,
+ TAny* aParam )
+ {
+ TAny* ret( NULL );
+
+ switch ( aFunction )
+ {
+ // ==========================================================
+ // Get Rx frame
+ // ==========================================================
+ case RWlanLogicalChannel::EWlanControlFastGetRxFrame:
+ if ( iEthernetFrameMemMngr )
+ {
+ ret = iEthernetFrameMemMngr->GetRxFrame(
+ reinterpret_cast<TDataBuffer*>(aParam) );
+ }
+ break;
+ // ==========================================================
+ // Unknown request
+ // ==========================================================
+ default:
+#ifndef NDEBUG
+ TraceDump(ERROR_LEVEL, (("WLANLDD: unknown request: %d"),
+ aFunction));
+ os_assert(
+ (TUint8*)("WLANLDD: panic"),
+ (TUint8*)(WLAN_FILE),
+ __LINE__ );
+#endif
+ break;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// Note! This method is executed in the context of the user mode client
+// thread, but in supervisor mode
+// ---------------------------------------------------------------------------
+//
+TAny* DWlanLogicalChannel::OnEthernetSideControlFast(
+ TInt aFunction,
+ TAny* aParam,
+ TBool& aTriggerTx )
+ {
+ TAny* ret( NULL );
+ aTriggerTx = EFalse;
+
+ switch ( aFunction )
+ {
+ // ==========================================================
+ // Alloc Tx buffer
+ // ==========================================================
+ case RPcmNetCardIf::EControlFastAllocTxBuffer:
+ if ( iEthernetFrameMemMngr )
+ {
+ ret = iEthernetFrameMemMngr->AllocTxBuffer(
+ reinterpret_cast<TUint>(aParam) );
+ }
+
+ if ( !ret && iAddTxFrameAllowed )
+ {
+ iAddTxFrameAllowed = EFalse;
+
+ TraceDump( NWSA_TX,
+ ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControlFast: "
+ "stop flow from protocol stack") );
+ }
+ break;
+ // ==========================================================
+ // Add Tx frame
+ // ==========================================================
+ case RPcmNetCardIf::EControlFastAddTxFrame:
+ {
+#ifndef NDEBUG
+ if ( !iAddTxFrameAllowed )
+ {
+ TraceDump(ERROR_LEVEL,
+ ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControlFast: "
+ "WARNING: AddTxFrame req. when flow ctrl is on"));
+ }
+#endif
+ if ( iEthernetFrameMemMngr && aParam )
+ {
+ if ( iEthernetFrameMemMngr->AllTxQueuesEmpty() )
+ {
+ aTriggerTx = ETrue;
+ }
+
+ TDataBuffer* discardFrame ( NULL );
+
+ ret = reinterpret_cast<TAny*>(
+ iEthernetFrameMemMngr->AddTxFrame(
+ reinterpret_cast<TDataBuffer*>(aParam),
+ discardFrame,
+ iUmac.UserDataTxEnabled() ));
+
+ if ( discardFrame )
+ {
+ TraceDump( NWSA_TX_DETAILS,
+ (("WLANLDD: DWlanLogicalChannel::OnEthernetSideControlFast: "
+ "have to drop tx frame of UP: %d"),
+ reinterpret_cast<TDataBuffer*>(
+ aParam)->UserPriority()) );
+
+ iEthernetFrameMemMngr->FreeTxPacket( discardFrame );
+ aTriggerTx = EFalse;
+ }
+ }
+
+ if ( !ret )
+ {
+ iAddTxFrameAllowed = EFalse;
+
+ TraceDump( NWSA_TX,
+ ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControlFast: "
+ "stop flow from protocol stack") );
+ }
+ break;
+ }
+ // ==========================================================
+ // Get Rx frame
+ // ==========================================================
+ case RPcmNetCardIf::EControlFastGetRxFrame:
+ {
+ if ( iEthernetFrameMemMngr )
+ {
+ ret = iEthernetFrameMemMngr->GetRxFrame(
+ reinterpret_cast<TDataBuffer*>(aParam) );
+ }
+ }
+ break;
+ // ==========================================================
+ // Unknown request
+ // ==========================================================
+ default:
+#ifndef NDEBUG
+ TraceDump(ERROR_LEVEL, (("WLANLDD: unknown request: %d"),
+ aFunction));
+ os_assert(
+ (TUint8*)("WLANLDD: panic"),
+ (TUint8*)(WLAN_FILE),
+ __LINE__ );
+#endif
+ break;
+ } // switch
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
//
@@ -748,7 +860,7 @@
{
if ( iUnit == KUnitWlan )
{
- if ( aMask & ( 1 << EWlanRequestNotify ) )
+ if ( aMask & ( 1 << RWlanLogicalChannel::EWlanRequestNotify ) )
{
TraceDump(INFO_LEVEL,
("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side notify cancel"));
@@ -758,7 +870,7 @@
iClient, iWlanRequestNotifyStatus, KErrServerTerminated );
iWlanRequestNotifyStatus = NULL;
}
- else if ( aMask & ( 1 << EWlanRequestFrame ) )
+ else if ( aMask & ( 1 << RWlanLogicalChannel::EWlanRequestFrame ) )
{
TraceDump(INFO_LEVEL,
("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side frame read cancel"));
@@ -770,7 +882,8 @@
else
{
TraceDump(ERROR_LEVEL,
- (("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side unhandled mask panic: 0x%08x"),
+ (("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side "
+ "unhandled mask panic: 0x%08x"),
aMask));
os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ );
}
@@ -798,7 +911,8 @@
else
{
TraceDump(ERROR_LEVEL,
- (("WLANLDD: DWlanLogicalChannel::DoCancel: user side unhandled mask panic: 0x%08x"),
+ (("WLANLDD: DWlanLogicalChannel::DoCancel: user side "
+ "unhandled mask panic: 0x%08x"),
aMask));
os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ );
}
@@ -816,11 +930,13 @@
// ---------------------------------------------------------------------------
//
TBool DWlanLogicalChannel::ProtocolStackDataReceiveComplete(
- const TDataBuffer*& aBufferStart,
+ TDataBuffer*& aBufferStart,
TUint32 aNumOfBuffers )
{
- if ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete( aBufferStart,
- aNumOfBuffers ) )
+ if ( iEthernetFrameMemMngr &&
+ iEthernetFrameMemMngr->OnEthernetFrameRxComplete(
+ aBufferStart,
+ aNumOfBuffers ) )
{
Kern::RequestComplete( iClient, iEthernetReceiveFrameStatus, KErrNone );
iEthernetReceiveFrameStatus = NULL;
@@ -903,13 +1019,17 @@
TraceDump(UMAC_PROTO_CALLBACK,
(("WLANLDD: aCompletionCode: %d"), aCompletionCode));
- iEthernetFrameMemMngr->FreeTxPacket( aMetaHeader );
+ if ( iEthernetFrameMemMngr )
+ {
+ iEthernetFrameMemMngr->FreeTxPacket( aMetaHeader );
+ }
TxProtocolStackData();
if ( !iAddTxFrameAllowed )
{
- if ( iResumeTxStatus &&
+ if ( iResumeTxStatus &&
+ iEthernetFrameMemMngr &&
iEthernetFrameMemMngr->ResumeClientTx(
iUmac.UserDataTxEnabled() ) )
{
@@ -980,18 +1100,24 @@
//
void DWlanLogicalChannel::TxManagementData()
{
- TDataBuffer* buffer = iEthernetFrameMemMngr->OnWriteEthernetFrame();
-
- if ( !buffer )
+ TDataBuffer* buffer( NULL );
+
+ if ( iEthernetFrameMemMngr )
{
- TraceDump(ERROR_LEVEL,
- ("WLANLDD: DWlanLogicalChannel::TxManagementData: "
- "panic, no buffer"));
- os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ );
+ buffer = iEthernetFrameMemMngr->OnWriteEthernetFrame();
+ }
+
+ if ( buffer )
+ {
+ iUmac.WriteMgmtFrame( *buffer );
}
else
{
- iUmac.WriteMgmtFrame( *buffer );
+#ifndef NDEBUG
+ os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ );
+#endif
+ Kern::RequestComplete(
+ iClient, iWlanSendFrameStatus, KErrGeneral );
}
}
@@ -1001,7 +1127,7 @@
//
void DWlanLogicalChannel::TxProtocolStackData()
{
-#ifndef NDEBUG
+#ifndef NDEBUG
TUint packetsSubmitted ( 0 );
#endif
@@ -1049,7 +1175,13 @@
//
TBool DWlanLogicalChannel::OnReadEthernetFrameRequest()
{
- const TBool ret = iEthernetFrameMemMngr->OnReadRequest();
+ TBool ret( EFalse );
+
+ if ( iEthernetFrameMemMngr )
+ {
+ ret = iEthernetFrameMemMngr->OnReadRequest();
+ }
+
return ret;
}
@@ -1451,17 +1583,17 @@
switch ( aReqNo )
{
- case EWlanInitSystem:
+ case RWlanLogicalChannel::EWlanInitSystem:
// bootup the chip and the system
iWlanGeneralRequestStatus = aStatus;
InitSystem( a1, sizeof(TOpenParam) );
break;
- case EWlanFinitSystem:
+ case RWlanLogicalChannel::EWlanFinitSystem:
// power down the chip and the system
iWlanGeneralRequestStatus = aStatus;
FinitSystem();
break;
- case EWlanCommand:
+ case RWlanLogicalChannel::EWlanCommand:
// management command
iWlanGeneralRequestStatus = aStatus;
@@ -1502,13 +1634,13 @@
output_buffer.iData,
output_buffer.iLen );
break;
- case EWlanRequestNotify:
+ case RWlanLogicalChannel::EWlanRequestNotify:
// store the USER mode indication address;
iIndicationBuffer = static_cast<TIndication*>(a1);
iWlanRequestNotifyStatus = aStatus;
IndicationRequest( static_cast<TIndication*>(a1) );
break;
- case EWlanRequestFrame:
+ case RWlanLogicalChannel::EWlanRequestFrame:
if ( OnReadEthernetFrameRequest() )
{
// rx data to be completed exists
@@ -1525,7 +1657,7 @@
iWlanReceiveFrameStatus = aStatus;
}
break;
- case EWlanRequestSend:
+ case RWlanLogicalChannel::EWlanRequestSend:
iWlanSendFrameStatus = aStatus;
TxManagementData();
@@ -1728,7 +1860,7 @@
TAny* /*a2*/ )
{
TInt ret( KErrNone );
- if ( aFunction == EWlanSvControlInitBuffers )
+ if ( aFunction == RWlanLogicalChannel::EWlanSvControlInitBuffers )
{
// initiliaze buffers for wlan mgmt client data xfer
if ( a1 )
@@ -1749,7 +1881,7 @@
os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ );
}
}
- else if ( aFunction == EWlanSvControlFreeBuffers )
+ else if ( aFunction == RWlanLogicalChannel::EWlanSvControlFreeBuffers )
{
// free wlan mgmt client data xfer buffers
OnReleaseEthernetFrameBuffers();
@@ -1891,13 +2023,16 @@
if ( iEthernetFrameMemMngr )
{
TraceDump(NWSA_TX_DETAILS,
- (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aEthernetFrameTxOffset: %d"),
+ (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: "
+ "aEthernetFrameTxOffset: %d"),
aEthernetFrameTxOffset ));
TraceDump(NWSA_TX_DETAILS,
- (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aDot11FrameTxOffset: %d"),
+ (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: "
+ "aDot11FrameTxOffset: %d"),
aDot11FrameTxOffset ));
TraceDump(NWSA_TX_DETAILS,
- (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aSnapFrameTxOffset: %d"),
+ (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: "
+ "aSnapFrameTxOffset: %d"),
aSnapFrameTxOffset ));
iEthernetFrameMemMngr->SetTxOffsets(
@@ -1934,12 +2069,13 @@
// ---------------------------------------------------------------------------
//
void DWlanLogicalChannel::MgmtDataReceiveComplete(
- const TDataBuffer*& aBufferStart,
+ TDataBuffer*& aBufferStart,
TUint32 aNumOfBuffers )
{
- if ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete(
- aBufferStart,
- aNumOfBuffers ) )
+ if ( iEthernetFrameMemMngr &&
+ ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete(
+ aBufferStart,
+ aNumOfBuffers ) ) )
{
Kern::RequestComplete( iClient, iWlanReceiveFrameStatus, KErrNone );
iWlanReceiveFrameStatus = NULL;
@@ -2174,23 +2310,32 @@
void DWlanLogicalChannel::ReleaseIndicationListEntry(
TIndicationListEntry* aEntry )
{
- aEntry->next = NULL;
-
- if ( !iFreeIndicationListHead )
+ if ( aEntry )
{
- iFreeIndicationListHead = aEntry;
+ aEntry->next = NULL;
+
+ if ( !iFreeIndicationListHead )
+ {
+ iFreeIndicationListHead = aEntry;
+ }
+ else
+ {
+ TIndicationListEntry* tmp = iFreeIndicationListHead;
+
+ while ( tmp->next )
+ {
+ tmp = tmp->next;
+ }
+
+ tmp->next = aEntry;
+ }
}
+#ifndef NDEBUG
else
{
- TIndicationListEntry* tmp = iFreeIndicationListHead;
-
- while ( tmp->next )
- {
- tmp = tmp->next;
- }
-
- tmp->next = aEntry;
+ os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ );
}
+#endif
}
// ---------------------------------------------------------------------------