summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/memif_test.c
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-08-21 10:51:21 +0200
committerOle Trøan <otroan@employees.org>2019-09-09 14:29:48 +0000
commit546f955b3dad6c0866a8ba778d0cfe1ef43d81d4 (patch)
tree6113bab6ae3dec547b6cc6467b0fb8db114e7728 /src/plugins/memif/memif_test.c
parentbdf3ebe358787ef240dc9fadc515dfd178dfef7b (diff)
memif: API cleanup
Use consistent API types. memif_create now enables zero-copy by default. Add no_zero_copy param to memif_create which if set, disables zero copy. Type: refactor Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I11df8b9212c40de179ee71dc9da14039b982ede5 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'src/plugins/memif/memif_test.c')
-rw-r--r--src/plugins/memif/memif_test.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/memif/memif_test.c b/src/plugins/memif/memif_test.c
index e26094b82a8..2dda6d35f2b 100644
--- a/src/plugins/memif/memif_test.c
+++ b/src/plugins/memif/memif_test.c
@@ -162,12 +162,14 @@ api_memif_socket_filename_add_del (vat_main_t * vam)
return -99;
}
- M (MEMIF_SOCKET_FILENAME_ADD_DEL, mp);
+ M2 (MEMIF_SOCKET_FILENAME_ADD_DEL, mp, strlen ((char *) socket_filename));
mp->is_add = is_add;
mp->socket_id = htonl (socket_id);
- strncpy ((char *) mp->socket_filename,
- (char *) socket_filename, sizeof (mp->socket_filename) - 1);
+ char *p = (char *) &mp->socket_filename;
+ p +=
+ vl_api_to_api_string (strlen ((char *) socket_filename),
+ (char *) socket_filename, (vl_api_string_t *) p);
vec_free (socket_filename);
@@ -259,7 +261,7 @@ api_memif_create (vat_main_t * vam)
return -99;
}
- M (MEMIF_CREATE, mp);
+ M2 (MEMIF_CREATE, mp, strlen ((char *) secret));
mp->mode = mode;
mp->id = clib_host_to_net_u32 (id);
@@ -269,7 +271,9 @@ api_memif_create (vat_main_t * vam)
mp->socket_id = clib_host_to_net_u32 (socket_id);
if (secret != 0)
{
- strncpy ((char *) mp->secret, (char *) secret, 16);
+ char *p = (char *) &mp->secret;
+ p += vl_api_to_api_string (strlen ((char *) secret), (char *) secret,
+ (vl_api_string_t *) p);
vec_free (secret);
}
memcpy (mp->hw_addr, hw_addr, 6);
@@ -382,8 +386,8 @@ vl_api_memif_details_t_handler (vl_api_memif_details_t * mp)
clib_net_to_host_u32 (mp->socket_id),
mp->role ? "slave" : "master",
ntohl (mp->ring_size), ntohs (mp->buffer_size),
- mp->admin_up_down ? "up" : "down",
- mp->link_up_down ? "up" : "down");
+ (mp->flags & IF_STATUS_API_FLAG_ADMIN_UP) ? "up" : "down",
+ (mp->flags & IF_STATUS_API_FLAG_LINK_UP) ? "up" : "down");
}
/* memif_socket_filename_dump API */