Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues #9

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/diamond_direction.sh
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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
22 changes: 13 additions & 9 deletions tests/interference.sh
Expand Up @@ -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

Expand Down
86 changes: 43 additions & 43 deletions 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
91 changes: 45 additions & 46 deletions wmediumd/per.c
Expand Up @@ -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,
Expand All @@ -28,9 +26,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];
Expand All @@ -40,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));
Expand Down
19 changes: 12 additions & 7 deletions wmediumd/wmediumd.c
Expand Up @@ -38,9 +38,15 @@
#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 };

if (index >= PER_MATRIX_RATE_LEN)
index = PER_MATRIX_RATE_LEN - 1;

return rates[index];
}

static inline int div_round(int a, int b)
{
Expand Down Expand Up @@ -318,7 +324,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
Expand Down Expand Up @@ -367,9 +373,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++;
Expand Down
1 change: 1 addition & 0 deletions wmediumd/wmediumd.h
Expand Up @@ -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;
Expand Down