示例#1
0
indigo_error_t
ft_hash_flow_delete(ft_instance_t ft, ft_entry_t *entry, int make_callback)
{
    INDIGO_ASSERT(ft->magic == FT_HASH_MAGIC_NUMBER);

    LOG_TRACE("Delete rsn %d flow " INDIGO_FLOW_ID_PRINTF_FORMAT,
              entry->removed_reason, entry->id);

    if (entry->id == INDIGO_FLOW_ID_INVALID) {
        LOG_ERROR("Deleting invalid flow table entry");
        return INDIGO_ERROR_UNKNOWN;
    }

    if (make_callback && ft->config.entry_deleted_cb) {
        ft->config.entry_deleted_cb(ft, entry, ft->config.deleted_cookie);
    }

    /* Unlink from hash lists; clear entry; put it on the free list */
    ft_entry_unlink(ft, entry);
    ft_entry_clear(ft, entry);

    INDIGO_ASSERT(entry->state == FT_FLOW_STATE_FREE);
    list_push(&ft->free_list, &entry->table_links);
    ft->status.current_count -= 1;
    ft->status.deletes += 1;

    return INDIGO_ERROR_NONE;
}
示例#2
0
文件: ft.c 项目: kenchiang/indigo
void
ft_destroy(ft_instance_t ft)
{
    ft_entry_t *entry;
    list_links_t *cur, *next;

    if (ft == NULL) {
        return;
    }

    FT_ITER(ft, entry, cur, next) {
        ft_entry_unlink(ft, entry);
        ft_entry_clear(ft, entry);
    }
示例#3
0
void
ft_hash_delete(ft_instance_t ft)
{
    ft_entry_t *entry;
    list_links_t *cur, *next;

    if (ft == NULL) {
        return;
    }
    INDIGO_ASSERT(ft->magic == FT_HASH_MAGIC_NUMBER);

    FT_ITER(ft, entry, cur, next) {
        ft_entry_unlink(ft, entry);
        ft_entry_clear(ft, entry);
    }