summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-06-10 18:01:49 -0700
committerNeale Ranns <nranns@cisco.com>2018-06-10 18:01:49 -0700
commit43add7ff90526f807f3bcf1e8859d900a665e266 (patch)
tree83a43e09da83977f5cb601b8119a8dfc7b57b29b /src
parent01dc6b968aa1bfa9deea9917b3b45b89c80f6a24 (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>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/igmp/igmp.c14
-rw-r--r--src/plugins/igmp/igmp.h2
-rw-r--r--src/plugins/igmp/igmp_api.c17
3 files changed, 15 insertions, 18 deletions
diff --git a/src/plugins/igmp/igmp.c b/src/plugins/igmp/igmp.c
index 6499b5be466..15f6317c93c 100644
--- a/src/plugins/igmp/igmp.c
+++ b/src/plugins/igmp/igmp.c
@@ -74,7 +74,7 @@ igmp_clear_config (igmp_config_t * config)
pool_free (config->groups);
hash_free (config->igmp_group_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);
}
@@ -635,7 +635,7 @@ igmp_send_state_changed (vlib_main_t * vm, vlib_node_runtime_t * rt,
igmp_clear_group (config, group);
if (pool_elts (config->groups) == 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);
}
}
@@ -784,8 +784,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)
{
@@ -979,10 +979,8 @@ igmp_init (vlib_main_t * vm)
int i;
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);
ip4_register_protocol (IP_PROTOCOL_IGMP, igmp_input_node.index);
diff --git a/src/plugins/igmp/igmp.h b/src/plugins/igmp/igmp.h
index fc131f7843b..4f197d99bdd 100644
--- a/src/plugins/igmp/igmp.h
+++ b/src/plugins/igmp/igmp.h
@@ -405,7 +405,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 164779c3e5a..fc5ce1b6431 100644
--- a/src/plugins/igmp/igmp_api.c
+++ b/src/plugins/igmp/igmp_api.c
@@ -204,7 +204,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]);
@@ -227,8 +227,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;
}
@@ -238,8 +238,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;
@@ -265,13 +265,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);
}
@@ -316,8 +316,7 @@ igmp_event (igmp_main_t * im, igmp_config_t * config, igmp_group_t * group,
igmp_clear_group (config, group);
if (pool_elts (config->groups) == 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);
}
}