- while (n_left_from > 0)
- {
-
- vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
-
- while (n_left_from > 0 && n_left_to_next > 0)
- {
- vxlan_gbp_header_t *vxlan_gbp0;
- gbp_vxlan_input_next_t next0;
- gbp_vxlan_tunnel_t *gt0;
- vlib_buffer_t *b0;
- u32 bi0, vni0;
- uword *p;
-
- bi0 = to_next[0] = from[0];
- from += 1;
- to_next += 1;
- n_left_from -= 1;
- n_left_to_next -= 1;
- next0 = GBP_VXLAN_INPUT_NEXT_DROP;
-
- b0 = vlib_get_buffer (vm, bi0);
- vxlan_gbp0 =
- vlib_buffer_get_current (b0) - sizeof (vxlan_gbp_header_t);
-
- vni0 = vxlan_gbp_get_vni (vxlan_gbp0);
- p = hash_get (gv_db, vni0);
-
- if (PREDICT_FALSE (NULL == p))
- {
- gt0 = NULL;
- next0 = GBP_VXLAN_INPUT_NEXT_DROP;
- }
- else
- {
- gt0 = gbp_vxlan_tunnel_get (p[0]);
-
- vnet_buffer (b0)->sw_if_index[VLIB_RX] = gt0->gt_sw_if_index;
-
- if (GBP_VXLAN_TUN_L2 == gt0->gt_layer)
- /*
- * An L2 layer tunnel goes into the BD
- */
- next0 = GBP_VXLAN_INPUT_NEXT_L2_INPUT;
- else
- {
- /*
- * An L3 layer tunnel needs to strip the L2 header
- * an inject into the RD
- */
- ethernet_header_t *e0;
- u16 type0;
-
- e0 = vlib_buffer_get_current (b0);
- type0 = clib_net_to_host_u16 (e0->type);
- switch (type0)
- {
- case ETHERNET_TYPE_IP4:
- next0 = GBP_VXLAN_INPUT_NEXT_IP4_INPUT;
- break;
- case ETHERNET_TYPE_IP6:
- next0 = GBP_VXLAN_INPUT_NEXT_IP6_INPUT;
- break;
- default:
- goto trace;
- }
- vlib_buffer_advance (b0, sizeof (*e0));
- }
- }
-
- trace:
- if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
- {
- gbp_vxlan_trace_t *tr;
-
- tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
- tr->dropped = (next0 == GBP_VXLAN_INPUT_NEXT_DROP);
- tr->vni = vni0;
- tr->sw_if_index = (gt0 ? gt0->gt_sw_if_index : ~0);
- tr->flags = vxlan_gbp_get_gpflags (vxlan_gbp0);
- tr->sclass = vxlan_gbp_get_sclass (vxlan_gbp0);
- }
-
- 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);
- }
-
- return from_frame->n_vectors;