wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/src/WlanLogicalChannel.cpp
branchRCL_3
changeset 10 0abc8c98be24
parent 3 6524e815f76f
child 22 c6a1762761b8
child 25 a0fdcd0e4c56
child 34 13838cf40350
equal deleted inserted replaced
8:e0f767079796 10:0abc8c98be24
    14 * Description:   Implementation of the DWlanLogicalChannel class.
    14 * Description:   Implementation of the DWlanLogicalChannel class.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 57 %
    19 * %version: 59 %
    20 */
    20 */
    21 
    21 
    22 #include "WlLddWlanLddConfig.h"
    22 #include "WlLddWlanLddConfig.h"
    23 #include "wlanlddcommon.h"
    23 #include "wlanlddcommon.h"
    24 #include "WlanLogicalChannel.h"
    24 #include "WlanLogicalChannel.h"
    25 #include "EthernetFrameMemMngr.h"
    25 #include "EthernetFrameMemMngr.h"
    26 #include "EtherCardIoc.h"
    26 #include "EtherCardIoc.h"
    27 #include "RWlanLogicalChannel.h"
       
    28 #include "Umac.h"
    27 #include "Umac.h"
    29 #include "wllddoidmsgstorage.h"
    28 #include "wllddoidmsgstorage.h"
    30 #include "WlanLogicalDevice.h"
    29 #include "WlanLogicalDevice.h"
    31 #include "osachunk.h"
    30 #include "osachunk.h"
    32 
    31 
   184             }
   183             }
   185         }
   184         }
   186     else if ( iUnit == KUnitEthernet )
   185     else if ( iUnit == KUnitEthernet )
   187         {
   186         {
   188         iTxTriggerDfc.Cancel();
   187         iTxTriggerDfc.Cancel();
   189         
       
   190         // detach protocol stack side callback
       
   191         TraceDump(INIT_LEVEL, 
       
   192             ("WLANLDD: detach protocol stack side callback from UMAC"));
       
   193         iUmac.DetachProtocolStackSideUmacCb();
       
   194         }
   188         }
   195 
   189 
   196     if ( iEthernetFrameMemMngr )
   190     if ( iEthernetFrameMemMngr )
   197         {
   191         {
   198         TraceDump(INIT_LEVEL, ("WLANLDD: deallocate ethernet frame memory pool"));
   192         TraceDump(INIT_LEVEL, ("WLANLDD: deallocate ethernet frame memory pool"));
   441             return KErrNoMemory;
   435             return KErrNoMemory;
   442             }
   436             }
   443         }
   437         }
   444     else if ( iUnit == KUnitEthernet )
   438     else if ( iUnit == KUnitEthernet )
   445         {
   439         {
   446         // attach protocol stack side callbac
   440         // nothing for now
   447         iUmac.AttachProtocolStackSideUmacCb( *this );
       
   448         }
   441         }
   449     else
   442     else
   450         {
   443         {
   451         // unknown unit
   444         // unknown unit
   452         
   445         
   630     
   623     
   631     // Note! We are executing in the context of the client's thread, but
   624     // Note! We are executing in the context of the client's thread, but
   632     // in supervisor mode
   625     // in supervisor mode
   633     
   626     
   634     // acquire mutex
   627     // acquire mutex
       
   628     // Enter critical section before requesting the mutex as
       
   629     // we are executing in the context of a user mode thread
       
   630     NKern::ThreadEnterCS();    
   635 #ifndef RD_WLAN_DDK
   631 #ifndef RD_WLAN_DDK
   636     Kern::MutexWait( iMutex );
   632     Kern::MutexWait( iMutex );
   637 #else
   633 #else
   638     iOsa->MutexAcquire();
   634     iOsa->MutexAcquire();
   639 #endif
   635 #endif
       
   636     NKern::ThreadLeaveCS();
   640     
   637     
   641     TraceDump(MUTEX, 
   638     TraceDump(MUTEX, 
   642         (("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex acquired")));
   639         (("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex acquired")));
   643     
   640     
   644     switch ( aFunction )
   641     switch ( aFunction )
   706 #endif
   703 #endif
   707             break;
   704             break;
   708         }
   705         }
   709     
   706     
   710     // release mutex
   707     // release mutex
       
   708     // Enter critical section before releasing the mutex as
       
   709     // we are executing in the context of a user mode thread
       
   710     NKern::ThreadEnterCS();    
   711 #ifndef RD_WLAN_DDK
   711 #ifndef RD_WLAN_DDK
   712     Kern::MutexSignal( iMutex );
   712     Kern::MutexSignal( iMutex );
   713 #else
   713 #else
   714     iOsa->MutexRelease();
   714     iOsa->MutexRelease();
   715 #endif 
   715 #endif 
       
   716     NKern::ThreadLeaveCS();
   716     
   717     
   717     TraceDump(MUTEX, 
   718     TraceDump(MUTEX, 
   718         ("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex released"));
   719         ("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex released"));
   719 
   720 
   720     if ( triggerTx )
   721     if ( triggerTx )
  1008         {
  1009         {
  1009         TWhaTxQueueState txQueueState;
  1010         TWhaTxQueueState txQueueState;
  1010         TBool morePackets ( EFalse );
  1011         TBool morePackets ( EFalse );
  1011         iTxActive = ETrue;
  1012         iTxActive = ETrue;
  1012         
  1013         
  1013         while ( iUmac.TxPermitted( txQueueState ) && iEthernetFrameMemMngr )
  1014         while ( iEthernetFrameMemMngr && iUmac.TxPermitted( txQueueState ) )
  1014             {
  1015             {
  1015             TDataBuffer* metaHeader = 
  1016             TDataBuffer* metaHeader = 
  1016                 iEthernetFrameMemMngr->GetTxFrame( txQueueState, morePackets );
  1017                 iEthernetFrameMemMngr->GetTxFrame( txQueueState, morePackets );
  1017             
  1018             
  1018             if ( metaHeader )
  1019             if ( metaHeader )
  1597         ret = iEthernetFrameMemMngr->OnInitialiseMemory( 
  1598         ret = iEthernetFrameMemMngr->OnInitialiseMemory( 
  1598             *iClient, 
  1599             *iClient, 
  1599             aSharedChunkInfo,
  1600             aSharedChunkInfo,
  1600             vendorTxHdrLen,
  1601             vendorTxHdrLen,
  1601             vendorTxTrailerLen );
  1602             vendorTxTrailerLen );
       
  1603         
       
  1604         if ( ( iUnit == KUnitEthernet ) && 
       
  1605              ( ret == KErrNone ) )
       
  1606             {
       
  1607             // attach protocol stack side callback
       
  1608             TraceDump(INIT_LEVEL, 
       
  1609                 ("WLANLDD: attach protocol stack side callback to UMAC"));
       
  1610             iUmac.AttachProtocolStackSideUmacCb( *this );
       
  1611     
       
  1612             // set frame Tx offset for protocol stack side 
       
  1613             iUmac.SetTxOffset();
       
  1614             }
  1602         }
  1615         }
  1603 
  1616 
  1604     return ret;
  1617     return ret;
  1605     }
  1618     }
  1606 
  1619 
  1611 void DWlanLogicalChannel::OnReleaseEthernetFrameBuffers()
  1624 void DWlanLogicalChannel::OnReleaseEthernetFrameBuffers()
  1612     {
  1625     {
  1613     if ( iEthernetFrameMemMngr )
  1626     if ( iEthernetFrameMemMngr )
  1614         {
  1627         {
  1615         iEthernetFrameMemMngr->OnReleaseMemory( *iClient );    
  1628         iEthernetFrameMemMngr->OnReleaseMemory( *iClient );    
       
  1629         }
       
  1630 
       
  1631     if ( iUnit == KUnitEthernet )
       
  1632         {
       
  1633         // detach protocol stack side callback
       
  1634         TraceDump(INIT_LEVEL, 
       
  1635             ("WLANLDD: detach protocol stack side callback from UMAC"));
       
  1636         iUmac.DetachProtocolStackSideUmacCb();
  1616         }
  1637         }
  1617     }
  1638     }
  1618 
  1639 
  1619 // ---------------------------------------------------------------------------
  1640 // ---------------------------------------------------------------------------
  1620 // 
  1641 // 
  1669                 TraceDump(INIT_LEVEL, 
  1690                 TraceDump(INIT_LEVEL, 
  1670                     (("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl: chunk info addr: 0x%08x"), 
  1691                     (("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl: chunk info addr: 0x%08x"), 
  1671                     a1));
  1692                     a1));
  1672                 ret = OnInitialiseEthernetFrameBuffers( 
  1693                 ret = OnInitialiseEthernetFrameBuffers( 
  1673                     static_cast<TSharedChunkInfo*>(a1) );
  1694                     static_cast<TSharedChunkInfo*>(a1) );
  1674 
       
  1675                 // set frame Tx offset for protocol stack side 
       
  1676                 iUmac.SetTxOffset();
       
  1677                 }
  1695                 }
  1678             else
  1696             else
  1679                 {
  1697                 {
  1680                 TraceDump(ERROR_LEVEL, 
  1698                 TraceDump(ERROR_LEVEL, 
  1681                     ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl(): init protocol stack buffer pool panic"));
  1699                     ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl(): init protocol stack buffer pool panic"));