win-pvdrivers

view liblfds.6/src/queue/queue_internal.h @ 766:6300617040e0

Big changes - not ready for production use.
Removed all the custom DMA handling code as it was completely incompatible with the Windows verifier.
Added liblfds (using the lock free stack) from liblfds.org so that grant's can be obtained at DIRQL.
Fixed xennet and xenvbd to support the changes.
xenusb and xenscsi almost certainly will not yet work after the changes.
author James Harper <james.harper@bendigoit.com.au>
date Sun Jan 31 21:28:42 2010 +1100 (2010-01-31)
parents
children
line source
1 /***** the library wide include file *****/
2 #include "liblfds_internal.h"
4 /***** pragmas *****/
6 /***** defines *****/
7 #define QUEUE_STATE_UNKNOWN -1
8 #define QUEUE_STATE_EMPTY 0
9 #define QUEUE_STATE_ENQUEUE_OUT_OF_PLACE 1
10 #define QUEUE_STATE_ATTEMPT_DEQUEUE 2
12 #define QUEUE_POINTER 0
13 #define QUEUE_COUNTER 1
14 #define QUEUE_PAC_SIZE 2
16 /***** structures *****/
17 #pragma pack( push, ALIGN_DOUBLE_POINTER )
19 struct queue_state
20 {
21 struct queue_element
22 *volatile enqueue[QUEUE_PAC_SIZE],
23 *volatile dequeue[QUEUE_PAC_SIZE];
25 atom_t
26 aba_counter;
28 struct freelist_state
29 *fs;
30 };
32 struct queue_element
33 {
34 // TRD : next in a queue requires volatile as it is target of CAS
35 struct queue_element
36 *volatile next[QUEUE_PAC_SIZE];
38 struct freelist_element
39 *fe;
41 void
42 *user_data;
43 };
45 #pragma pack( pop )
47 /***** externs *****/
49 /***** private prototypes *****/
50 int queue_internal_freelist_init_function( void **user_data, void *user_state );
51 void queue_internal_freelist_delete_function( void *user_data, void *user_state );
53 void queue_internal_new_element_from_freelist( struct queue_state *qs, struct queue_element *qe[QUEUE_PAC_SIZE], void *user_data );
54 void queue_internal_guaranteed_new_element_from_freelist( struct queue_state *qs, struct queue_element * qe[QUEUE_PAC_SIZE], void *user_data );
55 void queue_internal_init_element( struct queue_state *qs, struct queue_element *qe[QUEUE_PAC_SIZE], struct freelist_element *fe, void *user_data );
57 void queue_internal_queue( struct queue_state *qs, struct queue_element *qe[QUEUE_PAC_SIZE] );
59 void queue_internal_validate( struct queue_state *qs, struct validation_info *vi, enum data_structure_validity *queue_validity, enum data_structure_validity *freelist_validity );