Changeset 68 for trunk/kernel/libk/remote_fifo.h
- Timestamp:
- Jun 27, 2017, 10:24:13 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/libk/remote_fifo.h
r14 r68 1 1 /* 2 * remote_fifo.h - kernel generic SRMWFIFO2 * remote_fifo.h - Lock-less Single-Reader Multiple-Writers FIFO 3 3 * 4 * Authors : Mohamed Lamine Karaoui / Alain Greiner (2016) 4 * Authors : Mohamed Lamine Karaoui (2015) 5 * Alain Greiner (2016,2017) 5 6 * 6 7 * Copyright (c) UPMC Sorbonne Universites … … 33 34 * This structure defines a generic, single reader, multiple writers 34 35 * remote FIFO, that is used by the RPCs for inter cluster communications. 35 * The accesses are implemented using a lock-free algorithm, as it 36 * uses a ticket based mechanism to handle concurrent access between 37 * the multiple writers. 38 * Each FIF0 slot can contain one full cache line, even if RPCs store only 39 * an extended pointer on the RPC descriptor in each slot. 36 * The accesses are implemented using a lock-free algorithm, as it uses a ticket 37 * based mechanism to handle concurrent access between multiple writers. 38 * Each FIF0 slot can contain one 64 bits integer. 40 39 * In case of FIFO full, the writer deschedule without blocking, to retry later. 41 40 * 42 41 * WARNING : the number of slots is statically defined by the global 43 42 * configuration parameter CONFIG_REMOTE_FIFO_SLOTS for all fifos, requiring 44 * CACHE_LINE_SIZE * CONFIG_REMOTE_FIFO_SLOTS bytes for each FIFO...43 * 12 * CONFIG_REMOTE_FIFO_SLOTS bytes for each FIFO. 45 44 ***********************************************************************************/ 45 46 46 typedef struct remote_fifo_s 47 47 { 48 48 volatile uint32_t wr_id; /*! write slot index */ 49 49 volatile uint32_t rd_id; /*! read slot index */ 50 volatile bool_t valid[CONFIG_REMOTE_FIFO_SLOTS]; /*! empty slot if false*/51 cacheline_tdata[CONFIG_REMOTE_FIFO_SLOTS]; /*! fifo slot content */50 volatile uint32_t valid[CONFIG_REMOTE_FIFO_SLOTS]; /*! empty slot if 0 */ 51 uint64_t data[CONFIG_REMOTE_FIFO_SLOTS]; /*! fifo slot content */ 52 52 } 53 53 remote_fifo_t; … … 72 72 ***********************************************************************************/ 73 73 error_t local_fifo_get_item( remote_fifo_t * fifo, 74 void * item, 75 uint32_t size ); 74 uint64_t * item ); 76 75 77 76 /************************************************************************************ … … 84 83 * @ fifo : extended pointer to the fifo in remote cluster. 85 84 * @ item : pointer on a local buffer containing the item to be stored. 86 * @ size : actual number of bytes in one item. 87 * @ first : return value (true if first item registered in remote fifo) 85 * @ first : [out] true if first item registered in remote fifo. 88 86 * @ return 0 on success / EBUSY if a contention has been detected. 89 87 ***********************************************************************************/ 90 88 error_t remote_fifo_put_item( xptr_t fifo, 91 void * item, 92 uint32_t size, 89 uint64_t * item, 93 90 bool_t * first ); 94 91
Note: See TracChangeset
for help on using the changeset viewer.