42 DWlanLogicalChannel& aParent, |
42 DWlanLogicalChannel& aParent, |
43 WlanChunk*& aRxFrameMemoryPool, |
43 WlanChunk*& aRxFrameMemoryPool, |
44 TBool aUseCachedMemory, |
44 TBool aUseCachedMemory, |
45 TInt aRxFrameBufAllocationUnit ) : |
45 TInt aRxFrameBufAllocationUnit ) : |
46 DEthernetFrameMemMngr( aParent, aRxFrameMemoryPool ), |
46 DEthernetFrameMemMngr( aParent, aRxFrameMemoryPool ), |
|
47 iFrameXferBlock( NULL ), |
|
48 iChunkKernelAddr( 0 ), |
|
49 iTxDataBuffer( NULL ), |
47 iUseCachedMemory( aUseCachedMemory ), |
50 iUseCachedMemory( aUseCachedMemory ), |
48 iRxFrameBufAllocationUnit ( aRxFrameBufAllocationUnit ), |
51 iRxFrameBufAllocationUnit ( aRxFrameBufAllocationUnit ), |
49 iChunkSize( |
52 iChunkSize( |
50 Kern::RoundToPageSize( |
53 Kern::RoundToPageSize( |
51 4096 * 15 + KProtocolStackSideTxDataChunkSize ) ) // bytes |
54 4096 * 15 + KProtocolStackSideTxDataChunkSize ) ) // bytes |
52 {}; |
55 {}; |
53 |
56 |
54 /** Dtor */ |
57 /** Dtor */ |
55 virtual ~MgmtFrameMemMngr() {}; |
58 virtual ~MgmtFrameMemMngr() |
|
59 { |
|
60 iFrameXferBlock = NULL; |
|
61 iTxDataBuffer = NULL; |
|
62 }; |
56 |
63 |
57 protected: |
64 protected: |
58 |
65 |
59 /** |
66 /** |
60 * From DEthernetFrameMemMngr |
67 * From DEthernetFrameMemMngr |
105 * @return ETrue if a pending user mode frame read request exists |
112 * @return ETrue if a pending user mode frame read request exists |
106 * and callee should complete it, |
113 * and callee should complete it, |
107 * EFalse otherwise |
114 * EFalse otherwise |
108 */ |
115 */ |
109 virtual TBool DoEthernetFrameRxComplete( |
116 virtual TBool DoEthernetFrameRxComplete( |
110 const TDataBuffer*& aBufferStart, |
117 TDataBuffer*& aBufferStart, |
111 TUint32 aNumOfBuffers ); |
118 TUint32 aNumOfBuffers ); |
112 |
119 |
113 /** |
120 /** |
114 * From DEthernetFrameMemMngr |
121 * From DEthernetFrameMemMngr |
115 * Gets start address of Rx buffers (their offset addresses) |
|
116 * that are waiting for completion to user mode |
|
117 * |
|
118 * @since S60 3.1 |
|
119 * @return see above statement |
|
120 */ |
|
121 virtual TUint32* DoGetTobeCompletedBuffersStart(); |
|
122 |
|
123 /** |
|
124 * From DEthernetFrameMemMngr |
|
125 * Gets start address of Rx buffers (their offset addresses) |
|
126 * that have been completed to user mode |
|
127 * |
|
128 * @since S60 3.1 |
|
129 * @return see above statement |
|
130 */ |
|
131 virtual TUint32* DoGetCompletedBuffersStart(); |
|
132 |
|
133 /** |
|
134 * From DEthernetFrameMemMngr |
|
135 * Gets called when user mode client issues a frame receive request |
|
136 * and Rx buffers have been completed to it. The completed Rx frame |
|
137 * buffers are freed. |
|
138 * |
|
139 * @since S60 3.1 |
|
140 */ |
|
141 virtual void DoFreeRxBuffers(); |
|
142 |
|
143 /** |
|
144 * From DEthernetFrameMemMngr |
|
145 * Frees the specified Rx frame buffer |
122 * Frees the specified Rx frame buffer |
146 * |
123 * |
147 * @since S60 3.1 |
124 * @since S60 3.1 |
148 * @param aBufferToFree The buffer to free |
125 * @param aBufferToFree The buffer to free |
149 */ |
126 */ |
150 virtual void DoMarkRxBufFree( TUint8* aBufferToFree ); |
127 virtual void DoMarkRxBufFree( TUint8* aBufferToFree ); |
|
128 |
|
129 /** |
|
130 * From DEthernetFrameMemMngr |
|
131 * To be called when user mode client issues a frame Rx request |
|
132 * |
|
133 * @return ETrue if callee should complete the request immediately |
|
134 * as there exists Rx frame(s) which can be retrieved by the user |
|
135 * mode client. |
|
136 * EFalse otherwise |
|
137 */ |
|
138 virtual TBool OnReadRequest(); |
|
139 |
|
140 /** |
|
141 * From DEthernetFrameMemMngr |
|
142 * Gets the next frame (contained in a buffer allocated from |
|
143 * the shared memory) from the Rx queue. |
|
144 * Optionally frees the memory associated to a previously received frame. |
|
145 * |
|
146 * @param aFrameToFree User space pointer to previously received frame |
|
147 * which can now be freed. |
|
148 * NULL if nothing to free. |
|
149 * @return User space pointer to the Rx frame to be handled next. |
|
150 * NULL, if there are no frames available. |
|
151 */ |
|
152 virtual TDataBuffer* GetRxFrame( TDataBuffer* aFrameToFreeInUserSpace ); |
151 |
153 |
152 private: |
154 private: |
|
155 |
|
156 /** |
|
157 * Gets a memory block that can be used for tx frame write |
|
158 * |
|
159 * @since S60 3.1 |
|
160 * @return memory block that can be used for tx frame write, |
|
161 * NULL upon failure |
|
162 */ |
|
163 virtual TDataBuffer* OnWriteEthernetFrame() const; |
153 |
164 |
154 /** |
165 /** |
155 * Returns the number of extra bytes required to align Rx buffer start |
166 * Returns the number of extra bytes required to align Rx buffer start |
156 * address, to be returned to WHA layer, to allocation unit boundary |
167 * address, to be returned to WHA layer, to allocation unit boundary |
157 * @return See above |
168 * @return See above |
169 virtual void OnReleaseMemory( DThread& aThread ); |
180 virtual void OnReleaseMemory( DThread& aThread ); |
170 |
181 |
171 // Prohibit copy constructor. |
182 // Prohibit copy constructor. |
172 MgmtFrameMemMngr( const MgmtFrameMemMngr& ); |
183 MgmtFrameMemMngr( const MgmtFrameMemMngr& ); |
173 // Prohibit assigment operator. |
184 // Prohibit assigment operator. |
174 MgmtFrameMemMngr& operator= ( const MgmtFrameMemMngr & ); |
185 MgmtFrameMemMngr& operator= ( const MgmtFrameMemMngr& ); |
175 |
186 |
176 private: // Data |
187 private: // Data |
|
188 |
|
189 /** kernel address of frame xfer block */ |
|
190 RFrameXferBlock* iFrameXferBlock; |
177 |
191 |
178 /** |
192 /** |
179 * kernel address of the shared memory chunk |
193 * kernel address of the shared memory chunk |
180 */ |
194 */ |
181 TLinAddr iChunkKernelAddr; |
195 TLinAddr iChunkKernelAddr; |
182 |
196 |
183 /** |
197 /** kernel address of Tx data buffer */ |
184 * array of TDataBuffer offset addresses, denoting Rx buffers, |
198 TDataBuffer* iTxDataBuffer; |
185 * which are waiting here in kernel mode to be completed |
|
186 * to user mode, when the next frame receive request arrives |
|
187 */ |
|
188 TUint32 iTobeCompletedBuffers[KMaxToBeCompletedRxBufs]; |
|
189 |
|
190 /** |
|
191 * array of TDataBuffer offset addresses, denoting Rx buffers, that are |
|
192 * currently under processing in user mode |
|
193 */ |
|
194 TUint32 iCompletedBuffers[KMaxCompletedRxBufs]; |
|
195 |
199 |
196 /** |
200 /** |
197 * ETrue if cached frame transfer memory shall be used, |
201 * ETrue if cached frame transfer memory shall be used, |
198 * EFalse otherwise |
202 * EFalse otherwise |
199 */ |
203 */ |