aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/api.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-15 01:08:33 -0800
committerDave Barach <openvpp@barachs.net>2018-01-25 23:53:35 +0000
commitb384b543313b6b47a277c903e9d4fcd4343054fa (patch)
tree1996e3a25eb3a32fe5bbc405d75f38dd041a5a40 /src/vlibmemory/api.h
parent4e578068fc3fe8ba176d211123ddd88962dab315 (diff)
session: add support for memfd segments
- update segment manager and session api to work with both flavors of ssvm segments - added generic ssvm slave/master init and del functions - cleanup/refactor tcp_echo - fixed uses of svm fifo pool as vector Change-Id: Ieee8b163faa407da6e77e657a2322de213a9d2a0 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vlibmemory/api.h')
-rw-r--r--src/vlibmemory/api.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/vlibmemory/api.h b/src/vlibmemory/api.h
index e86b88cdf9e..8d2b191fb81 100644
--- a/src/vlibmemory/api.h
+++ b/src/vlibmemory/api.h
@@ -61,6 +61,44 @@ vl_api_client_index_to_registration (u32 index)
return (vl_mem_api_client_index_to_registration (index));
}
+always_inline u32
+vl_api_registration_file_index (vl_api_registration_t * reg)
+{
+ return reg->clib_file_index;
+}
+
+always_inline clib_file_t *
+vl_api_registration_file (vl_api_registration_t * reg)
+{
+ return clib_file_get (&file_main, vl_api_registration_file_index (reg));
+}
+
+always_inline void
+vl_api_registration_del_file (vl_api_registration_t * reg)
+{
+ clib_file_t *cf = vl_api_registration_file (reg);
+ if (cf)
+ clib_file_del (&file_main, cf);
+}
+
+always_inline clib_error_t *
+vl_api_send_fd_msg (vl_api_registration_t * reg, int fd_to_send)
+{
+ clib_file_t *cf = vl_api_registration_file (reg);
+ if (cf)
+ return vl_sock_api_send_fd_msg (cf->file_descriptor, fd_to_send);
+ return 0;
+}
+
+always_inline clib_error_t *
+vl_api_recv_fd_msg (vl_api_registration_t * reg, int *fd_to_recv, u32 wait)
+{
+ clib_file_t *cf = vl_api_registration_file (reg);
+ if (cf)
+ return vl_sock_api_recv_fd_msg (cf->file_descriptor, fd_to_recv, wait);
+ return 0;
+}
+
/*
* vl_api_clnt process data used by transports (socket api in particular)
*/