diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-03-24 20:51:55 +0100 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-03-24 20:51:55 +0100 |
commit | 0dd4526f5c75f23aba886bee2d9850a70aa67ca8 (patch) | |
tree | 3480b39405a9ce935a5d110ebfacc121f9440b37 /include | |
parent | 545092a8eaa1a972a2bcaf1b532d74f21db1b623 (diff) | |
download | ouroboros-0dd4526f5c75f23aba886bee2d9850a70aa67ca8.tar.gz ouroboros-0dd4526f5c75f23aba886bee2d9850a70aa67ca8.zip |
lib: Shared Memory
Updated tests. Added code to drop a corner case (packet where the tail
PCI would cross the edge of the ring buffer) because solving this very
rare case is not worth the performance hit on the ringbuffer the extra
code would incur. This means the ringbuffer might drop a very small
percentage of packets.
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/shm_du_map.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/include/ouroboros/shm_du_map.h b/include/ouroboros/shm_du_map.h index b3533fa3..05c49c2d 100644 --- a/include/ouroboros/shm_du_map.h +++ b/include/ouroboros/shm_du_map.h @@ -38,15 +38,14 @@ #define SHM_DU_MAP_FILENAME "ouroboros_du_map" #endif -#ifndef SHM_DU_MAP_SIZE -#define SHM_DU_MAP_SIZE 10 +#ifndef SHM_BLOCKS_IN_MAP +#define SHM_BLOCKS_IN_MAP (1 << 12) #endif #include "common.h" #include "logs.h" struct shm_du_buff; - struct shm_du_map; struct shm_du_map * shm_du_map_create(); @@ -60,11 +59,9 @@ struct shm_du_buff * shm_create_du_buff(struct shm_du_map * dum, size_t len); int shm_release_du_buff(struct shm_du_map * dum); -uint8_t * shm_du_buff_head_alloc(struct shm_du_map * dum, - struct shm_du_buff * sdb, +uint8_t * shm_du_buff_head_alloc(struct shm_du_buff * sdb, size_t size); -uint8_t * shm_du_buff_tail_alloc(struct shm_du_map * dum, - struct shm_du_buff * sdb, +uint8_t * shm_du_buff_tail_alloc(struct shm_du_buff * sdb, size_t size); int shm_du_buff_head_release(struct shm_du_buff * sdb, size_t size); |