Ejemplo n.º 1
0
/**
 *  This function deinits lacp DB
 *
 * @return 0 when successful, otherwise ERROR
 */
int
lacp_db_deinit(void)
{
    int err = 0;
    cl_map_item_t *map_item;
    struct mlag_lacp_entry *lacp_entry;
    struct lacp_pending_entry *pending_entry;
    const cl_map_item_t *map_end = NULL;

    map_item = cl_qmap_head(&(mlag_lacp_db.port_map));
    map_end = cl_qmap_end(&(mlag_lacp_db.port_map));
    while (map_item != map_end) {
        lacp_entry = PARENT_STRUCT(map_item, struct mlag_lacp_entry, map_item);
        MAP_ITEM_DEINIT(&(mlag_lacp_db.port_pool), lacp_entry);
        map_item = cl_qmap_next(map_item);
    }
    cl_qmap_remove_all(&(mlag_lacp_db.port_map));
    cl_qpool_destroy(&(mlag_lacp_db.port_pool));

    map_item = cl_qmap_head(&(mlag_lacp_db.pending_map));
    map_end = cl_qmap_end(&(mlag_lacp_db.pending_map));
    while (map_item != map_end) {
        pending_entry = PARENT_STRUCT(map_item, struct lacp_pending_entry,
                                      map_item);
        MAP_ITEM_DEINIT(&(mlag_lacp_db.pending_pool), pending_entry);
        map_item = cl_qmap_next(map_item);
    }

    cl_qmap_remove_all(&(mlag_lacp_db.pending_map));
    cl_qpool_destroy(&(mlag_lacp_db.pending_pool));

    return err;
}
Ejemplo n.º 2
0
void osm_ucast_cache_invalidate(osm_ucast_mgr_t * p_mgr)
{
	cache_switch_t *p_sw;
	cache_switch_t *p_next_sw;

	OSM_LOG_ENTER(p_mgr->p_log);

	if (!p_mgr->cache_valid)
		goto Exit;

	p_mgr->cache_valid = FALSE;

	p_next_sw = (cache_switch_t *) cl_qmap_head(&p_mgr->cache_sw_tbl);
	while (p_next_sw !=
	       (cache_switch_t *) cl_qmap_end(&p_mgr->cache_sw_tbl)) {
		p_sw = p_next_sw;
		p_next_sw = (cache_switch_t *) cl_qmap_next(&p_sw->map_item);
		cache_sw_destroy(p_sw);
	}
	cl_qmap_remove_all(&p_mgr->cache_sw_tbl);

	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE, "Unicast Cache invalidated\n");
Exit:
	OSM_LOG_EXIT(p_mgr->p_log);
}