diff options
author | Damjan Marion <dmarion@me.com> | 2022-10-12 16:02:18 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2022-10-12 16:04:13 +0200 |
commit | dd298e804a25dbebc9e284b3b2d0dfd9bf674ad8 (patch) | |
tree | cd91568dc9f1947c04d97eb95e15ae06d5d0ec06 /src/plugins/ioam | |
parent | 0f8f4351b03f9350a406ad1d63f97d1f4b59fec2 (diff) |
misc: fix issues reported by clang-15
Type: improvement
Change-Id: I3fbbda0378b72843ecd39a7e8592dedc9757793a
Signed-off-by: Damjan Marion <dmarion@me.com>
Diffstat (limited to 'src/plugins/ioam')
-rw-r--r-- | src/plugins/ioam/analyse/ioam_summary_export.c | 3 | ||||
-rw-r--r-- | src/plugins/ioam/lib-pot/math64.h | 31 | ||||
-rw-r--r-- | src/plugins/ioam/udp-ping/udp_ping_export.c | 4 |
3 files changed, 13 insertions, 25 deletions
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c index ceec1551bea..09884fdb019 100644 --- a/src/plugins/ioam/analyse/ioam_summary_export.c +++ b/src/plugins/ioam/analyse/ioam_summary_export.c @@ -275,7 +275,6 @@ ioam_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp, ipfix_set_header_t *s = NULL; ip4_header_t *ip; udp_header_t *udp; - u32 records_this_buffer; u16 new_l0, old_l0; ip_csum_t sum0; vlib_main_t *vm = vlib_get_main (); @@ -329,13 +328,11 @@ ioam_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp, h->sequence_number = stream->sequence_number++; h->sequence_number = clib_host_to_net_u32 (h->sequence_number); next_offset = (u32) (((u8 *) (s + 1)) - (u8 *) tp); - records_this_buffer = 0; } next_offset = ioam_analyse_add_ipfix_record (fr, record, b0, next_offset, &temp, &temp, 0, 0); - records_this_buffer++; /* Flush data if packet len is about to reach path mtu */ if (next_offset > (exp->path_mtu - 250)) diff --git a/src/plugins/ioam/lib-pot/math64.h b/src/plugins/ioam/lib-pot/math64.h index 4c608a37de4..2084c25fa58 100644 --- a/src/plugins/ioam/lib-pot/math64.h +++ b/src/plugins/ioam/lib-pot/math64.h @@ -51,23 +51,23 @@ static inline void mul64by64(u64 a, u64 b, u64 * hi, u64 * lo) static inline u64 mod128by64(u64 x, u64 y, u64 m, double di) { - u64 q1, q2, q; - u64 p1, p0; - double dq; + u64 q1, q2; + u64 p1, p0; + double dq; - /* calculate quotient first pass 53 bits */ - dq = (TWO64 * (double)x + (double)y) * di; + /* calculate quotient first pass 53 bits */ + dq = (TWO64 * (double) x + (double) y) * di; - if (dq >= TWO64) - q1 = 0xfffffffffffff800L; - else - q1 = dq; + if (dq >= TWO64) + q1 = 0xfffffffffffff800L; + else + q1 = dq; - /* q1 * m to compare the product to the dividend. */ - mul64by64(q1, m, &p1, &p0); + /* q1 * m to compare the product to the dividend. */ + mul64by64 (q1, m, &p1, &p0); - /* Adjust quotient. is it > actual result: */ - if (x < p1 || (x == p1 && y < p0)) + /* Adjust quotient. is it > actual result: */ + if (x < p1 || (x == p1 && y < p0)) { /* q1 > quotient. calculate abs remainder */ x = p1 - (x + (p0 < y)); @@ -77,7 +77,6 @@ static inline u64 mod128by64(u64 x, u64 y, u64 m, double di) q2 = (u64) ((TWO64 * (double)x + (double)y) * di); mul64by64(q2, m, &p1, &p0); - q = q1 - q2; if (x < p1 || (x == p1 && y <= p0)) { y = p0 - y; @@ -86,7 +85,6 @@ static inline u64 mod128by64(u64 x, u64 y, u64 m, double di) { y = p0 - y; y += m; - q--; } } else @@ -97,12 +95,10 @@ static inline u64 mod128by64(u64 x, u64 y, u64 m, double di) q2 = (u64) ((TWO64 * (double)x + (double)y) * di); mul64by64(q2, m, &p1, &p0); - q = q1 + q2; if (x < p1 || (x == p1 && y < p0)) { y = y - p0; y += m; - q--; } else { @@ -110,7 +106,6 @@ static inline u64 mod128by64(u64 x, u64 y, u64 m, double di) if (y >= m) { y -= m; - q++; } } } diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c index 3dc1436a1a9..de0bad7a855 100644 --- a/src/plugins/ioam/udp-ping/udp_ping_export.c +++ b/src/plugins/ioam/udp-ping/udp_ping_export.c @@ -45,7 +45,6 @@ udp_ping_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp, ipfix_set_header_t *s = NULL; ip4_header_t *ip; udp_header_t *udp; - u32 records_this_buffer; u16 new_l0, old_l0; ip_csum_t sum0; vlib_main_t *vm = vlib_get_main (); @@ -99,7 +98,6 @@ udp_ping_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp, h->sequence_number = clib_host_to_net_u32 (h->sequence_number); next_offset = (u32) (((u8 *) (s + 1)) - (u8 *) tp); - records_this_buffer = 0; } next_offset = ioam_analyse_add_ipfix_record (fr, @@ -115,8 +113,6 @@ udp_ping_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp, //memcpy (b0->data + next_offset, &pak_sent, sizeof(u32)); //next_offset += sizeof(u32); - records_this_buffer++; - /* Flush data if packet len is about to reach path mtu */ if (next_offset > (exp->path_mtu - UDP_PING_EXPORT_RECORD_SIZE)) { |