32 class TSharedChunkInfo; |
32 class TSharedChunkInfo; |
33 class WlanChunk; |
33 class WlanChunk; |
34 |
34 |
35 /** |
35 /** |
36 * Manager object for frame Tx and Rx memory |
36 * Manager object for frame Tx and Rx memory |
37 * |
|
38 * Consumed count of Rx-buffers = |
|
39 * nbr of Rx buffers currently under processing in user mode |
|
40 * + nbr of Rx buffers given to wlanpdd |
|
41 * + nbr of Rx buffers waiting for completion to user mode |
|
42 * |
37 * |
43 * @since S60 v3.1 |
38 * @since S60 v3.1 |
44 */ |
39 */ |
45 class DEthernetFrameMemMngr |
40 class DEthernetFrameMemMngr |
46 { |
41 { |
92 /** |
87 /** |
93 * Gets a memory block that can be used for tx frame write |
88 * Gets a memory block that can be used for tx frame write |
94 * |
89 * |
95 * @since S60 3.1 |
90 * @since S60 3.1 |
96 * @return memory block that can be used for tx frame write, |
91 * @return memory block that can be used for tx frame write, |
97 * NULL upon failure |
92 * NULL upon failure |
98 */ |
93 */ |
99 TDataBuffer* OnWriteEthernetFrame() const; |
94 virtual TDataBuffer* OnWriteEthernetFrame() const; |
100 |
95 |
101 /** |
96 /** |
102 * Gets a memory block that can be used as rx frame buffer |
97 * Gets a memory block that can be used as rx frame buffer |
103 * |
98 * |
104 * @since S60 3.1 |
99 * @since S60 3.1 |
119 /** |
114 /** |
120 * Deallocates Rx frame meta header |
115 * Deallocates Rx frame meta header |
121 * @param aMetaHeader Meta header to deallocate |
116 * @param aMetaHeader Meta header to deallocate |
122 */ |
117 */ |
123 void FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ); |
118 void FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ); |
|
119 |
|
120 /** |
|
121 * Frees the memory associated to a frame. |
|
122 * |
|
123 * @param aFrameToFreeInUserSpace User space pointer to the meta header |
|
124 * of the frame to be freed. |
|
125 */ |
|
126 void FreeRxPacket( TDataBuffer* aFrameToFreeInUserSpace ); |
124 |
127 |
125 /** |
128 /** |
126 * To be called when rx frame read cycle has ended. |
129 * To be called when rx frame read cycle has ended. |
127 * |
130 * |
128 * @since S60 3.1 |
131 * @since S60 3.1 |
132 * @return ETrue if a pending user mode frame read request exists |
135 * @return ETrue if a pending user mode frame read request exists |
133 * and callee should complete it, |
136 * and callee should complete it, |
134 * EFalse otherwise |
137 * EFalse otherwise |
135 */ |
138 */ |
136 TBool OnEthernetFrameRxComplete( |
139 TBool OnEthernetFrameRxComplete( |
137 const TDataBuffer*& aBufferStart, |
140 TDataBuffer*& aBufferStart, |
138 TUint32 aNumOfBuffers ); |
141 TUint32 aNumOfBuffers ); |
139 |
142 |
140 /** |
143 /** |
141 * To be called when user mode issues a rx frame read request |
144 * To be called when user mode client issues a frame Rx request |
142 * |
145 * |
143 * @since S60 3.1 |
146 * @since S60 3.1 |
144 * @return ETrue if callee should complete the request immediadly |
147 * @return ETrue if callee should complete the request immediately |
145 * as their exist data to be completed, EFalse otherwise |
148 * as there exists Rx frame(s) which can be retrieved by the user |
146 */ |
149 * mode client. |
147 TBool OnReadRequest(); |
150 * EFalse otherwise |
148 |
151 */ |
|
152 virtual TBool OnReadRequest() = 0; |
|
153 |
|
154 /** |
|
155 * Gets the highest priority frame (contained in a buffer allocated from |
|
156 * the shared memory) from the Rx queues. |
|
157 * Optionally frees the memory associated to a previously received frame. |
|
158 * |
|
159 * @param aFrameToFree Previously received frame which can now be freed. |
|
160 * NULL if nothing to free. |
|
161 * @return Pointer to the Rx frame to be handled next. |
|
162 * NULL, if there are no frames available. If NULL is returned |
|
163 * the client should re-issue the asynchronous frame Rx request |
|
164 * (i.e. RequestFrame()) |
|
165 */ |
|
166 virtual TDataBuffer* GetRxFrame( TDataBuffer* aFrameToFree ) = 0; |
|
167 |
149 /** |
168 /** |
150 * Frees the specified Rx frame buffer |
169 * Frees the specified Rx frame buffer |
151 * |
170 * |
152 * @since S60 3.1 |
171 * @since S60 3.1 |
153 * @param aBufferToFree The buffer to free |
172 * @param aBufferToFree The buffer to free |
156 |
175 |
157 /** |
176 /** |
158 * Allocates a Tx packet from the shared memory. |
177 * Allocates a Tx packet from the shared memory. |
159 * |
178 * |
160 * @param aLength Length of the requested Tx buffer in bytes |
179 * @param aLength Length of the requested Tx buffer in bytes |
161 * @return Pointer to the meta header attached to the allocated packet, on |
180 * @return User space pointer to the meta header attached to the |
162 * success. |
181 * allocated packet, on success. |
163 * NULL, in case of failure. |
182 * NULL, in case of failure. |
164 */ |
183 */ |
165 virtual TDataBuffer* AllocTxBuffer( TUint aLength ); |
184 virtual TDataBuffer* AllocTxBuffer( TUint aLength ); |
166 |
185 |
167 /** |
186 /** |
179 * @return ETrue if the client is allowed to continue calling this method |
198 * @return ETrue if the client is allowed to continue calling this method |
180 * (i.e. Tx flow is not stopped). |
199 * (i.e. Tx flow is not stopped). |
181 * EFalse if the client is not allowed to call this method again |
200 * EFalse if the client is not allowed to call this method again |
182 * (i.e. Tx flow is stopped) until it is re-allowed. |
201 * (i.e. Tx flow is stopped) until it is re-allowed. |
183 */ |
202 */ |
184 TBool AddTxFrame( |
203 virtual TBool AddTxFrame( |
185 TDataBuffer* aPacketInUserSpace, |
204 TDataBuffer* aPacketInUserSpace, |
186 TDataBuffer*& aPacketInKernSpace, |
205 TDataBuffer*& aPacketInKernSpace, |
187 TBool aUserDataTxEnabled ); |
206 TBool aUserDataTxEnabled ); |
188 |
207 |
189 /** |
208 /** |
196 * @return Pointer to the meta header of the frame to be transmitted, on |
215 * @return Pointer to the meta header of the frame to be transmitted, on |
197 * success |
216 * success |
198 * NULL, if there's no frame that could be transmitted, given the |
217 * NULL, if there's no frame that could be transmitted, given the |
199 * current status of the WHA Tx queues |
218 * current status of the WHA Tx queues |
200 */ |
219 */ |
201 TDataBuffer* GetTxFrame( |
220 virtual TDataBuffer* GetTxFrame( |
202 const TWhaTxQueueState& aTxQueueState, |
221 const TWhaTxQueueState& aTxQueueState, |
203 TBool& aMore ); |
222 TBool& aMore ); |
204 |
223 |
205 /** |
224 /** |
206 * Deallocates a Tx packet. |
225 * Deallocates a Tx packet. |
218 * @param aUserDataTxEnabled ETrue if user data Tx is enabled |
237 * @param aUserDataTxEnabled ETrue if user data Tx is enabled |
219 * EFalse otherwise |
238 * EFalse otherwise |
220 * @return ETrue if Tx should be resumed |
239 * @return ETrue if Tx should be resumed |
221 * EFalse otherwise |
240 * EFalse otherwise |
222 */ |
241 */ |
223 TBool ResumeClientTx( TBool aUserDataTxEnabled ) const; |
242 virtual TBool ResumeClientTx( TBool aUserDataTxEnabled ) const; |
224 |
243 |
225 /** |
244 /** |
226 * Determines if all protocol stack side client's Tx queues are empty |
245 * Determines if all protocol stack side client's Tx queues are empty |
227 * |
246 * |
228 * @return ETrue if all Tx queues are empty |
247 * @return ETrue if all Tx queues are empty |
229 * EFalse otherwise |
248 * EFalse otherwise |
230 */ |
249 */ |
231 TBool AllTxQueuesEmpty() const; |
250 virtual TBool AllTxQueuesEmpty() const; |
232 |
251 |
233 /** |
252 /** |
234 * Static creator of the class instance |
253 * Static creator of the class instance |
235 * @param aUnit identifier of the type of object to be created |
254 * @param aUnit identifier of the type of object to be created |
236 * @param aParent |
255 * @param aParent |
270 /** Ctor */ |
289 /** Ctor */ |
271 DEthernetFrameMemMngr( |
290 DEthernetFrameMemMngr( |
272 DWlanLogicalChannel& aParent, |
291 DWlanLogicalChannel& aParent, |
273 WlanChunk*& aRxFrameMemoryPool ) : |
292 WlanChunk*& aRxFrameMemoryPool ) : |
274 iReadStatus( ENotPending ), |
293 iReadStatus( ENotPending ), |
275 iFrameXferBlock( NULL ), |
294 iFrameXferBlockBase( NULL ), |
276 iCountCompleted( 0 ), |
|
277 iCountTobeCompleted( 0 ), |
|
278 iTxDataBuffer( NULL ), |
|
279 iRxDataChunk( NULL ), |
295 iRxDataChunk( NULL ), |
280 iParent( aParent ), |
296 iParent( aParent ), |
281 iRxFrameMemoryPool( aRxFrameMemoryPool ), |
297 iRxFrameMemoryPool( aRxFrameMemoryPool ), |
282 iRxBufAlignmentPadding( 0 ), |
298 iRxBufAlignmentPadding( 0 ), |
283 iVendorTxHdrLen( 0 ), |
299 iVendorTxHdrLen( 0 ), |
332 * @return ETrue if a pending user mode frame read request exists |
348 * @return ETrue if a pending user mode frame read request exists |
333 * and callee should complete it, |
349 * and callee should complete it, |
334 * EFalse otherwise |
350 * EFalse otherwise |
335 */ |
351 */ |
336 virtual TBool DoEthernetFrameRxComplete( |
352 virtual TBool DoEthernetFrameRxComplete( |
337 const TDataBuffer*& aBufferStart, |
353 TDataBuffer*& aBufferStart, |
338 TUint32 aNumOfBuffers ) = 0; |
354 TUint32 aNumOfBuffers ) = 0; |
339 |
|
340 /** |
|
341 * Gets start address of Rx buffers (their offset addresses) |
|
342 * that are waiting for completion to user mode |
|
343 * |
|
344 * @since S60 3.1 |
|
345 * @return see above statement |
|
346 */ |
|
347 virtual TUint32* DoGetTobeCompletedBuffersStart() = 0; |
|
348 |
|
349 /** |
|
350 * Gets start address of Rx buffers (their offset addresses) |
|
351 * that have been completed to user mode |
|
352 * |
|
353 * @since S60 3.1 |
|
354 * @return see above statement |
|
355 */ |
|
356 virtual TUint32* DoGetCompletedBuffersStart() = 0; |
|
357 |
|
358 /** |
|
359 * Gets called when user mode client issues a frame receive request |
|
360 * and Rx buffers have been completed to it. The completed Rx frame |
|
361 * buffers are freed. |
|
362 * |
|
363 * @since S60 3.1 |
|
364 */ |
|
365 virtual void DoFreeRxBuffers() = 0; |
|
366 |
355 |
367 /** |
356 /** |
368 * Marks memory as not in use, meaning that it is not allocated |
357 * Marks memory as not in use, meaning that it is not allocated |
369 * and attached to calling process'es address space |
358 * and attached to calling process'es address space |
370 */ |
359 */ |
397 }; |
386 }; |
398 |
387 |
399 /** state of the rx frame read request */ |
388 /** state of the rx frame read request */ |
400 TFrameReadState iReadStatus; |
389 TFrameReadState iReadStatus; |
401 |
390 |
402 /** kernel address of xfer block */ |
391 /** kernel address of xfer block; as base class pointer */ |
403 RFrameXferBlock* iFrameXferBlock; |
392 RFrameXferBlockBase* iFrameXferBlockBase; |
404 |
|
405 /** |
|
406 * amount of rx frame buffers that are |
|
407 * currently under processing in user mode |
|
408 */ |
|
409 TUint32 iCountCompleted; |
|
410 |
|
411 /** |
|
412 * amount of rx frame buffers waiting completion to user mode |
|
413 */ |
|
414 TUint32 iCountTobeCompleted; |
|
415 |
|
416 /** kernel address of Tx-data buffer */ |
|
417 TDataBuffer* iTxDataBuffer; |
|
418 |
393 |
419 /** pointer to Rx area start in the kernel address space */ |
394 /** pointer to Rx area start in the kernel address space */ |
420 TUint8* iRxDataChunk; |
395 TUint8* iRxDataChunk; |
421 |
396 |
422 /** |
397 /** |