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

ACK timing misconfiguration #146

Open
psyborg55 opened this issue Jul 24, 2018 · 11 comments
Open

ACK timing misconfiguration #146

psyborg55 opened this issue Jul 24, 2018 · 11 comments

Comments

@psyborg55
Copy link

running AR9271 card with default ACK timing setting or enabling Coverage class: 6 (up to 2700m) by issuing iw phy1 set distance 2500 will reduce throughput. trying other coverage classes towards 0 improves the throughput, which maxes out at Coverage class: 1 (up to 450m).

link distance 2500m
driver versions tested:
BACKPORTS_VERSION="v3.18.1-1-0-g5e9ec4c"
BACKPORTED_KERNEL_VERSION="v3.18.1-0-g39ca484"

BACKPORTS_VERSION="v4.4.2-1-0-gbec4037"
BACKPORTED_KERNEL_VERSION="v4.4.2-0-g1cb8570"

@erikarn
Copy link
Collaborator

erikarn commented Jul 24, 2018 via email

@psyborg55
Copy link
Author

does firmware sets that value? i'm running custom one with 6 and 9 Mbps rates enabled too.

enabling dynack with auto distance seems to help in 4.4.2 but does not work on 3.18.1

@erikarn
Copy link
Collaborator

erikarn commented Jul 25, 2018 via email

@psyborg55
Copy link
Author

is there an easy way to debug this? i have enabled debug output by passing 0xffffffff to htc_debug modparam but it outputs only a lot of calibration info.

for ar9003 series there is ar9003_hw_selfgen_tpc_txpower routine that seems to set ALL_TARGET_LEGACY_1L_5L rates for these frames, so maybe it would help to allow all rates via similar routine for ar9002 (couldn't find one) (testcase AP runs pure-g 48M fixed).

or try extending a workaround in hw.c: initval's 64us ack timeout value. Use 48us for the CTS timeout. + subtract of sifstime and slottime?

@psyborg55
Copy link
Author

debug output of SIFS EIFS SLOT ACK and CTS values:

4.4.2-0-g1cb8570:

230-233 connect to network
411 iw phy1 set distance 0
439 iw phy1 set distance 2500
482 iw phy1 set distance 10000
499 iw phy1 set distance 0
528 iw phy1 set distance auto
531 iw phy1 set distance 1

ubuntu@ubuntu:~$ dmesg | grep SIFS
[    3.320806] ath: phy0: SIFS = 352
[    3.327730] ath: phy0: SIFS = 352
[    3.327771] ath: phy0: SIFS = 352
[    3.328708] ath: phy0: SIFS = 352
[    3.498254] ath: phy0: SIFS = 352
[    3.508338] ath: phy0: SIFS = 352
[    4.326450] ath: phy1: SIFS = 352
[    4.426327] ath: phy1: SIFS = 352
[    4.471173] ath: phy1: SIFS = 352
[    5.528875] ath: phy0: SIFS = 616
[    5.705062] ath: phy1: SIFS = 352
[    5.771062] ath: phy1: SIFS = 352
[    7.772914] ath: phy0: SIFS = 352
[    8.490493] ath: phy1: SIFS = 352
[  230.336741] ath: phy1: SIFS = 352
[  230.416813] ath: phy1: SIFS = 352
[  233.287508] ath: phy1: SIFS = 352
[  233.374742] ath: phy1: SIFS = 352
[  233.459975] ath: phy1: SIFS = 352
[  233.542209] ath: phy1: SIFS = 352
[  233.627442] ath: phy1: SIFS = 352
[  233.713180] ath: phy1: SIFS = 352
[  233.797036] ath: phy1: SIFS = 352
[  233.856062] ath: phy1: SIFS = 352
[  411.087565] ath: phy1: SIFS = 352
[  439.974061] ath: phy1: SIFS = 352
[  482.658737] ath: phy1: SIFS = 352
[  499.158312] ath: phy1: SIFS = 352
[  528.735826] ath: phy1: SIFS = 352
[  531.038698] ath: phy1: SIFS = 352
ubuntu@ubuntu:~$ dmesg | grep EIFS
[    3.320819] ath: phy0: EIFS = 362
[    3.327742] ath: phy0: EIFS = 362
[    3.327780] ath: phy0: EIFS = 362
[    3.328718] ath: phy0: EIFS = 362
[    3.498266] ath: phy0: EIFS = 362
[    3.508350] ath: phy0: EIFS = 362
[    4.327450] ath: phy1: EIFS = 362
[    4.427557] ath: phy1: EIFS = 362
[    4.472174] ath: phy1: EIFS = 362
[    5.528887] ath: phy0: EIFS = 92
[    5.706060] ath: phy1: EIFS = 362
[    5.772063] ath: phy1: EIFS = 362
[    7.772927] ath: phy0: EIFS = 362
[    8.491990] ath: phy1: EIFS = 362
[  230.337739] ath: phy1: EIFS = 362
[  230.418310] ath: phy1: EIFS = 362
[  233.289013] ath: phy1: EIFS = 362
[  233.376246] ath: phy1: EIFS = 362
[  233.461475] ath: phy1: EIFS = 362
[  233.543709] ath: phy1: EIFS = 362
[  233.628942] ath: phy1: EIFS = 362
[  233.714677] ath: phy1: EIFS = 362
[  233.798536] ath: phy1: EIFS = 362
[  233.857524] ath: phy1: EIFS = 362
[  411.089061] ath: phy1: EIFS = 362
[  439.975550] ath: phy1: EIFS = 362
[  482.660241] ath: phy1: EIFS = 362
[  499.159808] ath: phy1: EIFS = 362
[  528.737322] ath: phy1: EIFS = 362
[  531.040201] ath: phy1: EIFS = 362
ubuntu@ubuntu:~$ dmesg | grep SLOT
[    3.320810] ath: phy0: SLOT = 396
[    3.327734] ath: phy0: SLOT = 880
[    3.327773] ath: phy0: SLOT = 880
[    3.328710] ath: phy0: SLOT = 880
[    3.498257] ath: phy0: SLOT = 880
[    3.508342] ath: phy0: SLOT = 880
[    4.326701] ath: phy1: SLOT = 396
[    4.426811] ath: phy1: SLOT = 880
[    4.471422] ath: phy1: SLOT = 880
[    5.528879] ath: phy0: SLOT = 880
[    5.705327] ath: phy1: SLOT = 880
[    5.771309] ath: phy1: SLOT = 880
[    7.772919] ath: phy0: SLOT = 880
[    8.490858] ath: phy1: SLOT = 880
[  230.336990] ath: phy1: SLOT = 880
[  230.417186] ath: phy1: SLOT = 880
[  233.287892] ath: phy1: SLOT = 880
[  233.375116] ath: phy1: SLOT = 880
[  233.460358] ath: phy1: SLOT = 880
[  233.542584] ath: phy1: SLOT = 880
[  233.627818] ath: phy1: SLOT = 880
[  233.713553] ath: phy1: SLOT = 880
[  233.797411] ath: phy1: SLOT = 880
[  233.856409] ath: phy1: SLOT = 396
[  411.087936] ath: phy1: SLOT = 396
[  439.974428] ath: phy1: SLOT = 1188
[  482.659112] ath: phy1: SLOT = 3432
[  499.158684] ath: phy1: SLOT = 396
[  528.736199] ath: phy1: SLOT = 264
[  531.039073] ath: phy1: SLOT = 528
ubuntu@ubuntu:~$ dmesg | grep ACK
[    3.320813] ath: phy0: ACK = 2816
[    3.327737] ath: phy0: ACK = 2816
[    3.327776] ath: phy0: ACK = 2816
[    3.328713] ath: phy0: ACK = 2816
[    3.498261] ath: phy0: ACK = 2816
[    3.508345] ath: phy0: ACK = 2816
[    4.326950] ath: phy1: ACK = 2816
[    4.427057] ath: phy1: ACK = 2816
[    4.471672] ath: phy1: ACK = 2816
[    5.528882] ath: phy0: ACK = 1584
[    5.705559] ath: phy1: ACK = 2816
[    5.771556] ath: phy1: ACK = 2816
[    7.772922] ath: phy0: ACK = 2816
[    8.491295] ath: phy1: ACK = 2816
[  230.337239] ath: phy1: ACK = 2816
[  230.417560] ath: phy1: ACK = 2816
[  233.288261] ath: phy1: ACK = 2816
[  233.375492] ath: phy1: ACK = 2816
[  233.460725] ath: phy1: ACK = 2816
[  233.542959] ath: phy1: ACK = 2816
[  233.628199] ath: phy1: ACK = 2816
[  233.713926] ath: phy1: ACK = 2816
[  233.797785] ath: phy1: ACK = 2816
[  233.856774] ath: phy1: ACK = 2816
[  411.088317] ath: phy1: ACK = 2816
[  439.974801] ath: phy1: ACK = 3608
[  482.659486] ath: phy1: ACK = 5852
[  499.159059] ath: phy1: ACK = 2816
[  528.736573] ath: phy1: ACK = 2684
[  531.039448] ath: phy1: ACK = 2948
ubuntu@ubuntu:~$ dmesg | grep CTS
[    3.320817] ath: phy0: CTS = 2112
[    3.327740] ath: phy0: CTS = 2112
[    3.327778] ath: phy0: CTS = 2112
[    3.328716] ath: phy0: CTS = 2112
[    3.498264] ath: phy0: CTS = 2112
[    3.508348] ath: phy0: CTS = 2112
[    4.327201] ath: phy1: CTS = 2112
[    4.427306] ath: phy1: CTS = 2112
[    4.471922] ath: phy1: CTS = 2112
[    5.528886] ath: phy0: CTS = 1584
[    5.705845] ath: phy1: CTS = 2112
[    5.771807] ath: phy1: CTS = 2112
[    7.772925] ath: phy0: CTS = 2112
[    8.491608] ath: phy1: CTS = 2112
[  230.337489] ath: phy1: CTS = 2112
[  230.417935] ath: phy1: CTS = 2112
[  233.288633] ath: phy1: CTS = 2112
[  233.375867] ath: phy1: CTS = 2112
[  233.461100] ath: phy1: CTS = 2112
[  233.543334] ath: phy1: CTS = 2112
[  233.628568] ath: phy1: CTS = 2112
[  233.714302] ath: phy1: CTS = 2112
[  233.798160] ath: phy1: CTS = 2112
[  233.857149] ath: phy1: CTS = 2112
[  411.088686] ath: phy1: CTS = 2112
[  439.975176] ath: phy1: CTS = 2904
[  482.659861] ath: phy1: CTS = 5148
[  499.159433] ath: phy1: CTS = 2112
[  528.736948] ath: phy1: CTS = 1980
[  531.039823] ath: phy1: CTS = 2244

3.18.1-0-g39ca484:

34-38 connect to network
85 iw phy1 set distance 0
103 iw phy1 set distance 2500
124 iw phy1 set distance 10000
136 iw phy1 set distance 0
151 iw phy1 set distance auto
418 iw phy1 set distance 1

ubuntu@ubuntu:~$ dmesg | grep SIFS
[    3.524569] ath: phy0: SIFS = 352
[    3.531926] ath: phy0: SIFS = 352
[    3.531949] ath: phy0: SIFS = 352
[    3.532888] ath: phy0: SIFS = 352
[    3.685783] ath: phy0: SIFS = 352
[    3.692893] ath: phy0: SIFS = 352
[    4.322885] ath: phy1: SIFS = 352
[    4.418620] ath: phy1: SIFS = 352
[    4.543096] ath: phy1: SIFS = 352
[    5.696903] ath: phy0: SIFS = 616
[    5.790980] ath: phy1: SIFS = 352
[    5.890458] ath: phy1: SIFS = 352
[    7.944968] ath: phy0: SIFS = 352
[    8.976938] ath: phy1: SIFS = 352
[   34.599055] ath: phy1: SIFS = 352
[   34.722985] ath: phy1: SIFS = 352
[   38.092467] ath: phy1: SIFS = 352
[   38.234812] ath: phy1: SIFS = 352
[   38.376045] ath: phy1: SIFS = 352
[   38.512264] ath: phy1: SIFS = 352
[   38.650106] ath: phy1: SIFS = 352
[   38.790964] ath: phy1: SIFS = 352
[   38.896613] ath: phy1: SIFS = 352
[   38.976422] ath: phy1: SIFS = 352
[   85.289139] ath: phy1: SIFS = 352
[  103.946550] ath: phy1: SIFS = 352
[  124.868407] ath: phy1: SIFS = 352
[  136.917336] ath: phy1: SIFS = 352
[  151.847839] ath: phy1: SIFS = 352
[  418.253111] ath: phy1: SIFS = 352
ubuntu@ubuntu:~$ dmesg | grep EIFS
[    3.524582] ath: phy0: EIFS = 362
[    3.531938] ath: phy0: EIFS = 362
[    3.531958] ath: phy0: EIFS = 362
[    3.532898] ath: phy0: EIFS = 362
[    3.685795] ath: phy0: EIFS = 362
[    3.692906] ath: phy0: EIFS = 362
[    4.352364] ath: phy1: EIFS = 362
[    4.420120] ath: phy1: EIFS = 362
[    4.546089] ath: phy1: EIFS = 362
[    5.696916] ath: phy0: EIFS = 92
[    5.792477] ath: phy1: EIFS = 362
[    5.891957] ath: phy1: EIFS = 362
[    7.944981] ath: phy0: EIFS = 362
[    8.979182] ath: phy1: EIFS = 362
[   34.600550] ath: phy1: EIFS = 362
[   34.725111] ath: phy1: EIFS = 362
[   38.094713] ath: phy1: EIFS = 362
[   38.237060] ath: phy1: EIFS = 362
[   38.378283] ath: phy1: EIFS = 362
[   38.514506] ath: phy1: EIFS = 362
[   38.652275] ath: phy1: EIFS = 362
[   38.793203] ath: phy1: EIFS = 362
[   38.898110] ath: phy1: EIFS = 362
[   38.978667] ath: phy1: EIFS = 362
[   85.291387] ath: phy1: EIFS = 362
[  103.948800] ath: phy1: EIFS = 362
[  124.870651] ath: phy1: EIFS = 362
[  136.919583] ath: phy1: EIFS = 362
[  151.850090] ath: phy1: EIFS = 362
[  418.255360] ath: phy1: EIFS = 362
ubuntu@ubuntu:~$ dmesg | grep SLOT
[    3.524574] ath: phy0: SLOT = 396
[    3.531930] ath: phy0: SLOT = 880
[    3.531951] ath: phy0: SLOT = 880
[    3.532890] ath: phy0: SLOT = 880
[    3.685787] ath: phy0: SLOT = 880
[    3.692897] ath: phy0: SLOT = 880
[    4.323133] ath: phy1: SLOT = 396
[    4.418869] ath: phy1: SLOT = 880
[    4.543424] ath: phy1: SLOT = 880
[    5.696908] ath: phy0: SLOT = 880
[    5.791226] ath: phy1: SLOT = 880
[    5.890708] ath: phy1: SLOT = 880
[    7.944972] ath: phy0: SLOT = 880
[    8.977308] ath: phy1: SLOT = 880
[   34.599299] ath: phy1: SLOT = 880
[   34.723360] ath: phy1: SLOT = 880
[   38.092838] ath: phy1: SLOT = 880
[   38.235185] ath: phy1: SLOT = 880
[   38.376412] ath: phy1: SLOT = 880
[   38.512632] ath: phy1: SLOT = 880
[   38.650481] ath: phy1: SLOT = 880
[   38.791328] ath: phy1: SLOT = 880
[   38.896858] ath: phy1: SLOT = 880
[   38.976798] ath: phy1: SLOT = 396
[   85.289513] ath: phy1: SLOT = 396
[  103.946926] ath: phy1: SLOT = 1188
[  124.868778] ath: phy1: SLOT = 3432
[  136.917710] ath: phy1: SLOT = 396
[  151.848216] ath: phy1: SLOT = 264
[  418.253486] ath: phy1: SLOT = 528
ubuntu@ubuntu:~$ dmesg | grep ACK
[    3.524577] ath: phy0: ACK = 2816
[    3.531933] ath: phy0: ACK = 2816
[    3.531954] ath: phy0: ACK = 2816
[    3.532893] ath: phy0: ACK = 2816
[    3.685790] ath: phy0: ACK = 2816
[    3.692901] ath: phy0: ACK = 2816
[    4.323633] ath: phy1: ACK = 2816
[    4.419369] ath: phy1: ACK = 2816
[    4.543966] ath: phy1: ACK = 2816
[    5.696911] ath: phy0: ACK = 1584
[    5.791726] ath: phy1: ACK = 2816
[    5.891204] ath: phy1: ACK = 2816
[    7.944976] ath: phy0: ACK = 2816
[    8.978065] ath: phy1: ACK = 2816
[   34.599798] ath: phy1: ACK = 2816
[   34.724036] ath: phy1: ACK = 2816
[   38.093587] ath: phy1: ACK = 2816
[   38.235935] ath: phy1: ACK = 2816
[   38.377157] ath: phy1: ACK = 2816
[   38.513382] ath: phy1: ACK = 2816
[   38.651231] ath: phy1: ACK = 2816
[   38.792089] ath: phy1: ACK = 2816
[   38.897360] ath: phy1: ACK = 2816
[   38.977543] ath: phy1: ACK = 2816
[   85.290262] ath: phy1: ACK = 2816
[  103.947675] ath: phy1: ACK = 3608
[  124.869526] ath: phy1: ACK = 5852
[  136.918459] ath: phy1: ACK = 2816
[  151.848963] ath: phy1: ACK = 2684
[  418.254235] ath: phy1: ACK = 2948
ubuntu@ubuntu:~$ dmesg | grep CTS
[    3.524580] ath: phy0: CTS = 2112
[    3.531936] ath: phy0: CTS = 2112
[    3.531956] ath: phy0: CTS = 2112
[    3.532896] ath: phy0: CTS = 2112
[    3.685793] ath: phy0: CTS = 2112
[    3.692904] ath: phy0: CTS = 2112
[    4.352065] ath: phy1: CTS = 2112
[    4.419869] ath: phy1: CTS = 2112
[    4.545878] ath: phy1: CTS = 2112
[    5.696915] ath: phy0: CTS = 1584
[    5.792237] ath: phy1: CTS = 2112
[    5.891706] ath: phy1: CTS = 2112
[    7.944979] ath: phy0: CTS = 2112
[    8.978811] ath: phy1: CTS = 2112
[   34.600306] ath: phy1: CTS = 2112
[   34.724739] ath: phy1: CTS = 2112
[   38.094337] ath: phy1: CTS = 2112
[   38.236687] ath: phy1: CTS = 2112
[   38.377908] ath: phy1: CTS = 2112
[   38.514132] ath: phy1: CTS = 2112
[   38.651980] ath: phy1: CTS = 2112
[   38.792831] ath: phy1: CTS = 2112
[   38.897860] ath: phy1: CTS = 2112
[   38.978292] ath: phy1: CTS = 2112
[   85.291012] ath: phy1: CTS = 2112
[  103.948427] ath: phy1: CTS = 2904
[  124.870276] ath: phy1: CTS = 5148
[  136.919210] ath: phy1: CTS = 2112
[  151.849713] ath: phy1: CTS = 1980
[  418.254985] ath: phy1: CTS = 2244

patch used for enabling output:

--- /a/drivers/net/wireless/ath/ath9k/hw.c
+++ /b/drivers/net/wireless/ath/ath9k/hw.c
@@ -919,30 +919,38 @@ static void ath9k_hw_init_interrupt_mask
 
 static void ath9k_hw_set_sifs_time(struct ath_hw *ah, u32 us)
 {
+	struct ath_common *common = ath9k_hw_common(ah);
 	u32 val = ath9k_hw_mac_to_clks(ah, us - 2);
 	val = min(val, (u32) 0xFFFF);
 	REG_WRITE(ah, AR_D_GBL_IFS_SIFS, val);
+	ath_warn(common, "SIFS = %d\n", val);
 }
 
 void ath9k_hw_setslottime(struct ath_hw *ah, u32 us)
 {
+	struct ath_common *common = ath9k_hw_common(ah);
 	u32 val = ath9k_hw_mac_to_clks(ah, us);
 	val = min(val, (u32) 0xFFFF);
 	REG_WRITE(ah, AR_D_GBL_IFS_SLOT, val);
+	ath_warn(common, "SLOT = %d\n", val);
 }
 
 void ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us)
 {
+	struct ath_common *common = ath9k_hw_common(ah);
 	u32 val = ath9k_hw_mac_to_clks(ah, us);
 	val = min(val, (u32) MS(0xFFFFFFFF, AR_TIME_OUT_ACK));
 	REG_RMW_FIELD(ah, AR_TIME_OUT, AR_TIME_OUT_ACK, val);
+	ath_warn(common, "ACK = %d\n", val);
 }
 
 void ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us)
 {
+	struct ath_common *common = ath9k_hw_common(ah);
 	u32 val = ath9k_hw_mac_to_clks(ah, us);
 	val = min(val, (u32) MS(0xFFFFFFFF, AR_TIME_OUT_CTS));
 	REG_RMW_FIELD(ah, AR_TIME_OUT, AR_TIME_OUT_CTS, val);
+	ath_warn(common, "CTS = %d\n", val);
 }
 
 static bool ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu)
