summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/memif/memif.h18
-rw-r--r--src/plugins/memif/private.h18
2 files changed, 20 insertions, 16 deletions
diff --git a/src/plugins/memif/memif.h b/src/plugins/memif/memif.h
index 30a27dc2a1e..11918eabcde 100644
--- a/src/plugins/memif/memif.h
+++ b/src/plugins/memif/memif.h
@@ -22,6 +22,11 @@
#define MEMIF_CACHELINE_SIZE 64
#endif
+#define MEMIF_COOKIE 0x3E31F10
+#define MEMIF_VERSION_MAJOR 1
+#define MEMIF_VERSION_MINOR 0
+#define MEMIF_VERSION ((MEMIF_VERSION_MAJOR << 8) | MEMIF_VERSION_MINOR)
+
/*
* Type definitions
*/
@@ -53,9 +58,12 @@ typedef enum
} memif_interface_mode_t;
typedef uint16_t memif_region_index_t;
+typedef uint64_t memif_region_offset_t;
+typedef uint64_t memif_region_size_t;
typedef uint16_t memif_ring_index_t;
typedef uint32_t memif_interface_id_t;
typedef uint16_t memif_version_t;
+typedef uint8_t memif_log2_ring_size_t;
/*
* Socket messages
@@ -69,7 +77,7 @@ typedef struct __attribute__ ((packed))
memif_region_index_t max_region;
memif_ring_index_t max_m2s_ring;
memif_ring_index_t max_s2m_ring;
- uint8_t max_log2_ring_size;
+ memif_log2_ring_size_t max_log2_ring_size;
} memif_msg_hello_t;
typedef struct __attribute__ ((packed))
@@ -84,7 +92,7 @@ typedef struct __attribute__ ((packed))
typedef struct __attribute__ ((packed))
{
memif_region_index_t index;
- uint32_t size;
+ memif_region_size_t size;
} memif_msg_add_region_t;
typedef struct __attribute__ ((packed))
@@ -93,8 +101,8 @@ typedef struct __attribute__ ((packed))
#define MEMIF_MSG_ADD_RING_FLAG_S2M (1 << 0)
memif_ring_index_t index;
memif_region_index_t region;
- uint32_t offset;
- uint8_t log2_ring_size;
+ memif_region_offset_t offset;
+ memif_log2_ring_size_t log2_ring_size;
} memif_msg_add_ring_t;
typedef struct __attribute__ ((packed))
@@ -143,7 +151,7 @@ typedef struct __attribute__ ((packed))
uint32_t buffer_length;
uint32_t length;
uint8_t reserved[4];
- uint64_t offset;
+ memif_region_offset_t offset;
uint64_t metadata;
} memif_desc_t;
diff --git a/src/plugins/memif/private.h b/src/plugins/memif/private.h
index 104706fa0c8..0f82f1e9575 100644
--- a/src/plugins/memif/private.h
+++ b/src/plugins/memif/private.h
@@ -24,10 +24,6 @@
#define MEMIF_DEFAULT_TX_QUEUES 1
#define MEMIF_DEFAULT_BUFFER_SIZE 2048
-#define MEMIF_VERSION_MAJOR 0
-#define MEMIF_VERSION_MINOR 1
-#define MEMIF_VERSION ((MEMIF_VERSION_MAJOR << 8) | MEMIF_VERSION_MINOR)
-#define MEMIF_COOKIE 0xdeadbeef
#define MEMIF_MAX_M2S_RING (vec_len (vlib_mains) - 1)
#define MEMIF_MAX_S2M_RING (vec_len (vlib_mains) - 1)
#define MEMIF_MAX_REGION 255
@@ -88,7 +84,7 @@ typedef struct
typedef struct
{
void *shm;
- u32 region_size;
+ memif_region_size_t region_size;
int fd;
} memif_region_t;
@@ -102,9 +98,9 @@ typedef struct
{
/* ring data */
memif_ring_t *ring;
- u8 log2_ring_size;
- u8 region;
- u32 offset;
+ memif_log2_ring_size_t log2_ring_size;
+ memif_region_index_t region;
+ memif_region_offset_t offset;
u16 last_head;
u16 last_tail;
@@ -163,7 +159,7 @@ typedef struct
struct
{
- u8 log2_ring_size;
+ memif_log2_ring_size_t log2_ring_size;
u8 num_s2m_rings;
u8 num_m2s_rings;
u16 buffer_size;
@@ -171,7 +167,7 @@ typedef struct
struct
{
- u8 log2_ring_size;
+ memif_log2_ring_size_t log2_ring_size;
u8 num_s2m_rings;
u8 num_m2s_rings;
u16 buffer_size;
@@ -218,7 +214,7 @@ typedef struct
u8 *secret;
u8 is_master;
memif_interface_mode_t mode:8;
- u8 log2_ring_size;
+ memif_log2_ring_size_t log2_ring_size;
u16 buffer_size;
u8 hw_addr_set;
u8 hw_addr[6];