X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Facl%2Ffa_node.c;h=a7e7b056a0b01d66f2a5b792451df1f166c817f5;hb=69cce166535e138e66d0a95f1cfe6a3591489e10;hp=1eeaa8c8df5ec5e9fe8c9b9559659dc38582c21c;hpb=b639b593372612fd3a55b3137b4fdd62df775d96;p=vpp.git diff --git a/src/plugins/acl/fa_node.c b/src/plugins/acl/fa_node.c index 1eeaa8c8df5..a7e7b056a0b 100644 --- a/src/plugins/acl/fa_node.c +++ b/src/plugins/acl/fa_node.c @@ -20,7 +20,7 @@ #include #include #include -#include "bihash_40_8.h" +#include #include #include @@ -170,7 +170,8 @@ single_acl_match_5tuple (acl_main_t * am, u32 acl_index, fa_5tuple_t * pkt_5tupl clib_warning ("ACL_FA_NODE_DBG acl %d rule %d pkt dst addr %U match rule addr %U/%d", acl_index, i, format_ip46_address, &pkt_5tuple->addr[1], - IP46_TYPE_ANY, format_ip46_address, &r->dst, IP46_TYPE_ANY, + r->is_ipv6 ? IP46_TYPE_IP6: IP46_TYPE_IP4, format_ip46_address, + &r->dst, r->is_ipv6 ? IP46_TYPE_IP6: IP46_TYPE_IP4, r->dst_prefixlen); #endif @@ -182,7 +183,8 @@ single_acl_match_5tuple (acl_main_t * am, u32 acl_index, fa_5tuple_t * pkt_5tupl clib_warning ("ACL_FA_NODE_DBG acl %d rule %d pkt src addr %U match rule addr %U/%d", acl_index, i, format_ip46_address, &pkt_5tuple->addr[0], - IP46_TYPE_ANY, format_ip46_address, &r->src, IP46_TYPE_ANY, + r->is_ipv6 ? IP46_TYPE_IP6: IP46_TYPE_IP4, format_ip46_address, + &r->src, r->is_ipv6 ? IP46_TYPE_IP6: IP46_TYPE_IP4, r->src_prefixlen); clib_warning ("ACL_FA_NODE_DBG acl %d rule %d trying to match pkt proto %d with rule %d", @@ -1361,6 +1363,7 @@ acl_fa_worker_conn_cleaner_process(vlib_main_t * vm, pw->interrupt_is_unwanted = 0; } } + pw->interrupt_generation = am->fa_interrupt_generation; return 0; } @@ -1404,7 +1407,7 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt, am->fa_current_cleaner_timer_wait_interval = max_timer_wait_interval; am->fa_cleaner_node_index = acl_fa_session_cleaner_process_node.index; - + am->fa_interrupt_generation = 1; while (1) { now = clib_cpu_time_now (); @@ -1503,10 +1506,6 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt, clib_warning("ACL_FA_CLEANER_DELETE_BY_SW_IF_INDEX bitmap: %U", format_bitmap_hex, clear_sw_if_index_bitmap); #endif vec_foreach(pw0, am->per_worker_data) { - if ((pw0 == am->per_worker_data) && (vec_len(vlib_mains) > 1)) { - /* thread 0 in multithreaded scenario is not used */ - continue; - } CLIB_MEMORY_BARRIER (); while (pw0->clear_in_process) { CLIB_MEMORY_BARRIER (); @@ -1541,10 +1540,6 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt, clib_warning("CLEANER mains len: %d per-worker len: %d", vec_len(vlib_mains), vec_len(am->per_worker_data)); #endif vec_foreach(pw0, am->per_worker_data) { - if ((pw0 == am->per_worker_data) && (vec_len(vlib_mains) > 1)) { - /* thread 0 in multithreaded scenario is not used */ - continue; - } CLIB_MEMORY_BARRIER (); while (pw0->clear_in_process) { CLIB_MEMORY_BARRIER (); @@ -1581,15 +1576,28 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt, if (event_data) _vec_len (event_data) = 0; + /* + * If the interrupts were not processed yet, ensure we wait a bit, + * but up to a point. + */ + int need_more_wait = 0; + int max_wait_cycles = 100; + do { + need_more_wait = 0; + vec_foreach(pw0, am->per_worker_data) { + if (pw0->interrupt_generation != am->fa_interrupt_generation) { + need_more_wait = 1; + } + } + if (need_more_wait) { + vlib_process_suspend(vm, 0.0001); + } + } while (need_more_wait && (--max_wait_cycles > 0)); int interrupts_needed = 0; int interrupts_unwanted = 0; vec_foreach(pw0, am->per_worker_data) { - if ((pw0 == am->per_worker_data) && (vec_len(vlib_mains) > 1)) { - /* thread 0 in multithreaded scenario is not used */ - continue; - } if (pw0->interrupt_is_needed) { interrupts_needed++; /* the per-worker value is reset when sending the interrupt */ @@ -1610,6 +1618,7 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt, am->fa_current_cleaner_timer_wait_interval += cpu_cps * am->fa_cleaner_wait_time_increment; } am->fa_cleaner_cnt_event_cycles++; + am->fa_interrupt_generation++; } /* NOT REACHED */ return 0;