@@ -1058,6 +1066,7 @@ void ath9k_hw_init_global_settings(struc
 		ath9k_hw_set_global_txtimeout(ah, ah->globaltxtimeout);
 
 	REG_WRITE(ah, AR_D_GBL_IFS_EIFS, ath9k_hw_mac_to_clks(ah, eifs));
+	ath_warn(common, "EIFS = %d\n", eifs);
 	REG_RMW(ah, AR_USEC,
 		(common->clockrate - 1) |
 		SM(rx_lat, AR_USEC_RX_LAT) |

@erikarn
Copy link
Collaborator

erikarn commented Jul 25, 2018 via email

@psyborg55
Copy link
Author

psyborg55 commented Jul 25, 2018

how to properly print that value because i doubt dec or hex strings would be much of a help?

from datasheet: default EIFS time 3480 -> run through this function

		eifs = REG_READ(ah, AR_D_GBL_IFS_EIFS)/
			common->clockrate;

should be 3480/40=87usec

clockrate was not 40, but 44 (2c)

so this will give EIFS=79.09

@erikarn
Copy link
Collaborator

erikarn commented Jul 25, 2018 via email

@psyborg55
Copy link
Author

psyborg55 commented Jul 25, 2018

mac to clcks = 2688202816

it's max should be 117MHz, but from the cpu clock table it seems possible to set any of the combinations
screenshot

@erikarn
Copy link
Collaborator

erikarn commented Jul 25, 2018 via email

@psyborg55
Copy link
Author

psyborg55 commented Jul 28, 2018

the value that is programmed in is ATH9K_CLOCK_RATE_2GHZ_OFDM, not 117 like it was for AR9287.
manually overriding this results in huge throughput degradation. maybe there are missing some initvals

update: dynack also works on 3.18 backport but there are other issues, possibly a well-known one: ack defaults to 64 S, setting distance to auto gives 61 S on both, but on 3.18 it works better at 67 S... +- kernel maths... or something with ath9k..

2dB RX loss on 4.4.2 (-68dBm vs -66dBm on 3.18)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants