memory_size, skip, match,
next_table_index, miss_next_index,
table_index, current_data_flag,
- current_data_offset, is_add);
+ current_data_offset, is_add,
+ 1 /* delete_chain */);
}
static int
memory_size, skip, match,
next_table_index, miss_next_index,
table_index, current_data_flag,
- current_data_offset, is_add);
+ current_data_offset, is_add,
+ 1 /* delete_chain */);
}
}
void vnet_classify_delete_table_index (vnet_classify_main_t *cm,
- u32 table_index)
+ u32 table_index, int del_chain)
{
vnet_classify_table_t * t;
return;
t = pool_elt_at_index (cm->tables, table_index);
- if (t->next_table_index != ~0)
- vnet_classify_delete_table_index (cm, t->next_table_index);
+ if (del_chain && t->next_table_index != ~0)
+ /* Recursively delete the entire chain */
+ vnet_classify_delete_table_index (cm, t->next_table_index, del_chain);
vec_free (t->mask);
vec_free (t->buckets);
u32 * table_index,
u8 current_data_flag,
i16 current_data_offset,
- int is_add)
+ int is_add,
+ int del_chain)
{
vnet_classify_table_t * t;
return 0;
}
- vnet_classify_delete_table_index (cm, *table_index);
+ vnet_classify_delete_table_index (cm, *table_index, del_chain);
return 0;
}
u32 skip = ~0;
u32 match = ~0;
int is_add = 1;
+ int del_chain = 0;
u32 table_index = ~0;
u32 next_table_index = ~0;
u32 miss_next_index = ~0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
if (unformat (input, "del"))
is_add = 0;
+ else if (unformat (input, "del-chain"))
+ {
+ is_add = 0;
+ del_chain = 1;
+ }
else if (unformat (input, "buckets %d", &nbuckets))
;
else if (unformat (input, "skip %d", &skip))
return clib_error_return (0, "table index required for delete");
rv = vnet_classify_add_del_table (cm, mask, nbuckets, memory_size,
- skip, match, next_table_index, miss_next_index,
- &table_index, current_data_flag, current_data_offset, is_add);
+ skip, match, next_table_index, miss_next_index, &table_index,
+ current_data_flag, current_data_offset, is_add, del_chain);
switch (rv)
{
case 0:
.short_help =
"classify table [miss-next|l2-miss_next|acl-miss-next <next_index>]"
"\n mask <mask-value> buckets <nn> [skip <n>] [match <n>]"
- "\n [current-data-flag <n>] [current-data-offset <n>] [table <n>] [del]",
+ "\n [current-data-flag <n>] [current-data-offset <n>] [table <n>]"
+ "\n [del] [del-chain]",
.function = classify_table_command_fn,
};
u32 * table_index,
u8 current_data_flag,
i16 current_data_offset,
- int is_add);
+ int is_add,
+ int del_chain);
unformat_function_t unformat_ip4_mask;
unformat_function_t unformat_ip6_mask;
u32 skip = ~0;
u32 match = ~0;
int is_add = 1;
+ int del_chain = 0;
u32 table_index = ~0;
u32 next_table_index = ~0;
u32 miss_next_index = ~0;
{
if (unformat (i, "del"))
is_add = 0;
+ else if (unformat (i, "del-chain"))
+ {
+ is_add = 0;
+ del_chain = 1;
+ }
else if (unformat (i, "buckets %d", &nbuckets))
;
else if (unformat (i, "memory_size %d", &memory_size))
M2 (CLASSIFY_ADD_DEL_TABLE, classify_add_del_table, vec_len (mask));
mp->is_add = is_add;
+ mp->del_chain = del_chain;
mp->table_index = ntohl (table_index);
mp->nbuckets = ntohl (nbuckets);
mp->memory_size = ntohl (memory_size);
"address [ip6 multicast address] sr-policy [policy name] [del]") \
_(classify_add_del_table, \
"buckets <nn> [skip <n>] [match <n>] [memory_size <nn-bytes>]\n" \
- " [del] mask <mask-value>\n" \
+ " [del] [del-chain] mask <mask-value>\n" \
" [l2-miss-next | miss-next | acl-miss-next] <name|nn>\n" \
" [current-data-flag <n>] [current-data-offset <nn>] [table <nn>]") \
_(classify_add_del_session, \
(cm, mp->mask, nbuckets, memory_size,
skip_n_vectors, match_n_vectors,
next_table_index, miss_next_index, &table_index,
- current_data_flag, current_data_offset, mp->is_add);
+ current_data_flag, current_data_offset, mp->is_add, mp->del_chain);
out:
/* *INDENT-OFF* */
if (mp->is_add == 0)
{
s = format (s, "table %d ", ntohl (mp->table_index));
- s = format (s, "del ");
+ s = format (s, "%s ", mp->del_chain ? "del-chain" : "del");
}
else
{
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param is_add- if non-zero add the table, else delete it
+ @param del_chain - if non-zero delete the whole chain of tables
@param table_index - if add, reuturns index of the created table, else specifies the table to delete
@param nbuckets - number of buckets when adding a table
@param memory_size - memory size when adding a table
u32 client_index;
u32 context;
u8 is_add;
+ u8 del_chain;
u32 table_index;
u32 nbuckets;
u32 memory_size;