summaryrefslogtreecommitdiffstats
path: root/src/vlibapi
AgeCommit message (Expand)AuthorFilesLines
2019-06-14api: add mp-safe/barrier-sync indication to elogsDave Barach1-6/+17
2019-06-12infra: fix minor memory leak in "api trace..."Dave Barach1-1/+3
2019-03-25add api trace printezkexma1-1/+16
2019-03-15Revert "API: Cleanup APIs interface.api"Ole Trøan1-3/+1
2019-03-15API: Cleanup APIs interface.apiJakub Grajciar1-1/+3
2019-01-24perfmon plugin: 2-way parallel stat collectionDave Barach1-9/+2
2019-01-14api_helper_macro mp->pid is network endianOle Troan1-1/+1
2018-12-18VAPI/VOM: Removing legacy stats tests, add string type.Ole Troan1-4/+6
2018-12-17String type: Not include \0 in show_versionOle Troan1-0/+6
2018-12-14String type: Fix off by one errorOle Troan1-3/+2
2018-12-13API: Use string type instead of u8.Ole Troan3-0/+56
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach1-1/+1
2018-10-23c11 safe string handling supportDave Barach3-7/+7
2018-10-22X86_64 perf counter pluginDave Barach1-2/+9
2018-10-02PAPI: Use UNIX domain sockets instead of shared memoryOle Troan1-1/+1
2018-10-01API / CLI event-log tracingDave Barach1-45/+38
2018-09-07cmake: set packaging component for different filesDamjan Marion1-0/+2
2018-08-26cmake: add add_vpp_library and add_vpp_executable macrosDamjan Marion1-1/+5
2018-08-25cmake: add more headers to the install listDamjan Marion1-0/+19
2018-08-03svm: add support for eventfd signaling to queueFlorin Coras1-3/+0
2018-07-09IGMP improvementsNeale Ranns1-2/+2
2018-06-21Implement DHCPv6 IA NA client (VPP-1094)Juraj Sloboda1-1/+2
2018-06-14Fix SEGV in generic event sub reaperMatthew Smith1-1/+1
2018-06-13Stat segment / client: show run" works nowDave Barach2-2/+3
2018-06-08Add reaper functions to want events APIs (VPP-1304)Neale Ranns1-1/+19
2018-06-08Implement DHCPv6 PD client (VPP-718, VPP-1050)Juraj Sloboda1-1/+2
2018-06-05VPP API: Memory traceOle Troan2-0/+19
2018-03-16IPv6 ND Router discovery data plane (VPP-1095)Juraj Sloboda1-1/+2
2018-01-25session: add support for memfd segmentsFlorin Coras1-0/+1
2018-01-22svm: queue sub: Add conditional timed waitMohsin Kazmi1-1/+1
2018-01-09api: refactor vlibmemoryFlorin Coras6-303/+38
2018-01-05sock api: add infra for bootstrapping shm clientsFlorin Coras1-44/+20
2017-10-13VPP-1027: DNS name resolverDave Barach1-1/+16
2017-10-10API versioning: Fix coverity errors from strncpy()Ole Troan1-1/+1
2017-10-09vppapigen: support per-file (major,minor,patch) version stampsDave Barach3-0/+22
2017-10-06Coverity fixes for API socketChris Luke1-5/+7
2017-10-05Clean up "show api ring" debug CLIDave Barach1-1/+4
2017-10-03Repair vlib API socket serverDave Barach3-98/+167
2017-09-28General documentation updatesChris Luke1-37/+40
2017-09-27VPP-990 remove registered handler if control ping failsv18.01-rc0Matej Perina2-0/+13
2017-09-25Add binary API documentationDave Barach2-70/+471
2017-09-22IP-MAC,ND:wildcard events,fix sending multiple eventsEyal Bari1-0/+1
2017-09-20Improve API message handler re-registration checkDave Barach1-3/+5
2017-09-18L2BD,ARP-TERM:fix arp query report mechanism+testEyal Bari1-1/+2
2017-09-13API message table inspection utilitiesDave Barach1-0/+3
2017-09-11Recombine diags and minimum barrier open time changes (VPP-968)Colin Tregenza Dancer2-2/+14
2017-09-09move unix_file_* code to vppinfraDamjan Marion1-1/+1
2017-09-07Allow individual stats API and introduce stats.apiKeith Burns (alagalah)1-1/+0
2017-07-01Refactor API message handling codeKlement Sekera2-255/+293
2017-06-01Improve fifo allocator performanceDave Barach1-0/+3
n class="mi">0); ip6_sw_interface_enable_disable (sw_if_index, 0); } } static clib_error_t * l2_emulation_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add) { if (is_add) { vec_validate_init_empty (l2_emulations, sw_if_index, ezero); } return (NULL); } VNET_SW_INTERFACE_ADD_DEL_FUNCTION (l2_emulation_interface_add_del); static clib_error_t * l2_emulation_cli (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { vnet_main_t *vnm = vnet_get_main (); u32 sw_if_index = ~0; u8 enable = 1; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index)) ; else if (unformat (input, "enable")) enable = 1; else if (unformat (input, "disable")) enable = 0; else break; } if (~0 == sw_if_index) return clib_error_return (0, "interface must be specified"); if (enable) l2_emulation_enable (sw_if_index); else l2_emulation_disable (sw_if_index); return (NULL); } /*? * Configure l2 emulation. * When the interface is in L2 mode, configure the extraction of L3 * packets out of the L2 path and into the L3 path. * * @cliexpar * @cliexstart{set interface l2 input l2-emulation <interface-name> [disable]} * @cliexend ?*/ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (l2_emulation_cli_node, static) = { .path = "set interface l2 l2-emulation", .short_help = "set interface l2 l2-emulation <interface-name> [disable|enable]\n", .function = l2_emulation_cli, }; /* *INDENT-ON* */ static clib_error_t * l2_emulation_show (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { vnet_main_t *vnm = vnet_get_main (); l2_emulation_t *l23e; u32 sw_if_index; vec_foreach_index (sw_if_index, l2_emulations) { l23e = &l2_emulations[sw_if_index]; if (l23e->enabled) { vlib_cli_output (vm, "%U\n", format_vnet_sw_if_index_name, vnm, sw_if_index); } } return (NULL); } /*? * Show l2 emulation. * When the interface is in L2 mode, configure the extraction of L3 * packets out of the L2 path and into the L3 path. * * @cliexpar * @cliexstart{show interface l2 l2-emulation} * @cliexend ?*/ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (l2_emulation_show_node, static) = { .path = "show interface l2 l2-emulation", .short_help = "show interface l2 l2-emulation\n", .function = l2_emulation_show, }; /* *INDENT-ON* */ #define foreach_l2_emulation \ _(IP4, "Extract IPv4") \ _(IP6, "Extract IPv6") typedef enum { #define _(sym,str) L2_EMULATION_ERROR_##sym, foreach_l2_emulation #undef _ L2_EMULATION_N_ERROR, } l2_emulation_error_t; static char *l2_emulation_error_strings[] = { #define _(sym,string) string, foreach_l2_emulation #undef _ }; typedef enum { #define _(sym,str) L2_EMULATION_NEXT_##sym, foreach_l2_emulation #undef _ L2_EMULATION_N_NEXT, } l2_emulation_next_t; /** * per-packet trace data */ typedef struct l2_emulation_trace_t_ { /* per-pkt trace data */ u8 extracted; } l2_emulation_trace_t; static uword l2_emulation_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { l2_emulation_main_t *em = &l2_emulation_main; u32 n_left_from, *from, *to_next; l2_emulation_next_t next_index; u32 ip4_hits = 0; u32 ip6_hits = 0; next_index = 0; n_left_from = frame->n_vectors; from = vlib_frame_vector_args (frame); while (n_left_from > 0) { u32 n_left_to_next; vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next); while (n_left_from >= 4 && n_left_to_next >= 2) { vlib_buffer_t *b0, *b1; u32 sw_if_index0, sw_if_index1; u16 ether_type0, ether_type1; u32 next0 = ~0, next1 = ~0; u8 l2_len0, l2_len1; u32 bi0, bi1; u8 *h0, *h1; bi0 = to_next[0] = from[0]; bi1 = to_next[1] = from[1]; from += 2; n_left_from -= 2; to_next += 2; n_left_to_next -= 2; b0 = vlib_get_buffer (vm, bi0); b1 = vlib_get_buffer (vm, bi1); l2_len0 = vnet_buffer (b0)->l2.l2_len; l2_len1 = vnet_buffer (b1)->l2.l2_len; h0 = vlib_buffer_get_current (b0); h1 = vlib_buffer_get_current (b1); ether_type0 = clib_net_to_host_u16 (*(u16 *) (h0 + l2_len0 - 2)); ether_type1 = clib_net_to_host_u16 (*(u16 *) (h1 + l2_len1 - 2)); sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_RX]; /* * only extract unicast */ if (PREDICT_TRUE (!(h0[0] & 0x1))) { switch (ether_type0) { case ETHERNET_TYPE_IP4: ASSERT (l2_emulations[sw_if_index0].enabled); ++ip4_hits; next0 = L2_EMULATION_NEXT_IP4; vlib_buffer_advance (b0, l2_len0); break; case ETHERNET_TYPE_IP6: ASSERT (l2_emulations[sw_if_index0].enabled); ++ip6_hits; next0 = L2_EMULATION_NEXT_IP6; vlib_buffer_advance (b0, l2_len0); default: break; } } if (PREDICT_TRUE (!(h1[0] & 0x1))) { switch (ether_type1) { case ETHERNET_TYPE_IP4: ASSERT (l2_emulations[sw_if_index1].enabled); ++ip4_hits; next1 = L2_EMULATION_NEXT_IP4; vlib_buffer_advance (b1, l2_len1); break; case ETHERNET_TYPE_IP6: ASSERT (l2_emulations[sw_if_index1].enabled); ++ip6_hits; next1 = L2_EMULATION_NEXT_IP6; vlib_buffer_advance (b1, l2_len1); default: break; } } if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && (b0->flags & VLIB_BUFFER_IS_TRACED))) { l2_emulation_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->extracted = (next0 != ~0); } if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && (b1->flags & VLIB_BUFFER_IS_TRACED))) { l2_emulation_trace_t *t = vlib_add_trace (vm, node, b1, sizeof (*t)); t->extracted = (next1 != ~0); } /* Determine the next node and remove ourself from bitmap */ if (PREDICT_TRUE (next0 == ~0)) next0 = vnet_l2_feature_next (b0, em->l2_input_feat_next, L2INPUT_FEAT_L2_EMULATION); /* Determine the next node and remove ourself from bitmap */ if (PREDICT_TRUE (next1 == ~0)) next1 = vnet_l2_feature_next (b1, em->l2_input_feat_next, L2INPUT_FEAT_L2_EMULATION); vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1); } while (n_left_from > 0 && n_left_to_next > 0) { vlib_buffer_t *b0; u32 sw_if_index0; u16 ether_type0; u32 next0 = ~0; u8 l2_len0; u32 bi0; u8 *h0; bi0 = from[0]; to_next[0] = bi0; from += 1; to_next += 1; n_left_from -= 1; n_left_to_next -= 1; b0 = vlib_get_buffer (vm, bi0); l2_len0 = vnet_buffer (b0)->l2.l2_len; h0 = vlib_buffer_get_current (b0); ether_type0 = clib_net_to_host_u16 (*(u16 *) (h0 + l2_len0 - 2)); sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; /* * only extract unicast */ if (PREDICT_TRUE (!(h0[0] & 0x1))) { switch (ether_type0) { case ETHERNET_TYPE_IP4: ASSERT (l2_emulations[sw_if_index0].enabled); ++ip4_hits; next0 = L2_EMULATION_NEXT_IP4; vlib_buffer_advance (b0, l2_len0); break; case ETHERNET_TYPE_IP6: ASSERT (l2_emulations[sw_if_index0].enabled); ++ip6_hits; next0 = L2_EMULATION_NEXT_IP6; vlib_buffer_advance (b0, l2_len0); default: break; } } if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && (b0->flags & VLIB_BUFFER_IS_TRACED))) { l2_emulation_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->extracted = (next0 != ~0); } /* Determine the next node and remove ourself from bitmap */ if (PREDICT_TRUE (next0 == ~0)) next0 = vnet_l2_feature_next (b0, em->l2_input_feat_next, L2INPUT_FEAT_L2_EMULATION); /* verify speculative enqueue, maybe switch current next frame */ vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next, n_left_to_next, bi0, next0); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } vlib_node_increment_counter (vm, node->node_index, L2_EMULATION_ERROR_IP4, ip4_hits); vlib_node_increment_counter (vm, node->node_index, L2_EMULATION_ERROR_IP6, ip6_hits); return frame->n_vectors; } /* packet trace format function */ static u8 * format_l2_emulation_trace (u8 * s, va_list * args) { CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); l2_emulation_trace_t *t = va_arg (*args, l2_emulation_trace_t *); s = format (s, "l2-emulation: %s", (t->extracted ? "yes" : "no")); return s; } /* *INDENT-OFF* */ VLIB_REGISTER_NODE (l2_emulation_node) = { .function = l2_emulation_node_fn, .name = "l2-emulation", .vector_size = sizeof (u32), .format_trace = format_l2_emulation_trace, .type = VLIB_NODE_TYPE_INTERNAL, .n_errors = ARRAY_LEN(l2_emulation_error_strings), .error_strings = l2_emulation_error_strings, .n_next_nodes = L2_EMULATION_N_NEXT, /* edit / add dispositions here */ .next_nodes = { [L2_EMULATION_NEXT_IP4] = "ip4-input", [L2_EMULATION_NEXT_IP6] = "ip6-input", }, }; /* *INDENT-ON* */ VLIB_NODE_FUNCTION_MULTIARCH (l2_emulation_node, l2_emulation_node_fn); static clib_error_t * l2_emulation_init (vlib_main_t * vm) { l2_emulation_main_t *em = &l2_emulation_main; /* Initialize the feature next-node indexes */ feat_bitmap_init_next_nodes (vm, l2_emulation_node.index, L2INPUT_N_FEAT, l2input_get_feat_names (), em->l2_input_feat_next); return 0; } VLIB_INIT_FUNCTION (l2_emulation_init); /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */