diff options
author | Neale Ranns <nranns@cisco.com> | 2018-06-10 18:01:49 -0700 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2018-06-11 02:08:30 -0400 |
commit | a652002ffe1c16fead656c5b57b240e73dc496e3 (patch) | |
tree | 696eb9c20ac2a28be170a29bb6cd3864c2708e9b | |
parent | 98ee17424bb9483cbf21d8f218f970001ba68adf (diff) |
IGMP: use simple u32 bit hash key
some IGMP hashse use only a u32 key, which is not stored in the object, so don't use memory based hash
Change-Id: Iaa4eddf568ea0164bc2a812da4cc502f1811b93c
Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r-- | src/plugins/igmp/igmp.c | 17 | ||||
-rw-r--r-- | src/plugins/igmp/igmp.h | 2 | ||||
-rw-r--r-- | src/plugins/igmp/igmp_api.c | 17 |
3 files changed, 15 insertions, 21 deletions
diff --git a/src/plugins/igmp/igmp.c b/src/plugins/igmp/igmp.c index e98e976cc96..c8008823eb9 100644 --- a/src/plugins/igmp/igmp.c +++ b/src/plugins/igmp/igmp.c @@ -50,7 +50,7 @@ igmp_clear_config (igmp_config_t * config) pool_free (config->sg); hash_free (config->igmp_sg_by_key); - hash_unset_mem (im->igmp_config_by_sw_if_index, &config->sw_if_index); + hash_unset (im->igmp_config_by_sw_if_index, config->sw_if_index); pool_put (im->configs, config); } @@ -503,12 +503,10 @@ igmp_send_state_changed (vlib_main_t * vm, vlib_node_runtime_t * rt, pool_put (config->sg, sg); if (pool_elts (config->sg) == 0) { - hash_unset_mem (im->igmp_config_by_sw_if_index, - &config->sw_if_index); + hash_unset (im->igmp_config_by_sw_if_index, config->sw_if_index); pool_put (im->configs, config); } } - } void @@ -631,8 +629,8 @@ igmp_listen (vlib_main_t * vm, u8 enable, u32 sw_if_index, config->adj_index = adj_mcast_add_or_lock (FIB_PROTOCOL_IP4, VNET_LINK_IP4, config->sw_if_index); - hash_set_mem (im->igmp_config_by_sw_if_index, &config->sw_if_index, - config - im->configs); + hash_set (im->igmp_config_by_sw_if_index, + config->sw_if_index, config - im->configs); } else if (config->cli_api_configured != cli_api_configured) { @@ -742,11 +740,8 @@ igmp_init (vlib_main_t * vm) if ((error = vlib_call_init_function (vm, ip4_lookup_init))) return error; - im->igmp_config_by_sw_if_index = - hash_create_mem (0, sizeof (u32), sizeof (uword)); - im->igmp_api_client_by_client_index = - hash_create_mem (0, sizeof (u32), sizeof (uword)); - + im->igmp_config_by_sw_if_index = hash_create (0, sizeof (u32)); + im->igmp_api_client_by_client_index = hash_create (0, sizeof (u32)); vec_validate_aligned (im->buffers, tm->n_vlib_mains - 1, CLIB_CACHE_LINE_BYTES); diff --git a/src/plugins/igmp/igmp.h b/src/plugins/igmp/igmp.h index 70f90437c54..405ab1745e9 100644 --- a/src/plugins/igmp/igmp.h +++ b/src/plugins/igmp/igmp.h @@ -235,7 +235,7 @@ igmp_config_lookup (igmp_main_t * im, u32 sw_if_index) uword *p; igmp_config_t *config = NULL; - p = hash_get_mem (im->igmp_config_by_sw_if_index, &sw_if_index); + p = hash_get (im->igmp_config_by_sw_if_index, sw_if_index); if (p) config = vec_elt_at_index (im->configs, p[0]); diff --git a/src/plugins/igmp/igmp_api.c b/src/plugins/igmp/igmp_api.c index 5da733b1f6a..87c57c8ebf6 100644 --- a/src/plugins/igmp/igmp_api.c +++ b/src/plugins/igmp/igmp_api.c @@ -196,7 +196,7 @@ igmp_api_client_lookup (igmp_main_t * im, u32 client_index) uword *p; vpe_client_registration_t *api_client = NULL; - p = hash_get_mem (im->igmp_api_client_by_client_index, &client_index); + p = hash_get (im->igmp_api_client_by_client_index, client_index); if (p) api_client = vec_elt_at_index (im->api_clients, p[0]); @@ -219,8 +219,8 @@ vl_api_want_igmp_events_t_handler (vl_api_want_igmp_events_t * mp) rv = VNET_API_ERROR_INVALID_REGISTRATION; goto done; } - hash_unset_mem (im->igmp_api_client_by_client_index, - &api_client->client_index); + hash_unset (im->igmp_api_client_by_client_index, + api_client->client_index); pool_put (im->api_clients, api_client); goto done; } @@ -230,8 +230,8 @@ vl_api_want_igmp_events_t_handler (vl_api_want_igmp_events_t * mp) memset (api_client, 0, sizeof (vpe_client_registration_t)); api_client->client_index = mp->client_index; api_client->client_pid = mp->pid; - hash_set_mem (im->igmp_api_client_by_client_index, - &mp->client_index, api_client - im->api_clients); + hash_set (im->igmp_api_client_by_client_index, + mp->client_index, api_client - im->api_clients); goto done; } rv = VNET_API_ERROR_INVALID_REGISTRATION; @@ -257,13 +257,13 @@ want_igmp_events_reaper (u32 client_index) vpe_client_registration_t *api_client; uword *p; - p = hash_get_mem (im->igmp_api_client_by_client_index, &client_index); + p = hash_get (im->igmp_api_client_by_client_index, client_index); if (p) { api_client = pool_elt_at_index (im->api_clients, p[0]); pool_put (im->api_clients, api_client); - hash_unset_mem (im->igmp_api_client_by_client_index, &client_index); + hash_unset (im->igmp_api_client_by_client_index, client_index); } return (NULL); } @@ -308,8 +308,7 @@ igmp_event (igmp_main_t * im, igmp_config_t * config, igmp_sg_t * sg) pool_put (config->sg, sg); if (pool_elts (config->sg) == 0) { - hash_unset_mem (im->igmp_config_by_sw_if_index, - &config->sw_if_index); + hash_unset (im->igmp_config_by_sw_if_index, config->sw_if_index); pool_put (im->configs, config); } } |