aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/buffer.h10
-rw-r--r--vnet/vnet/interface.c39
-rw-r--r--vnet/vnet/interface.h26
-rw-r--r--vnet/vnet/interface_funcs.h5
-rw-r--r--vnet/vnet/interface_output.c124
-rw-r--r--vnet/vnet/ipsec-gre/ipsec_gre.c6
-rw-r--r--vnet/vnet/ipsec/esp_decrypt.c4
-rw-r--r--vnet/vnet/ipsec/esp_encrypt.c4
-rw-r--r--vnet/vnet/ipsec/ipsec_if_in.c5
-rw-r--r--vnet/vnet/ipsec/ipsec_if_out.c3
-rw-r--r--vnet/vnet/ipsec/ipsec_input.c10
-rw-r--r--vnet/vnet/ipsec/ipsec_output.c3
12 files changed, 44 insertions, 195 deletions
diff --git a/vnet/vnet/buffer.h b/vnet/vnet/buffer.h
index fafb3181..d93c5011 100644
--- a/vnet/vnet/buffer.h
+++ b/vnet/vnet/buffer.h
@@ -78,7 +78,7 @@ _(gre) \
_(l2_classify) \
_(handoff) \
_(policer) \
-_(output_features) \
+_(ipsec) \
_(map) \
_(map_t) \
_(ip_frag)
@@ -203,11 +203,9 @@ typedef struct
/* 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
diff --git a/vnet/vnet/interface.c b/vnet/vnet/interface.c
index b57c1e8a..97855d53 100644
--- a/vnet/vnet/interface.c
+++ b/vnet/vnet/interface.c
@@ -818,14 +818,9 @@ vnet_register_interface (vnet_main_t * vnm,
}
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);
@@ -1212,34 +1207,6 @@ vnet_interface_name_renumber (u32 sw_if_index, u32 new_show_dev_instance)
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)
{
diff --git a/vnet/vnet/interface.h b/vnet/vnet/interface.h
index 1f5dcf16..4d7af374 100644
--- a/vnet/vnet/interface.h
+++ b/vnet/vnet/interface.h
@@ -511,8 +511,6 @@ typedef struct
u32 link_speed;
- u32 output_feature_bitmap;
-
union
{
/* VNET_SW_INTERFACE_TYPE_HARDWARE. */
@@ -607,30 +605,6 @@ void vnet_pcap_drop_trace_filter_add_del (u32 error_index, int is_add);
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 */
/*
diff --git a/vnet/vnet/interface_funcs.h b/vnet/vnet/interface_funcs.h
index 424e1764..076e62ec 100644
--- a/vnet/vnet/interface_funcs.h
+++ b/vnet/vnet/interface_funcs.h
@@ -230,10 +230,7 @@ word vnet_hw_interface_compare (vnet_main_t * vnm, uword hw_if_index0,
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;
diff --git a/vnet/vnet/interface_output.c b/vnet/vnet/interface_output.c
index 173bb75c..1d1546f6 100644
--- a/vnet/vnet/interface_output.c
+++ b/vnet/vnet/interface_output.c
@@ -400,11 +400,10 @@ vnet_interface_output_node (vlib_main_t * vm,
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;
@@ -469,7 +468,6 @@ vnet_interface_output_node_no_flatten_inline (vlib_main_t * vm,
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);
@@ -498,60 +496,25 @@ vnet_interface_output_node_no_flatten_inline (vlib_main_t * vm,
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)
@@ -577,31 +540,13 @@ vnet_interface_output_node_no_flatten_inline (vlib_main_t * vm,
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);
}
}
@@ -616,31 +561,6 @@ vnet_interface_output_node_no_flatten_inline (vlib_main_t * vm,
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);
diff --git a/vnet/vnet/ipsec-gre/ipsec_gre.c b/vnet/vnet/ipsec-gre/ipsec_gre.c
index 9fd8a304..a0b065ac 100644
--- a/vnet/vnet/ipsec-gre/ipsec_gre.c
+++ b/vnet/vnet/ipsec-gre/ipsec_gre.c
@@ -211,8 +211,8 @@ ipsec_gre_interface_tx (vlib_main_t * vm,
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;
@@ -288,7 +288,7 @@ ipsec_gre_interface_tx (vlib_main_t * vm,
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;
diff --git a/vnet/vnet/ipsec/esp_decrypt.c b/vnet/vnet/ipsec/esp_decrypt.c
index df9ec929..07a5edac 100644
--- a/vnet/vnet/ipsec/esp_decrypt.c
+++ b/vnet/vnet/ipsec/esp_decrypt.c
@@ -284,7 +284,7 @@ esp_decrypt_node_fn (vlib_main_t * vm,
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);
@@ -483,7 +483,7 @@ esp_decrypt_node_fn (vlib_main_t * vm,
/* 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;
diff --git a/vnet/vnet/ipsec/esp_encrypt.c b/vnet/vnet/ipsec/esp_encrypt.c
index ba7579de..7d05da0d 100644
--- a/vnet/vnet/ipsec/esp_encrypt.c
+++ b/vnet/vnet/ipsec/esp_encrypt.c
@@ -191,7 +191,7 @@ esp_encrypt_node_fn (vlib_main_t * vm,
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)))
@@ -314,8 +314,6 @@ esp_encrypt_node_fn (vlib_main_t * vm,
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);
}
diff --git a/vnet/vnet/ipsec/ipsec_if_in.c b/vnet/vnet/ipsec/ipsec_if_in.c
index 07d4bf30..93cedce2 100644
--- a/vnet/vnet/ipsec/ipsec_if_in.c
+++ b/vnet/vnet/ipsec/ipsec_if_in.c
@@ -111,9 +111,8 @@ ipsec_if_input_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
{
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;
diff --git a/vnet/vnet/ipsec/ipsec_if_out.c b/vnet/vnet/ipsec/ipsec_if_out.c
index 8b827959..a605874e 100644
--- a/vnet/vnet/ipsec/ipsec_if_out.c
+++ b/vnet/vnet/ipsec/ipsec_if_out.c
@@ -100,8 +100,7 @@ ipsec_if_output_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
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))
diff --git a/vnet/vnet/ipsec/ipsec_input.c b/vnet/vnet/ipsec/ipsec_input.c
index 809fe6da..8360a1d5 100644
--- a/vnet/vnet/ipsec/ipsec_input.c
+++ b/vnet/vnet/ipsec/ipsec_input.c
@@ -254,9 +254,8 @@ ipsec_input_ip4_node_fn (vlib_main_t * vm,
{
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;
@@ -385,9 +384,8 @@ VLIB_NODE_FUNCTION_MULTIARCH (ipsec_input_ip4_node, ipsec_input_ip4_node_fn)
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;
diff --git a/vnet/vnet/ipsec/ipsec_output.c b/vnet/vnet/ipsec/ipsec_output.c
index 49214d36..3810520d 100644
--- a/vnet/vnet/ipsec/ipsec_output.c
+++ b/vnet/vnet/ipsec/ipsec_output.c
@@ -286,8 +286,7 @@ ipsec_output_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
{
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)