From 1ee7830e9ee8a62800822b6f5224d66243b916d4 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Tue, 5 Feb 2019 15:51:15 -0800 Subject: transport: cleanup - move transport specific types to transport_types - add transport wrapper functions for interaction with transport protocol vfts Change-Id: I93f70d884585fc2f41c4a605e310c80e8a8972f2 Signed-off-by: Florin Coras --- src/vnet/session/session_lookup.c | 55 +++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 31 deletions(-) (limited to 'src/vnet/session/session_lookup.c') diff --git a/src/vnet/session/session_lookup.c b/src/vnet/session/session_lookup.c index 33fcb4250ca..f267a4cb7c3 100644 --- a/src/vnet/session/session_lookup.c +++ b/src/vnet/session/session_lookup.c @@ -29,11 +29,6 @@ #include #include -/** - * External vector of per transport virtual functions table - */ -extern transport_proto_vft_t *tp_vfts; - /** * Network namespace index (i.e., fib index) to session lookup table. We * should have one per network protocol type but for now we only support IP4/6 @@ -340,9 +335,9 @@ session_lookup_del_connection (transport_connection_t * tc) int session_lookup_del_session (session_t * s) { - transport_proto_t tp = session_get_transport_proto (s); transport_connection_t *ts; - ts = tp_vfts[tp].get_connection (s->connection_index, s->thread_index); + ts = transport_get_connection (session_get_transport_proto (s), + s->connection_index, s->thread_index); return session_lookup_del_connection (ts); } @@ -812,12 +807,10 @@ session_lookup_half_open_handle (transport_connection_t * tc) transport_connection_t * session_lookup_half_open_connection (u64 handle, u8 proto, u8 is_ip4) { - u32 sst; - if (handle != HALF_OPEN_LOOKUP_INVALID_VALUE) { - sst = session_type_from_proto_and_ip (proto, is_ip4); - return tp_vfts[sst].get_half_open (handle & 0xFFFFFFFF); + u32 sst = session_type_from_proto_and_ip (proto, is_ip4); + return transport_get_half_open (sst, handle & 0xFFFFFFFF); } return 0; } @@ -877,8 +870,8 @@ session_lookup_connection_wt4 (u32 fib_index, ip4_address_t * lcl, return 0; } s = session_get (kv4.value & 0xFFFFFFFFULL, thread_index); - return tp_vfts[proto].get_connection (s->connection_index, - thread_index); + return transport_get_connection (proto, s->connection_index, + thread_index); } /* @@ -886,7 +879,7 @@ session_lookup_connection_wt4 (u32 fib_index, ip4_address_t * lcl, */ rv = clib_bihash_search_inline_16_8 (&st->v4_half_open_hash, &kv4); if (rv == 0) - return tp_vfts[proto].get_half_open (kv4.value & 0xFFFFFFFF); + return transport_get_half_open (proto, kv4.value & 0xFFFFFFFF); /* * Check the session rules table @@ -902,7 +895,7 @@ session_lookup_connection_wt4 (u32 fib_index, ip4_address_t * lcl, } if ((s = session_lookup_action_to_session (action_index, FIB_PROTOCOL_IP4, proto))) - return tp_vfts[proto].get_listener (s->connection_index); + return transport_get_listener (proto, s->connection_index); return 0; } @@ -911,7 +904,7 @@ session_lookup_connection_wt4 (u32 fib_index, ip4_address_t * lcl, */ s = session_lookup_listener4_i (st, lcl, lcl_port, proto, 1); if (s) - return tp_vfts[proto].get_listener (s->connection_index); + return transport_get_listener (proto, s->connection_index); return 0; } @@ -954,8 +947,8 @@ session_lookup_connection4 (u32 fib_index, ip4_address_t * lcl, if (rv == 0) { s = session_get_from_handle (kv4.value); - return tp_vfts[proto].get_connection (s->connection_index, - s->thread_index); + return transport_get_connection (proto, s->connection_index, + s->thread_index); } /* @@ -963,7 +956,7 @@ session_lookup_connection4 (u32 fib_index, ip4_address_t * lcl, */ rv = clib_bihash_search_inline_16_8 (&st->v4_half_open_hash, &kv4); if (rv == 0) - return tp_vfts[proto].get_half_open (kv4.value & 0xFFFFFFFF); + return transport_get_half_open (proto, kv4.value & 0xFFFFFFFF); /* * Check the session rules table @@ -976,7 +969,7 @@ session_lookup_connection4 (u32 fib_index, ip4_address_t * lcl, return 0; if ((s = session_lookup_action_to_session (action_index, FIB_PROTOCOL_IP4, proto))) - return tp_vfts[proto].get_listener (s->connection_index); + return transport_get_listener (proto, s->connection_index); return 0; } @@ -985,7 +978,7 @@ session_lookup_connection4 (u32 fib_index, ip4_address_t * lcl, */ s = session_lookup_listener4_i (st, lcl, lcl_port, proto, 1); if (s) - return tp_vfts[proto].get_listener (s->connection_index); + return transport_get_listener (proto, s->connection_index); return 0; } @@ -1099,14 +1092,14 @@ session_lookup_connection_wt6 (u32 fib_index, ip6_address_t * lcl, return 0; } s = session_get (kv6.value & 0xFFFFFFFFULL, thread_index); - return tp_vfts[proto].get_connection (s->connection_index, - thread_index); + return transport_get_connection (proto, s->connection_index, + thread_index); } /* Try half-open connections */ rv = clib_bihash_search_inline_48_8 (&st->v6_half_open_hash, &kv6); if (rv == 0) - return tp_vfts[proto].get_half_open (kv6.value & 0xFFFFFFFF); + return transport_get_half_open (proto, kv6.value & 0xFFFFFFFF); /* Check the session rules table */ action_index = session_rules_table_lookup6 (&st->session_rules[proto], lcl, @@ -1120,14 +1113,14 @@ session_lookup_connection_wt6 (u32 fib_index, ip6_address_t * lcl, } if ((s = session_lookup_action_to_session (action_index, FIB_PROTOCOL_IP6, proto))) - return tp_vfts[proto].get_listener (s->connection_index); + return transport_get_listener (proto, s->connection_index); return 0; } /* If nothing is found, check if any listener is available */ s = session_lookup_listener6_i (st, lcl, lcl_port, proto, 1); if (s) - return tp_vfts[proto].get_listener (s->connection_index); + return transport_get_listener (proto, s->connection_index); return 0; } @@ -1168,14 +1161,14 @@ session_lookup_connection6 (u32 fib_index, ip6_address_t * lcl, if (rv == 0) { s = session_get_from_handle (kv6.value); - return tp_vfts[proto].get_connection (s->connection_index, - s->thread_index); + return transport_get_connection (proto, s->connection_index, + s->thread_index); } /* Try half-open connections */ rv = clib_bihash_search_inline_48_8 (&st->v6_half_open_hash, &kv6); if (rv == 0) - return tp_vfts[proto].get_half_open (kv6.value & 0xFFFFFFFF); + return transport_get_half_open (proto, kv6.value & 0xFFFFFFFF); /* Check the session rules table */ action_index = session_rules_table_lookup6 (&st->session_rules[proto], lcl, @@ -1186,14 +1179,14 @@ session_lookup_connection6 (u32 fib_index, ip6_address_t * lcl, return 0; if ((s = session_lookup_action_to_session (action_index, FIB_PROTOCOL_IP6, proto))) - return tp_vfts[proto].get_listener (s->connection_index); + return transport_get_listener (proto, s->connection_index); return 0; } /* If nothing is found, check if any listener is available */ s = session_lookup_listener6_i (st, lcl, lcl_port, proto, 1); if (s) - return tp_vfts[proto].get_listener (s->connection_index); + return transport_get_listener (proto, s->connection_index); return 0; } -- cgit 1.2.3-korg