wifi-diag: Fix rate decoding, fix perl include path.

The regex needed tweaking for Fedora-32 (and/or possibly just HE
frames).

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear
2021-03-23 15:44:21 -07:00
parent 2341f57b39
commit 55489b42c0
2 changed files with 16 additions and 17 deletions

View File

@@ -167,7 +167,7 @@ sub append {
$self->{payload_type} = $1; $self->{payload_type} = $1;
} }
elsif (($ln =~ /^\s+\[Data Rate: (.*)\]/) || elsif (($ln =~ /^\s+\[Data Rate: (.*)\]/) ||
($ln =~ /^\s*Data Rate: (.*)/)) { ($ln =~ /^\s*Data [rR]ate: (.*)/)) {
my $dr = $1; my $dr = $1;
if ($dr =~ /(\S+) Mb/) { if ($dr =~ /(\S+) Mb/) {
$self->{datarate} = $1; $self->{datarate} = $1;

View File

@@ -8,6 +8,16 @@ use warnings;
# Un-buffer output # Un-buffer output
$| = 1; $| = 1;
use Cwd qw(getcwd); use Cwd qw(getcwd);
# this is pedantic necessity for the following use statements
use if (-e "/home/lanforge/scripts"), lib => "/home/lanforge/scripts";
use lib "../";
use lib "./";
use PeerConn;
use Packet;
use Getopt::Long;
my $cwd = getcwd(); my $cwd = getcwd();
if (defined $ENV{'DEBUG'} && $ENV{'DEBUG'} eq "1") { if (defined $ENV{'DEBUG'} && $ENV{'DEBUG'} eq "1") {
use diagnostics; use diagnostics;
@@ -15,21 +25,6 @@ if (defined $ENV{'DEBUG'} && $ENV{'DEBUG'} eq "1") {
$SIG{ __DIE__ } = sub { Carp::confess( @_ ) }; $SIG{ __DIE__ } = sub { Carp::confess( @_ ) };
$SIG{ __WARN__ } = sub { Carp::confess( @_ ) }; $SIG{ __WARN__ } = sub { Carp::confess( @_ ) };
} }
# this is pedantic necessity for the following use statements
use lib '/home/lanforge/scripts';
if ( $cwd =~ q(.*LANforge-Server\scripts$)) {
use lib '/home/lanforge/scripts/LANforge';
use lib '/home/lanforge/scripts/wifi_diag';
} else {
if ( -d "wifi_diag" ) {
use lib '.';
} else {
use lib '.';
}
}
use PeerConn;
use Packet;
use Getopt::Long;
my %peer_conns = (); my %peer_conns = ();
@@ -69,7 +64,7 @@ my $ampdu_pkt_count_total_rx = 0;
my $wmm_info = ""; my $wmm_info = "";
my $dut = ""; my $dut = "";
our $report_prefix = "wifi-diag-"; our $report_prefix = "wifi-diag-results";
my $non_dut_frames = 0; my $non_dut_frames = 0;
my $show_help = 0; my $show_help = 0;
my $gen_report = 0; my $gen_report = 0;
@@ -103,8 +98,10 @@ if ($show_help) {
print $usage; print $usage;
exit 0 exit 0
} }
$::report_prefix .= "/" $::report_prefix .= "/"
if ($report_prefix !~ m{/$}); if ($report_prefix !~ m{/$});
my $glb_ba_tx_fname = $::report_prefix . "glb-ba-tx-rpt.txt"; my $glb_ba_tx_fname = $::report_prefix . "glb-ba-tx-rpt.txt";
my $glb_ba_rx_fname = $::report_prefix . "glb-ba-rx-rpt.txt"; my $glb_ba_rx_fname = $::report_prefix . "glb-ba-rx-rpt.txt";
my $glb_mcs_ps_fname = $::report_prefix . "glb-mcs-ps-rpt.txt"; my $glb_mcs_ps_fname = $::report_prefix . "glb-mcs-ps-rpt.txt";
@@ -119,6 +116,8 @@ if ($gen_report) {
exit 0; exit 0;
} }
system("mkdir -p " . $::report_prefix);
open($glb_fh_ba_tx, ">", $glb_ba_tx_fname) or die("Can't open $glb_ba_tx_fname for writing: $!\n"); open($glb_fh_ba_tx, ">", $glb_ba_tx_fname) or die("Can't open $glb_ba_tx_fname for writing: $!\n");
open($glb_fh_ba_rx, ">", $glb_ba_rx_fname) or die("Can't open $glb_ba_rx_fname for writing: $!\n"); open($glb_fh_ba_rx, ">", $glb_ba_rx_fname) or die("Can't open $glb_ba_rx_fname for writing: $!\n");
open($glb_fh_mcs_ps, ">", $glb_mcs_ps_fname) or die("Can't open $glb_mcs_ps_fname for writing: $!\n"); open($glb_fh_mcs_ps, ">", $glb_mcs_ps_fname) or die("Can't open $glb_mcs_ps_fname for writing: $!\n");