u32 session_index;
u32 counter_index;
u32 nincr = 0;
- u32 cpu_index = os_get_cpu_number ();
+ u32 thread_index = vm->thread_index;
/* *INDENT-OFF* */
pool_foreach (session, lm->sessions,
session_index_to_counter_index (session_index,
SESSION_COUNTER_USER_TO_NETWORK);
vlib_increment_combined_counter (&lm->counter_main,
- cpu_index,
+ thread_index,
counter_index,
1/*pkt*/, 1111 /*bytes*/);
vlib_increment_combined_counter (&lm->counter_main,
- cpu_index,
+ thread_index,
counter_index+1,
1/*pkt*/, 2222 /*bytes*/);
nincr++;
return VNET_API_ERROR_INVALID_VALUE;
pool_get (lm->sessions, s);
- memset (s, 0, sizeof (*s));
+ clib_memset (s, 0, sizeof (*s));
clib_memcpy (&s->our_address, our_address, sizeof (s->our_address));
clib_memcpy (&s->client_address, client_address,
sizeof (s->client_address));
u32 sw_if_index;
u32 encap_fib_id = ~0;
u32 encap_fib_index = ~0;
+ clib_error_t *error = NULL;
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
else if (unformat (line_input, "l2-sublayer-present"))
l2_sublayer_present = 1;
else
- return clib_error_return (0, "parse error: '%U'",
- format_unformat_error, line_input);
+ {
+ error = clib_error_return (0, "parse error: '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
}
- unformat_free (line_input);
-
if (encap_fib_id != ~0)
{
uword *p;
ip6_main_t *im = &ip6_main;
if (!(p = hash_get (im->fib_index_by_table_id, encap_fib_id)))
- return clib_error_return (0, "No fib with id %d", encap_fib_id);
+ {
+ error = clib_error_return (0, "No fib with id %d", encap_fib_id);
+ goto done;
+ }
encap_fib_index = p[0];
}
else
}
if (our_address_set == 0)
- return clib_error_return (0, "our address not specified");
+ {
+ error = clib_error_return (0, "our address not specified");
+ goto done;
+ }
if (client_address_set == 0)
- return clib_error_return (0, "client address not specified");
+ {
+ error = clib_error_return (0, "client address not specified");
+ goto done;
+ }
rv = create_l2tpv3_ipv6_tunnel (lm, &client_address, &our_address,
local_session_id, remote_session_id,
vnet_get_main (), sw_if_index);
break;
case VNET_API_ERROR_INVALID_VALUE:
- return clib_error_return (0, "session already exists...");
+ error = clib_error_return (0, "session already exists...");
+ goto done;
case VNET_API_ERROR_NO_SUCH_ENTRY:
- return clib_error_return (0, "session does not exist...");
+ error = clib_error_return (0, "session does not exist...");
+ goto done;
default:
- return clib_error_return (0, "l2tp_session_add_del returned %d", rv);
+ error = clib_error_return (0, "l2tp_session_add_del returned %d", rv);
+ goto done;
}
- return 0;
+done:
+ unformat_free (line_input);
+
+ return error;
}
/* *INDENT-OFF* */
return 0;
}
-/* Enable/disable L2TPv3 intercept on IP6 fowarding path */
+/* Enable/disable L2TPv3 intercept on IP6 forwarding path */
static clib_error_t *
set_ip6_l2tpv3 (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
VLIB_INIT_FUNCTION (l2tp_init);
+clib_error_t *
+l2tp_worker_init (vlib_main_t * vm)
+{
+ l2tp_encap_init (vm);
+
+ return 0;
+}
+
+VLIB_WORKER_INIT_FUNCTION (l2tp_worker_init);
+
/*
* fd.io coding-style-patch-verification: ON
*