wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EthernetFrameMemMngr.h
branchRCL_3
changeset 42 a828660c511c
parent 3 6524e815f76f
child 43 d3d7683d16f5
--- a/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EthernetFrameMemMngr.h	Thu Aug 19 11:40:48 2010 +0300
+++ b/wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EthernetFrameMemMngr.h	Tue Aug 31 17:02:06 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 18 %
+* %version: 19 %
 */
 
 #ifndef DETHERNETFRAMEMEMMNGR_H
@@ -35,11 +35,6 @@
 /**
 * Manager object for frame Tx and Rx memory
 *
-* Consumed count of Rx-buffers = 
-* nbr of Rx buffers currently under processing in user mode        
-* + nbr of Rx buffers given to wlanpdd
-* + nbr of Rx buffers waiting for completion to user mode
-*
 *  @since S60 v3.1
 */
 class DEthernetFrameMemMngr
@@ -94,9 +89,9 @@
     *
     * @since S60 3.1
     * @return memory block that can be used for tx frame write, 
-    * NULL upon failure
+    *         NULL upon failure
     */
-    TDataBuffer* OnWriteEthernetFrame() const;
+    virtual TDataBuffer* OnWriteEthernetFrame() const;
 
     /**
     * Gets a memory block that can be used as rx frame buffer
@@ -123,6 +118,14 @@
     void FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader );
     
     /**
+     * Frees the memory associated to a frame. 
+     * 
+     * @param aFrameToFreeInUserSpace User space pointer to the meta header
+     *        of the frame to be freed.
+     */ 
+    void FreeRxPacket( TDataBuffer* aFrameToFreeInUserSpace );
+    
+    /**
     * To be called when rx frame read cycle has ended.
     *
     * @since S60 3.1
@@ -134,19 +137,35 @@
     *         EFalse otherwise
     */
     TBool OnEthernetFrameRxComplete( 
-        const TDataBuffer*& aBufferStart, 
+        TDataBuffer*& aBufferStart, 
         TUint32 aNumOfBuffers );
 
     /**
-    * To be called when user mode issues a rx frame read request
+    * To be called when user mode client issues a frame Rx request
     *
     * @since S60 3.1
-    * @return ETrue if callee should complete the request immediadly 
-    * as their exist data to be completed, EFalse otherwise
+    * @return ETrue if callee should complete the request immediately 
+    *         as there exists Rx frame(s) which can be retrieved by the user
+    *         mode client.
+    *         EFalse otherwise
     */
-    TBool OnReadRequest();
+    virtual TBool OnReadRequest() = 0;
 
     /**
+     * Gets the highest priority frame (contained in a buffer allocated from
+     * the shared memory) from the Rx queues.
+     * Optionally frees the memory associated to a previously received frame. 
+     * 
+     * @param aFrameToFree Previously received frame which can now be freed.
+     *        NULL if nothing to free.
+     * @return Pointer to the Rx frame to be handled next.
+     *         NULL, if there are no frames available. If NULL is returned
+     *         the client should re-issue the asynchronous frame Rx request
+     *         (i.e. RequestFrame())
+     */ 
+    virtual TDataBuffer* GetRxFrame( TDataBuffer* aFrameToFree ) = 0;
+    
+    /**
     * Frees the specified Rx frame buffer
     *
     * @since S60 3.1
@@ -158,8 +177,8 @@
      * Allocates a Tx packet from the shared memory.
      * 
      * @param aLength Length of the requested Tx buffer in bytes
-     * @return Pointer to the meta header attached to the allocated packet, on
-     *         success.
+     * @return User space pointer to the meta header attached to the 
+     *         allocated packet, on success.
      *         NULL, in case of failure.
      */
     virtual TDataBuffer* AllocTxBuffer( TUint aLength );
@@ -181,7 +200,7 @@
      *         EFalse if the client is not allowed to call this method again
      *         (i.e. Tx flow is stopped) until it is re-allowed.
      */
