From e7abe3b378f25785e8979b1d4e3dee587b0e081c Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 6 Sep 2022 11:48:05 -0400 Subject: [PATCH] TT#44805 rename `stats` to `stats_in` Change-Id: Ifaf9a97b41d2cba76bf252772ed76242a7ca48d2 --- daemon/call.c | 30 +++++++++++++-------------- daemon/call_interfaces.c | 2 +- daemon/cdr.c | 18 ++++++++-------- daemon/cli.c | 4 ++-- daemon/media_socket.c | 14 ++++++------- daemon/redis.c | 8 ++++---- daemon/statistics.c | 6 +++--- include/call.h | 4 ++-- kernel-module/xt_RTPENGINE.c | 40 ++++++++++++++++++------------------ kernel-module/xt_RTPENGINE.h | 4 ++-- 10 files changed, 65 insertions(+), 65 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 80b1b80e9..129c07a5b 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -540,12 +540,12 @@ static void count_stream_stats_kernel(struct packet_stream *ps) { #define DS(x) do { \ uint64_t ks_val; \ - ks_val = atomic64_get(&ps->kernel_stats.x); \ - if (ke->stats.x < ks_val) \ + ks_val = atomic64_get(&ps->kernel_stats_in.x); \ + if (ke->stats_in.x < ks_val) \ diff_ ## x = 0; \ else \ - diff_ ## x = ke->stats.x - ks_val; \ - atomic64_add(&ps->stats.x, diff_ ## x); \ + diff_ ## x = ke->stats_in.x - ks_val; \ + atomic64_add(&ps->stats_in.x, diff_ ## x); \ RTPE_STATS_ADD(x ## _kernel, diff_ ## x); \ } while (0) @@ -613,23 +613,23 @@ void call_timer(void *ptr) { DS(errors); - if (ke->stats.packets != atomic64_get(&ps->kernel_stats.packets)) { + if (ke->stats_in.packets != atomic64_get(&ps->kernel_stats_in.packets)) { atomic64_set(&ps->last_packet, rtpe_now.tv_sec); count_stream_stats_kernel(ps); } - ps->in_tos_tclass = ke->stats.in_tos; + ps->in_tos_tclass = ke->stats_in.tos; #if (RE_HAS_MEASUREDELAY) /* XXX fix atomicity */ - ps->stats.delay_min = ke->stats.delay_min; - ps->stats.delay_avg = ke->stats.delay_avg; - ps->stats.delay_max = ke->stats.delay_max; + ps->stats_in.delay_min = ke->stats_in.delay_min; + ps->stats_in.delay_avg = ke->stats_in.delay_avg; + ps->stats_in.delay_max = ke->stats_in.delay_max; #endif - atomic64_set(&ps->kernel_stats.bytes, ke->stats.bytes); - atomic64_set(&ps->kernel_stats.packets, ke->stats.packets); - atomic64_set(&ps->kernel_stats.errors, ke->stats.errors); + atomic64_set(&ps->kernel_stats_in.bytes, ke->stats_in.bytes); + atomic64_set(&ps->kernel_stats_in.packets, ke->stats_in.packets); + atomic64_set(&ps->kernel_stats_in.errors, ke->stats_in.errors); for (j = 0; j < ke->target.num_payload_types; j++) { pt = ke->target.pt_input[j].pt_num; @@ -3562,9 +3562,9 @@ void call_destroy(struct call *c) { FMT_M(addr, ps->endpoint.port), (!PS_ISSET(ps, RTP) && PS_ISSET(ps, RTCP)) ? " (RTCP)" : "", FMT_M(ps->ssrc_in[0] ? ps->ssrc_in[0]->parent->h.ssrc : 0), - atomic64_get(&ps->stats.packets), - atomic64_get(&ps->stats.bytes), - atomic64_get(&ps->stats.errors), + atomic64_get(&ps->stats_in.packets), + atomic64_get(&ps->stats_in.bytes), + atomic64_get(&ps->stats_in.errors), rtpe_now.tv_sec - atomic64_get(&ps->last_packet)); } } diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 2f56357f3..88f31f891 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1981,7 +1981,7 @@ stats: s = &totals->totals[0]; if (!PS_ISSET(ps, RTP)) s = &totals->totals[1]; - ng_stats(bencode_dictionary_add_dictionary(dict, "stats"), &ps->stats, s); + ng_stats(bencode_dictionary_add_dictionary(dict, "stats"), &ps->stats_in, s); } #define BF_M(k, f) if (MEDIA_ISSET(m, f)) bencode_list_add_string(flags, k) diff --git a/daemon/cdr.c b/daemon/cdr.c index 645613c97..13be18a22 100644 --- a/daemon/cdr.c +++ b/daemon/cdr.c @@ -131,11 +131,11 @@ void cdr_update_entry(struct call* c) { cdrlinecnt, md->index, protocol, (ps->selected_sfd ? ps->selected_sfd->socket.local.port : 0), cdrlinecnt, md->index, protocol, - atomic64_get(&ps->stats.packets), + atomic64_get(&ps->stats_in.packets), cdrlinecnt, md->index, protocol, - atomic64_get(&ps->stats.bytes), + atomic64_get(&ps->stats_in.bytes), cdrlinecnt, md->index, protocol, - atomic64_get(&ps->stats.errors), + atomic64_get(&ps->stats_in.errors), cdrlinecnt, md->index, protocol, atomic64_get(&ps->last_packet), cdrlinecnt, md->index, protocol, @@ -160,11 +160,11 @@ void cdr_update_entry(struct call* c) { cdrlinecnt, md->index, protocol, local_addr, cdrlinecnt, md->index, protocol, (unsigned int) (ps->selected_sfd ? ps->selected_sfd->socket.local.port : 0), cdrlinecnt, md->index, protocol, - atomic64_get(&ps->stats.packets), + atomic64_get(&ps->stats_in.packets), cdrlinecnt, md->index, protocol, - atomic64_get(&ps->stats.bytes), + atomic64_get(&ps->stats_in.bytes), cdrlinecnt, md->index, protocol, - atomic64_get(&ps->stats.errors), + atomic64_get(&ps->stats_in.errors), cdrlinecnt, md->index, protocol, atomic64_get(&ps->last_packet), cdrlinecnt, md->index, protocol, @@ -189,11 +189,11 @@ void cdr_update_entry(struct call* c) { cdrlinecnt, md->index, protocol, (ps->selected_sfd ? ps->selected_sfd->socket.local.port : 0), cdrlinecnt, md->index, protocol, - atomic64_get(&ps->stats.packets), + atomic64_get(&ps->stats_in.packets), cdrlinecnt, md->index, protocol, - atomic64_get(&ps->stats.bytes), + atomic64_get(&ps->stats_in.bytes), cdrlinecnt, md->index, protocol, - atomic64_get(&ps->stats.errors), + atomic64_get(&ps->stats_in.errors), cdrlinecnt, md->index, protocol, atomic64_get(&ps->last_packet), cdrlinecnt, md->index, protocol, diff --git a/daemon/cli.c b/daemon/cli.c index 373012ab1..dbba70b34 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -700,8 +700,8 @@ static void cli_list_tag_info(struct cli_writer *cw, struct call_monologue *ml) ps->endpoint.port, (!PS_ISSET(ps, RTP) && PS_ISSET(ps, RTCP)) ? " (RTCP)" : "", ps->ssrc_in[0] ? ps->ssrc_in[0]->parent->h.ssrc : 0, - atomic64_get(&ps->stats.packets), - atomic64_get(&ps->stats.bytes), atomic64_get(&ps->stats.errors), + atomic64_get(&ps->stats_in.packets), + atomic64_get(&ps->stats_in.bytes), atomic64_get(&ps->stats_in.errors), atomic64_get(&ps->last_packet)); #if RE_HAS_MEASUREDELAY if (PS_ISSET(ps, RTP) || !PS_ISSET(ps, RTCP)) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index d753840f2..499bf79f6 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1238,7 +1238,7 @@ static const char *kernelize_one(struct rtpengine_target_info *reti, GQueue *out reti->ssrc[u] = htonl(stream->ssrc_in[u]->parent->h.ssrc); } - ZERO(stream->kernel_stats); + ZERO(stream->kernel_stats_in); if (proto_is_rtp(media->protocol) && sinks && sinks->length) { GList *l; @@ -1918,7 +1918,7 @@ static void media_packet_rtp_in(struct packet_handler_ctx *phc) "RTP packet with unknown payload type %u received from %s%s%s", phc->payload_type, FMT_M(endpoint_print_buf(&phc->mp.fsin))); - atomic64_inc(&phc->mp.stream->stats.errors); + atomic64_inc(&phc->mp.stream->stats_in.errors); RTPE_STATS_INC(errors_user); } else { @@ -2107,7 +2107,7 @@ static int media_packet_address_check(struct packet_handler_ctx *phc) FMT_M(sockaddr_print_buf(&endpoint.address), endpoint.port), FMT_M(sockaddr_print_buf(&phc->mp.stream->endpoint.address), phc->mp.stream->endpoint.port)); - atomic64_inc(&phc->mp.stream->stats.errors); + atomic64_inc(&phc->mp.stream->stats_in.errors); ret = -1; } } @@ -2444,11 +2444,11 @@ static int stream_packet(struct packet_handler_ctx *phc) { phc->mp.raw = phc->s; // XXX separate stats for received/sent - if (atomic64_inc(&phc->mp.stream->stats.packets) == 0) { + if (atomic64_inc(&phc->mp.stream->stats_in.packets) == 0) { if (phc->mp.stream->component == 1 && phc->mp.media->index == 1) janus_media_up(phc->mp.media->monologue); } - atomic64_add(&phc->mp.stream->stats.bytes, phc->s.len); + atomic64_add(&phc->mp.stream->stats_in.bytes, phc->s.len); atomic64_set(&phc->mp.stream->last_packet, rtpe_now.tv_sec); RTPE_STATS_INC(packets_user); RTPE_STATS_ADD(bytes_user, phc->s.len); @@ -2610,7 +2610,7 @@ next_mirror: err_next: ilog(LOG_DEBUG | LOG_FLAG_LIMIT ,"Error when sending message. Error: %s", strerror(errno)); - atomic64_inc(&sink->stats.errors); + atomic64_inc(&sink->stats_in.errors); RTPE_STATS_INC(errors_user); goto next; @@ -2652,7 +2652,7 @@ out: } if (handler_ret < 0) { - atomic64_inc(&phc->mp.stream->stats.errors); + atomic64_inc(&phc->mp.stream->stats_in.errors); RTPE_STATS_INC(errors_user); } diff --git a/daemon/redis.c b/daemon/redis.c index e8d109cae..e1b6acb95 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -1442,7 +1442,7 @@ static int redis_streams(struct call *c, struct redis_list *streams) { return -1; if (redis_hash_get_endpoint(&ps->advertised_endpoint, rh, "advertised_endpoint")) return -1; - if (redis_hash_get_stats(&ps->stats, rh, "stats")) + if (redis_hash_get_stats(&ps->stats_in, rh, "stats")) return -1; if (redis_hash_get_sdes_params1(&ps->crypto.params, rh, "") == -1) return -1; @@ -2405,9 +2405,9 @@ char* redis_encode_json(struct call *c) { JSON_SET_SIMPLE("component","%u",ps->component); JSON_SET_SIMPLE_CSTR("endpoint",endpoint_print_buf(&ps->endpoint)); JSON_SET_SIMPLE_CSTR("advertised_endpoint",endpoint_print_buf(&ps->advertised_endpoint)); - JSON_SET_SIMPLE("stats-packets","%" PRIu64, atomic64_get(&ps->stats.packets)); - JSON_SET_SIMPLE("stats-bytes","%" PRIu64, atomic64_get(&ps->stats.bytes)); - JSON_SET_SIMPLE("stats-errors","%" PRIu64, atomic64_get(&ps->stats.errors)); + JSON_SET_SIMPLE("stats-packets","%" PRIu64, atomic64_get(&ps->stats_in.packets)); + JSON_SET_SIMPLE("stats-bytes","%" PRIu64, atomic64_get(&ps->stats_in.bytes)); + JSON_SET_SIMPLE("stats-errors","%" PRIu64, atomic64_get(&ps->stats_in.errors)); json_update_crypto_params(builder, "", &ps->crypto.params); } diff --git a/daemon/statistics.c b/daemon/statistics.c index 39bc98808..0bce17ab7 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -142,9 +142,9 @@ void statistics_update_oneway(struct call* c) { ps2 = sh ? sh->sink : NULL; } - if (ps && ps2 && atomic64_get(&ps2->stats.packets)==0) { - if (atomic64_get(&ps->stats.packets)!=0 && IS_OWN_CALL(c)){ - if (atomic64_get(&ps->stats.packets)!=0) + if (ps && ps2 && atomic64_get(&ps2->stats_in.packets)==0) { + if (atomic64_get(&ps->stats_in.packets)!=0 && IS_OWN_CALL(c)){ + if (atomic64_get(&ps->stats_in.packets)!=0) RTPE_STATS_INC(oneway_stream_sess); } else { diff --git a/include/call.h b/include/call.h index 1edffb4a3..2e321d497 100644 --- a/include/call.h +++ b/include/call.h @@ -342,8 +342,8 @@ struct packet_stream { struct send_timer *send_timer; /* RO */ struct jitter_buffer *jb; /* RO */ - struct stream_stats stats; - struct stream_stats kernel_stats; + struct stream_stats stats_in; + struct stream_stats kernel_stats_in; unsigned char in_tos_tclass; atomic64 last_packet; GHashTable *rtp_stats; /* LOCK: call->master_lock */ diff --git a/kernel-module/xt_RTPENGINE.c b/kernel-module/xt_RTPENGINE.c index b3c5a0320..7ca8da321 100644 --- a/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/xt_RTPENGINE.c @@ -295,7 +295,7 @@ struct rtpengine_stats_a { uint64_t delay_min; uint64_t delay_avg; uint64_t delay_max; - atomic_t in_tos; + atomic_t tos; }; struct rtpengine_rtp_stats_a { atomic64_t packets; @@ -311,7 +311,7 @@ struct rtpengine_target { struct rtpengine_target_info target; unsigned int last_pt; // index into pt_input[] and pt_output[] - struct rtpengine_stats_a stats; + struct rtpengine_stats_a stats_in; struct rtpengine_rtp_stats_a rtp_stats[RTPE_NUM_PAYLOAD_TYPES]; spinlock_t ssrc_stats_lock; struct rtpengine_ssrc_stats ssrc_stats[RTPE_NUM_SSRC_TRACKING]; @@ -1423,13 +1423,13 @@ static ssize_t proc_blist_read(struct file *f, char __user *b, size_t l, loff_t memcpy(&opp->target, &g->target, sizeof(opp->target)); - opp->stats.packets = atomic64_read(&g->stats.packets); - opp->stats.bytes = atomic64_read(&g->stats.bytes); - opp->stats.errors = atomic64_read(&g->stats.errors); - opp->stats.delay_min = g->stats.delay_min; - opp->stats.delay_max = g->stats.delay_max; - opp->stats.delay_avg = g->stats.delay_avg; - opp->stats.in_tos = atomic_read(&g->stats.in_tos); + opp->stats_in.packets = atomic64_read(&g->stats_in.packets); + opp->stats_in.bytes = atomic64_read(&g->stats_in.bytes); + opp->stats_in.errors = atomic64_read(&g->stats_in.errors); + opp->stats_in.delay_min = g->stats_in.delay_min; + opp->stats_in.delay_max = g->stats_in.delay_max; + opp->stats_in.delay_avg = g->stats_in.delay_avg; + opp->stats_in.tos = atomic_read(&g->stats_in.tos); for (i = 0; i < g->target.num_payload_types; i++) { opp->rtp_stats[i].packets = atomic64_read(&g->rtp_stats[i].packets); @@ -1645,9 +1645,9 @@ static int proc_list_show(struct seq_file *f, void *v) { if (g->target.src_mismatch > 0 && g->target.src_mismatch <= ARRAY_SIZE(re_msm_strings)) seq_printf(f, " src mismatch action: %s\n", re_msm_strings[g->target.src_mismatch]); seq_printf(f, " stats: %20llu bytes, %20llu packets, %20llu errors\n", - (unsigned long long) atomic64_read(&g->stats.bytes), - (unsigned long long) atomic64_read(&g->stats.packets), - (unsigned long long) atomic64_read(&g->stats.errors)); + (unsigned long long) atomic64_read(&g->stats_in.bytes), + (unsigned long long) atomic64_read(&g->stats_in.packets), + (unsigned long long) atomic64_read(&g->stats_in.errors)); for (i = 0; i < g->target.num_payload_types; i++) { seq_printf(f, " RTP payload type %3u: %20llu bytes, %20llu packets\n", g->target.pt_input[i].pt_num, @@ -4642,7 +4642,7 @@ no_intercept: skb2 = skb_copy_expand(skb, MAX_HEADER, MAX_SKB_TAIL_ROOM, GFP_ATOMIC); if (!skb2) { log_err("out of memory while creating skb copy"); - atomic64_inc(&g->stats.errors); + atomic64_inc(&g->stats_in.errors); continue; } } @@ -4680,14 +4680,14 @@ no_intercept: err = send_proxy_packet(skb2, &o->output.src_addr, &o->output.dst_addr, o->output.tos, par); if (err) - atomic64_inc(&g->stats.errors); + atomic64_inc(&g->stats_in.errors); } - if (atomic64_read(&g->stats.packets)==0) - atomic_set(&g->stats.in_tos,in_tos); + if (atomic64_read(&g->stats_in.packets)==0) + atomic_set(&g->stats_in.tos,in_tos); - atomic64_inc(&g->stats.packets); - atomic64_add(datalen, &g->stats.bytes); + atomic64_inc(&g->stats_in.packets); + atomic64_add(datalen, &g->stats_in.bytes); if (rtp_pt_idx >= 0) { atomic64_inc(&g->rtp_stats[rtp_pt_idx].packets); @@ -4721,7 +4721,7 @@ no_intercept: else if (rtp_pt_idx == -2) /* not RTP */ ; else if (rtp_pt_idx == -1) - atomic64_inc(&g->stats.errors); + atomic64_inc(&g->stats_in.errors); target_put(g); table_put(t); @@ -4730,7 +4730,7 @@ no_intercept: skip_error: log_err("x_tables action failed: %s", errstr); - atomic64_inc(&g->stats.errors); + atomic64_inc(&g->stats_in.errors); skip1: target_put(g); skip2: diff --git a/kernel-module/xt_RTPENGINE.h b/kernel-module/xt_RTPENGINE.h index fac19a22d..f73298e58 100644 --- a/kernel-module/xt_RTPENGINE.h +++ b/kernel-module/xt_RTPENGINE.h @@ -20,7 +20,7 @@ struct rtpengine_stats { uint64_t delay_min; uint64_t delay_avg; uint64_t delay_max; - uint8_t in_tos; + uint8_t tos; }; struct rtpengine_rtp_stats { uint64_t packets; @@ -220,7 +220,7 @@ struct rtpengine_message { struct rtpengine_list_entry { struct rtpengine_target_info target; - struct rtpengine_stats stats; + struct rtpengine_stats stats_in; struct rtpengine_rtp_stats rtp_stats[RTPE_NUM_PAYLOAD_TYPES]; // same index as pt_input struct rtpengine_output_info outputs[RTPE_MAX_FORWARD_DESTINATIONS]; };