summaryrefslogtreecommitdiffstats
path: root/src/plugins/igmp/igmp_api.c
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/plugins/igmp/igmp_api.c
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/plugins/igmp/igmp_api.c')
-rw-r--r--src/plugins/igmp/igmp_api.c17
1 files changed, 8 insertions, 9 deletions
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);
}
}
66 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * vnet.h: general networking definitions
 *
 * Copyright (c) 2011 Eliot Dresselhaus
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef included_vnet_vnet_h
#define included_vnet_vnet_h

#include <stddef.h>

#include <vppinfra/types.h>

#include <vppinfra/pcap.h>
#include <vnet/buffer.h>
#include <vnet/config.h>
#include <vnet/interface.h>
#include <vnet/api_errno.h>

/* ip table add delete callback */
typedef struct _vnet_ip_table_function_list_elt
{
  struct _vnet_ip_table_function_list_elt *next_ip_table_function;
  clib_error_t *(*fp) (struct vnet_main_t * vnm, u32 table_id, u32 flags);
} _vnet_ip_table_function_list_elt_t;

typedef struct
{
  /* Trace RX pkts */
  u8 pcap_rx_enable;
  /* Trace TX pkts */
  u8 pcap_tx_enable;
  /* Trace drop pkts */
  u8 pcap_drop_enable;
  u8 pad1;
  u32 max_bytes_per_pkt;
  u32 pcap_sw_if_index;
  pcap_main_t pcap_main;
  u32 filter_classify_table_index;
  vlib_error_t pcap_error_index;
} vnet_pcap_t;

typedef struct vnet_main_t
{
  u32 local_interface_hw_if_index;
  u32 local_interface_sw_if_index;

  vnet_interface_main_t interface_main;

  /* set up by constructors */
  vnet_device_class_t *device_class_registrations;
  vnet_hw_interface_class_t *hw_interface_class_registrations;
    _vnet_interface_function_list_elt_t
    * hw_interface_add_del_functions[VNET_ITF_FUNC_N_PRIO];
    _vnet_interface_function_list_elt_t
    * hw_interface_link_up_down_functions[VNET_ITF_FUNC_N_PRIO];
    _vnet_interface_function_list_elt_t
    * sw_interface_add_del_functions[VNET_ITF_FUNC_N_PRIO];
    _vnet_interface_function_list_elt_t
    * sw_interface_admin_up_down_functions[VNET_ITF_FUNC_N_PRIO];
    _vnet_interface_function_list_elt_t
    * sw_interface_mtu_change_functions[VNET_ITF_FUNC_N_PRIO];

  uword *interface_tag_by_sw_if_index;

    _vnet_ip_table_function_list_elt_t
    * ip_table_add_del_functions[VNET_ITF_FUNC_N_PRIO];

    /* pcap rx / tx tracing */
    vnet_pcap_t pcap;

    /*
     * Last "api" error, preserved so we can issue reasonable diagnostics
     * at or near the top of the food chain
     */
    vnet_api_error_t api_errno;

    vlib_main_t *vlib_main;
} vnet_main_t;

extern vnet_main_t vnet_main;

#include <vppinfra/pcap_funcs.h>
#include <vnet/interface_funcs.h>
#include <vnet/global_funcs.h>

#endif /* included_vnet_vnet_h */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */