win-pvdrivers

annotate 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
rev   line source
james@766 1 /***** the library wide include file *****/
james@766 2 #include "liblfds_internal.h"
james@766 3
james@766 4 /***** pragmas *****/
james@766 5
james@766 6 /***** defines *****/
james@766 7 #define QUEUE_STATE_UNKNOWN -1
james@766 8 #define QUEUE_STATE_EMPTY 0
james@766 9 #define QUEUE_STATE_ENQUEUE_OUT_OF_PLACE 1
james@766 10 #define QUEUE_STATE_ATTEMPT_DEQUEUE 2
james@766 11
james@766 12 #define QUEUE_POINTER 0
james@766 13 #define QUEUE_COUNTER 1
james@766 14 #define QUEUE_PAC_SIZE 2
james@766 15
james@766 16 /***** structures *****/
james@766 17 #pragma pack( push, ALIGN_DOUBLE_POINTER )
james@766 18
james@766 19 struct queue_state
james@766 20 {
james@766 21 struct queue_element
james@766 22 *volatile enqueue[QUEUE_PAC_SIZE],
james@766 23 *volatile dequeue[QUEUE_PAC_SIZE];
james@766 24
james@766 25 atom_t
james@766 26 aba_counter;
james@766 27
james@766 28 struct freelist_state
james@766 29 *fs;
james@766 30 };
james@766 31
james@766 32 struct queue_element
james@766 33 {
james@766 34 // TRD : next in a queue requires volatile as it is target of CAS
james@766 35 struct queue_element
james@766 36 *volatile next[QUEUE_PAC_SIZE];
james@766 37
james@766 38 struct freelist_element
james@766 39 *fe;
james@766 40
james@766 41 void
james@766 42 *user_data;
james@766 43 };
james@766 44
james@766 45 #pragma pack( pop )
james@766 46
james@766 47 /***** externs *****/
james@766 48
james@766 49 /***** private prototypes *****/
james@766 50 int queue_internal_freelist_init_function( void **user_data, void *user_state );
james@766 51 void queue_internal_freelist_delete_function( void *user_data, void *user_state );
james@766 52
james@766 53 void queue_internal_new_element_from_freelist( struct queue_state *qs, struct queue_element *qe[QUEUE_PAC_SIZE], void *user_data );
james@766 54 void queue_internal_guaranteed_new_element_from_freelist( struct queue_state *qs, struct queue_element * qe[QUEUE_PAC_SIZE], void *user_data );
james@766 55 void queue_internal_init_element( struct queue_state *qs, struct queue_element *qe[QUEUE_PAC_SIZE], struct freelist_element *fe, void *user_data );
james@766 56
james@766 57 void queue_internal_queue( struct queue_state *qs, struct queue_element *qe[QUEUE_PAC_SIZE] );
james@766 58
james@766 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 );
james@766 60