xref: /freebsd/tools/tools/ath/athctrl.sh (revision abd87254)
1#! /bin/sh
2#
3# Set the IFS parameters for an interface configured for
4# point-to-point use at a specific distance.  Based on a
5# program by Gunter Burchardt.
6#
7#
8DEV=ath0
9d=0
10
11usage()
12{
13	echo "Usage: $0 [-i athX] [-d meters]"
14	exit 2
15}
16
17args=`getopt d:i: $*`
18test $? -ne 0 && usage
19
20set -- $args
21for i; do
22	case "$i" in
23	-i)	DEV="$2"; shift; shift;;
24	-d)	d="$2"; shift; shift;;
25	--)	shift; break;
26	esac
27done
28
29test $d -eq 0 && usage
30
31slottime=`expr 9 + \( $d / 300 \)`
32if expr \( $d % 300 \) != 0 >/dev/null 2>&1; then
33	slottime=`expr $slottime + 1`
34fi
35timeout=`expr $slottime \* 2 + 3`
36
37printf "Setup IFS parameters on interface ${DEV} for %i meter p-2-p link\n" $d
38ATHN=`echo $DEV | sed 's/ath//'`
39sysctl dev.ath.$ATHN.slottime=$slottime
40sysctl dev.ath.$ATHN.acktimeout=$timeout
41sysctl dev.ath.$ATHN.ctstimeout=$timeout
42