vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
}
-static u8 *
-format_decap_next (u8 * s, va_list * args)
-{
- u32 next_index = va_arg (*args, u32);
-
- switch (next_index)
- {
- case LISP_GPE_INPUT_NEXT_DROP:
- return format (s, "drop");
- case LISP_GPE_INPUT_NEXT_IP4_INPUT:
- return format (s, "ip4");
- case LISP_GPE_INPUT_NEXT_IP6_INPUT:
- return format (s, "ip6");
- default:
- return format (s, "unknown %d", next_index);
- }
- return s;
-}
-
-static void
-vl_api_lisp_gpe_tunnel_details_t_handler (vl_api_lisp_gpe_tunnel_details_t *
- mp)
-{
- vat_main_t *vam = &vat_main;
- u8 *iid_str;
- u8 *flag_str = NULL;
-
- iid_str = format (0, "%d (0x%x)", ntohl (mp->iid), ntohl (mp->iid));
-
-#define _(n,v) if (mp->flags & v) flag_str = format (flag_str, "%s-bit ", #n);
- foreach_lisp_gpe_flag_bit;
-#undef _
-
- print (vam->ofp, "%=20d%=30U%=16U%=16d%=16d%=16U"
- "%=16d%=16d%=16sd=16d%=16s%=16s",
- mp->tunnels,
- mp->is_ipv6 ? format_ip6_address : format_ip4_address,
- mp->source_ip,
- mp->is_ipv6 ? format_ip6_address : format_ip4_address,
- mp->destination_ip,
- ntohl (mp->encap_fib_id),
- ntohl (mp->decap_fib_id),
- format_decap_next, ntohl (mp->dcap_next),
- mp->ver_res >> 6,
- flag_str, mp->next_protocol, mp->ver_res, mp->res, iid_str);
-
- vec_free (iid_str);
-}
-
-static void
- vl_api_lisp_gpe_tunnel_details_t_handler_json
- (vl_api_lisp_gpe_tunnel_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = NULL;
- struct in6_addr ip6;
- struct in_addr ip4;
- u8 *next_decap_str;
-
- next_decap_str = format (0, "%U", format_decap_next, htonl (mp->dcap_next));
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- vat_json_object_add_uint (node, "tunel", mp->tunnels);
- if (mp->is_ipv6)
- {
- clib_memcpy (&ip6, mp->source_ip, sizeof (ip6));
- vat_json_object_add_ip6 (node, "source address", ip6);
- clib_memcpy (&ip6, mp->destination_ip, sizeof (ip6));
- vat_json_object_add_ip6 (node, "destination address", ip6);
- }
- else
- {
- clib_memcpy (&ip4, mp->source_ip, sizeof (ip4));
- vat_json_object_add_ip4 (node, "source address", ip4);
- clib_memcpy (&ip4, mp->destination_ip, sizeof (ip4));
- vat_json_object_add_ip4 (node, "destination address", ip4);
- }
- vat_json_object_add_uint (node, "fib encap", ntohl (mp->encap_fib_id));
- vat_json_object_add_uint (node, "fib decap", ntohl (mp->decap_fib_id));
- vat_json_object_add_string_copy (node, "decap next", next_decap_str);
- vat_json_object_add_uint (node, "lisp version", mp->ver_res >> 6);
- vat_json_object_add_uint (node, "flags", mp->flags);
- vat_json_object_add_uint (node, "next protocol", mp->next_protocol);
- vat_json_object_add_uint (node, "ver_res", mp->ver_res);
- vat_json_object_add_uint (node, "res", mp->res);
- vat_json_object_add_uint (node, "iid", ntohl (mp->iid));
-
- vec_free (next_decap_str);
-}
-
static void
vl_api_show_lisp_map_register_state_reply_t_handler
(vl_api_show_lisp_map_register_state_reply_t * mp)
_(sw_interface_set_vpath_reply) \
_(sw_interface_set_vxlan_bypass_reply) \
_(sw_interface_set_l2_bridge_reply) \
-_(sw_interface_set_dpdk_hqos_pipe_reply) \
-_(sw_interface_set_dpdk_hqos_subport_reply) \
-_(sw_interface_set_dpdk_hqos_tctbl_reply) \
_(bridge_domain_add_del_reply) \
_(sw_interface_set_l2_xconnect_reply) \
_(l2fib_add_del_reply) \
_(sw_interface_tag_add_del_reply) \
_(sw_interface_set_mtu_reply)
+#if DPDK > 0
+#define foreach_standard_dpdk_reply_retval_handler \
+_(sw_interface_set_dpdk_hqos_pipe_reply) \
+_(sw_interface_set_dpdk_hqos_subport_reply) \
+_(sw_interface_set_dpdk_hqos_tctbl_reply)
+#endif
+
#define _(n) \
static void vl_api_##n##_t_handler \
(vl_api_##n##_t * mp) \
foreach_standard_reply_retval_handler;
#undef _
+#if DPDK > 0
+#define _(n) \
+ static void vl_api_##n##_t_handler \
+ (vl_api_##n##_t * mp) \
+ { \
+ vat_main_t * vam = &vat_main; \
+ i32 retval = ntohl(mp->retval); \
+ if (vam->async_mode) { \
+ vam->async_errors += (retval < 0); \
+ } else { \
+ vam->retval = retval; \
+ vam->result_ready = 1; \
+ } \
+ }
+foreach_standard_dpdk_reply_retval_handler;
+#undef _
+
+#define _(n) \
+ static void vl_api_##n##_t_handler_json \
+ (vl_api_##n##_t * mp) \
+ { \
+ vat_main_t * vam = &vat_main; \
+ vat_json_node_t node; \
+ vat_json_init_object(&node); \
+ vat_json_object_add_int(&node, "retval", ntohl(mp->retval)); \
+ vat_json_print(vam->ofp, &node); \
+ vam->retval = ntohl(mp->retval); \
+ vam->result_ready = 1; \
+ }
+foreach_standard_dpdk_reply_retval_handler;
+#undef _
+#endif
+
/*
* Table of message reply handlers, must include boilerplate handlers
* we just generated
sw_interface_set_l2_xconnect_reply) \
_(SW_INTERFACE_SET_L2_BRIDGE_REPLY, \
sw_interface_set_l2_bridge_reply) \
-_(SW_INTERFACE_SET_DPDK_HQOS_PIPE_REPLY, \
- sw_interface_set_dpdk_hqos_pipe_reply) \
-_(SW_INTERFACE_SET_DPDK_HQOS_SUBPORT_REPLY, \
- sw_interface_set_dpdk_hqos_subport_reply) \
-_(SW_INTERFACE_SET_DPDK_HQOS_TCTBL_REPLY, \
- sw_interface_set_dpdk_hqos_tctbl_reply) \
_(BRIDGE_DOMAIN_ADD_DEL_REPLY, bridge_domain_add_del_reply) \
_(BRIDGE_DOMAIN_DETAILS, bridge_domain_details) \
_(BRIDGE_DOMAIN_SW_IF_DETAILS, bridge_domain_sw_if_details) \
_(LISP_EID_TABLE_DETAILS, lisp_eid_table_details) \
_(LISP_EID_TABLE_MAP_DETAILS, lisp_eid_table_map_details) \
_(LISP_EID_TABLE_VNI_DETAILS, lisp_eid_table_vni_details) \
-_(LISP_GPE_TUNNEL_DETAILS, lisp_gpe_tunnel_details) \
_(LISP_MAP_RESOLVER_DETAILS, lisp_map_resolver_details) \
_(LISP_MAP_SERVER_DETAILS, lisp_map_server_details) \
_(LISP_ADJACENCIES_GET_REPLY, lisp_adjacencies_get_reply) \
_(IP_NEIGHBOR_DETAILS, ip_neighbor_details) \
_(SW_INTERFACE_GET_TABLE_REPLY, sw_interface_get_table_reply)
+#if DPDK > 0
+#define foreach_vpe_dpdk_api_reply_msg \
+_(SW_INTERFACE_SET_DPDK_HQOS_PIPE_REPLY, \
+ sw_interface_set_dpdk_hqos_pipe_reply) \
+_(SW_INTERFACE_SET_DPDK_HQOS_SUBPORT_REPLY, \
+ sw_interface_set_dpdk_hqos_subport_reply) \
+_(SW_INTERFACE_SET_DPDK_HQOS_TCTBL_REPLY, \
+ sw_interface_set_dpdk_hqos_tctbl_reply)
+#endif
+
/* M: construct, but don't yet send a message */
#define M(T,t) \
W;
}
+#if DPDK >0
static int
api_sw_interface_set_dpdk_hqos_pipe (vat_main_t * vam)
{
/* NOTREACHED */
return 0;
}
+#endif
static int
api_sw_interface_add_del_address (vat_main_t * vam)
f64 timeout;
u32 sw_if_index;
u8 sw_if_index_set = 0;
- u32 address_length = 0;
u8 v6_address_set = 0;
ip6_address_t v6address;
sw_if_index_set = 1;
else if (unformat (i, "sw_if_index %d", &sw_if_index))
sw_if_index_set = 1;
- else if (unformat (i, "%U/%d",
- unformat_ip6_address, &v6address, &address_length))
+ else if (unformat (i, "%U", unformat_ip6_address, &v6address))
v6_address_set = 1;
else
break;
mp->sw_if_index = ntohl (sw_if_index);
clib_memcpy (mp->address, &v6address, sizeof (v6address));
- mp->address_length = address_length;
/* send it... */
S;
static int
api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
{
+ u32 dp_table = 0, vni = 0;;
unformat_input_t *input = vam->input;
vl_api_lisp_gpe_add_del_fwd_entry_t *mp;
f64 timeout = ~0;
lisp_eid_vat_t _rmt_eid, *rmt_eid = &_rmt_eid;
lisp_eid_vat_t _lcl_eid, *lcl_eid = &_lcl_eid;
u8 rmt_eid_set = 0, lcl_eid_set = 0;
- u32 action = ~0, p, w;
+ u32 action = ~0, w;
ip4_address_t rmt_rloc4, lcl_rloc4;
ip6_address_t rmt_rloc6, lcl_rloc6;
- rloc_t *rmt_locs = 0, *lcl_locs = 0, rloc, *curr_rloc = 0;
+ vl_api_lisp_gpe_locator_t *rmt_locs = 0, *lcl_locs = 0, rloc, *curr_rloc =
+ 0;
memset (&rloc, 0, sizeof (rloc));
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "rmt_eid %U", unformat_lisp_eid_vat, rmt_eid))
+ is_add = 0;
+ else if (unformat (input, "add"))
+ is_add = 1;
+ else if (unformat (input, "reid %U", unformat_lisp_eid_vat, rmt_eid))
{
rmt_eid_set = 1;
}
- else if (unformat (input, "lcl_eid %U", unformat_lisp_eid_vat, lcl_eid))
+ else if (unformat (input, "leid %U", unformat_lisp_eid_vat, lcl_eid))
{
lcl_eid_set = 1;
}
- else if (unformat (input, "p %d w %d", &p, &w))
+ else if (unformat (input, "vrf %d", &dp_table))
+ ;
+ else if (unformat (input, "bd %d", &dp_table))
+ ;
+ else if (unformat (input, "vni %d", &vni))
+ ;
+ else if (unformat (input, "w %d", &w))
{
if (!curr_rloc)
{
errmsg ("No RLOC configured for setting priority/weight!");
return -99;
}
- curr_rloc->priority = p;
curr_rloc->weight = w;
}
else if (unformat (input, "loc-pair %U %U", unformat_ip4_address,
rloc.is_ip4 = 1;
clib_memcpy (&rloc.addr, &lcl_rloc4, sizeof (lcl_rloc4));
- rloc.priority = rloc.weight = 0;
+ rloc.weight = 0;
vec_add1 (lcl_locs, rloc);
clib_memcpy (&rloc.addr, &rmt_rloc4, sizeof (rmt_rloc4));
vec_add1 (rmt_locs, rloc);
- /* priority and weight saved in rmt loc */
+ /* weight saved in rmt loc */
curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
}
else if (unformat (input, "loc-pair %U %U", unformat_ip6_address,
{
rloc.is_ip4 = 0;
clib_memcpy (&rloc.addr, &lcl_rloc6, sizeof (lcl_rloc6));
- rloc.priority = rloc.weight = 0;
+ rloc.weight = 0;
vec_add1 (lcl_locs, rloc);
clib_memcpy (&rloc.addr, &rmt_rloc6, sizeof (rmt_rloc6));
vec_add1 (rmt_locs, rloc);
- /* priority and weight saved in rmt loc */
+ /* weight saved in rmt loc */
curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
}
else if (unformat (input, "action %d", &action))
}
/* Construct the API message */
- M (LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry);
+ M2 (LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry,
+ sizeof (vl_api_lisp_gpe_locator_t) * vec_len (rmt_locs) * 2);
mp->is_add = is_add;
lisp_eid_put_vat (mp->rmt_eid, rmt_eid->addr, rmt_eid->type);
lisp_eid_put_vat (mp->lcl_eid, lcl_eid->addr, lcl_eid->type);
mp->eid_type = rmt_eid->type;
+ mp->dp_table = clib_host_to_net_u32 (dp_table);
+ mp->vni = clib_host_to_net_u32 (vni);
mp->rmt_len = rmt_eid->len;
mp->lcl_len = lcl_eid->len;
mp->action = action;
if (0 != rmt_locs && 0 != lcl_locs)
{
- mp->loc_num = vec_len (rmt_locs);
- clib_memcpy (mp->lcl_locs, lcl_locs,
- (sizeof (rloc_t) * vec_len (lcl_locs)));
- clib_memcpy (mp->rmt_locs, rmt_locs,
- (sizeof (rloc_t) * vec_len (rmt_locs)));
+ mp->loc_num = clib_host_to_net_u32 (vec_len (rmt_locs) * 2);
+ clib_memcpy (mp->locs, lcl_locs,
+ (sizeof (vl_api_lisp_gpe_locator_t) * vec_len (lcl_locs)));
+
+ u32 offset = sizeof (vl_api_lisp_gpe_locator_t) * vec_len (lcl_locs);
+ clib_memcpy (((u8 *) mp->locs) + offset, rmt_locs,
+ (sizeof (vl_api_lisp_gpe_locator_t) * vec_len (rmt_locs)));
}
vec_free (lcl_locs);
vec_free (rmt_locs);
return 0;
}
-static int
-api_lisp_gpe_tunnel_dump (vat_main_t * vam)
-{
- vl_api_lisp_gpe_tunnel_dump_t *mp;
- f64 timeout = ~0;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=20s%=30s%=16s%=16s%=16s%=16s"
- "%=16s%=16s%=16s%=16s%=16s",
- "Tunel", "Source", "Destination", "Fib encap", "Fib decap",
- "Decap next", "Lisp version", "Flags", "Next protocol",
- "ver_res", "res", "iid");
- }
-
- M (LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump);
- /* send it... */
- S;
-
- /* Use a control ping for synchronization */
- {
- vl_api_control_ping_t *mp;
- M (CONTROL_PING, control_ping);
- S;
- }
- /* Wait for a reply... */
- W;
-
- /* NOTREACHED */
- return 0;
-}
-
static int
api_lisp_adjacencies_get (vat_main_t * vam)
{
"<intfc> | sw_if_index <id> bd_id <bridge-domain-id>\n" \
"[shg <split-horizon-group>] [bvi]\n" \
"enable | disable") \
-_(sw_interface_set_dpdk_hqos_pipe, \
- "rx <intfc> | sw_if_index <id> subport <subport-id> pipe <pipe-id>\n" \
- "profile <profile-id>\n") \
-_(sw_interface_set_dpdk_hqos_subport, \
- "rx <intfc> | sw_if_index <id> subport <subport-id> [rate <n>]\n" \
- "[bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] [period <n>]\n") \
-_(sw_interface_set_dpdk_hqos_tctbl, \
- "rx <intfc> | sw_if_index <id> entry <n> tc <n> queue <n>\n") \
_(bridge_domain_add_del, \
"bd_id <bridge-domain-id> [flood 1|0] [uu-flood 1|0] [forward 1|0] [learn 1|0] [arp-term 1|0] [del]\n") \
_(bridge_domain_dump, "[bd_id <bridge-domain-id>]\n") \
"<ipv4|ipv6>/<prefix> | <L2 address> " \
"locator-set <locator_name> [del]" \
"[key-id sha1|sha256 secret-key <secret-key>]") \
-_(lisp_gpe_add_del_fwd_entry, "rmt_eid <eid> [lcl_eid <eid>] vni <vni>" \
- "dp_table <table> loc-pair <lcl_loc> <rmt_loc> ... [del]") \
+_(lisp_gpe_add_del_fwd_entry, "reid <eid> [leid <eid>] vni <vni>" \
+ "vrf/bd <dp_table> loc-pair <lcl_loc> <rmt_loc> w <weight>... [del]") \
_(lisp_add_del_map_resolver, "<ip4|6-addr> [del]") \
_(lisp_add_del_map_server, "<ip4|6-addr> [del]") \
_(lisp_gpe_enable_disable, "enable|disable") \
"[local] | [remote]") \
_(lisp_eid_table_vni_dump, "") \
_(lisp_eid_table_map_dump, "l2|l3") \
-_(lisp_gpe_tunnel_dump, "") \
_(lisp_map_resolver_dump, "") \
_(lisp_map_server_dump, "") \
_(lisp_adjacencies_get, "vni <vni>") \
_(ip_neighbor_dump, "[ip6] <intfc> | sw_if_index <nn>") \
_(sw_interface_get_table, "<intfc> | sw_if_index <id> [ipv6]")
+#if DPDK > 0
+#define foreach_vpe_dpdk_api_msg \
+_(sw_interface_set_dpdk_hqos_pipe, \
+ "rx <intfc> | sw_if_index <id> subport <subport-id> pipe <pipe-id>\n" \
+ "profile <profile-id>\n") \
+_(sw_interface_set_dpdk_hqos_subport, \
+ "rx <intfc> | sw_if_index <id> subport <subport-id> [rate <n>]\n" \
+ "[bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] [period <n>]\n") \
+_(sw_interface_set_dpdk_hqos_tctbl, \
+ "rx <intfc> | sw_if_index <id> entry <n> tc <n> queue <n>\n")
+#endif
+
/* List of command functions, CLI names map directly to functions */
#define foreach_cli_function \
_(comment, "usage: comment <ignore-rest-of-line>") \
foreach_vpe_api_reply_msg;
#undef _
+#if DPDK > 0
+#define _(N,n) \
+ static void vl_api_##n##_t_handler_uni \
+ (vl_api_##n##_t * mp) \
+ { \
+ vat_main_t * vam = &vat_main; \
+ if (vam->json_output) { \
+ vl_api_##n##_t_handler_json(mp); \
+ } else { \
+ vl_api_##n##_t_handler(mp); \
+ } \
+ }
+foreach_vpe_dpdk_api_reply_msg;
+#undef _
+#endif
+
void
vat_api_hookup (vat_main_t * vam)
{
foreach_vpe_api_reply_msg;
#undef _
+#if DPDK > 0
+#define _(N,n) \
+ vl_msg_api_set_handlers(VL_API_##N, #n, \
+ vl_api_##n##_t_handler_uni, \
+ vl_noop_handler, \
+ vl_api_##n##_t_endian, \
+ vl_api_##n##_t_print, \
+ sizeof(vl_api_##n##_t), 1);
+ foreach_vpe_dpdk_api_reply_msg;
+#undef _
+#endif
+
#if (VPP_API_TEST_BUILTIN==0)
vl_msg_api_set_first_available_msg_id (VL_MSG_FIRST_AVAILABLE);
#endif
#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
foreach_vpe_api_msg;
#undef _
+#if DPDK >0
+#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
+ foreach_vpe_dpdk_api_msg;
+#undef _
+#endif
/* Help strings */
#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
foreach_vpe_api_msg;
#undef _
+#if DPDK >0
+#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
+ foreach_vpe_dpdk_api_msg;
+#undef _
+#endif
/* CLI functions */
#define _(n,h) hash_set_mem (vam->function_by_name, #n, n);