aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lb/cli.c
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2018-09-18 23:25:02 +0800
committerDamjan Marion <dmarion@me.com>2018-09-24 08:04:37 +0000
commit6a4375e02d8dd4ebcc2f79ee9f6abbafdd2f674c (patch)
treef4f2b6958c5797b14b9ebd0ad5d762630189e150 /src/plugins/lb/cli.c
parent742582f4156b249b5a4f60070ae6491dd9b6e7c0 (diff)
LB: fix flush flow table issue
Change-Id: Ib0a06ab71aed42eb5bb2ab2edf4844b2167e0610 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'src/plugins/lb/cli.c')
-rw-r--r--src/plugins/lb/cli.c60
1 files changed, 7 insertions, 53 deletions
diff --git a/src/plugins/lb/cli.c b/src/plugins/lb/cli.c
index 6e1b7c1b1ee..a12a63354cc 100644
--- a/src/plugins/lb/cli.c
+++ b/src/plugins/lb/cli.c
@@ -497,32 +497,13 @@ VLIB_CLI_COMMAND (lb_set_interface_nat6_command, static) = {
.short_help = "lb set interface nat6 in <intfc> [del]",
};
-int
-lb_flush_vip (u32 vip_index)
+static clib_error_t *
+lb_flowtable_flush_command_fn (vlib_main_t * vm,
+ unformat_input_t * input, vlib_cli_command_t * cmd)
{
- u32 thread_index;
- vlib_thread_main_t *tm = vlib_get_thread_main();
- lb_main_t *lbm = &lb_main;
-
- for(thread_index = 0; thread_index < tm->n_vlib_mains; thread_index++ ) {
- lb_hash_t *h = lbm->per_cpu[thread_index].sticky_ht;
- if (h != NULL) {
- u32 i;
- lb_hash_bucket_t *b;
-
- lb_hash_foreach_entry(h, b, i) {
- if (b->vip[i] == vip_index)
- {
- vlib_refcount_add(&lbm->as_refcount, thread_index, b->value[i], -1);
- vlib_refcount_add(&lbm->as_refcount, thread_index, 0, 1);
- b->vip[i] = ~0;
- b->value[i] = ~0;
- }
- }
- }
- }
+ lb_flush_vip_as(~0, 0);
- return 0;
+ return NULL;
}
static clib_error_t *
@@ -574,7 +555,7 @@ lb_flush_vip_command_fn (vlib_main_t * vm,
goto done;
}
- if ((ret = lb_flush_vip(vip_index)))
+ if ((ret = lb_flush_vip_as(vip_index, ~0)))
{
error = clib_error_return (0, "lb_flush_vip error %d", ret);
}
@@ -596,37 +577,10 @@ VLIB_CLI_COMMAND (lb_flush_vip_command, static) =
{
.path = "lb flush vip",
.short_help = "lb flush vip <prefix> "
- "[protocol (tcp|udp) port <n>] exec []",
+ "[protocol (tcp|udp) port <n>]",
.function = lb_flush_vip_command_fn,
};
-static clib_error_t *
-lb_flowtable_flush_command_fn (vlib_main_t * vm,
- unformat_input_t * input, vlib_cli_command_t * cmd)
-{
- u32 thread_index;
- vlib_thread_main_t *tm = vlib_get_thread_main();
- lb_main_t *lbm = &lb_main;
-
- for(thread_index = 0; thread_index < tm->n_vlib_mains; thread_index++ ) {
- lb_hash_t *h = lbm->per_cpu[thread_index].sticky_ht;
- if (h != NULL) {
- u32 i;
- lb_hash_bucket_t *b;
-
- lb_hash_foreach_entry(h, b, i) {
- vlib_refcount_add(&lbm->as_refcount, thread_index, b->value[i], -1);
- vlib_refcount_add(&lbm->as_refcount, thread_index, 0, 1);
- }
-
- lb_hash_free(h);
- lbm->per_cpu[thread_index].sticky_ht = 0;
- }
- }
-
- return NULL;
-}
-
/*
* flush all lb flowtables
* This is indented for debug and unit-tests purposes only