Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
api: refactor vlibmemory
[vpp.git]
/
src
/
plugins
/
memif
/
memif_api.c
diff --git
a/src/plugins/memif/memif_api.c
b/src/plugins/memif/memif_api.c
index
65a4a09
..
068fd3d
100644
(file)
--- a/
src/plugins/memif/memif_api.c
+++ b/
src/plugins/memif/memif_api.c
@@
-25,7
+25,7
@@
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
-#include <vlibsocket/api.h>
+
/* define message IDs */
#include <memif/memif_msg_enum.h>
/* define message IDs */
#include <memif/memif_msg_enum.h>
@@
-60,7
+60,7
@@
*/
#define REPLY_MACRO(t) \
do { \
*/
#define REPLY_MACRO(t) \
do { \
-
unix_shared_memory
_queue_t * q = \
+
svm
_queue_t * q = \
vl_api_client_index_to_input_queue (mp->client_index); \
if (!q) \
return; \
vl_api_client_index_to_input_queue (mp->client_index); \
if (!q) \
return; \
@@
-75,7
+75,7
@@
do { \
#define REPLY_MACRO2(t, body) \
do { \
#define REPLY_MACRO2(t, body) \
do { \
-
unix_shared_memory
_queue_t * q = \
+
svm
_queue_t * q = \
vl_api_client_index_to_input_queue (mp->client_index); \
if (!q) \
return; \
vl_api_client_index_to_input_queue (mp->client_index); \
if (!q) \
return; \
@@
-91,7
+91,6
@@
do { \
#define foreach_memif_plugin_api_msg \
_(MEMIF_CREATE, memif_create) \
_(MEMIF_DELETE, memif_delete) \
#define foreach_memif_plugin_api_msg \
_(MEMIF_CREATE, memif_create) \
_(MEMIF_DELETE, memif_delete) \
-_(MEMIF_DETAILS, memif_details) \
_(MEMIF_DUMP, memif_dump) \
/**
_(MEMIF_DUMP, memif_dump) \
/**
@@
-134,6
+133,9
@@
vl_api_memif_create_t_handler (vl_api_memif_create_t * mp)
/* role */
args.is_master = (mp->role == 0);
/* role */
args.is_master = (mp->role == 0);
+ /* mode */
+ args.mode = mp->mode;
+
/* rx/tx queues */
if (args.is_master == 0)
{
/* rx/tx queues */
if (args.is_master == 0)
{
@@
-202,19
+204,22
@@
vl_api_memif_delete_t_handler (vl_api_memif_delete_t * mp)
vl_api_memif_delete_reply_t *rmp;
vnet_hw_interface_t *hi =
vnet_get_sup_hw_interface (vnm, ntohl (mp->sw_if_index));
vl_api_memif_delete_reply_t *rmp;
vnet_hw_interface_t *hi =
vnet_get_sup_hw_interface (vnm, ntohl (mp->sw_if_index));
- memif_if_t *mif
= pool_elt_at_index (mm->interfaces, hi->dev_instance)
;
+ memif_if_t *mif;
int rv = 0;
if (hi == NULL || memif_device_class.index != hi->dev_class_index)
rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
else
int rv = 0;
if (hi == NULL || memif_device_class.index != hi->dev_class_index)
rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
else
- rv = memif_delete_if (vm, mif);
+ {
+ mif = pool_elt_at_index (mm->interfaces, hi->dev_instance);
+ rv = memif_delete_if (vm, mif);
+ }
REPLY_MACRO (VL_API_MEMIF_DELETE_REPLY);
}
static void
REPLY_MACRO (VL_API_MEMIF_DELETE_REPLY);
}
static void
-send_memif_details (
unix_shared_memory
_queue_t * q,
+send_memif_details (
svm
_queue_t * q,
memif_if_t * mif,
vnet_sw_interface_t * swif,
u8 * interface_name, u32 context)
memif_if_t * mif,
vnet_sw_interface_t * swif,
u8 * interface_name, u32 context)
@@
-265,7
+270,7
@@
vl_api_memif_dump_t_handler (vl_api_memif_dump_t * mp)
vnet_sw_interface_t *swif;
memif_if_t *mif;
u8 *if_name = 0;
vnet_sw_interface_t *swif;
memif_if_t *mif;
u8 *if_name = 0;
-
unix_shared_memory
_queue_t *q;
+
svm
_queue_t *q;
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
@@
-288,16
+293,6
@@
vl_api_memif_dump_t_handler (vl_api_memif_dump_t * mp)
vec_free (if_name);
}
vec_free (if_name);
}
-/**
- * @brief Message handler for memif_details API.
- * @param mp vl_api_memif_details_t * mp the api message
- */
-void
-vl_api_memif_details_t_handler (vl_api_memif_details_t * mp)
-{
- clib_warning ("BUG");
-}
-
#define vl_msg_name_crc_list
#include <memif/memif_all_api_h.h>
#undef vl_msg_name_crc_list
#define vl_msg_name_crc_list
#include <memif/memif_all_api_h.h>
#undef vl_msg_name_crc_list