summaryrefslogtreecommitdiffstats
path: root/ui/cli/tap-rlcltestat.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
commita86c5f7cae7ec9a3398300555a0b644689d946a1 (patch)
tree39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /ui/cli/tap-rlcltestat.c
parentReleasing progress-linux version 4.2.6-1~progress7.99u1. (diff)
downloadwireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz
wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ui/cli/tap-rlcltestat.c')
-rw-r--r--ui/cli/tap-rlcltestat.c84
1 files changed, 47 insertions, 37 deletions
diff --git a/ui/cli/tap-rlcltestat.c b/ui/cli/tap-rlcltestat.c
index 9f4a2cc9..9ebf051b 100644
--- a/ui/cli/tap-rlcltestat.c
+++ b/ui/cli/tap-rlcltestat.c
@@ -18,11 +18,15 @@
#include <epan/packet.h>
#include <epan/tap.h>
#include <epan/stat_tap_ui.h>
+
#include <epan/dissectors/packet-rlc-lte.h>
+#include <epan/dissectors/packet-rlc-3gpp-common.h>
+
void register_tap_listener_rlc_lte_stat(void);
enum {
+ RAT_COLUMN,
UEID_COLUMN,
UL_FRAMES_COLUMN,
UL_BYTES_COLUMN,
@@ -39,42 +43,43 @@ enum {
NUM_UE_COLUMNS
};
-static const gchar *ue_titles[] = { " UEId",
+static const char *ue_titles[] = { "RAT", " UEId",
"UL Frames", "UL Bytes", " UL Mbs", "UL ACKs", "UL NACKs", "UL Missed",
"DL Frames", "DL Bytes", " DL Mbs", "DL ACKs", "DL NACKs", "DL Missed"};
/* Stats for one UE */
typedef struct rlc_lte_row_data {
/* Key for matching this row */
- guint16 ueid;
+ uint8_t rat;
+ uint16_t ueid;
- gboolean is_predefined_data;
+ bool is_predefined_data;
- guint32 UL_frames;
- guint32 UL_total_bytes;
+ uint32_t UL_frames;
+ uint32_t UL_total_bytes;
nstime_t UL_time_start;
nstime_t UL_time_stop;
- guint32 UL_total_acks;
- guint32 UL_total_nacks;
- guint32 UL_total_missing;
+ uint32_t UL_total_acks;
+ uint32_t UL_total_nacks;
+ uint32_t UL_total_missing;
- guint32 DL_frames;
- guint32 DL_total_bytes;
+ uint32_t DL_frames;
+ uint32_t DL_total_bytes;
nstime_t DL_time_start;
nstime_t DL_time_stop;
- guint32 DL_total_acks;
- guint32 DL_total_nacks;
- guint32 DL_total_missing;
+ uint32_t DL_total_acks;
+ uint32_t DL_total_nacks;
+ uint32_t DL_total_missing;
} rlc_lte_row_data;
-/* Common channel stats */
+/* Common channel stats (i.e. independent of UEs) */
typedef struct rlc_lte_common_stats {
- guint32 bcch_frames;
- guint32 bcch_bytes;
- guint32 pcch_frames;
- guint32 pcch_bytes;
+ uint32_t bcch_frames;
+ uint32_t bcch_bytes;
+ uint32_t pcch_frames;
+ uint32_t pcch_bytes;
} rlc_lte_common_stats;
@@ -85,10 +90,10 @@ typedef struct rlc_lte_ep {
} rlc_lte_ep_t;
-/* Used to keep track of all RLC LTE statistics */
+/* Top-level struct for RLC LTE statistics */
typedef struct rlc_lte_stat_t {
rlc_lte_ep_t *ep_list;
- guint32 total_frames;
+ uint32_t total_frames;
/* Common stats */
rlc_lte_common_stats common_stats;
@@ -115,7 +120,7 @@ rlc_lte_stat_reset(void *phs)
/* Allocate a rlc_lte_ep_t struct to store info for new UE */
-static rlc_lte_ep_t *alloc_rlc_lte_ep(const struct rlc_lte_tap_info *si, packet_info *pinfo _U_)
+static rlc_lte_ep_t *alloc_rlc_lte_ep(const struct rlc_3gpp_tap_info *si, packet_info *pinfo _U_)
{
rlc_lte_ep_t *ep;
@@ -128,6 +133,7 @@ static rlc_lte_ep_t *alloc_rlc_lte_ep(const struct rlc_lte_tap_info *si, packet_
}
/* Copy SI data into ep->stats */
+ ep->stats.rat = si->rat;
ep->stats.ueid = si->ueid;
/* Counts for new UE are all 0 */
@@ -160,7 +166,7 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
rlc_lte_ep_t *tmp = NULL, *te = NULL;
/* Cast tap info struct */
- const struct rlc_lte_tap_info *si = (const struct rlc_lte_tap_info *)phi;
+ const struct rlc_3gpp_tap_info *si = (const struct rlc_3gpp_tap_info *)phi;
/* Need this */
if (!hs) {
@@ -194,15 +200,18 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
/* Make it the first/only entry */
te = hs->ep_list;
} else {
- /* Look among existing rows for this UEId */
+ /* Look among existing rows for this rat/UEId */
+ /* TODO: with different data structures, could avoid this linear search */
for (tmp = hs->ep_list; (tmp != NULL); tmp = tmp->next) {
- if (tmp->stats.ueid == si->ueid) {
+ if ((tmp->stats.rat == si->rat) &&
+ (tmp->stats.ueid == si->ueid))
+ {
te = tmp;
break;
}
}
- /* Not found among existing, so create a new one anyway */
+ /* Not found among existing, so create a new one now */
if (te == NULL) {
if ((te = alloc_rlc_lte_ep(si, pinfo))) {
/* Add new item to end of list */
@@ -228,9 +237,9 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
if (si->direction == DIRECTION_UPLINK) {
/* Update time range */
if (te->stats.UL_frames == 0) {
- te->stats.UL_time_start = si->rlc_lte_time;
+ te->stats.UL_time_start = si->rlc_time;
}
- te->stats.UL_time_stop = si->rlc_lte_time;
+ te->stats.UL_time_stop = si->rlc_time;
te->stats.UL_frames++;
te->stats.UL_total_bytes += si->pduLength;
@@ -238,9 +247,9 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
else {
/* Update time range */
if (te->stats.DL_frames == 0) {
- te->stats.DL_time_start = si->rlc_lte_time;
+ te->stats.DL_time_start = si->rlc_time;
}
- te->stats.DL_time_stop = si->rlc_lte_time;
+ te->stats.DL_time_stop = si->rlc_time;
te->stats.DL_frames++;
te->stats.DL_total_bytes += si->pduLength;
@@ -267,7 +276,7 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
/* Calculate and return a bandwidth figure, in Mbs */
-static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 bytes)
+static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, uint32_t bytes)
{
/* Can only calculate bandwidth if have time delta */
if (memcmp(start_time, stop_time, sizeof(nstime_t)) != 0) {
@@ -292,8 +301,8 @@ static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 byt
static void
rlc_lte_stat_draw(void *phs)
{
- guint16 number_of_ues = 0;
- gint i;
+ uint16_t number_of_ues = 0;
+ int i;
/* Look up the statistics struct */
rlc_lte_stat_t *hs = (rlc_lte_stat_t *)phs;
@@ -330,7 +339,8 @@ rlc_lte_stat_draw(void *phs)
&tmp->stats.DL_time_stop,
tmp->stats.DL_total_bytes);
- printf("%5u %10u %9u %10f %8u %9u %10u %10u %9u %10f %8u %9u %10u\n",
+ printf("%s %5u %10u %9u %10f %8u %9u %10u %10u %9u %10f %8u %9u %10u\n",
+ (tmp->stats.rat == RLC_RAT_LTE) ? "LTE" : "NR ",
tmp->stats.ueid,
tmp->stats.UL_frames,
tmp->stats.UL_total_bytes, UL_bw,
@@ -356,9 +366,9 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
GString *error_string;
/* Check for a filter string */
- if (strncmp(opt_arg, "rlc-lte,stat,", 13) == 0) {
+ if (strncmp(opt_arg, "rlc-3gpp,stat,", 14) == 0) {
/* Skip those characters from filter to display */
- filter = opt_arg + 13;
+ filter = opt_arg + 14;
}
else {
/* No filter */
@@ -374,7 +384,7 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
/* Register the tap listener */
/**********************************************/
- error_string = register_tap_listener("rlc-lte", hs,
+ error_string = register_tap_listener("rlc-3gpp", hs,
filter, 0,
rlc_lte_stat_reset,
rlc_lte_stat_packet,
@@ -393,7 +403,7 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
static stat_tap_ui rlc_lte_stat_ui = {
REGISTER_STAT_GROUP_GENERIC,
NULL,
- "rlc-lte,stat",
+ "rlc-3gpp,stat",
rlc_lte_stat_init,
0,
NULL