summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorShwetha <shwethab@cisco.com>2016-09-27 08:04:05 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2016-11-01 21:30:54 +0000
commit57fc854c0862a439daca4dde734553622851e92f (patch)
tree4d40c3aa32f2aa107aaa7b30be0647f848073d07 /vnet
parent8fe8cc21d1e389d8e971a303e53c9e703aaaa0e0 (diff)
VPP-437: ip6 hbh processing with FIB 2.0
1. Modifies ip6 hbh selective processing in lookup only when non-recursive routes are present. 2. Adds ip6 hbh processing in load balance. 3. Cleanup of ip6 iOAM hbh plugin formatting and CLI handling found while testing the changes. 4. Deleted wrong asserts in dual loop for add and pop iOAM hbh nodes. The current data of the buffer ip6 start and will not be 0 5. Deleted set ioam destination cli and associate functions. iOAM add/pop is enabled via classifier, this cli is no longer used. Change-Id: I3aac71ad512762c0b2b602fe88fe0291b85d39c7 Signed-off-by: Shwetha <shwethab@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/ip/ip6_forward.c45
-rw-r--r--vnet/vnet/ip/ip6_hop_by_hop.c134
2 files changed, 29 insertions, 150 deletions
diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c
index 2873e2bdaeb..4493cb4cff3 100644
--- a/vnet/vnet/ip/ip6_forward.c
+++ b/vnet/vnet/ip/ip6_forward.c
@@ -164,15 +164,16 @@ ip6_lookup_inline (vlib_main_t * vm,
next1 = dpo1->dpoi_next_node;
/* Only process the HBH Option Header if explicitly configured to do so */
- next0 = ((ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) &&
- im->hbh_enabled) ?
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP :
- next0;
- next1 = ((ip1->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) &&
- im->hbh_enabled) ?
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP :
- next1;
-
+ if (PREDICT_FALSE(ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS))
+ {
+ next0 = (dpo_is_adj(dpo0) && im->hbh_enabled) ?
+ (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP : next0;
+ }
+ if (PREDICT_FALSE(ip1->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS))
+ {
+ next1 = (dpo_is_adj(dpo1) && im->hbh_enabled) ?
+ (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP : next1;
+ }
vnet_buffer (p0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
vnet_buffer (p1)->ip.adj_index[VLIB_TX] = dpo1->dpoi_index;
@@ -271,12 +272,13 @@ ip6_lookup_inline (vlib_main_t * vm,
(vnet_buffer (p0)->ip.flow_hash &
lb0->lb_n_buckets_minus_1));
next0 = dpo0->dpoi_next_node;
- /* Only process the HBH Option Header if explicitly configured to do so */
- next0 = ((ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS) &&
- im->hbh_enabled) ?
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP :
- next0;
+ /* Only process the HBH Option Header if explicitly configured to do so */
+ if (PREDICT_FALSE(ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS))
+ {
+ next0 = (dpo_is_adj(dpo0) && im->hbh_enabled) ?
+ (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP : next0;
+ }
vnet_buffer (p0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
vlib_increment_combined_counter
@@ -785,6 +787,7 @@ ip6_load_balance (vlib_main_t * vm,
u32 n_left_from, n_left_to_next, * from, * to_next;
ip_lookup_next_t next;
u32 cpu_index = os_get_cpu_number();
+ ip6_main_t * im = &ip6_main;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -823,8 +826,13 @@ ip6_load_balance (vlib_main_t * vm,
dpo0 = load_balance_get_bucket_i(lb0,
vnet_buffer(p0)->ip.flow_hash &
(lb0->lb_n_buckets - 1));
-
next0 = dpo0->dpoi_next_node;
+ /* Only process the HBH Option Header if explicitly configured to do so */
+ if (PREDICT_FALSE(ip0->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS))
+ {
+ next0 = (dpo_is_adj(dpo0) && im->hbh_enabled) ?
+ (ip_lookup_next_t) IP6_LOOKUP_NEXT_HOP_BY_HOP : next0;
+ }
vnet_buffer (p0)->ip.adj_index[VLIB_TX] = dpo0->dpoi_index;
vlib_increment_combined_counter
@@ -2410,6 +2418,8 @@ ip6_hop_by_hop (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
b1 = vlib_get_buffer (vm, bi1);
+
+ /* Default use the next_index from the adjacency. A HBH option rarely redirects to a different node */
u32 adj_index0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
ip_adjacency_t *adj0 = ip_get_adjacency(lm, adj_index0);
u32 adj_index1 = vnet_buffer(b1)->ip.adj_index[VLIB_TX];
@@ -2505,9 +2515,12 @@ ip6_hop_by_hop (vlib_main_t * vm,
n_left_to_next -= 1;
b0 = vlib_get_buffer (vm, bi0);
+ /*
+ * Default use the next_index from the adjacency.
+ * A HBH option rarely redirects to a different node
+ */
u32 adj_index0 = vnet_buffer(b0)->ip.adj_index[VLIB_TX];
ip_adjacency_t *adj0 = ip_get_adjacency(lm, adj_index0);
- /* Default use the next_index from the adjacency. A HBH option rarely redirects to a different node */
next0 = adj0->lookup_next_index;
ip0 = vlib_buffer_get_current (b0);
diff --git a/vnet/vnet/ip/ip6_hop_by_hop.c b/vnet/vnet/ip/ip6_hop_by_hop.c
index 5769d7c3e6d..72490b915e4 100644
--- a/vnet/vnet/ip/ip6_hop_by_hop.c
+++ b/vnet/vnet/ip/ip6_hop_by_hop.c
@@ -191,9 +191,6 @@ ip6_add_hop_by_hop_node_fn (vlib_main_t * vm,
b1 = vlib_get_buffer (vm, bi1);
/* $$$$$ Dual loop: process 2 x packets here $$$$$ */
- ASSERT (b0->current_data == 0);
- ASSERT (b1->current_data == 0);
-
ip0 = vlib_buffer_get_current (b0);
ip1 = vlib_buffer_get_current (b1);
@@ -533,9 +530,6 @@ ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm,
b1 = vlib_get_buffer (vm, bi1);
/* $$$$$ Dual loop: process 2 x packets here $$$$$ */
- ASSERT (b0->current_data == 0);
- ASSERT (b1->current_data == 0);
-
ip0 = vlib_buffer_get_current (b0);
ip1 = vlib_buffer_get_current (b1);
adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
@@ -990,134 +984,6 @@ VLIB_CLI_COMMAND (ip6_show_ioam_run_cmd, static) = {
};
/* *INDENT-ON* */
-int
-ip6_ioam_set_destination (ip6_address_t * addr, u32 mask_width, u32 vrf_id,
- int is_add, int is_pop, int is_none)
-{
- ip6_main_t *im = &ip6_main;
- ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main;
- ip_lookup_main_t *lm = &im->lookup_main;
- ip_adjacency_t *adj;
- u32 fib_index;
- u32 adj_index;
-
- if ((is_add + is_pop + is_none) != 1)
- return VNET_API_ERROR_INVALID_VALUE_2;
-
- /* Go find the adjacency we're supposed to tickle */
- fib_index = ip6_fib_index_from_table_id (vrf_id);
-
- if (~0 == fib_index)
- return VNET_API_ERROR_NO_SUCH_FIB;
-
- adj_index = ip6_fib_table_fwding_lookup (im, fib_index, addr);
-
- ASSERT (!"Not an ADJ");
-
- /* Got it, modify as directed... */
- adj = ip_get_adjacency (lm, adj_index);
-
- /* Restore original lookup-next action */
- if (adj->saved_lookup_next_index)
- {
- adj->lookup_next_index = adj->saved_lookup_next_index;
- adj->saved_lookup_next_index = 0;
- }
-
- /* Save current action */
- if (is_add || is_pop)
- adj->saved_lookup_next_index = adj->lookup_next_index;
-
- if (is_add)
- adj->lookup_next_index =
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP;
-
- if (is_pop)
- adj->lookup_next_index =
- (ip_lookup_next_t) IP6_LOOKUP_NEXT_POP_HOP_BY_HOP;
-
- hm->adj = *addr;
- hm->ioam_flag = (is_add ? IOAM_HBYH_ADD :
- (is_pop ? IOAM_HBYH_POP : IOAM_HBYH_MOD));
- return 0;
-}
-
-static clib_error_t *
-ip6_set_ioam_destination_command_fn (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd)
-{
- ip6_address_t addr;
- u32 mask_width = ~0;
- int is_add = 0;
- int is_pop = 0;
- int is_none = 0;
- u32 vrf_id = 0;
- // int rv;
-
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "%U/%d", unformat_ip6_address, &addr, &mask_width))
- ;
- else if (unformat (input, "vrf-id %d", &vrf_id))
- ;
- else if (unformat (input, "add"))
- is_add = 1;
- else if (unformat (input, "pop"))
- is_pop = 1;
- else if (unformat (input, "none"))
- is_none = 1;
- else
- break;
- }
-
- if ((is_add + is_pop + is_none) != 1)
- return clib_error_return (0, "One of (add, pop, none) required");
- if (mask_width == ~0)
- return clib_error_return (0, "<address>/<mask-width> required");
-
- /* rv = ip6_ioam_set_destination (&addr, mask_width, vrf_id, */
- /* is_add, is_pop, is_none); */
-
- /* switch (rv) */
- /* { */
- /* case 0: */
- /* break; */
- /* default: */
- /* return clib_error_return (0, "ip6_ioam_set_destination returned %d", */
- /* rv); */
- /* } */
-
- /* return 0; */
-
- return clib_error_return (0,
- "ip6_ioam_set_destination Currnetly Disabled due to FIB2.0",
- 1);
-}
-
-/*?
- * This command sets the In-band OAM (iOAM) destination IPv6 address
- * subnet. An action is required (add, pop or none). Optionally, an IPv6
- * FIB table (aka VRF Table) can be provided. If not provided, table 0
- * used.
- *
- * Use '<em>show ioam summary</em>' to verify the configured settings.
- *
- * @todo This content needs to be validated and potentially more detail added.
- *
- * @cliexpar
- * Example of how to set the iOAM destination:
- * @cliexcmd{set ioam destination ff02::1/128 pop vrf-id 8}
-?*/
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (ip6_set_ioam_destination_cmd, static) = {
- .path = "set ioam destination",
- .short_help = "set ioam destination <ip6-address>/<width> {add|pop|none} [vrf-id <table-id>]",
- .function = ip6_set_ioam_destination_command_fn,
-};
-/* *INDENT-ON* */
-
-
void
vnet_register_ioam_end_of_path_callback (void *cb)
{