-    TBool AddTxFrame( 
+    virtual TBool AddTxFrame( 
         TDataBuffer* aPacketInUserSpace, 
         TDataBuffer*& aPacketInKernSpace,
         TBool aUserDataTxEnabled );
@@ -198,7 +217,7 @@
      *         NULL, if there's no frame that could be transmitted, given the
      *         current status of the WHA Tx queues
      */ 
-    TDataBuffer* GetTxFrame( 
+    virtual TDataBuffer* GetTxFrame( 
         const TWhaTxQueueState& aTxQueueState,
         TBool& aMore );
     
@@ -220,7 +239,7 @@
      * @return ETrue if Tx should be resumed
      *         EFalse otherwise
      */
-    TBool ResumeClientTx( TBool aUserDataTxEnabled ) const;
+    virtual TBool ResumeClientTx( TBool aUserDataTxEnabled ) const;
     
     /** 
      * Determines if all protocol stack side client's Tx queues are empty
@@ -228,7 +247,7 @@
      * @return ETrue if all Tx queues are empty
      *         EFalse otherwise
      */
-    TBool AllTxQueuesEmpty() const;
+    virtual TBool AllTxQueuesEmpty() const;
     
     /**
     * Static creator of the class instance
@@ -272,10 +291,7 @@
         DWlanLogicalChannel& aParent, 
         WlanChunk*& aRxFrameMemoryPool ) :
         iReadStatus( ENotPending ), 
-        iFrameXferBlock( NULL ), 
-        iCountCompleted( 0 ), 
-        iCountTobeCompleted( 0 ),
-        iTxDataBuffer( NULL ), 
+        iFrameXferBlockBase( NULL ),
         iRxDataChunk( NULL ),
         iParent( aParent ),
         iRxFrameMemoryPool( aRxFrameMemoryPool ),
@@ -334,37 +350,10 @@
     *         EFalse otherwise
     */
     virtual TBool DoEthernetFrameRxComplete( 
-        const TDataBuffer*& aBufferStart, 
+        TDataBuffer*& aBufferStart, 
         TUint32 aNumOfBuffers ) = 0;
 
     /**
-    * Gets start address of Rx buffers (their offset addresses)
-    * that are waiting for completion to user mode
-    *
-    * @since S60 3.1
-    * @return see above statement
-    */
-    virtual TUint32* DoGetTobeCompletedBuffersStart() = 0;
-
-    /**
-    * Gets start address of Rx buffers (their offset addresses)
-    * that have been completed to user mode
-    *
-    * @since S60 3.1
-    * @return see above statement
-    */
-    virtual TUint32* DoGetCompletedBuffersStart() = 0;        
-
-    /**
-    * Gets called when user mode client issues a frame receive request 
-    * and Rx buffers have been completed to it. The completed Rx frame 
-    * buffers are freed.
-    *
-    * @since S60 3.1
-    */
-    virtual void DoFreeRxBuffers() = 0;
-
-    /**
     * Marks memory as not in use, meaning that it is not allocated 
     * and attached to calling process'es address space
     */
@@ -399,22 +388,8 @@
     /** state  of the rx frame read request */
     TFrameReadState    iReadStatus;
 
-    /** kernel address of xfer block */
-    RFrameXferBlock*    iFrameXferBlock;
-
-    /**
-    * amount of rx frame buffers that are 
-    * currently under processing in user mode
-    */
-    TUint32 iCountCompleted;
-
-    /**
-    * amount of rx frame buffers waiting completion to user mode
-    */
-    TUint32 iCountTobeCompleted;
-
-    /** kernel address of Tx-data buffer */
-    TDataBuffer*        iTxDataBuffer;
+    /** kernel address of xfer block; as base class pointer */
+    RFrameXferBlockBase* iFrameXferBlockBase;
 
     /** pointer to Rx area start in the kernel address space */
     TUint8*             iRxDataChunk;