aboutsummaryrefslogtreecommitdiffstats
path: root/vpp
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2016-05-11 04:49:46 -0700
committerDamjan Marion <damarion@cisco.com>2016-05-18 17:14:46 +0000
commit82e29c455833b5b12e04c89d2dec1106b499e6b0 (patch)
tree4e7fc87fd853113d5ab47dd92aec04968f7551cc /vpp
parent5a206eafdbf9370fead2dd26fcab09e7ff5544c4 (diff)
Add netmap API
JIRA: VPP-66 Change-Id: I421529fa8eafe5268745a34a4fcd40156defcdf8 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'vpp')
-rw-r--r--vpp/api/api.c44
-rw-r--r--vpp/api/vpe.api50
2 files changed, 93 insertions, 1 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c
index f81b9c98..39ea0aa4 100644
--- a/vpp/api/api.c
+++ b/vpp/api/api.c
@@ -75,6 +75,7 @@
#include <vnet/ip/ip6_hop_by_hop.h>
#include <vnet/devices/af_packet/af_packet.h>
#include <vnet/policer/policer.h>
+#include <vnet/devices/netmap/netmap.h>
#undef BIHASH_TYPE
#undef __included_bihash_template_h__
@@ -337,7 +338,9 @@ _(LISP_ENABLE_DISABLE_STATUS_DUMP, \
_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del) \
_(AF_PACKET_CREATE, af_packet_create) \
_(AF_PACKET_DELETE, af_packet_delete) \
-_(POLICER_ADD_DEL, policer_add_del)
+_(POLICER_ADD_DEL, policer_add_del) \
+_(NETMAP_CREATE, netmap_create) \
+_(NETMAP_DELETE, netmap_delete)
#define QUOTE_(x) #x
#define QUOTE(x) QUOTE_(x)
@@ -5964,6 +5967,45 @@ vl_api_policer_add_del_t_handler
REPLY_MACRO(VL_API_POLICER_ADD_DEL_REPLY);
}
+static void
+vl_api_netmap_create_t_handler
+(vl_api_netmap_create_t *mp)
+{
+ vlib_main_t *vm = vlib_get_main();
+ vl_api_netmap_create_reply_t *rmp;
+ int rv = 0;
+ u8 *if_name = NULL;
+
+ if_name = format(0, "%s", mp->if_name);
+ vec_add1 (if_name, 0);
+
+ rv = netmap_create_if(vm, if_name, mp->use_random_hw_addr ? 0 : mp->hw_addr,
+ mp->is_pipe, mp->is_master);
+
+ vec_free(if_name);
+
+ REPLY_MACRO(VL_API_NETMAP_CREATE_REPLY);
+}
+
+static void
+vl_api_netmap_delete_t_handler
+(vl_api_netmap_delete_t *mp)
+{
+ vlib_main_t * vm = vlib_get_main();
+ vl_api_netmap_delete_reply_t *rmp;
+ int rv = 0;
+ u8 *if_name = NULL;
+
+ if_name = format(0, "%s", mp->if_name);
+ vec_add1 (if_name, 0);
+
+ rv = netmap_delete_if(vm, if_name);
+
+ vec_free(if_name);
+
+ REPLY_MACRO(VL_API_NETMAP_DELETE_REPLY);
+}
+
#define BOUNCE_HANDLER(nn) \
static void vl_api_##nn##_t_handler ( \
vl_api_##nn##_t *mp) \
diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api
index 021cd0c0..e2d23594 100644
--- a/vpp/api/vpe.api
+++ b/vpp/api/vpe.api
@@ -3460,3 +3460,53 @@ define policer_add_del_reply {
u32 context;
i32 retval;
};
+
+/** \brief Create netmap
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param if_name - interface name
+ @param hw_addr - interface MAC
+ @param use_random_hw_addr - use random generated MAC
+ @param is_pipe - is pipe
+ @param is_master - 0=slave, 1=master
+*/
+define netmap_create {
+ u32 client_index;
+ u32 context;
+
+ u8 if_name[64];
+ u8 hw_addr[6];
+ u8 use_random_hw_addr;
+ u8 is_pipe;
+ u8 is_master;
+};
+
+/** \brief Create netmap response
+ @param context - sender context, to match reply w/ request
+ @param retval - return value for request
+*/
+define netmap_create_reply {
+ u32 context;
+ i32 retval;
+};
+
+/** \brief Delete netmap
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param if_name - interface name
+*/
+define netmap_delete {
+ u32 client_index;
+ u32 context;
+
+ u8 if_name[64];
+};
+
+/** \brief Delete netmap response
+ @param context - sender context, to match reply w/ request
+ @param retval - return value for request
+*/
+define netmap_delete_reply {
+ u32 context;
+ i32 retval;
+};