win-pvdrivers

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/liblfds.6/src/queue/queue_internal.h	Sun Jan 31 21:28:42 2010 +1100
     1.3 @@ -0,0 +1,60 @@
     1.4 +/***** the library wide include file *****/
     1.5 +#include "liblfds_internal.h"
     1.6 +
     1.7 +/***** pragmas *****/
     1.8 +
     1.9 +/***** defines *****/
    1.10 +#define QUEUE_STATE_UNKNOWN               -1
    1.11 +#define QUEUE_STATE_EMPTY                  0
    1.12 +#define QUEUE_STATE_ENQUEUE_OUT_OF_PLACE   1
    1.13 +#define QUEUE_STATE_ATTEMPT_DEQUEUE        2
    1.14 +
    1.15 +#define QUEUE_POINTER 0
    1.16 +#define QUEUE_COUNTER 1
    1.17 +#define QUEUE_PAC_SIZE 2
    1.18 +
    1.19 +/***** structures *****/
    1.20 +#pragma pack( push, ALIGN_DOUBLE_POINTER )
    1.21 +
    1.22 +struct queue_state
    1.23 +{
    1.24 +  struct queue_element
    1.25 +    *volatile enqueue[QUEUE_PAC_SIZE],
    1.26 +    *volatile dequeue[QUEUE_PAC_SIZE];
    1.27 +
    1.28 +  atom_t
    1.29 +    aba_counter;
    1.30 +
    1.31 +  struct freelist_state
    1.32 +    *fs;
    1.33 +};
    1.34 +
    1.35 +struct queue_element
    1.36 +{
    1.37 +  // TRD : next in a queue requires volatile as it is target of CAS
    1.38 +  struct queue_element
    1.39 +    *volatile next[QUEUE_PAC_SIZE];
    1.40 +
    1.41 +  struct freelist_element
    1.42 +    *fe;
    1.43 +
    1.44 +  void
    1.45 +    *user_data;
    1.46 +};
    1.47 +
    1.48 +#pragma pack( pop )
    1.49 +
    1.50 +/***** externs *****/
    1.51 +
    1.52 +/***** private prototypes *****/
    1.53 +int queue_internal_freelist_init_function( void **user_data, void *user_state );
    1.54 +void queue_internal_freelist_delete_function( void *user_data, void *user_state );
    1.55 +
    1.56 +void queue_internal_new_element_from_freelist( struct queue_state *qs, struct queue_element *qe[QUEUE_PAC_SIZE], void *user_data );
    1.57 +void queue_internal_guaranteed_new_element_from_freelist( struct queue_state *qs, struct queue_element * qe[QUEUE_PAC_SIZE], void *user_data );
    1.58 +void queue_internal_init_element( struct queue_state *qs, struct queue_element *qe[QUEUE_PAC_SIZE], struct freelist_element *fe, void *user_data );
    1.59 +
    1.60 +void queue_internal_queue( struct queue_state *qs, struct queue_element *qe[QUEUE_PAC_SIZE] );
    1.61 +
    1.62 +void queue_internal_validate( struct queue_state *qs, struct validation_info *vi, enum data_structure_validity *queue_validity, enum data_structure_validity *freelist_validity );
    1.63 +