From 4642297a42aca860b4f50b18497d7e2b7e727bde Mon Sep 17 00:00:00 2001 From: Masashi Honma Date: Tue, 21 Feb 2017 12:15:10 +0900 Subject: [PATCH 1/3] Fix the rate limitation by PER file Previously, tx rate more than 54Mbps was dealed as error because of limitation of the PER file. This patch fixes the issue to use the highest rate in the PER file. Signed-off-by: Masashi Honma --- wmediumd/per.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wmediumd/per.c b/wmediumd/per.c index 0ea9d5a..8c9b27a 100644 --- a/wmediumd/per.c +++ b/wmediumd/per.c @@ -28,9 +28,10 @@ static double get_error_prob_from_per_matrix(struct wmediumd *ctx, double snr, return 0.0; if (rate_idx >= PER_MATRIX_RATE_LEN) { - w_flogf(ctx, LOG_ERR, stderr, - "%s: invalid rate_idx=%d\n", __func__, rate_idx); - exit(EXIT_FAILURE); + w_flogf(ctx, LOG_WARNING, stderr, + "%s: invalid rate_idx=%d is replaced by %d\n", + __func__, rate_idx, PER_MATRIX_RATE_LEN - 1); + rate_idx = PER_MATRIX_RATE_LEN - 1; } return ctx->per_matrix[signal_idx * PER_MATRIX_RATE_LEN + rate_idx]; From 68e1738d5dd84dcbfe441c43b2ecee9da92eba87 Mon Sep 17 00:00:00 2001 From: Masashi Honma Date: Thu, 9 Mar 2017 10:34:52 +0900 Subject: [PATCH 2/3] Fix index_to_rate buffer over run Signed-off-by: Masashi Honma --- wmediumd/wmediumd.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/wmediumd/wmediumd.c b/wmediumd/wmediumd.c index 30e27b0..7e3fded 100644 --- a/wmediumd/wmediumd.c +++ b/wmediumd/wmediumd.c @@ -38,9 +38,16 @@ #include "ieee80211.h" #include "config.h" -static int index_to_rate[] = { - 60, 90, 120, 180, 240, 360, 480, 540 -}; +static int index_to_rate(int index) +{ + static int rates[] = { 60, 90, 120, 180, 240, 360, 480, 540 }; + static int rate_len = 8; + + if (index >= rate_len) + index = rate_len - 1; + + return rates[index]; +} static inline int div_round(int a, int b) { @@ -318,7 +325,7 @@ void queue_frame(struct wmediumd *ctx, struct station *station, clock_gettime(CLOCK_MONOTONIC, &now); - int ack_time_usec = pkt_duration(14, index_to_rate[0]) + sifs; + int ack_time_usec = pkt_duration(14, index_to_rate(0)) + sifs; /* * To determine a frame's expiration time, we compute the @@ -367,9 +374,8 @@ void queue_frame(struct wmediumd *ctx, struct station *station, frame->data_len, station, deststa); for (j = 0; j < frame->tx_rates[i].count; j++) { - int rate = index_to_rate[rate_idx]; - if (rate == 0) // avoid division by zero - continue; + int rate = index_to_rate(rate_idx); + send_time += difs + pkt_duration(frame->data_len, rate); retries++; From 595eb678422b9d1d35cb00edf070c8592813c972 Mon Sep 17 00:00:00 2001 From: Masashi Honma Date: Fri, 10 Mar 2017 07:40:16 +0900 Subject: [PATCH 3/3] Fix the rates of PER file and default PER The commit 0bad6d6db3ea9ff5b0832f5c5f44a95b2e90b066 "Replace get_error_prob() with PER file" removed previous get_error_prob_from_snr(). The previous function used rates defined by rateset. The rates were [6, 9, 12, 18, 24, 36, 48, 54]. But new PER file includes 11b rates [1, 2, 5.5, ...]. This patch fixes the PER file and default PER to use 11a/g rate only and fixes some tests to suite to new PER table. Signed-off-by: Masashi Honma --- tests/diamond_direction.sh | 6 +-- tests/interference.sh | 22 +++++---- tests/signal_table_ieee80211ax | 86 +++++++++++++++++----------------- wmediumd/per.c | 84 ++++++++++++++++----------------- wmediumd/wmediumd.c | 5 +- wmediumd/wmediumd.h | 1 + 6 files changed, 103 insertions(+), 101 deletions(-) diff --git a/tests/diamond_direction.sh b/tests/diamond_direction.sh index e2cd24d..05509d4 100755 --- a/tests/diamond_direction.sh +++ b/tests/diamond_direction.sh @@ -38,8 +38,8 @@ model : type = "path_loss"; positions = ( (-50.0, 0.0), - ( 0.0, 70.0), - ( 0.0,-100.0), + ( 0.0, 50.0), + ( 0.0, -90.0), ( 50.0, 0.0) ); directions = ( @@ -110,6 +110,6 @@ tmux send-keys -t $win '../wmediumd/wmediumd -c diamond.cfg -x signal_table_ieee tmux send-keys -t $session:0 'ip link set hwsim0 up' C-m tmux select-window -t $session:1 -tmux send-keys -t $session:1 'ping -c 15 10.10.10.13' C-m +tmux send-keys -t $session:1 'ping -c 18 10.10.10.13' C-m tmux attach diff --git a/tests/interference.sh b/tests/interference.sh index 4db582a..98d2f0a 100755 --- a/tests/interference.sh +++ b/tests/interference.sh @@ -38,19 +38,23 @@ ifaces : enable_interference = true; }; -path_loss : +model : { + type = "path_loss"; positions = ( - (-70.0, 0.0), - ( 0.0, 0.0), - ( 70.0, 0.0), - (130.0, -2.0), - (130.0, -1.0), - (130.0, 2.0), - (130.0, 1.0) + (-70.0, 0.0), + ( 0.0, 0.0), + ( 70.0, 0.0), + ( -2.0, 130.0), + ( -1.0, 130.0), + ( 2.0, 130.0), + ( 1.0, 130.0) ); tx_powers = (15.0, 15.0, 15.0, 11.0, 11.0, 11.0, 11.0); - model_params = ("log_distance", 3.5, 0.0); + + model_name = "log_distance"; + path_loss_exp = 3.5; + xg = 0.0; }; __EOM diff --git a/tests/signal_table_ieee80211ax b/tests/signal_table_ieee80211ax index 69c441f..e633486 100644 --- a/tests/signal_table_ieee80211ax +++ b/tests/signal_table_ieee80211ax @@ -1,44 +1,44 @@ # RSSI vs MCS vs PER table, based on 11-14-0571-12-00ax-evaluation-methodology.docx assuming No is -91dBm. -# bitrate 1Mbps 2Mbps 5.5Mbps 6Mbps 9Mbps 11Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps -# RSSI [dBm] 0 1 2 3 4 5 6 7 8 9 10 11 --100 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --99 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --98 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --97 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --96 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --95 0.9995 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --94 0.529 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --93 0.0427 0.9194 0.9995 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --92 0.0014 0.1765 0.529 0.9995 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --91 0.00E+00 0.0086 0.0427 0.529 0.9995 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --90 0.00E+00 0.0001 0.0014 0.0427 0.529 0.9995 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --89 0.00E+00 0.00E+00 0.00E+00 0.0014 0.0427 0.529 0.9997 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --88 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0014 0.0427 0.5462 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --87 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0014 0.0439 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --86 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0016 0.9597 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --85 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.2239 1.00E+00 1.00E+00 1.00E+00 1.00E+00 --84 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0117 0.8908 1.00E+00 1.00E+00 1.00E+00 --83 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.2343 1.00E+00 1.00E+00 1.00E+00 --82 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.024 1.00E+00 1.00E+00 1.00E+00 --81 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 1.00E+00 1.00E+00 1.00E+00 --80 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.979 1.00E+00 1.00E+00 --79 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.3536 1.00E+00 1.00E+00 --78 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0356 1.00E+00 1.00E+00 --77 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0018 1.00E+00 1.00E+00 --76 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.9496 1.00E+00 --75 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.379 0.9981 --74 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.061 0.6465 --73 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0057 0.1343 --72 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0004 0.0145 --71 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0007 --70 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --69 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --68 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --67 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --66 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --65 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --64 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --63 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --62 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --61 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 --60 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +# bitrate 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps +# RSSI [dBm] 0 1 2 3 4 5 6 7 +-100 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-99 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-98 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-97 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-96 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-95 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-94 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-93 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-92 0.9995 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-91 0.529 0.9995 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-90 0.0427 0.529 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-89 0.0014 0.0427 0.9997 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-88 0.00E+00 0.0014 0.5462 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-87 0.00E+00 0.00E+00 0.0439 1.00E+00 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-86 0.00E+00 0.00E+00 0.0016 0.9597 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-85 0.00E+00 0.00E+00 0.00E+00 0.2239 1.00E+00 1.00E+00 1.00E+00 1.00E+00 +-84 0.00E+00 0.00E+00 0.00E+00 0.0117 0.8908 1.00E+00 1.00E+00 1.00E+00 +-83 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.2343 1.00E+00 1.00E+00 1.00E+00 +-82 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.024 1.00E+00 1.00E+00 1.00E+00 +-81 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 1.00E+00 1.00E+00 1.00E+00 +-80 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.979 1.00E+00 1.00E+00 +-79 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.3536 1.00E+00 1.00E+00 +-78 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0356 1.00E+00 1.00E+00 +-77 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0018 1.00E+00 1.00E+00 +-76 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.9496 1.00E+00 +-75 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.379 0.9981 +-74 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.061 0.6465 +-73 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0057 0.1343 +-72 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0004 0.0145 +-71 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.0007 +-70 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-69 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-68 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-67 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-66 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-65 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-64 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-63 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-62 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-61 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 +-60 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 0.00E+00 diff --git a/wmediumd/per.c b/wmediumd/per.c index 8c9b27a..75fd932 100644 --- a/wmediumd/per.c +++ b/wmediumd/per.c @@ -10,8 +10,6 @@ #include "wmediumd.h" -#define PER_MATRIX_RATE_LEN (12) - static double get_error_prob_from_per_matrix(struct wmediumd *ctx, double snr, unsigned int rate_idx, int frame_len, struct station *src, @@ -41,47 +39,47 @@ int set_default_per(struct wmediumd *ctx) { /* Default value is same as tests/signal_table_ieee80211ax file. */ float default_per_matrix[] = { - 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.9995, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.529, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.0427, 0.9194, 0.9995, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.0014, 0.1765, 0.529, 0.9995, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.0086, 0.0427, 0.529, 0.9995, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.0001, 0.0014, 0.0427, 0.529, 0.9995, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.0014, 0.0427, 0.529, 0.9997, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0014, 0.0427, 0.5462, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0014, 0.0439, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0016, 0.9597, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.2239, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0117, 0.8908, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.2343, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.024, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.979, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.3536, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0356, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0018, 1.00E+00, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.9496, 1.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.379, 0.9981, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.061, 0.6465, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0057, 0.1343, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0004, 0.0145, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0007, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, - 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00 + 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.9995, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.529, 0.9995, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.0427, 0.529, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.0014, 0.0427, 0.9997, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.00E+00, 0.0014, 0.5462, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.0439, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.0016, 0.9597, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.2239, 1.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.0117, 0.8908, 1.00E+00, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.2343, 1.00E+00, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.024, 1.00E+00, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 1.00E+00, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.979, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.3536, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0356, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0018, 1.00E+00, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.9496, 1.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.379, 0.9981, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.061, 0.6465, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0057, 0.1343, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0004, 0.0145, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.0007, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, + 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00 }; ctx->per_matrix = malloc(sizeof(default_per_matrix)); diff --git a/wmediumd/wmediumd.c b/wmediumd/wmediumd.c index 7e3fded..c1ca2af 100644 --- a/wmediumd/wmediumd.c +++ b/wmediumd/wmediumd.c @@ -41,10 +41,9 @@ static int index_to_rate(int index) { static int rates[] = { 60, 90, 120, 180, 240, 360, 480, 540 }; - static int rate_len = 8; - if (index >= rate_len) - index = rate_len - 1; + if (index >= PER_MATRIX_RATE_LEN) + index = PER_MATRIX_RATE_LEN - 1; return rates[index]; } diff --git a/wmediumd/wmediumd.h b/wmediumd/wmediumd.h index b1b4554..5c7efb7 100644 --- a/wmediumd/wmediumd.h +++ b/wmediumd/wmediumd.h @@ -67,6 +67,7 @@ typedef uint64_t u64; #define NOISE_LEVEL (-91) #define CCA_THRESHOLD (-90) +#define PER_MATRIX_RATE_LEN (8) struct wqueue { struct list_head frames;