memif: add private header size field
private header size allows to reserve firs X bytes of payload to be considered as private metadata. For now we just support value 0 but adding this field to address future needs without changing protocol version. Change-Id: Id77336584c0194a303b20210aff584c7372cba01 Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:

committed by
Damjan Marion

parent
18c0f229ce
commit
d50c987ead
@ -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))
|
||||
|
@ -153,6 +153,7 @@ memif_msg_enq_add_ring (memif_if_t * mif, u8 index, u8 direction)
|
||||
ar->offset = mq->offset;
|
||||
ar->log2_ring_size = mq->log2_ring_size;
|
||||
ar->flags = (direction == MEMIF_RING_S2M) ? MEMIF_MSG_ADD_RING_FLAG_S2M : 0;
|
||||
ar->private_hdr_size = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -326,6 +327,9 @@ memif_msg_receive_add_ring (memif_if_t * mif, memif_msg_t * msg, int fd)
|
||||
if (fd < 0)
|
||||
return clib_error_return (0, "missing ring interrupt fd");
|
||||
|
||||
if (ar->private_hdr_size != 0)
|
||||
return clib_error_return (0, "private headers not supported");
|
||||
|
||||
if (ar->flags & MEMIF_MSG_ADD_RING_FLAG_S2M)
|
||||
{
|
||||
if (ar->index != vec_len (mif->rx_queues))
|
||||
|
Reference in New Issue
Block a user