aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2018-03-28 10:21:05 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-28 13:35:40 +0000
commitab7c2b012d0132c63d700e036de801a1b7dc3340 (patch)
treeb02973c00f8cc37f3423542f1206a11e9cc3a10a /extras
parentea2600ae6adbdb30bc66c9415bf19fe41a3af4f0 (diff)
libmemif: add private header size field
Change-Id: I09567c8ee9c92e91918840f80942a005069d9842 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/libmemif/src/libmemif.h1
-rw-r--r--extras/libmemif/src/main.c6
-rw-r--r--extras/libmemif/src/memif.h1
-rw-r--r--extras/libmemif/src/socket.c4
4 files changed, 10 insertions, 2 deletions
diff --git a/extras/libmemif/src/libmemif.h b/extras/libmemif/src/libmemif.h
index 14c450338ce..e1f96f90c80 100644
--- a/extras/libmemif/src/libmemif.h
+++ b/extras/libmemif/src/libmemif.h
@@ -74,6 +74,7 @@ typedef enum
MEMIF_ERR_UNKNOWN_MSG, /*!< unknown message type */
MEMIF_ERR_POLL_CANCEL, /*!< memif_poll_event() was cancelled */
MEMIF_ERR_MAX_RING, /*!< too large ring size */
+ MEMIF_ERR_PRIVHDR, /*!< private hdrs not supported */
} memif_err_t;
/**
diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c
index f83f71064e6..42bced67dae 100644
--- a/extras/libmemif/src/main.c
+++ b/extras/libmemif/src/main.c
@@ -54,7 +54,7 @@
/* private structs and functions */
#include <memif_private.h>
-#define ERRLIST_LEN 38
+#define ERRLIST_LEN 39
#define MAX_ERRBUF_LEN 256
#if __x86_x64__
@@ -144,7 +144,9 @@ const char *memif_errlist[ERRLIST_LEN] = { /* MEMIF_ERR_SUCCESS */
/* MEMIF_ERR_POLL_CANCEL */
"Memif event polling was canceled.",
/* MEMIF_ERR_MAX_RING */
- "Maximum log2 ring size is 15"
+ "Maximum log2 ring size is 15.",
+ /* MEMIF_ERR_PRIVHDR */
+ "Private headers not supported."
};
#define MEMIF_ERR_UNDEFINED "undefined error"
diff --git a/extras/libmemif/src/memif.h b/extras/libmemif/src/memif.h
index 38b54029e46..3fbce91d68f 100644
--- a/extras/libmemif/src/memif.h
+++ b/extras/libmemif/src/memif.h
@@ -103,6 +103,7 @@ typedef struct __attribute__ ((packed))
memif_region_index_t region;
memif_region_offset_t offset;
memif_log2_ring_size_t log2_ring_size;
+ uint16_t private_hdr_size; /* used for private metadata */
} memif_msg_add_ring_t;
typedef struct __attribute__ ((packed))
diff --git a/extras/libmemif/src/socket.c b/extras/libmemif/src/socket.c
index 8f18d892139..a471e0ba943 100644
--- a/extras/libmemif/src/socket.c
+++ b/extras/libmemif/src/socket.c
@@ -227,6 +227,7 @@ memif_msg_enq_add_ring (memif_connection_t * c, uint8_t index, uint8_t dir)
ar->region = mq->region;
ar->log2_ring_size = mq->log2_ring_size;
ar->flags = (dir == MEMIF_RING_S2M) ? MEMIF_MSG_ADD_RING_FLAG_S2M : 0;
+ ar->private_hdr_size = 0;
e->next = NULL;
if (c->msg_queue == NULL)
@@ -516,6 +517,9 @@ memif_msg_receive_add_ring (memif_connection_t * c, memif_msg_t * msg, int fd)
if (fd < 0)
return MEMIF_ERR_NO_INTFD;
+ if (ar->private_hdr_size != 0)
+ return MEMIF_ERR_PRIVHDR;
+
if (ar->flags & MEMIF_MSG_ADD_RING_FLAG_S2M)
{
if (ar->index > MEMIF_MAX_S2M_RING)