diff options
author | Florin Coras <fcoras@cisco.com> | 2022-03-18 10:27:29 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2022-03-18 20:05:00 +0000 |
commit | c8e4110cd10ea36c996eff6e30cc9116896b4adf (patch) | |
tree | ada2062db8d507685e1260835818227ead0ade16 /src/vnet | |
parent | 1aa6afb3cf160b03bd7a5a58f8c0291431efa7cb (diff) |
udp: avoid grabbing vlib main if not needed
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I88a747cac70cb88755f50c7b337207f4ba256530
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/udp/udp.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index b36ef562169..d2a2b6323f0 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -23,7 +23,7 @@ udp_main_t udp_main; static void -udp_connection_register_port (vlib_main_t * vm, u16 lcl_port, u8 is_ip4) +udp_connection_register_port (u16 lcl_port, u8 is_ip4) { udp_main_t *um = &udp_main; udp_dst_port_info_t *pi; @@ -166,7 +166,6 @@ static u32 udp_session_bind (u32 session_index, transport_endpoint_cfg_t *lcl) { udp_main_t *um = vnet_get_udp_main (); - vlib_main_t *vm = vlib_get_main (); transport_endpoint_cfg_t *lcl_ext; udp_connection_t *listener; u16 lcl_port_ho; @@ -207,7 +206,7 @@ udp_session_bind (u32 session_index, transport_endpoint_cfg_t *lcl) listener->c_flags |= TRANSPORT_CONNECTION_F_CLESS; clib_spinlock_init (&listener->rx_lock); - udp_connection_register_port (vm, lcl_port_ho, lcl->is_ip4); + udp_connection_register_port (lcl_port_ho, lcl->is_ip4); return listener->c_c_index; } @@ -349,11 +348,10 @@ udp_session_send_params (transport_connection_t * tconn, static int udp_open_connection (transport_endpoint_cfg_t * rmt) { - vlib_main_t *vm = vlib_get_main (); - u32 thread_index = vm->thread_index; udp_main_t *um = &udp_main; ip46_address_t lcl_addr; udp_connection_t *uc; + u32 thread_index; u16 lcl_port; int rv; @@ -398,7 +396,7 @@ udp_open_connection (transport_endpoint_cfg_t * rmt) conn_alloc: - udp_connection_register_port (vm, lcl_port, rmt->is_ip4); + udp_connection_register_port (lcl_port, rmt->is_ip4); /* We don't poll main thread if we have workers */ thread_index = transport_cl_thread (); |