diff options
author | Damjan Marion <damarion@cisco.com> | 2020-12-13 21:47:40 +0100 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-12-14 12:14:21 +0000 |
commit | b2c31b685fd2cf28436ca32bc93e23eb24c74878 (patch) | |
tree | dc0a1b1ff784445b2cbb0f9b2c07b5bcb4f5a5d0 /src/plugins/cnat | |
parent | 62c25abaa3e93be5815172d391295a6ab0390122 (diff) |
misc: move to new pool_foreach macros
Type: refactor
Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/cnat')
-rw-r--r-- | src/plugins/cnat/cnat_client.c | 7 | ||||
-rw-r--r-- | src/plugins/cnat/cnat_session.c | 4 | ||||
-rw-r--r-- | src/plugins/cnat/cnat_translation.c | 26 |
3 files changed, 18 insertions, 19 deletions
diff --git a/src/plugins/cnat/cnat_client.c b/src/plugins/cnat/cnat_client.c index 1074fccc97f..534813c1564 100644 --- a/src/plugins/cnat/cnat_client.c +++ b/src/plugins/cnat/cnat_client.c @@ -84,7 +84,7 @@ cnat_client_throttle_pool_process () vec_reset_length (del_vec); clib_spinlock_lock (&cnat_client_db.throttle_pool_lock[i]); /* *INDENT-OFF* */ - pool_foreach(addr, cnat_client_db.throttle_pool[i], ({ + pool_foreach (addr, cnat_client_db.throttle_pool[i]) { cc = (AF_IP4 == addr->version ? cnat_client_ip4_find (&ip_addr_v4(addr)) : cnat_client_ip6_find (&ip_addr_v6(addr))); @@ -94,7 +94,7 @@ cnat_client_throttle_pool_process () cnat_client_cnt_session (cc); vec_add1(del_vec, addr - cnat_client_db.throttle_pool[i]); } - })); + } /* *INDENT-ON* */ vec_foreach (ai, del_vec) { @@ -301,9 +301,8 @@ cnat_client_show (vlib_main_t * vm, if (INDEX_INVALID == cci) { /* *INDENT-OFF* */ - pool_foreach_index(cci, cnat_client_pool, ({ + pool_foreach_index (cci, cnat_client_pool) vlib_cli_output(vm, "%U", format_cnat_client, cci, 0); - })) /* *INDENT-ON* */ vlib_cli_output (vm, "%d clients", pool_elts (cnat_client_pool)); diff --git a/src/plugins/cnat/cnat_session.c b/src/plugins/cnat/cnat_session.c index 54554cedc8c..c3d8aa7eb3d 100644 --- a/src/plugins/cnat/cnat_session.c +++ b/src/plugins/cnat/cnat_session.c @@ -243,11 +243,11 @@ cnat_timestamp_show (vlib_main_t * vm, cnat_timestamp_t *ts; clib_rwlock_reader_lock (&cnat_main.ts_lock); /* *INDENT-OFF* */ - pool_foreach (ts, cnat_timestamps, ({ + pool_foreach (ts, cnat_timestamps) { vlib_cli_output (vm, "[%d] last_seen:%f lifetime:%u ref:%u", ts - cnat_timestamps, ts->last_seen, ts->lifetime, ts->refcnt); - })); + } /* *INDENT-ON* */ clib_rwlock_reader_unlock (&cnat_main.ts_lock); return (NULL); diff --git a/src/plugins/cnat/cnat_translation.c b/src/plugins/cnat/cnat_translation.c index d519cd59171..9a1cc8bbc0b 100644 --- a/src/plugins/cnat/cnat_translation.c +++ b/src/plugins/cnat/cnat_translation.c @@ -69,11 +69,11 @@ cnat_translation_unwatch_addr (u32 cti, cnat_addr_resol_type_t type) addr_resolution_t *ar; index_t *indexes = 0, *ari; /* *INDENT-OFF* */ - pool_foreach (ar, tr_resolutions, ({ + pool_foreach (ar, tr_resolutions) { if ((cti == INDEX_INVALID || ar->cti == cti) && (ar->type == type || CNAT_RESOLV_ADDR_ANY == type)) vec_add1(indexes, ar - tr_resolutions); - })); + } /* *INDENT-ON* */ vec_foreach (ari, indexes) pool_put_index (tr_resolutions, *ari); @@ -313,11 +313,11 @@ cnat_translation_walk (cnat_translation_walk_cb_t cb, void *ctx) u32 api; /* *INDENT-OFF* */ - pool_foreach_index(api, cnat_translation_pool, - ({ + pool_foreach_index (api, cnat_translation_pool) + { if (!cb(api, ctx)) break; - })); + } /* *INDENT-ON* */ } @@ -381,11 +381,11 @@ cnat_translation_show (vlib_main_t * vm, if (INDEX_INVALID == cti) { /* *INDENT-OFF* */ - pool_foreach_index(cti, cnat_translation_pool, - ({ + pool_foreach_index (cti, cnat_translation_pool) + { ct = pool_elt_at_index (cnat_translation_pool, cti); vlib_cli_output(vm, "%U", format_cnat_translation, ct); - })); + } /* *INDENT-ON* */ } else @@ -403,10 +403,10 @@ cnat_translation_purge (void) index_t tri, *trp, *trs = NULL; /* *INDENT-OFF* */ - pool_foreach_index(tri, cnat_translation_pool, - ({ + pool_foreach_index (tri, cnat_translation_pool) + { vec_add1(trs, tri); - })); + } /* *INDENT-ON* */ vec_foreach (trp, trs) cnat_translation_delete (*trp); @@ -649,13 +649,13 @@ cnat_if_addr_add_del_callback (u32 sw_if_index, ip_address_t * address, { addr_resolution_t *ar; /* *INDENT-OFF* */ - pool_foreach (ar, tr_resolutions, ({ + pool_foreach (ar, tr_resolutions) { if (ar->sw_if_index != sw_if_index) continue; if (ar->af != ip_addr_version (address)) continue; cnat_if_addr_add_cbs[ar->type] (ar, address, is_del); - })); + } /* *INDENT-ON* */ } |