changeset 25 | a0fdcd0e4c56 |
parent 17 | 41a8eba36f74 |
24:e717b8f55620 | 25:a0fdcd0e4c56 |
---|---|
14 * Description: Implementation of the DWlanLogicalChannel class. |
14 * Description: Implementation of the DWlanLogicalChannel class. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 /* |
18 /* |
19 * %version: 59 % |
19 * %version: 61 % |
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" |
39 |
39 |
40 // Tx memory for frames created by UMAC |
40 // Tx memory for frames created by UMAC |
41 const TUint32 KDmaTxMemSize = 4096; // equals to 1 MMU page on most systems |
41 const TUint32 KDmaTxMemSize = 4096; // equals to 1 MMU page on most systems |
42 |
42 |
43 // --------------------------------------------------------------------------- |
43 // --------------------------------------------------------------------------- |
44 // |
44 // Note! This method is executed in the context of the user mode client |
45 // thread, but in supervisor mode |
|
45 // --------------------------------------------------------------------------- |
46 // --------------------------------------------------------------------------- |
46 // |
47 // |
47 #ifndef RD_WLAN_DDK |
48 #ifndef RD_WLAN_DDK |
48 DWlanLogicalChannel::DWlanLogicalChannel( |
49 DWlanLogicalChannel::DWlanLogicalChannel( |
49 DWlanLogicalDevice& aParent, |
50 DWlanLogicalDevice& aParent, |
269 |
270 |
270 return ret; |
271 return ret; |
271 } |
272 } |
272 |
273 |
273 // --------------------------------------------------------------------------- |
274 // --------------------------------------------------------------------------- |
275 // Note! This method is executed in the context of the user mode client |
|
276 // thread, but in supervisor mode |
|
277 // |
|
274 // If an error occurs in this method, we set iPdd to NULL to prevent |
278 // If an error occurs in this method, we set iPdd to NULL to prevent |
275 // PDD object destruction in base class (DLogicalChannelBase) destructor. |
279 // PDD object destruction in base class (DLogicalChannelBase) destructor. |
276 // DLogicalChannelBase destructor gets called as this logical channel instance |
280 // DLogicalChannelBase destructor gets called as this logical channel instance |
277 // gets destoyed when this method returns with an error. |
281 // gets destoyed when this method returns with an error. |
278 // The PDD object gets destructed elsewhere. |
282 // The PDD object gets destructed elsewhere. |
604 (("WLANLDD: DWlanLogicalChannel::HandleMsg: mutex released"))); |
608 (("WLANLDD: DWlanLogicalChannel::HandleMsg: mutex released"))); |
605 } |
609 } |
606 |
610 |
607 |
611 |
608 // --------------------------------------------------------------------------- |
612 // --------------------------------------------------------------------------- |
609 // |
613 // Note! This method is executed in the context of the user mode client |
610 // --------------------------------------------------------------------------- |
614 // thread, but in supervisor mode |
611 // |
615 // --------------------------------------------------------------------------- |
612 TAny* DWlanLogicalChannel::DoControlFast( TInt aFunction, TAny* param ) |
616 // |
617 TAny* DWlanLogicalChannel::DoControlFast( TInt aFunction, TAny* aParam ) |
|
613 { |
618 { |
614 TAny* ret( NULL ); |
619 TAny* ret( NULL ); |
615 TBool triggerTx ( EFalse ); |
620 TBool triggerTx ( EFalse ); |
616 |
621 |
617 TraceDump(WLM_CMD_DETAILS, |
622 TraceDump(WLM_CMD_DETAILS, |
618 (("WLANLDD: DWlanLogicalChannel::DoControlFast: current thread 0x%08x"), |
623 (("WLANLDD: DWlanLogicalChannel::DoControlFast: current thread 0x%08x"), |
619 &Kern::CurrentThread())); |
624 &Kern::CurrentThread())); |
620 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: channel creator thread: 0x%08x"), |
625 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: channel creator thread: 0x%08x"), |
621 iClient)); |
626 iClient)); |
622 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: function: 0x%x"), aFunction)); |
627 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: function: 0x%x"), aFunction)); |
623 |
|
624 // Note! We are executing in the context of the client's thread, but |
|
625 // in supervisor mode |
|
626 |
628 |
627 // acquire mutex |
629 // acquire mutex |
628 // Enter critical section before requesting the mutex as |
630 // Enter critical section before requesting the mutex as |
629 // we are executing in the context of a user mode thread |
631 // we are executing in the context of a user mode thread |
630 NKern::ThreadEnterCS(); |
632 NKern::ThreadEnterCS(); |
631 #ifndef RD_WLAN_DDK |
633 #ifndef RD_WLAN_DDK |
632 Kern::MutexWait( iMutex ); |
634 Kern::MutexWait( iMutex ); |
633 #else |
635 #else |
634 iOsa->MutexAcquire(); |
636 iOsa->MutexAcquire(); |
635 #endif |
637 #endif |
636 NKern::ThreadLeaveCS(); |
|
637 |
638 |
638 TraceDump(MUTEX, |
639 TraceDump(MUTEX, |
639 (("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex acquired"))); |
640 (("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex acquired"))); |
640 |
641 |
642 if ( iUnit == KUnitWlan ) |
|
643 { |
|
644 ret = OnMgmtSideControlFast( aFunction, aParam ); |
|
645 } |
|
646 else if ( iUnit == KUnitEthernet ) |
|
647 { |
|
648 ret = OnEthernetSideControlFast( aFunction, aParam, triggerTx ); |
|
649 } |
|
650 else |
|
651 { |
|
652 // unknown unit |
|
653 #ifndef NDEBUG |
|
654 TraceDump(ERROR_LEVEL, |
|
655 ("WLANLDD: DWlanLogicalChannel::DoControlFast: unknown unit")); |
|
656 TraceDump(ERROR_LEVEL, (("WLANLDD: aFunction: %d"), aFunction)); |
|
657 TraceDump(ERROR_LEVEL, (("WLANLDD: unit: %d"), iUnit)); |
|
658 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
659 #endif |
|
660 } |
|
661 |
|
662 // release mutex |
|
663 #ifndef RD_WLAN_DDK |
|
664 Kern::MutexSignal( iMutex ); |
|
665 #else |
|
666 iOsa->MutexRelease(); |
|
667 #endif |
|
668 // and exit from critical section |
|
669 NKern::ThreadLeaveCS(); |
|
670 |
|
671 TraceDump(MUTEX, |
|
672 ("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex released")); |
|
673 |
|
674 if ( triggerTx ) |
|
675 { |
|
676 // Trigger a new Tx - via a DFC. |
|
677 // Note that we do this outside of mutex protection, as this block of |
|
678 // code is executed by a lower priority (user side) thread, and the |
|
679 // DFC by a higher priority (kernel side) thread, and the latter will |
|
680 // also need to acquire the same mutex before it can proceed. So, as |
|
681 // the lower priority thread will get paused and the higher priority |
|
682 // thread will get scheduled (to execute the DFC), we don't want the |
|
683 // higher priority thread to need to wait for the mutex. So we |
|
684 // released the mutex first in this code block and after that enqueue |
|
685 // the DFC request. |
|
686 if ( !( iFlags & KTxTriggerArmed ) ) |
|
687 { |
|
688 iFlags |= KTxTriggerArmed; |
|
689 iTxTriggerDfc.Enque(); |
|
690 } |
|
691 } |
|
692 |
|
693 return ret; |
|
694 } |
|
695 |
|
696 // --------------------------------------------------------------------------- |
|
697 // Note! This method is executed in the context of the user mode client |
|
698 // thread, but in supervisor mode |
|
699 // --------------------------------------------------------------------------- |
|
700 // |
|
701 TAny* DWlanLogicalChannel::OnMgmtSideControlFast( |
|
702 TInt aFunction, |
|
703 TAny* aParam ) |
|
704 { |
|
705 TAny* ret( NULL ); |
|
706 |
|
641 switch ( aFunction ) |
707 switch ( aFunction ) |
642 { |
708 { |
709 // ========================================================== |
|
710 // Get Rx frame |
|
711 // ========================================================== |
|
712 case RWlanLogicalChannel::EWlanControlFastGetRxFrame: |
|
713 if ( iEthernetFrameMemMngr ) |
|
714 { |
|
715 ret = iEthernetFrameMemMngr->GetRxFrame( |
|
716 reinterpret_cast<TDataBuffer*>(aParam) ); |
|
717 } |
|
718 break; |
|
719 // ========================================================== |
|
720 // Unknown request |
|
721 // ========================================================== |
|
722 default: |
|
723 #ifndef NDEBUG |
|
724 TraceDump(ERROR_LEVEL, (("WLANLDD: unknown request: %d"), |
|
725 aFunction)); |
|
726 os_assert( |
|
727 (TUint8*)("WLANLDD: panic"), |
|
728 (TUint8*)(WLAN_FILE), |
|
729 __LINE__ ); |
|
730 #endif |
|
731 break; |
|
732 } |
|
733 |
|
734 return ret; |
|
735 } |
|
736 |
|
737 // --------------------------------------------------------------------------- |
|
738 // Note! This method is executed in the context of the user mode client |
|
739 // thread, but in supervisor mode |
|
740 // --------------------------------------------------------------------------- |
|
741 // |
|
742 TAny* DWlanLogicalChannel::OnEthernetSideControlFast( |
|
743 TInt aFunction, |
|
744 TAny* aParam, |
|
745 TBool& aTriggerTx ) |
|
746 { |
|
747 TAny* ret( NULL ); |
|
748 aTriggerTx = EFalse; |
|
749 |
|
750 switch ( aFunction ) |
|
751 { |
|
752 // ========================================================== |
|
753 // Alloc Tx buffer |
|
754 // ========================================================== |
|
643 case RPcmNetCardIf::EControlFastAllocTxBuffer: |
755 case RPcmNetCardIf::EControlFastAllocTxBuffer: |
644 ret = iEthernetFrameMemMngr->AllocTxBuffer( |
756 if ( iEthernetFrameMemMngr ) |
645 reinterpret_cast<TUint>(param) ); |
757 { |
758 ret = iEthernetFrameMemMngr->AllocTxBuffer( |
|
759 reinterpret_cast<TUint>(aParam) ); |
|
760 } |
|
646 |
761 |
647 if ( !ret && iAddTxFrameAllowed ) |
762 if ( !ret && iAddTxFrameAllowed ) |
648 { |
763 { |
649 iAddTxFrameAllowed = EFalse; |
764 iAddTxFrameAllowed = EFalse; |
650 |
765 |
651 TraceDump( NWSA_TX, |
766 TraceDump( NWSA_TX, |
652 ("WLANLDD: DWlanLogicalChannel::DoControlFast: stop flow from protocol stack") ); |
767 ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControlFast: " |
768 "stop flow from protocol stack") ); |
|
653 } |
769 } |
654 break; |
770 break; |
655 |
771 // ========================================================== |
772 // Add Tx frame |
|
773 // ========================================================== |
|
656 case RPcmNetCardIf::EControlFastAddTxFrame: |
774 case RPcmNetCardIf::EControlFastAddTxFrame: |
657 { |
775 { |
658 #ifndef NDEBUG |
776 #ifndef NDEBUG |
659 if ( !iAddTxFrameAllowed ) |
777 if ( !iAddTxFrameAllowed ) |
660 { |
778 { |
661 TraceDump(ERROR_LEVEL, |
779 TraceDump(ERROR_LEVEL, |
662 ("WLANLDD: DWlanLogicalChannel::DoControlFast: WARNING: AddTxFrame req. when flow ctrl is on")); |
780 ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControlFast: " |
781 "WARNING: AddTxFrame req. when flow ctrl is on")); |
|
663 } |
782 } |
664 #endif |
783 #endif |
665 if ( iEthernetFrameMemMngr->AllTxQueuesEmpty() ) |
784 if ( iEthernetFrameMemMngr && aParam ) |
666 { |
785 { |
667 triggerTx = ETrue; |
786 if ( iEthernetFrameMemMngr->AllTxQueuesEmpty() ) |
668 } |
787 { |
669 |
788 aTriggerTx = ETrue; |
670 TDataBuffer* discardFrame ( NULL ); |
789 } |
671 |
|
672 ret = reinterpret_cast<TAny*>(iEthernetFrameMemMngr->AddTxFrame( |
|
673 reinterpret_cast<TDataBuffer*>(param), |
|
674 discardFrame, |
|
675 iUmac.UserDataTxEnabled() )); |
|
676 |
|
677 if ( discardFrame ) |
|
678 { |
|
679 TraceDump( NWSA_TX_DETAILS, |
|
680 (("WLANLDD: DWlanLogicalChannel::DoControlFast: have to drop tx frame of UP: %d"), |
|
681 reinterpret_cast<TDataBuffer*>(param)->UserPriority()) ); |
|
682 |
790 |
683 iEthernetFrameMemMngr->FreeTxPacket( discardFrame ); |
791 TDataBuffer* discardFrame ( NULL ); |
792 |
|
793 ret = reinterpret_cast<TAny*>( |
|
794 iEthernetFrameMemMngr->AddTxFrame( |
|
795 reinterpret_cast<TDataBuffer*>(aParam), |
|
796 discardFrame, |
|
797 iUmac.UserDataTxEnabled() )); |
|
798 |
|
799 if ( discardFrame ) |
|
800 { |
|
801 TraceDump( NWSA_TX_DETAILS, |
|
802 (("WLANLDD: DWlanLogicalChannel::OnEthernetSideControlFast: " |
|
803 "have to drop tx frame of UP: %d"), |
|
804 reinterpret_cast<TDataBuffer*>( |
|
805 aParam)->UserPriority()) ); |
|
806 |
|
807 iEthernetFrameMemMngr->FreeTxPacket( discardFrame ); |
|
808 aTriggerTx = EFalse; |
|
809 } |
|
684 } |
810 } |
685 |
811 |
686 if ( !ret ) |
812 if ( !ret ) |
687 { |
813 { |
688 iAddTxFrameAllowed = EFalse; |
814 iAddTxFrameAllowed = EFalse; |
689 |
815 |
690 TraceDump( NWSA_TX, |
816 TraceDump( NWSA_TX, |
691 ("WLANLDD: DWlanLogicalChannel::DoControlFast: stop flow from protocol stack") ); |
817 ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControlFast: " |
818 "stop flow from protocol stack") ); |
|
692 } |
819 } |
693 break; |
820 break; |
694 } |
821 } |
822 // ========================================================== |
|
823 // Get Rx frame |
|
824 // ========================================================== |
|
825 case RPcmNetCardIf::EControlFastGetRxFrame: |
|
826 { |
|
827 if ( iEthernetFrameMemMngr ) |
|
828 { |
|
829 ret = iEthernetFrameMemMngr->GetRxFrame( |
|
830 reinterpret_cast<TDataBuffer*>(aParam) ); |
|
831 } |
|
832 } |
|
833 break; |
|
834 // ========================================================== |
|
835 // Unknown request |
|
836 // ========================================================== |
|
695 default: |
837 default: |
696 #ifndef NDEBUG |
838 #ifndef NDEBUG |
697 TraceDump(ERROR_LEVEL, (("WLANLDD: unknown request: %d"), |
839 TraceDump(ERROR_LEVEL, (("WLANLDD: unknown request: %d"), |
698 aFunction)); |
840 aFunction)); |
699 os_assert( |
841 os_assert( |
700 (TUint8*)("WLANLDD: panic"), |
842 (TUint8*)("WLANLDD: panic"), |
701 (TUint8*)(WLAN_FILE), |
843 (TUint8*)(WLAN_FILE), |
702 __LINE__ ); |
844 __LINE__ ); |
703 #endif |
845 #endif |
704 break; |
846 break; |
705 } |
847 } // switch |
706 |
|
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 |
|
712 Kern::MutexSignal( iMutex ); |
|
713 #else |
|
714 iOsa->MutexRelease(); |
|
715 #endif |
|
716 NKern::ThreadLeaveCS(); |
|
717 |
|
718 TraceDump(MUTEX, |
|
719 ("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex released")); |
|
720 |
|
721 if ( triggerTx ) |
|
722 { |
|
723 // Trigger a new Tx - via a DFC. |
|
724 // Note that we do this outside of mutex protection, as this block of |
|
725 // code is executed by a lower priority (user side) thread, and the |
|
726 // DFC by a higher priority (kernel side) thread, and the latter will |
|
727 // also need to acquire the same mutex before it can proceed. So, as |
|
728 // the lower priority thread will get paused and the higher priority |
|
729 // thread will get scheduled (to execute the DFC), we don't want the |
|
730 // higher priority thread to need to wait for the mutex. So we |
|
731 // released the mutex first in this code block and after that enque |
|
732 // the DFC request. |
|
733 if ( !( iFlags & KTxTriggerArmed ) ) |
|
734 { |
|
735 iFlags |= KTxTriggerArmed; |
|
736 iTxTriggerDfc.Enque(); |
|
737 } |
|
738 } |
|
739 |
848 |
740 return ret; |
849 return ret; |
741 } |
850 } |
742 |
851 |
743 // --------------------------------------------------------------------------- |
852 // --------------------------------------------------------------------------- |
746 // |
855 // |
747 void DWlanLogicalChannel::DoCancel( TInt aMask ) |
856 void DWlanLogicalChannel::DoCancel( TInt aMask ) |
748 { |
857 { |
749 if ( iUnit == KUnitWlan ) |
858 if ( iUnit == KUnitWlan ) |
750 { |
859 { |
751 if ( aMask & ( 1 << EWlanRequestNotify ) ) |
860 if ( aMask & ( 1 << RWlanLogicalChannel::EWlanRequestNotify ) ) |
752 { |
861 { |
753 TraceDump(INFO_LEVEL, |
862 TraceDump(INFO_LEVEL, |
754 ("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side notify cancel")); |
863 ("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side notify cancel")); |
755 |
864 |
756 CancelIndicationRequest(); |
865 CancelIndicationRequest(); |
757 Kern::RequestComplete( |
866 Kern::RequestComplete( |
758 iClient, iWlanRequestNotifyStatus, KErrServerTerminated ); |
867 iClient, iWlanRequestNotifyStatus, KErrServerTerminated ); |
759 iWlanRequestNotifyStatus = NULL; |
868 iWlanRequestNotifyStatus = NULL; |
760 } |
869 } |
761 else if ( aMask & ( 1 << EWlanRequestFrame ) ) |
870 else if ( aMask & ( 1 << RWlanLogicalChannel::EWlanRequestFrame ) ) |
762 { |
871 { |
763 TraceDump(INFO_LEVEL, |
872 TraceDump(INFO_LEVEL, |
764 ("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side frame read cancel")); |
873 ("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side frame read cancel")); |
765 |
874 |
766 Kern::RequestComplete( |
875 Kern::RequestComplete( |
768 iWlanReceiveFrameStatus = NULL; |
877 iWlanReceiveFrameStatus = NULL; |
769 } |
878 } |
770 else |
879 else |
771 { |
880 { |
772 TraceDump(ERROR_LEVEL, |
881 TraceDump(ERROR_LEVEL, |
773 (("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side unhandled mask panic: 0x%08x"), |
882 (("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side " |
883 "unhandled mask panic: 0x%08x"), |
|
774 aMask)); |
884 aMask)); |
775 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
885 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
776 } |
886 } |
777 } |
887 } |
778 else if ( iUnit == KUnitEthernet ) |
888 else if ( iUnit == KUnitEthernet ) |
796 iEthernetReceiveFrameStatus = NULL; |
906 iEthernetReceiveFrameStatus = NULL; |
797 } |
907 } |
798 else |
908 else |
799 { |
909 { |
800 TraceDump(ERROR_LEVEL, |
910 TraceDump(ERROR_LEVEL, |
801 (("WLANLDD: DWlanLogicalChannel::DoCancel: user side unhandled mask panic: 0x%08x"), |
911 (("WLANLDD: DWlanLogicalChannel::DoCancel: user side " |
912 "unhandled mask panic: 0x%08x"), |
|
802 aMask)); |
913 aMask)); |
803 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
914 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
804 } |
915 } |
805 } |
916 } |
806 else |
917 else |
814 // --------------------------------------------------------------------------- |
925 // --------------------------------------------------------------------------- |
815 // |
926 // |
816 // --------------------------------------------------------------------------- |
927 // --------------------------------------------------------------------------- |
817 // |
928 // |
818 TBool DWlanLogicalChannel::ProtocolStackDataReceiveComplete( |
929 TBool DWlanLogicalChannel::ProtocolStackDataReceiveComplete( |
819 const TDataBuffer*& aBufferStart, |
930 TDataBuffer*& aBufferStart, |
820 TUint32 aNumOfBuffers ) |
931 TUint32 aNumOfBuffers ) |
821 { |
932 { |
822 if ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete( aBufferStart, |
933 if ( iEthernetFrameMemMngr && |
823 aNumOfBuffers ) ) |
934 iEthernetFrameMemMngr->OnEthernetFrameRxComplete( |
935 aBufferStart, |
|
936 aNumOfBuffers ) ) |
|
824 { |
937 { |
825 Kern::RequestComplete( iClient, iEthernetReceiveFrameStatus, KErrNone ); |
938 Kern::RequestComplete( iClient, iEthernetReceiveFrameStatus, KErrNone ); |
826 iEthernetReceiveFrameStatus = NULL; |
939 iEthernetReceiveFrameStatus = NULL; |
827 } |
940 } |
828 |
941 |
901 TraceDump(UMAC_PROTO_CALLBACK, |
1014 TraceDump(UMAC_PROTO_CALLBACK, |
902 ("WLANLDD: DWlanLogicalChannel::OnTxProtocolStackDataComplete")); |
1015 ("WLANLDD: DWlanLogicalChannel::OnTxProtocolStackDataComplete")); |
903 TraceDump(UMAC_PROTO_CALLBACK, |
1016 TraceDump(UMAC_PROTO_CALLBACK, |
904 (("WLANLDD: aCompletionCode: %d"), aCompletionCode)); |
1017 (("WLANLDD: aCompletionCode: %d"), aCompletionCode)); |
905 |
1018 |
906 iEthernetFrameMemMngr->FreeTxPacket( aMetaHeader ); |
1019 if ( iEthernetFrameMemMngr ) |
1020 { |
|
1021 iEthernetFrameMemMngr->FreeTxPacket( aMetaHeader ); |
|
1022 } |
|
907 |
1023 |
908 TxProtocolStackData(); |
1024 TxProtocolStackData(); |
909 |
1025 |
910 if ( !iAddTxFrameAllowed ) |
1026 if ( !iAddTxFrameAllowed ) |
911 { |
1027 { |
912 if ( iResumeTxStatus && |
1028 if ( iResumeTxStatus && |
1029 iEthernetFrameMemMngr && |
|
913 iEthernetFrameMemMngr->ResumeClientTx( |
1030 iEthernetFrameMemMngr->ResumeClientTx( |
914 iUmac.UserDataTxEnabled() ) ) |
1031 iUmac.UserDataTxEnabled() ) ) |
915 { |
1032 { |
916 // resume Tx flow from protocol stack |
1033 // resume Tx flow from protocol stack |
917 |
1034 |
978 // |
1095 // |
979 // --------------------------------------------------------------------------- |
1096 // --------------------------------------------------------------------------- |
980 // |
1097 // |
981 void DWlanLogicalChannel::TxManagementData() |
1098 void DWlanLogicalChannel::TxManagementData() |
982 { |
1099 { |
983 TDataBuffer* buffer = iEthernetFrameMemMngr->OnWriteEthernetFrame(); |
1100 TDataBuffer* buffer( NULL ); |
984 |
1101 |
985 if ( !buffer ) |
1102 if ( iEthernetFrameMemMngr ) |
986 { |
1103 { |
987 TraceDump(ERROR_LEVEL, |
1104 buffer = iEthernetFrameMemMngr->OnWriteEthernetFrame(); |
988 ("WLANLDD: DWlanLogicalChannel::TxManagementData: " |
1105 } |
989 "panic, no buffer")); |
1106 |
1107 if ( buffer ) |
|
1108 { |
|
1109 iUmac.WriteMgmtFrame( *buffer ); |
|
1110 } |
|
1111 else |
|
1112 { |
|
1113 #ifndef NDEBUG |
|
990 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
1114 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
991 } |
1115 #endif |
992 else |
1116 Kern::RequestComplete( |
993 { |
1117 iClient, iWlanSendFrameStatus, KErrGeneral ); |
994 iUmac.WriteMgmtFrame( *buffer ); |
|
995 } |
1118 } |
996 } |
1119 } |
997 |
1120 |
998 // --------------------------------------------------------------------------- |
1121 // --------------------------------------------------------------------------- |
999 // |
1122 // |
1000 // --------------------------------------------------------------------------- |
1123 // --------------------------------------------------------------------------- |
1001 // |
1124 // |
1002 void DWlanLogicalChannel::TxProtocolStackData() |
1125 void DWlanLogicalChannel::TxProtocolStackData() |
1003 { |
1126 { |
1004 #ifndef NDEBUG |
1127 #ifndef NDEBUG |
1005 TUint packetsSubmitted ( 0 ); |
1128 TUint packetsSubmitted ( 0 ); |
1006 #endif |
1129 #endif |
1007 |
1130 |
1008 if ( !iTxActive ) |
1131 if ( !iTxActive ) |
1009 { |
1132 { |
1047 // |
1170 // |
1048 // --------------------------------------------------------------------------- |
1171 // --------------------------------------------------------------------------- |
1049 // |
1172 // |
1050 TBool DWlanLogicalChannel::OnReadEthernetFrameRequest() |
1173 TBool DWlanLogicalChannel::OnReadEthernetFrameRequest() |
1051 { |
1174 { |
1052 const TBool ret = iEthernetFrameMemMngr->OnReadRequest(); |
1175 TBool ret( EFalse ); |
1176 |
|
1177 if ( iEthernetFrameMemMngr ) |
|
1178 { |
|
1179 ret = iEthernetFrameMemMngr->OnReadRequest(); |
|
1180 } |
|
1181 |
|
1053 return ret; |
1182 return ret; |
1054 } |
1183 } |
1055 |
1184 |
1056 // --------------------------------------------------------------------------- |
1185 // --------------------------------------------------------------------------- |
1057 // |
1186 // |
1449 } |
1578 } |
1450 } |
1579 } |
1451 |
1580 |
1452 switch ( aReqNo ) |
1581 switch ( aReqNo ) |
1453 { |
1582 { |
1454 case EWlanInitSystem: |
1583 case RWlanLogicalChannel::EWlanInitSystem: |
1455 // bootup the chip and the system |
1584 // bootup the chip and the system |
1456 iWlanGeneralRequestStatus = aStatus; |
1585 iWlanGeneralRequestStatus = aStatus; |
1457 InitSystem( a1, sizeof(TOpenParam) ); |
1586 InitSystem( a1, sizeof(TOpenParam) ); |
1458 break; |
1587 break; |
1459 case EWlanFinitSystem: |
1588 case RWlanLogicalChannel::EWlanFinitSystem: |
1460 // power down the chip and the system |
1589 // power down the chip and the system |
1461 iWlanGeneralRequestStatus = aStatus; |
1590 iWlanGeneralRequestStatus = aStatus; |
1462 FinitSystem(); |
1591 FinitSystem(); |
1463 break; |
1592 break; |
1464 case EWlanCommand: |
1593 case RWlanLogicalChannel::EWlanCommand: |
1465 // management command |
1594 // management command |
1466 iWlanGeneralRequestStatus = aStatus; |
1595 iWlanGeneralRequestStatus = aStatus; |
1467 |
1596 |
1468 // read the USER mode parameters to internal storage |
1597 // read the USER mode parameters to internal storage |
1469 ret = Kern::ThreadRawRead( |
1598 ret = Kern::ThreadRawRead( |
1500 // because it is not accessed by UMAC and the |
1629 // because it is not accessed by UMAC and the |
1501 // actual user mode writing is done by OnOidCompleted method |
1630 // actual user mode writing is done by OnOidCompleted method |
1502 output_buffer.iData, |
1631 output_buffer.iData, |
1503 output_buffer.iLen ); |
1632 output_buffer.iLen ); |
1504 break; |
1633 break; |
1505 case EWlanRequestNotify: |
1634 case RWlanLogicalChannel::EWlanRequestNotify: |
1506 // store the USER mode indication address; |
1635 // store the USER mode indication address; |
1507 iIndicationBuffer = static_cast<TIndication*>(a1); |
1636 iIndicationBuffer = static_cast<TIndication*>(a1); |
1508 iWlanRequestNotifyStatus = aStatus; |
1637 iWlanRequestNotifyStatus = aStatus; |
1509 IndicationRequest( static_cast<TIndication*>(a1) ); |
1638 IndicationRequest( static_cast<TIndication*>(a1) ); |
1510 break; |
1639 break; |
1511 case EWlanRequestFrame: |
1640 case RWlanLogicalChannel::EWlanRequestFrame: |
1512 if ( OnReadEthernetFrameRequest() ) |
1641 if ( OnReadEthernetFrameRequest() ) |
1513 { |
1642 { |
1514 // rx data to be completed exists |
1643 // rx data to be completed exists |
1515 // complete it directly |
1644 // complete it directly |
1516 Kern::RequestComplete( |
1645 Kern::RequestComplete( |
1523 // no rx data for completion exists |
1652 // no rx data for completion exists |
1524 // store the pending request |
1653 // store the pending request |
1525 iWlanReceiveFrameStatus = aStatus; |
1654 iWlanReceiveFrameStatus = aStatus; |
1526 } |
1655 } |
1527 break; |
1656 break; |
1528 case EWlanRequestSend: |
1657 case RWlanLogicalChannel::EWlanRequestSend: |
1529 iWlanSendFrameStatus = aStatus; |
1658 iWlanSendFrameStatus = aStatus; |
1530 |
1659 |
1531 TxManagementData(); |
1660 TxManagementData(); |
1532 break; |
1661 break; |
1533 default: |
1662 default: |
1726 TInt aFunction, |
1855 TInt aFunction, |
1727 TAny* a1, |
1856 TAny* a1, |
1728 TAny* /*a2*/ ) |
1857 TAny* /*a2*/ ) |
1729 { |
1858 { |
1730 TInt ret( KErrNone ); |
1859 TInt ret( KErrNone ); |
1731 if ( aFunction == EWlanSvControlInitBuffers ) |
1860 if ( aFunction == RWlanLogicalChannel::EWlanSvControlInitBuffers ) |
1732 { |
1861 { |
1733 // initiliaze buffers for wlan mgmt client data xfer |
1862 // initiliaze buffers for wlan mgmt client data xfer |
1734 if ( a1 ) |
1863 if ( a1 ) |
1735 { |
1864 { |
1736 TraceDump(INIT_LEVEL, |
1865 TraceDump(INIT_LEVEL, |
1747 TraceDump(ERROR_LEVEL, |
1876 TraceDump(ERROR_LEVEL, |
1748 ("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl(): init management client buffer pool panic")); |
1877 ("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl(): init management client buffer pool panic")); |
1749 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
1878 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
1750 } |
1879 } |
1751 } |
1880 } |
1752 else if ( aFunction == EWlanSvControlFreeBuffers ) |
1881 else if ( aFunction == RWlanLogicalChannel::EWlanSvControlFreeBuffers ) |
1753 { |
1882 { |
1754 // free wlan mgmt client data xfer buffers |
1883 // free wlan mgmt client data xfer buffers |
1755 OnReleaseEthernetFrameBuffers(); |
1884 OnReleaseEthernetFrameBuffers(); |
1756 } |
1885 } |
1757 else |
1886 else |
1889 TUint32 aSnapFrameTxOffset ) |
2018 TUint32 aSnapFrameTxOffset ) |
1890 { |
2019 { |
1891 if ( iEthernetFrameMemMngr ) |
2020 if ( iEthernetFrameMemMngr ) |
1892 { |
2021 { |
1893 TraceDump(NWSA_TX_DETAILS, |
2022 TraceDump(NWSA_TX_DETAILS, |
1894 (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aEthernetFrameTxOffset: %d"), |
2023 (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: " |
2024 "aEthernetFrameTxOffset: %d"), |
|
1895 aEthernetFrameTxOffset )); |
2025 aEthernetFrameTxOffset )); |
1896 TraceDump(NWSA_TX_DETAILS, |
2026 TraceDump(NWSA_TX_DETAILS, |
1897 (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aDot11FrameTxOffset: %d"), |
2027 (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: " |
2028 "aDot11FrameTxOffset: %d"), |
|
1898 aDot11FrameTxOffset )); |
2029 aDot11FrameTxOffset )); |
1899 TraceDump(NWSA_TX_DETAILS, |
2030 TraceDump(NWSA_TX_DETAILS, |
1900 (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aSnapFrameTxOffset: %d"), |
2031 (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: " |
2032 "aSnapFrameTxOffset: %d"), |
|
1901 aSnapFrameTxOffset )); |
2033 aSnapFrameTxOffset )); |
1902 |
2034 |
1903 iEthernetFrameMemMngr->SetTxOffsets( |
2035 iEthernetFrameMemMngr->SetTxOffsets( |
1904 aEthernetFrameTxOffset, |
2036 aEthernetFrameTxOffset, |
1905 aDot11FrameTxOffset, |
2037 aDot11FrameTxOffset, |
1932 // --------------------------------------------------------------------------- |
2064 // --------------------------------------------------------------------------- |
1933 // |
2065 // |
1934 // --------------------------------------------------------------------------- |
2066 // --------------------------------------------------------------------------- |
1935 // |
2067 // |
1936 void DWlanLogicalChannel::MgmtDataReceiveComplete( |
2068 void DWlanLogicalChannel::MgmtDataReceiveComplete( |
1937 const TDataBuffer*& aBufferStart, |
2069 TDataBuffer*& aBufferStart, |
1938 TUint32 aNumOfBuffers ) |
2070 TUint32 aNumOfBuffers ) |
1939 { |
2071 { |
1940 if ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete( |
2072 if ( iEthernetFrameMemMngr && |
1941 aBufferStart, |
2073 ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete( |
1942 aNumOfBuffers ) ) |
2074 aBufferStart, |
2075 aNumOfBuffers ) ) ) |
|
1943 { |
2076 { |
1944 Kern::RequestComplete( iClient, iWlanReceiveFrameStatus, KErrNone ); |
2077 Kern::RequestComplete( iClient, iWlanReceiveFrameStatus, KErrNone ); |
1945 iWlanReceiveFrameStatus = NULL; |
2078 iWlanReceiveFrameStatus = NULL; |
1946 } |
2079 } |
1947 } |
2080 } |
2172 // --------------------------------------------------------------------------- |
2305 // --------------------------------------------------------------------------- |
2173 // |
2306 // |
2174 void DWlanLogicalChannel::ReleaseIndicationListEntry( |
2307 void DWlanLogicalChannel::ReleaseIndicationListEntry( |
2175 TIndicationListEntry* aEntry ) |
2308 TIndicationListEntry* aEntry ) |
2176 { |
2309 { |
2177 aEntry->next = NULL; |
2310 if ( aEntry ) |
2178 |
2311 { |
2179 if ( !iFreeIndicationListHead ) |
2312 aEntry->next = NULL; |
2180 { |
2313 |
2181 iFreeIndicationListHead = aEntry; |
2314 if ( !iFreeIndicationListHead ) |
2182 } |
2315 { |
2316 iFreeIndicationListHead = aEntry; |
|
2317 } |
|
2318 else |
|
2319 { |
|
2320 TIndicationListEntry* tmp = iFreeIndicationListHead; |
|
2321 |
|
2322 while ( tmp->next ) |
|
2323 { |
|
2324 tmp = tmp->next; |
|
2325 } |
|
2326 |
|
2327 tmp->next = aEntry; |
|
2328 } |
|
2329 } |
|
2330 #ifndef NDEBUG |
|
2183 else |
2331 else |
2184 { |
2332 { |
2185 TIndicationListEntry* tmp = iFreeIndicationListHead; |
2333 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
2186 |
2334 } |
2187 while ( tmp->next ) |
2335 #endif |
2188 { |
|
2189 tmp = tmp->next; |
|
2190 } |
|
2191 |
|
2192 tmp->next = aEntry; |
|
2193 } |
|
2194 } |
2336 } |
2195 |
2337 |
2196 // --------------------------------------------------------------------------- |
2338 // --------------------------------------------------------------------------- |
2197 // |
2339 // |
2198 // --------------------------------------------------------------------------- |
2340 // --------------------------------------------------------------------------- |