_(l2_classify) \
_(handoff) \
_(policer) \
-_(output_features) \
+_(ipsec) \
_(map) \
_(map_t) \
_(ip_frag)
/* interface output features */
struct
{
- u32 ipsec_flags;
- u32 ipsec_sad_index;
- u32 unused[3];
- u32 bitmap;
- } output_features;
+ u32 flags;
+ u32 sad_index;
+ } ipsec;
/* vcgn udp inside input, only valid there */
struct
}
hw->output_node_index = vlib_register_node (vm, &r);
-#define _(sym,str) vlib_node_add_named_next_with_slot (vm, \
- hw->output_node_index, str, \
- VNET_INTERFACE_OUTPUT_NEXT_##sym);
- foreach_intf_output_feat
-#undef _
- vlib_node_add_named_next_with_slot (vm, hw->output_node_index,
- "error-drop",
- VNET_INTERFACE_OUTPUT_NEXT_DROP);
+ vlib_node_add_named_next_with_slot (vm, hw->output_node_index,
+ "error-drop",
+ VNET_INTERFACE_OUTPUT_NEXT_DROP);
vlib_node_add_next_with_slot (vm, hw->output_node_index,
hw->tx_node_index,
VNET_INTERFACE_OUTPUT_NEXT_TX);
return rv;
}
-int
-vnet_interface_add_del_feature (vnet_main_t * vnm,
- vlib_main_t * vm,
- u32 sw_if_index,
- intf_output_feat_t feature, int is_add)
-{
- vnet_sw_interface_t *sw;
-
- sw = vnet_get_sw_interface (vnm, sw_if_index);
-
- if (is_add)
- {
-
- sw->output_feature_bitmap |= (1 << feature);
- sw->output_feature_bitmap |= (1 << INTF_OUTPUT_FEAT_DONE);
-
- }
- else
- { /* delete */
-
- sw->output_feature_bitmap &= ~(1 << feature);
- if (sw->output_feature_bitmap == (1 << INTF_OUTPUT_FEAT_DONE))
- sw->output_feature_bitmap = 0;
-
- }
- return 0;
-}
-
clib_error_t *
vnet_rename_interface (vnet_main_t * vnm, u32 hw_if_index, char *new_name)
{
u32 link_speed;
- u32 output_feature_bitmap;
-
union
{
/* VNET_SW_INTERFACE_TYPE_HARDWARE. */
int vnet_interface_name_renumber (u32 sw_if_index, u32 new_show_dev_instance);
-
-/*
- * Output features
- */
-
-#define foreach_intf_output_feat \
- _(IPSEC, "ipsec-output")
-
-/* Feature bitmap positions */
-typedef enum
-{
-#define _(sym,str) INTF_OUTPUT_FEAT_##sym,
- foreach_intf_output_feat
-#undef _
- INTF_OUTPUT_N_FEAT,
-} intf_output_feat_t;
-
-/* flag that we are done with feature path */
-#define INTF_OUTPUT_FEAT_DONE INTF_OUTPUT_N_FEAT
-
-int vnet_interface_add_del_feature (struct vnet_main_t *vnm, vlib_main_t * vm,
- u32 sw_if_index,
- intf_output_feat_t feature, int is_add);
-
#endif /* included_vnet_interface_h */
/*
typedef enum
{
-#define _(sym,str) VNET_INTERFACE_OUTPUT_NEXT_##sym,
- foreach_intf_output_feat
-#undef _
- VNET_INTERFACE_OUTPUT_NEXT_DROP,
+ VNET_INTERFACE_OUTPUT_NEXT_DROP,
VNET_INTERFACE_OUTPUT_NEXT_TX,
} vnet_interface_output_next_t;
VLIB_NODE_FUNCTION_MULTIARCH_CLONE (vnet_interface_output_node);
CLIB_MULTIARCH_SELECT_FN (vnet_interface_output_node);
-always_inline uword
-vnet_interface_output_node_no_flatten_inline (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame,
- int with_features)
+uword
+vnet_interface_output_node_no_flatten (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
vnet_main_t *vnm = vnet_get_main ();
vnet_interface_output_runtime_t *rt = (void *) node->runtime_data;
u32 bi0, bi1;
vlib_buffer_t *b0, *b1;
u32 tx_swif0, tx_swif1;
- u32 next0, next1;
/* Prefetch next iteration. */
vlib_prefetch_buffer_with_index (vm, from[2], LOAD);
n_bytes += n_bytes_b0 + n_bytes_b1;
n_packets += 2;
- if (with_features)
- {
- b0->flags |= BUFFER_OUTPUT_FEAT_DONE;
- vnet_buffer (b0)->output_features.bitmap =
- si->output_feature_bitmap;
- count_trailing_zeros (next0,
- vnet_buffer (b0)->output_features.bitmap);
- vnet_buffer (b0)->output_features.bitmap &= ~(1 << next0);
- }
- else
- {
- next0 = VNET_INTERFACE_OUTPUT_NEXT_TX;
- vnet_buffer (b0)->output_features.bitmap = 0;
- if (PREDICT_FALSE (tx_swif0 != rt->sw_if_index))
- {
- /* update vlan subif tx counts, if required */
- vlib_increment_combined_counter (im->combined_sw_if_counters
- +
- VNET_INTERFACE_COUNTER_TX,
- cpu_index, tx_swif0, 1,
- n_bytes_b0);
- }
- }
-
- if (with_features)
+ if (PREDICT_FALSE (tx_swif0 != rt->sw_if_index))
{
- b1->flags |= BUFFER_OUTPUT_FEAT_DONE;
- vnet_buffer (b1)->output_features.bitmap =
- si->output_feature_bitmap;
- count_trailing_zeros (next1,
- vnet_buffer (b1)->output_features.bitmap);
- vnet_buffer (b1)->output_features.bitmap &= ~(1 << next1);
+ /* update vlan subif tx counts, if required */
+ vlib_increment_combined_counter (im->combined_sw_if_counters +
+ VNET_INTERFACE_COUNTER_TX,
+ cpu_index, tx_swif0, 1,
+ n_bytes_b0);
}
- else
- {
- next1 = VNET_INTERFACE_OUTPUT_NEXT_TX;
- vnet_buffer (b1)->output_features.bitmap = 0;
- /* update vlan subif tx counts, if required */
- if (PREDICT_FALSE (tx_swif1 != rt->sw_if_index))
- {
+ /* update vlan subif tx counts, if required */
+ if (PREDICT_FALSE (tx_swif1 != rt->sw_if_index))
+ {
- vlib_increment_combined_counter (im->combined_sw_if_counters
- +
- VNET_INTERFACE_COUNTER_TX,
- cpu_index, tx_swif1, 1,
- n_bytes_b1);
- }
+ vlib_increment_combined_counter (im->combined_sw_if_counters +
+ VNET_INTERFACE_COUNTER_TX,
+ cpu_index, tx_swif1, 1,
+ n_bytes_b1);
}
- if (with_features)
- vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_tx,
- n_left_to_tx, bi0, bi1, next0,
- next1);
}
while (from + 1 <= from_end && n_left_to_tx >= 1)
n_bytes += n_bytes_b0;
n_packets += 1;
- if (with_features)
+ if (PREDICT_FALSE (tx_swif0 != rt->sw_if_index))
{
- u32 next0;
- b0->flags |= BUFFER_OUTPUT_FEAT_DONE;
- vnet_buffer (b0)->output_features.bitmap =
- si->output_feature_bitmap;
- count_trailing_zeros (next0,
- vnet_buffer (b0)->output_features.bitmap);
- vnet_buffer (b0)->output_features.bitmap &= ~(1 << next0);
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_tx,
- n_left_to_tx, bi0, next0);
- }
- else
- {
- vnet_buffer (b0)->output_features.bitmap = 0;
-
- if (PREDICT_FALSE (tx_swif0 != rt->sw_if_index))
- {
- vlib_increment_combined_counter (im->combined_sw_if_counters
- +
- VNET_INTERFACE_COUNTER_TX,
- cpu_index, tx_swif0, 1,
- n_bytes_b0);
- }
+ vlib_increment_combined_counter (im->combined_sw_if_counters +
+ VNET_INTERFACE_COUNTER_TX,
+ cpu_index, tx_swif0, 1,
+ n_bytes_b0);
}
}
return n_buffers;
}
-uword
-vnet_interface_output_node_no_flatten (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- vnet_main_t *vnm = vnet_get_main ();
- vnet_interface_output_runtime_t *rt = (void *) node->runtime_data;
- vnet_sw_interface_t *si;
- si = vnet_get_sw_interface (vnm, rt->sw_if_index);
-
- if (PREDICT_FALSE (si->output_feature_bitmap))
- {
- /* if first pakcet in the frame have BUFFER_OUTPUT_FEAT_DONE flag set
- then whole frame is arriving from feature node */
-
- u32 *from = vlib_frame_args (frame);
- vlib_buffer_t *b = vlib_get_buffer (vm, from[0]);
-
- if ((b->flags & BUFFER_OUTPUT_FEAT_DONE) == 0)
- return vnet_interface_output_node_no_flatten_inline (vm, node, frame,
- 1);
- }
- return vnet_interface_output_node_no_flatten_inline (vm, node, frame, 0);
-}
-
VLIB_NODE_FUNCTION_MULTIARCH_CLONE (vnet_interface_output_node_no_flatten);
CLIB_MULTIARCH_SELECT_FN (vnet_interface_output_node_no_flatten);
vnet_buffer (b1)->sw_if_index[VLIB_RX] =
vnet_buffer (b1)->sw_if_index[VLIB_TX];
- vnet_buffer (b0)->output_features.ipsec_sad_index = t->local_sa;
- vnet_buffer (b1)->output_features.ipsec_sad_index = t->local_sa;
+ vnet_buffer (b0)->ipsec.sad_index = t->local_sa;
+ vnet_buffer (b1)->ipsec.sad_index = t->local_sa;
vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
vnet_buffer (b1)->sw_if_index[VLIB_TX] = (u32) ~ 0;
vnet_buffer (b0)->sw_if_index[VLIB_RX] =
vnet_buffer (b0)->sw_if_index[VLIB_TX];
- vnet_buffer (b0)->output_features.ipsec_sad_index = t->local_sa;
+ vnet_buffer (b0)->ipsec.sad_index = t->local_sa;
vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
next0 = IPSEC_GRE_OUTPUT_NEXT_ESP_ENCRYPT;
i_b0 = vlib_get_buffer (vm, i_bi0);
esp0 = vlib_buffer_get_current (i_b0);
- sa_index0 = vnet_buffer (i_b0)->output_features.ipsec_sad_index;
+ sa_index0 = vnet_buffer (i_b0)->ipsec.sad_index;
sa0 = pool_elt_at_index (im->sad, sa_index0);
seq = clib_host_to_net_u32 (esp0->seq);
/* for IPSec-GRE tunnel next node is ipsec-gre-input */
if (PREDICT_FALSE
- ((vnet_buffer (i_b0)->output_features.ipsec_flags) &
+ ((vnet_buffer (i_b0)->ipsec.flags) &
IPSEC_FLAG_IPSEC_GRE_TUNNEL))
next0 = ESP_DECRYPT_NEXT_IPSEC_GRE_INPUT;
next0 = ESP_ENCRYPT_NEXT_DROP;
i_b0 = vlib_get_buffer (vm, i_bi0);
- sa_index0 = vnet_buffer (i_b0)->output_features.ipsec_sad_index;
+ sa_index0 = vnet_buffer (i_b0)->ipsec.sad_index;
sa0 = pool_elt_at_index (im->sad, sa_index0);
if (PREDICT_FALSE (esp_seq_advance (sa0)))
o_b0->flags |= BUFFER_OUTPUT_FEAT_DONE;
vnet_buffer (o_b0)->sw_if_index[VLIB_TX] =
vnet_buffer (i_b0)->sw_if_index[VLIB_TX];
- vnet_buffer (o_b0)->output_features.bitmap =
- vnet_buffer (i_b0)->output_features.bitmap;
}
vlib_buffer_advance (i_b0, ip_hdr_size);
}
{
ipsec_tunnel_if_t *t;
t = pool_elt_at_index (im->tunnel_interfaces, p[0]);
- vnet_buffer (b0)->output_features.ipsec_sad_index =
- t->input_sa_index;
- vnet_buffer (b0)->output_features.ipsec_flags =
+ vnet_buffer (b0)->ipsec.sad_index = t->input_sa_index;
+ vnet_buffer (b0)->ipsec.flags =
t->hw_if_index == ~0 ? IPSEC_FLAG_IPSEC_GRE_TUNNEL : 0;
vlib_buffer_advance (b0, ip4_header_bytes (ip0));
next0 = IPSEC_IF_INPUT_NEXT_ESP_DECRYPT;
sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
t0 = pool_elt_at_index (im->tunnel_interfaces, hi0->dev_instance);
- vnet_buffer (b0)->output_features.ipsec_sad_index =
- t0->output_sa_index;
+ vnet_buffer (b0)->ipsec.sad_index = t0->output_sa_index;
next0 = IPSEC_IF_OUTPUT_NEXT_ESP_ENCRYPT;
if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
{
p0->counter.packets++;
p0->counter.bytes += clib_net_to_host_u16 (ip0->length);
- vnet_buffer (b0)->output_features.ipsec_sad_index =
- p0->sa_index;
- vnet_buffer (b0)->output_features.ipsec_flags = 0;
+ vnet_buffer (b0)->ipsec.sad_index = p0->sa_index;
+ vnet_buffer (b0)->ipsec.flags = 0;
next0 = IPSEC_INPUT_NEXT_ESP_DECRYPT;
vlib_buffer_advance (b0, ip4_header_bytes (ip0));
goto trace0;
p0->counter.bytes +=
clib_net_to_host_u16 (ip0->payload_length);
p0->counter.bytes += header_size;
- vnet_buffer (b0)->output_features.ipsec_sad_index =
- p0->sa_index;
- vnet_buffer (b0)->output_features.ipsec_flags = 0;
+ vnet_buffer (b0)->ipsec.sad_index = p0->sa_index;
+ vnet_buffer (b0)->ipsec.flags = 0;
next0 = IPSEC_INPUT_NEXT_ESP_DECRYPT;
vlib_buffer_advance (b0, header_size);
goto trace0;
{
nc_protect++;
next_node_index = im->esp_encrypt_node_index;
- vnet_buffer (b0)->output_features.ipsec_sad_index =
- p0->sa_index;
+ vnet_buffer (b0)->ipsec.sad_index = p0->sa_index;
vlib_buffer_advance (b0, iph_offset);
p0->counter.packets++;
if (is_ipv6)