From 4d4d1d9e0bd0bf25eab88ec59e329fa3d1c388c6 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Wed, 24 Mar 2021 06:29:37 -0700 Subject: [PATCH] wifi-diag: Show basic trigger RU Alloc over time graph. I believe this will show OFDMA ru allocation over time. Signed-off-by: Ben Greear --- wifi_diag/Packet.pm | 23 +++++++++++++++++++++ wifi_diag/wifi_pcap_diag.pl | 41 ++++++++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/wifi_diag/Packet.pm b/wifi_diag/Packet.pm index bfd4ff35..39f03107 100644 --- a/wifi_diag/Packet.pm +++ b/wifi_diag/Packet.pm @@ -43,6 +43,9 @@ sub new { ba_starting_seq => 0, # needs to be initialized bss_color => 0, bss_color_known => 0, + trigger_type_basic => 0, # basic trigger type relates to OFDMA + trigger_user_aid => "", + trigger_user_ru_alloc => "", }; bless($self, $class); @@ -141,6 +144,26 @@ sub append { elsif ($ln =~ /.* = (Trigger Type: .*)/) { # Differentiate some special subtypes. $self->{type_subtype} = $1; + if ($1 =~ /Trigger Type: Basic \(0\)/) { + $self->{trigger_type_basic} = 1; + } + } + elsif ($ln =~ /.* = AID12: (\S+)/) { + if ($self->{trigger_type_basic}) { + if ($self->{trigger_user_aid} ne "") { + $self->{trigger_user_aid} .= ","; + } + $self->{trigger_user_aid} .= $1; + } + } + elsif ($ln =~ /.* = RU Allocation: (.*)/) { + if ($self->{trigger_type_basic}) { + if ($self->{trigger_user_ru_alloc} ne "") { + $self->{trigger_user_ru_alloc} .= ","; + } + $self->{trigger_user_ru_alloc} .= $1; + print("ru-alloc: " . $self->{trigger_user_ru_alloc} . "\n"); + } } elsif ($ln =~ /.* = Starting Sequence Number: (\d+)/) { $self->{ba_starting_seq} = $1; diff --git a/wifi_diag/wifi_pcap_diag.pl b/wifi_diag/wifi_pcap_diag.pl index 7593d981..494cd2be 100755 --- a/wifi_diag/wifi_pcap_diag.pl +++ b/wifi_diag/wifi_pcap_diag.pl @@ -48,6 +48,8 @@ my $glb_fh_rtx_tx; my $glb_fh_rtx_rx; my $glb_fh_color_tx; my $glb_fh_color_rx; +my $glb_fh_ru_alloc_tx; +my $glb_fh_ru_alloc_rx; my $tx_no_ack_found_big = 0; my $rx_no_ack_found_big = 0; @@ -113,6 +115,8 @@ my $glb_rtx_tx_fname = $::report_prefix . "glb-rtx-tx-rpt.txt"; my $glb_rtx_rx_fname = $::report_prefix . "glb-rtx-rx-rpt.txt"; my $glb_color_rx_fname = $::report_prefix . "glb-color-rx-rpt.txt"; my $glb_color_tx_fname = $::report_prefix . "glb-color-tx-rpt.txt"; +my $glb_ru_alloc_rx_fname = $::report_prefix . "glb-ru-alloc-rx-rpt.txt"; +my $glb_ru_alloc_tx_fname = $::report_prefix . "glb-ru-alloc-tx-rpt.txt"; if ($gen_report) { $report_html .= genGlobalReports(); @@ -131,6 +135,8 @@ open($glb_fh_rtx_tx, ">", $glb_rtx_tx_fname) or die("Can't open $glb_rtx_tx_fnam open($glb_fh_rtx_rx, ">", $glb_rtx_rx_fname) or die("Can't open $glb_rtx_rx_fname for writing: $!\n"); open($glb_fh_color_rx, ">", $glb_color_rx_fname) or die("Can't open $glb_color_rx_fname for writing: $!\n"); open($glb_fh_color_tx, ">", $glb_color_tx_fname) or die("Can't open $glb_color_tx_fname for writing: $!\n"); +open($glb_fh_ru_alloc_rx, ">", $glb_ru_alloc_rx_fname) or die("Can't open $glb_ru_alloc_rx_fname for writing: $!\n"); +open($glb_fh_ru_alloc_tx, ">", $glb_ru_alloc_tx_fname) or die("Can't open $glb_ru_alloc_tx_fname for writing: $!\n"); my $hdr = "#timestamp\ttid\ttime_diff\tperiod_tot_pkts_ps\t" . "period_rx_pkts_ps\tperiod_rx_retrans_pkts_ps\tperiod_rx_amsdu_pkts_ps\tperiod_rx_retrans_amsdu_pkts_ps\tperiod_dummy_rx_pkts_ps\t" . @@ -408,8 +414,11 @@ sub htmlMcsHistogram { $html .= "

TX Packet Type histogram

\n "; foreach my $name (sort keys %glb_pkt_type_tx_hash) { - $html .= sprintf(qq(\n), $name, $glb_pkt_type_tx_hash{$name}, ($glb_pkt_type_tx_hash{$name} * 100.0) / $tx_pkts); + $html .= sprintf(qq(\n), + $name, $glb_pkt_type_tx_hash{$name}, ($glb_pkt_type_tx_hash{$name} * 100.0) / ($tx_pkts + $dummy_tx_pkts)); } + $html .= sprintf(qq(\n), + $dummy_tx_pkts, ($dummy_tx_pkts * 100.0) / ($tx_pkts + $dummy_tx_pkts)); $html .= "
TypePacketsPercentage
%s%s%f
%s%s%f
ACK but not Captured%d%f
\n"; $html .= "

RX Packet Type histogram

\n @@ -472,6 +481,9 @@ sub genGlobalReports { $html .= doTimeGraph("BSS Color", "RX BSS Color over time", "1:2", $glb_color_rx_fname, "glb-color-rx.png"); $html .= doTimeGraph("BSS Color", "TX BSS Color over time", "1:2", $glb_color_tx_fname, "glb-color-tx.png"); + $html .= doTimeGraph("Basic Trigger RU Alloc", "RX RU Alloc over time", "1:2", $glb_ru_alloc_rx_fname, "glb-ru-alloc-rx.png"); + $html .= doTimeGraph("Basic Trigger RU Alloc", "TX RU Alloc over time", "1:2", $glb_ru_alloc_tx_fname, "glb-ru-alloc-tx.png"); + # Local peer sending BA back to DUT $html .= "\n\n

Block-Acks sent from all local endpoints to DUT.

\n"; $html .= doTimeGraph("BA Latency", "TX Block-Ack latency from last known frame", "1:6", $glb_ba_tx_fname, "glb-ba-tx-latency.png"); @@ -741,11 +753,25 @@ sub processPkt { $ln = "" . $pkt->timestamp() . "\t" . $pkt->{bss_color} . "\n"; print $glb_fh_color_rx $ln; } + if ($pkt->{trigger_type_basic}) { + # We may have multiple, split them out. + my @toks = split(/,/, $pkt->{trigger_user_ru_alloc}); + my $ti; + for ($ti = 0; $ti<@toks; $ti++) { + my $tok = $toks[$ti]; + # tok looks like: 55 (106 tones) + if ($tok =~ /\s*(\d+)\s+.*/) { + $ln = "" . $pkt->timestamp() . "\t" . $1 . "\n"; + print $glb_fh_ru_alloc_rx $ln; + } + } + } if ($pkt->retrans()) { $ln = "" . $pkt->timestamp() . "\t" . $pkt->retrans() . "\n"; print $glb_fh_rtx_rx $ln; } } else { + # else is tx if ($delta != -1) { $delta_time_tx_count++; $delta_time_tx += $delta; @@ -793,6 +819,19 @@ sub processPkt { $ln = "" . $pkt->timestamp() . "\t" . $pkt->{bss_color} . "\n"; print $glb_fh_color_tx $ln; } + if ($pkt->{trigger_type_basic}) { + # We may have multiple, split them out. + my @toks = split(/,/, $pkt->{trigger_user_ru_alloc}); + my $ti; + for ($ti = 0; $ti<@toks; $ti++) { + my $tok = $toks[$ti]; + # tok looks like: 55 (106 tones) + if ($tok =~ /\s*(\d+)\s+.*/) { + $ln = "" . $pkt->timestamp() . "\t" . $1 . "\n"; + print $glb_fh_ru_alloc_tx $ln; + } + } + } if ($pkt->retrans()) { $ln = "" . $pkt->timestamp() . "\t" . $pkt->retrans() . "\n"; print $glb_fh_rtx_tx $ln;