mirror of https://github.com/aredn/aredn.git
aredn: enable ath9k auto distance capability (#367)
This commit is contained in:
parent
f833b38e04
commit
d5be7814b3
|
@ -104,3 +104,4 @@ CONFIG_PACKAGE_kmod-ipip=y
|
||||||
CONFIG_IMAGEOPT=y
|
CONFIG_IMAGEOPT=y
|
||||||
CONFIG_VERSIONOPT=y
|
CONFIG_VERSIONOPT=y
|
||||||
CONFIG_VERSION_DIST="AREDN"
|
CONFIG_VERSION_DIST="AREDN"
|
||||||
|
CONFIG_PACKAGE_ATH_DYNACK=y
|
||||||
|
|
|
@ -189,12 +189,19 @@ $parms{wifi_txpower} = $wifi_txpower;
|
||||||
|
|
||||||
if(($parms{button_apply} or $parms{button_save}) and $wifi_enable )
|
if(($parms{button_apply} or $parms{button_save}) and $wifi_enable )
|
||||||
{
|
{
|
||||||
if($wifi_distance < 1 or $wifi_distance =~ /\D/)
|
if($wifi_distance < 0 or $wifi_distance =~ /\D/)
|
||||||
{
|
{
|
||||||
push (@errors, "invalid distance value");
|
push (@errors, "invalid distance value");
|
||||||
} else {
|
} else {
|
||||||
$cmd = "";
|
$cmd = "";
|
||||||
$cmd .= "iw phy ${phy} set distance $wifi_distance >/dev/null 2>&1;";
|
if ( $wifi_distance eq "0" )
|
||||||
|
{
|
||||||
|
$cmd .= "iw phy ${phy} set distance auto >/dev/null 2>&1;";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cmd .= "iw phy ${phy} set distance $wifi_distance >/dev/null 2>&1;";
|
||||||
|
}
|
||||||
$cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;";
|
$cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;";
|
||||||
system $cmd;
|
system $cmd;
|
||||||
}
|
}
|
||||||
|
@ -555,12 +562,8 @@ function updDist(x) {
|
||||||
document.getElementsByName('wifi_distance_disp_meters')[0].value = xc;
|
document.getElementsByName('wifi_distance_disp_meters')[0].value = xc;
|
||||||
dist_meters.value = xc;
|
dist_meters.value = xc;
|
||||||
|
|
||||||
// if default, then ALERT!
|
// default of 0 means 'auto', so full range is always dist-norm
|
||||||
if(dist_meters.value==0) {
|
distBox.className = 'dist-norm';
|
||||||
distBox.className = 'dist-alert';
|
|
||||||
} else {
|
|
||||||
distBox.className = 'dist-norm';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -757,15 +760,15 @@ if ( ${wifi_enable} )
|
||||||
for($i = wifi_maxpower($wifi_channel); $i >= 1; --$i) { selopt($i+$txpoweroffset ." dBm", $i, $wifi_txpower) }
|
for($i = wifi_maxpower($wifi_channel); $i >= 1; --$i) { selopt($i+$txpoweroffset ." dBm", $i, $wifi_txpower) }
|
||||||
print "</select> <a href=\"/help.html\#power\" target=\"_blank\"><img src=\"/qmark.png\"></a></td></tr>\n";
|
print "</select> <a href=\"/help.html\#power\" target=\"_blank\"><img src=\"/qmark.png\"></a></td></tr>\n";
|
||||||
|
|
||||||
print "<tr id='dist' class='dist-norm'><td>Distance to<br />FARTHEST Neighbor</td>\n";
|
print "<tr id='dist' class='dist-norm'><td>Distance to<br/>FARTHEST Neighbor<br/><h3>'0' is auto</h3></td>\n";
|
||||||
|
|
||||||
$wifi_distance=int($wifi_distance); # in meters
|
$wifi_distance=int($wifi_distance); # in meters
|
||||||
$wifi_distance_disp_km=int($wifi_distance/1000);
|
$wifi_distance_disp_km=int($wifi_distance/1000);
|
||||||
$wifi_distance_disp_miles=sprintf("%.2f",$wifi_distance_disp_km*.621371192);
|
$wifi_distance_disp_miles=sprintf("%.2f",$wifi_distance_disp_km*.621371192);
|
||||||
|
|
||||||
print "<td><input disabled size=6 type=text name='wifi_distance_disp_miles' value='$wifi_distance_disp_miles' title='Distance to the farthest neighbor'> miles<br />";
|
print "<td><input disabled size=6 type=text name='wifi_distance_disp_miles' value='$wifi_distance_disp_miles' title='Distance to the farthest neighbor'> mi<br />";
|
||||||
print "<input disabled size=6 type=text size=4 name='wifi_distance_disp_km' value='$wifi_distance_disp_km' title='Distance to the farthest neighbor'> kilometers<br />";
|
print "<input disabled size=6 type=text size=4 name='wifi_distance_disp_km' value='$wifi_distance_disp_km' title='Distance to the farthest neighbor'> km<br />";
|
||||||
print "<input disabled size=6 type=text size=4 name='wifi_distance_disp_meters' value='$wifi_distance' title='Distance to the farthest neighbor'> meters<br />";
|
print "<input disabled size=6 type=text size=4 name='wifi_distance_disp_meters' value='$wifi_distance' title='Distance to the farthest neighbor'> m<br />";
|
||||||
|
|
||||||
print "<input id='distance_slider' type='range' min='0' max='150' step='1' value='$wifi_distance_disp_km' oninput='updDist(this.value)' onchange='updDist(this.value)' /><br />";
|
print "<input id='distance_slider' type='range' min='0' max='150' step='1' value='$wifi_distance_disp_km' oninput='updDist(this.value)' onchange='updDist(this.value)' /><br />";
|
||||||
print "<input type='hidden' size='6' name='wifi_distance' value='$wifi_distance' />";
|
print "<input type='hidden' size='6' name='wifi_distance' value='$wifi_distance' />";
|
||||||
|
|
|
@ -371,12 +371,18 @@ The <strong>Distance</strong> setting adjusts the RF retry timer
|
||||||
to define how long the transmitter will wait for an acknowledgement
|
to define how long the transmitter will wait for an acknowledgement
|
||||||
from a Neighbor station. If the distance parameter is too short, then
|
from a Neighbor station. If the distance parameter is too short, then
|
||||||
the transmitter will send duplicate data packets before the acknowledgement
|
the transmitter will send duplicate data packets before the acknowledgement
|
||||||
has had time to return. This value is only applicable to nodes that can
|
has had time to return. If the distance parameter is too long, then the
|
||||||
|
transmitter will wait extra time before considering the data lost to re-transmit.
|
||||||
|
This value is only applicable to nodes that can
|
||||||
be communicated with directly over RF and not multiple hop nodes on the
|
be communicated with directly over RF and not multiple hop nodes on the
|
||||||
greater mesh network. The value should be set to the distance in meters
|
greater mesh network. The value should be set to the distance in meters
|
||||||
to the farthest direct RF node you expect to communicate with. Change
|
to the farthest direct RF node you expect to communicate with. Change
|
||||||
the distance value by moving the slider. Distance values will be in multiples
|
the distance value by moving the slider. Distance values will be in multiples
|
||||||
of 1000 meters (approximately 0.62 miles). A value of zero is not allowed.
|
of 1000 meters (approximately 0.62 miles). A value of '0' will cause
|
||||||
|
the radio to auto determine the RF retry timer based on measuring the
|
||||||
|
actual time it takes acknowledgement packets to be received back. The
|
||||||
|
automatic timer is set using a Exponential Weighted Moving Average (EWMA) method.
|
||||||
|
'auto' is the default setting and in most all situations the optimal setting.
|
||||||
The best way to test an optimal distance settings is to do an 'iperf'
|
The best way to test an optimal distance settings is to do an 'iperf'
|
||||||
test directly between 2 nodes to measure the performance of this RF
|
test directly between 2 nodes to measure the performance of this RF
|
||||||
channel. Try different distance settings to peak out the iperf throughput.
|
channel. Try different distance settings to peak out the iperf throughput.
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
Index: openwrt/package/kernel/mac80211/patches/569-dynack-aredn-long-dist-defaults.patch
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ openwrt/package/kernel/mac80211/patches/569-dynack-aredn-long-dist-defaults.patch
|
||||||
|
@@ -0,0 +1,32 @@
|
||||||
|
+--- a/drivers/net/wireless/ath/ath9k/dynack.c
|
||||||
|
++++ b/drivers/net/wireless/ath/ath9k/dynack.c
|
||||||
|
+@@ -21,7 +21,8 @@
|
||||||
|
+ #define COMPUTE_TO (5 * HZ)
|
||||||
|
+ #define LATEACK_DELAY (10 * HZ)
|
||||||
|
+ #define LATEACK_TO 256
|
||||||
|
+-#define MAX_DELAY 300
|
||||||
|
++/* AREDN max distance set to 150km */
|
||||||
|
++#define MAX_DELAY 1054
|
||||||
|
+ #define EWMA_LEVEL 96
|
||||||
|
+ #define EWMA_DIV 128
|
||||||
|
+
|
||||||
|
+@@ -293,7 +294,8 @@
|
||||||
|
+ void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
|
||||||
|
+ {
|
||||||
|
+ /* ackto = slottime + sifs + air delay */
|
||||||
|
+- u32 ackto = 9 + 16 + 64;
|
||||||
|
++ /* AREDN starting point is 20km */
|
||||||
|
++ u32 ackto = 9 + 16 + 171;
|
||||||
|
+ struct ath_dynack *da = &ah->dynack;
|
||||||
|
+
|
||||||
|
+ an->ackto = ackto;
|
||||||
|
+@@ -328,7 +330,8 @@
|
||||||
|
+ void ath_dynack_reset(struct ath_hw *ah)
|
||||||
|
+ {
|
||||||
|
+ /* ackto = slottime + sifs + air delay */
|
||||||
|
+- u32 ackto = 9 + 16 + 64;
|
||||||
|
++ /* AREDN starting point is 20km */
|
||||||
|
++ u32 ackto = 9 + 16 + 171;
|
||||||
|
+ struct ath_dynack *da = &ah->dynack;
|
||||||
|
+
|
||||||
|
+ da->lto = jiffies;
|
||||||
|
Index: openwrt/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
|
||||||
|
===================================================================
|
||||||
|
--- openwrt.orig/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
|
||||||
|
+++ openwrt/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
|
||||||
|
@@ -788,7 +788,11 @@ drv_mac80211_setup() {
|
||||||
|
|
||||||
|
iw phy "$phy" set antenna $txantenna $rxantenna >/dev/null 2>&1
|
||||||
|
iw phy "$phy" set antenna_gain $antenna_gain
|
||||||
|
- iw phy "$phy" set distance "$distance"
|
||||||
|
+ if [ $distance -eq 0 -a -d /sys/kernel/debug/ieee80211/$phy/ath9k ]; then
|
||||||
|
+ iw phy "$phy" set distance auto
|
||||||
|
+ else
|
||||||
|
+ iw phy "$phy" set distance "$distance"
|
||||||
|
+ fi
|
||||||
|
|
||||||
|
[ -n "$frag" ] && iw phy "$phy" set frag "${frag%%.*}"
|
||||||
|
[ -n "$rts" ] && iw phy "$phy" set rts "${rts%%.*}"
|
|
@ -21,3 +21,4 @@
|
||||||
709-iperf-fw-restart.patch
|
709-iperf-fw-restart.patch
|
||||||
710-no-ping6-traceroute6.patch
|
710-no-ping6-traceroute6.patch
|
||||||
711-nano-xw-switch-config.patch
|
711-nano-xw-switch-config.patch
|
||||||
|
712-auto-distance-settings.patch
|
||||||
|
|
Loading…
Reference in New Issue