diff options
author | fjoe <fjoe@FreeBSD.org> | 2004-03-16 22:29:26 +0000 |
---|---|---|
committer | fjoe <fjoe@FreeBSD.org> | 2004-03-16 22:29:26 +0000 |
commit | 7d2d6deecf36ab78dace21a1160668a957723bb8 (patch) | |
tree | cd23432ac3c0466312aa1487bc5aefb6a3867b4c | |
parent | 8a75d9d9aa221d8d196e66e8c64407e595f15722 (diff) | |
download | FreeBSD-src-7d2d6deecf36ab78dace21a1160668a957723bb8.zip FreeBSD-src-7d2d6deecf36ab78dace21a1160668a957723bb8.tar.gz |
Implement "arlconfig arlX quality".
Man pages fixes.
Submitted by: Stanislav A. Svirid <count@riss-telecom.ru>
-rw-r--r-- | sys/dev/arl/if_arl.c | 109 | ||||
-rw-r--r-- | sys/dev/arl/if_arl_isa.c | 12 | ||||
-rw-r--r-- | sys/dev/arl/if_arlreg.h | 23 | ||||
-rw-r--r-- | usr.sbin/arlconfig/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/arlconfig/arlconfig.8 | 48 | ||||
-rw-r--r-- | usr.sbin/arlconfig/arlconfig.c | 156 | ||||
-rw-r--r-- | usr.sbin/arlcontrol/arlcontrol.8 | 48 | ||||
-rw-r--r-- | usr.sbin/arlcontrol/arlcontrol.c | 156 |
8 files changed, 226 insertions, 328 deletions
diff --git a/sys/dev/arl/if_arl.c b/sys/dev/arl/if_arl.c index 63bb4b7..c9759b2 100644 --- a/sys/dev/arl/if_arl.c +++ b/sys/dev/arl/if_arl.c @@ -1,10 +1,16 @@ /* - * $RISS: if_arl/dev/arl/if_arl.c,v 1.5 2004/01/22 12:49:05 frol Exp $ + * $RISS: if_arl/dev/arl/if_arl.c,v 1.7 2004/03/16 04:43:27 count Exp $ */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_inet.h" + +#ifdef INET +#define ARLCACHE +#endif + #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> @@ -26,10 +32,16 @@ __FBSDID("$FreeBSD$"); #include <net/if_arp.h> #include <net/if_media.h> #include <net/ethernet.h> -#include <net/bpf.h> + +#ifdef INET #include <netinet/in.h> -#include <netinet/if_ether.h> +#include <netinet/in_systm.h> +#include <netinet/in_var.h> +#include <netinet/ip.h> +#endif + +#include <net/bpf.h> #include <machine/clock.h> @@ -48,7 +60,7 @@ __FBSDID("$FreeBSD$"); #define ARL_CHANNEL(sc) \ { \ D(("channel ctrl %x reg %x\n", sc->arl_control, ar->controlRegister)); \ - ar->controlRegister = (sc->arl_control ^= ARL_CHANNEL_ATTENTION); \ + ar->controlRegister = (sc->arl_control ^= ARL_CHANNEL_ATTENTION); \ } /* @@ -60,7 +72,7 @@ __FBSDID("$FreeBSD$"); #define BPF_MTAP(_ifp,_m) \ do { \ if ((_ifp)->if_bpf) \ - bpf_mtap((_ifp), (_m)); \ + bpf_mtap((_ifp), (_m)); \ } while (0) #endif @@ -90,6 +102,11 @@ static void arl_read (struct arl_softc *, caddr_t, int); static void arl_recv (struct arl_softc *); static struct mbuf* arl_get (caddr_t, int, int, struct ifnet *); +#ifdef ARLCACHE +static void arl_cache_store (struct arl_softc *, struct ether_header *, + u_int8_t, u_int8_t, int); +#endif + devclass_t arl_devclass; /* @@ -279,22 +296,7 @@ arl_config(sc) ar->commandByte = 1; ARL_CHANNEL(sc); DELAY(ARDELAY1); -/* - if (arl_command(sc) != 0) { - int i; - for (i = 0x168; ar->diagnosticInfo == 0 && i; i--) { - DELAY(ARDELAY1); - } - - if (i != 0 && ar->diagnosticInfo != 0xff) - printf("arl%d: config error\n", sc->arl_unit); - else if (i == 0) - printf("arl%d: config timeout\n", sc->arl_unit); - - } else - printf("arl%d: config failed\n", sc->arl_unit); -*/ if (arl_command(sc)) { D(("config failed\n")); return; @@ -320,7 +322,7 @@ arl_config(sc) ar->spreadingCode, ar->registrationMode)); /* clear quality stat */ - bzero(&(aqual), ARLAN_MAX_QUALITY * sizeof(aqual[0])); + bzero(sc->arl_sigcache, MAXARLCACHE * sizeof(struct arl_sigcache)); } /* @@ -443,17 +445,17 @@ arl_ioctl(ifp, cmd, data) #undef GET_COPY_PARAM #undef GET_PARAM break; - +#ifdef ARLCACHE case SIOCGARLQLT: user = (void *)ifr->ifr_data; - for (count = 0; count < sizeof(struct arl_quality); count++) { + for (count = 0; count < sizeof(sc->arl_sigcache); count++) { if (fubyte(user + count) < 0) return (EFAULT); } while (ar->interruptInProgress) ; /* wait */ - bcopy(&(aqual), (void *)ifr->ifr_data, sizeof(aqual)); + bcopy(&(sc->arl_sigcache), (void *)ifr->ifr_data, sizeof(sc->arl_sigcache)); break; - +#endif case SIOCGARLSTB: user = (void *)ifr->ifr_data; for (count = 0; count < sizeof(struct arl_stats); count++) { @@ -802,6 +804,11 @@ arl_read(sc, buf, len) if (m == 0) return; +#ifdef ARLCACHE + arl_cache_store(sc, eh, ar->rxQuality & 0x0f, + (ar->rxQuality & 0xf0) >> 4, ARLCACHE_RX); +#endif + #if __FreeBSD_version < 500100 ether_input(ifp, eh, m); #else @@ -858,13 +865,15 @@ arl_intr(arg) ifp->if_flags &= ~IFF_OACTIVE; arl_start(ifp); ar->txStatusVector = 0; -/* (sc->quality.txLevel)[ar->txAckQuality & 0x0f]++; - (sc->quality.txQuality)[(ar->txAckQuality & 0xf0) >> 4]++;*/ +#ifdef ARLCACHE + arl_cache_store(sc, + (struct ether_header *)(sc->arl_tx), + ar->txAckQuality & 0x0f, + (ar->txAckQuality & 0xf0) >> 4, ARLCACHE_TX); +#endif } if (ar->rxStatusVector) { -/* (sc->quality.rxLevel)[ar->rxQuality & 0x0f]++; - (sc->quality.rxQuality)[(ar->rxQuality & 0xf0) >> 4]++; */ if (ar->rxStatusVector == 1) { /* it is data frame */ arl_recv(sc); arl_read(sc, sc->arl_rx, sc->rx_len); @@ -971,3 +980,45 @@ arl_release_resources(dev) sc->irq_res = 0; } } + +#ifdef ARLCACHE +static void +arl_cache_store(sc, eh, level, quality, dir) + struct arl_softc *sc; + struct ether_header *eh; + u_int8_t level; + u_int8_t quality; + int dir; +{ + int i; + static int cache_slot = 0; + static int wrapindex = 0; + + if ((ntohs(eh->ether_type) != ETHERTYPE_IP)) { + return; + } + + for (i = 0; i < MAXARLCACHE; i++) { + if (! bcmp(dir == ARLCACHE_RX ? eh->ether_shost : eh->ether_dhost, + sc->arl_sigcache[i].macsrc, 6) ) { + break; + } + } + + if (i < MAXARLCACHE) { + cache_slot = i; + } + else { + if (wrapindex == MAXARLCACHE) { + wrapindex = 0; + } + cache_slot = wrapindex++; + } + + bcopy(dir == ARLCACHE_RX ? eh->ether_shost : eh->ether_dhost, + sc->arl_sigcache[cache_slot].macsrc, 6); + + sc->arl_sigcache[cache_slot].level[dir] = level; + sc->arl_sigcache[cache_slot].quality[dir] = quality; +} +#endif diff --git a/sys/dev/arl/if_arl_isa.c b/sys/dev/arl/if_arl_isa.c index 434407d..3cb2a88 100644 --- a/sys/dev/arl/if_arl_isa.c +++ b/sys/dev/arl/if_arl_isa.c @@ -1,10 +1,16 @@ /* - * $RISS: if_arl/dev/arl/if_arl_isa.c,v 1.4 2004/01/22 12:08:48 count Exp $ + * $RISS: if_arl/dev/arl/if_arl_isa.c,v 1.7 2004/03/16 05:30:38 count Exp $ */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_inet.h" + +#ifdef INET +#define ARLCACHE +#endif + #include <sys/param.h> #include <sys/systm.h> #include <sys/socket.h> @@ -125,7 +131,7 @@ arl_isa_identify (driver_t *driver, device_t parent) u_int16_t free_mem = 0xFFFF; if (bootverbose) - printf("in identify\n"); + printf("arl: in identify\n"); /* Try avoid already added devices */ for (i = 0; (child = device_find_child(parent, "arl", i)) != NULL; i++) { @@ -263,10 +269,10 @@ arl_isa_probe (device_t dev) if (!arcfg.channelSet) arcfg.channelSet = ar->defaultChannelSet; GET_ARL_PARAM(channelNumber); - GET_ARL_PARAM(registrationMode); GET_ARL_PARAM(spreadingCode); GET_ARL_PARAM(priority); GET_ARL_PARAM(receiveMode); + arcfg.registrationMode = 1; /* set default TMA mode */ arcfg.txRetry = 0; /* use default */ strncpy(arcfg.name, ar->name, ARLAN_NAME_SIZE); diff --git a/sys/dev/arl/if_arlreg.h b/sys/dev/arl/if_arlreg.h index 6c057aa..368dc55 100644 --- a/sys/dev/arl/if_arlreg.h +++ b/sys/dev/arl/if_arlreg.h @@ -1,5 +1,5 @@ /* - * $RISS: if_arl/dev/arl/if_arlreg.h,v 1.2 2004/01/22 09:18:13 count Exp $ + * $RISS: if_arl/dev/arl/if_arlreg.h,v 1.4 2004/03/16 04:43:27 count Exp $ * $FreeBSD$ */ @@ -230,13 +230,17 @@ struct arl_req { struct arl_cfg_param cfg; }; -#define ARLAN_MAX_QUALITY 16 +#ifdef ARLCACHE +#define MAXARLCACHE 16 +#define ARLCACHE_RX 0 +#define ARLCACHE_TX 1 -struct arl_quality { - u_int8_t macsrc[6]; - int rx_quality; - int tx_quality; +struct arl_sigcache { + u_int8_t macsrc[6]; /* unique MAC address for entry */ + u_int8_t level[2]; + u_int8_t quality[2]; }; +#endif #define ARLAN_SET_name 0x0001 #define ARLAN_SET_sid 0x0002 @@ -270,8 +274,10 @@ struct arl_softc { int tx_len; u_char arl_rx[2048]; int rx_len; - - struct arl_quality quality[ARLAN_MAX_QUALITY]; + +#ifdef ARLCACHE + struct arl_sigcache arl_sigcache[MAXARLCACHE]; +#endif }; #endif @@ -280,7 +286,6 @@ struct arl_softc { #define ar sc->arl_mem #define arcfg sc->arl_cfg -#define aqual sc->quality #define ARDELAY 10000 #define ARDELAY1 50000 diff --git a/usr.sbin/arlconfig/Makefile b/usr.sbin/arlconfig/Makefile index 94a03a3..b47b94b 100644 --- a/usr.sbin/arlconfig/Makefile +++ b/usr.sbin/arlconfig/Makefile @@ -5,7 +5,7 @@ PROG= arlconfig SRCS= arlconfig.c -CFLAGS= -I${.CURDIR}/../../sys +CFLAGS= -I${.CURDIR}/../../sys -DARLCACHE MAN= arlconfig.8 .include <bsd.prog.mk> diff --git a/usr.sbin/arlconfig/arlconfig.8 b/usr.sbin/arlconfig/arlconfig.8 index 09b9771..7858b12 100644 --- a/usr.sbin/arlconfig/arlconfig.8 +++ b/usr.sbin/arlconfig/arlconfig.8 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 25, 2003 +.Dd March 15, 2004 .Dt ARLCONFIG 8 i386 .Os .Sh NAME @@ -38,6 +38,8 @@ .Nd configure Aironet Arlan 655 device .Sh SYNOPSIS .Nm +.Ar iface +.Nm .Ar iface Cm name Ar name .Nm .Ar iface Cm sid Ar SID @@ -60,7 +62,7 @@ .Nm .Ar iface Cm stat .Nm -.Ar iface Cm quality Ar seconds [ Cm count Ar <count> ] +.Ar iface Cm quality .Sh DESCRIPTION The .Nm @@ -91,7 +93,11 @@ etc.) and must be specified. .Sh OPTIONS The options are as follows: .Bl -tag -width indent -.It Cm name Ar name +.It Ar iface +Display current settings of specified wireless interface. +This retrieves current card settings from the driver and prints +them out. +.It Ar iface Cm name Ar name Set .Ar Device Name . This @@ -104,7 +110,7 @@ If you choose to assign a name, while operating in .Ar TMA mode, the name will appear in the Arlan Access Point's Registration Table. Duplicate names are allowed. -.It Cm sid Ar SID +.It Ar iface Cm sid Ar SID Set .Ar System Identifier. The System Identifier @@ -127,7 +133,7 @@ SID is Since nodes will only receive packets from other nodes with a matching SID, you must make sure that the Arlan 655 Client Card is set the same SID as other nodes on your network. -.It Cm mode Ar mode ( Cm 640 | 655 ) +.It Ar iface Cm mode Ar mode ( Cm 640 | 655 ) Use .Ar operating mode parameter to specify whether you are operating in @@ -146,9 +152,9 @@ mode. .It PSP Ta Power save mode .El .!!! -.It Cm country Ar country ( Cm 9-15 ) -.It Cm channel Ar channel -.It Cm freq Ar freq ( Cm 2412, 2427, 2442, 2457, 2465 ) +.It Ar iface Cm country Ar country ( Cm 9-15 ) +.It Ar iface Cm channel Ar channel +.It Ar iface Cm freq Ar freq ( Cm 2412, 2427, 2442, 2457, 2465 ) Chose .Ar country , channel , freq parameters that depend on the @@ -170,8 +176,8 @@ according to the following table: .It "U.K. " Ta 15 Ta "2460" .It "Spain " Ta 15 Ta "2460" .El -.It Cm bitrate Ar bitrate ( Cm 0-4) -.It Cm spread Ar spread Cm ( 354, 500, 1000, 2000 ) +.It Ar iface Cm bitrate Ar bitrate ( Cm 0-4) +.It Ar iface Cm spread Ar spread Cm ( 354, 500, 1000, 2000 ) Set device operating bitrate or spread. .Bl -column ".Em Rate" ".Em Spread" ".Em kb/s" -offset indent indent .Em "Rate Spread kb/s" @@ -181,7 +187,7 @@ Set device operating bitrate or spread. .It 3 Ta 1000 Ta 1000 .It 4 Ta 2000 Ta 2000 .El -.It Cm priority Ar priority ( Cm normal, high, highest ) +.It Ar iface Cm priority Ar priority ( Cm normal, high, highest ) Use the .Ar priority parameter to set the priority of the Atlan 655 Radio Media Access Control @@ -196,21 +202,19 @@ to transmit at the same time. The percentage of units on your network that you set to other than .Dq normal should be kept small - 10 percent or less. -.It Cm stat +.It Ar iface Cm stat Print internal Arlan 655 statistics block. -.It Cm quality Ar seconds [ Cm count Ar <count> ] -Perform link quality test during -.Ar seconds -transmitting -.Ar count -packets. -Currently is broken. +.It Ar iface Cm quality +Display the cached signal level and quality mantained by the +.Xr arl 4 +driver . The driver retains information about quality and level for packets received from different hosts. Also driver extract values from ACK packets. .El .Sh EXAMPLES .Bd -literal -offset indent -alrlconfig arl0 name NODE1 sid 4 freq 2442 -arlconfig arl0 quality 10 seconds -arlconfig arl0 status +arlconfig arl0 name NODE1 sid 4 freq 2442 +arlconfig arl0 quality +arlconfig arl0 stat +arlconfig arl0 .Pp You can configure Arlan 655 card from /etc/start_if.arl0. For example: .Pp diff --git a/usr.sbin/arlconfig/arlconfig.c b/usr.sbin/arlconfig/arlconfig.c index 4ab5ca9..9055ddaa 100644 --- a/usr.sbin/arlconfig/arlconfig.c +++ b/usr.sbin/arlconfig/arlconfig.c @@ -1,5 +1,5 @@ /* - * $RISS: if_arl/arlconfig/arlconfig.c,v 1.3 2003/01/13 07:23:25 count Exp $ + * $RISS: if_arl/arlconfig/arlconfig.c,v 1.5 2004/03/16 05:00:21 count Exp $ */ #include <sys/cdefs.h> @@ -205,9 +205,10 @@ usage() #endif fprintf(stderr, "or: %s <ifname> stat\n", progname); fprintf(stderr, "\tprint internal arlan statistics block\n"); - fprintf(stderr, "or: %s <ifname> quality <seconds> [count <count>]\n", - progname); - fprintf(stderr, "\tprint receive packet level and quality with interval\n"); +#ifdef ARLCACHE + fprintf(stderr,"or: %s <ifname> quality\n", progname); + fprintf(stderr,"\tprint receive packet level and quality\n"); +#endif exit(0); } @@ -307,105 +308,31 @@ print_stb( struct arl_stats stb ) stb.numNACKReceived); } -#ifdef ARL_QUALITY +#ifdef ARLCACHE void -print_qlt(struct arl_quality qlt, int count) +print_qlt(struct arl_sigcache *qlt) { - int i, s; - int v, v1; - time_t t; - int minLevel, maxLevel, avgLevel; - int minQuality, maxQuality, avgQuality; - - t = time(NULL); - localtime(&t); - printf("#%d Current date-time: %s", count, ctime(&t)); - printf(" %-39s %s\n","Receive Level","Receive Quality"); - printf( -" pkts 0.......10 11............100 > pkts 0.......10 11............100 >\n"\ -" -----+----------+-----------------+--- -----+----------+-----------------+---\n"); - - minLevel = 16; - maxLevel = 0; - avgLevel = 0; - minQuality = 16; - maxQuality = 0; - avgQuality = 0; - - for (i = 0, s = 0; i < ARLAN_MAX_QUALITY; i++) { - v = qlt.rxLevel[i]; - if (v) { - if (i < minLevel) - minLevel = i; - if (i > maxLevel) - maxLevel = i; - avgLevel += v*i; - printf(" %-4d %x", v, i); - } else - printf(" o %x", i); - s += v; - if (v < 10) - ; - else if (v < 100) - v = 10 + ((v-10) * 20) / 90; - else if (v < 1000) - v = 31; - else - v = 32; - v1 = v; - while (v) { - printf("*"); - v--; - } - - v = 33 - v1; - while (v) { - printf(" "); - v--; - } - - v = qlt.rxQuality[i]; - if (v) { - if (i < minQuality) - minQuality = i; - if (i > maxQuality) - maxQuality = i; - avgQuality += v*i; - printf("%-4d %x", v, i); - } else - printf("o %x", i); - - if (v < 10) - ; - else if (v < 100) - v = 10 + ((v-10) * 20) / 90; - else if (v < 1000) - v = 31; - else - v = 32; - } - v1 = v; - while (v) { - printf("*"); - v--; - } - + int i; + u_int8_t zero[6] = {0, 0, 0, 0, 0, 0}; + + for (i = 0; i < MAXARLCACHE && bcmp(qlt->macsrc, zero, 6); i++) { + printf("[%d]:", i+1); + printf(" %02x:%02x:%02x:%02x:%02x:%02x,", + qlt->macsrc[0]&0xff, + qlt->macsrc[1]&0xff, + qlt->macsrc[2]&0xff, + qlt->macsrc[3]&0xff, + qlt->macsrc[4]&0xff, + qlt->macsrc[5]&0xff); + printf(" rx lvl/qlty: %d/%d,", qlt->level[ARLCACHE_RX], + qlt->quality[ARLCACHE_RX]); + printf(" tx lvl/qlty: %d/%d", qlt->level[ARLCACHE_TX], + qlt->quality[ARLCACHE_TX]); printf("\n"); + qlt++; } - printf(" -----+----------+-----------------+--- -----+----------+-----------------+---\n"); - if (minLevel > 15) - minLevel = 0; - if (minQuality > 15) - minQuality = 0; - printf("\tPackets count %-6d\n", s); - if (!s) - s++; - printf("\tLevel min %d/avg %d/max %d\n", - minLevel, avgLevel/s, maxLevel); - printf("\tQuality min %d/avg %d/max %d\n", - minQuality, avgQuality/s, maxQuality); } -#endif /* ARL_QUALITY */ +#endif int main(int argc, char *argv[]) @@ -414,11 +341,10 @@ main(int argc, char *argv[]) struct arl_req arl_io; struct ether_addr *ea; struct arl_stats stb; - /*static arl_quality qlt;*/ + struct arl_sigcache qlt[MAXARLCACHE]; int sd, argind, val = -1; long val2; char *param, *value, *value2; - /*int end_count, i;*/ if (argc < 2) usage(); @@ -448,30 +374,18 @@ main(int argc, char *argv[]) print_stb(stb); exit(0); } -#ifdef ARL_QUALITY - if (!strcasecmp(argv[2],"quality") && argc > 3) { - val = atoi(argv[3]); - if (val < 0 || val >= 3601) - err(1,"Bad time range"); - end_count = 0; - if (argc > 5 && !strcasecmp(argv[4], "count")) - end_count = atoi(argv[5]); +#ifdef ARLCACHE + if (!strcasecmp( argv[2],"quality")) { printf("\n"); - i = 0; - while (i < end_count || !end_count) { /* loop */ - if (i++) - sleep(val); - strncpy(ifr.ifr_name, - argv[1], sizeof(ifr.ifr_name)); - ifr.ifr_addr.sa_family = AF_INET; - ifr.ifr_data = (caddr_t)&qlt; - if (ioctl(sd, SIOCGARLQLT, (caddr_t)&ifr)) - err(1,"Get QLT"); - print_qlt(qlt, i); - } + strncpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name)); + ifr.ifr_addr.sa_family = AF_INET; + ifr.ifr_data = (caddr_t)qlt; + if (ioctl(sd, SIOCGARLQLT, (caddr_t)&ifr)) + err(1,"Get QLT"); + print_qlt(qlt); exit(0); } -#endif /* ARL_QUALITY */ +#endif } arl_io.what_set = 0; diff --git a/usr.sbin/arlcontrol/arlcontrol.8 b/usr.sbin/arlcontrol/arlcontrol.8 index 09b9771..7858b12 100644 --- a/usr.sbin/arlcontrol/arlcontrol.8 +++ b/usr.sbin/arlcontrol/arlcontrol.8 @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 25, 2003 +.Dd March 15, 2004 .Dt ARLCONFIG 8 i386 .Os .Sh NAME @@ -38,6 +38,8 @@ .Nd configure Aironet Arlan 655 device .Sh SYNOPSIS .Nm +.Ar iface +.Nm .Ar iface Cm name Ar name .Nm .Ar iface Cm sid Ar SID @@ -60,7 +62,7 @@ .Nm .Ar iface Cm stat .Nm -.Ar iface Cm quality Ar seconds [ Cm count Ar <count> ] +.Ar iface Cm quality .Sh DESCRIPTION The .Nm @@ -91,7 +93,11 @@ etc.) and must be specified. .Sh OPTIONS The options are as follows: .Bl -tag -width indent -.It Cm name Ar name +.It Ar iface +Display current settings of specified wireless interface. +This retrieves current card settings from the driver and prints +them out. +.It Ar iface Cm name Ar name Set .Ar Device Name . This @@ -104,7 +110,7 @@ If you choose to assign a name, while operating in .Ar TMA mode, the name will appear in the Arlan Access Point's Registration Table. Duplicate names are allowed. -.It Cm sid Ar SID +.It Ar iface Cm sid Ar SID Set .Ar System Identifier. The System Identifier @@ -127,7 +133,7 @@ SID is Since nodes will only receive packets from other nodes with a matching SID, you must make sure that the Arlan 655 Client Card is set the same SID as other nodes on your network. -.It Cm mode Ar mode ( Cm 640 | 655 ) +.It Ar iface Cm mode Ar mode ( Cm 640 | 655 ) Use .Ar operating mode parameter to specify whether you are operating in @@ -146,9 +152,9 @@ mode. .It PSP Ta Power save mode .El .!!! -.It Cm country Ar country ( Cm 9-15 ) -.It Cm channel Ar channel -.It Cm freq Ar freq ( Cm 2412, 2427, 2442, 2457, 2465 ) +.It Ar iface Cm country Ar country ( Cm 9-15 ) +.It Ar iface Cm channel Ar channel +.It Ar iface Cm freq Ar freq ( Cm 2412, 2427, 2442, 2457, 2465 ) Chose .Ar country , channel , freq parameters that depend on the @@ -170,8 +176,8 @@ according to the following table: .It "U.K. " Ta 15 Ta "2460" .It "Spain " Ta 15 Ta "2460" .El -.It Cm bitrate Ar bitrate ( Cm 0-4) -.It Cm spread Ar spread Cm ( 354, 500, 1000, 2000 ) +.It Ar iface Cm bitrate Ar bitrate ( Cm 0-4) +.It Ar iface Cm spread Ar spread Cm ( 354, 500, 1000, 2000 ) Set device operating bitrate or spread. .Bl -column ".Em Rate" ".Em Spread" ".Em kb/s" -offset indent indent .Em "Rate Spread kb/s" @@ -181,7 +187,7 @@ Set device operating bitrate or spread. .It 3 Ta 1000 Ta 1000 .It 4 Ta 2000 Ta 2000 .El -.It Cm priority Ar priority ( Cm normal, high, highest ) +.It Ar iface Cm priority Ar priority ( Cm normal, high, highest ) Use the .Ar priority parameter to set the priority of the Atlan 655 Radio Media Access Control @@ -196,21 +202,19 @@ to transmit at the same time. The percentage of units on your network that you set to other than .Dq normal should be kept small - 10 percent or less. -.It Cm stat +.It Ar iface Cm stat Print internal Arlan 655 statistics block. -.It Cm quality Ar seconds [ Cm count Ar <count> ] -Perform link quality test during -.Ar seconds -transmitting -.Ar count -packets. -Currently is broken. +.It Ar iface Cm quality +Display the cached signal level and quality mantained by the +.Xr arl 4 +driver . The driver retains information about quality and level for packets received from different hosts. Also driver extract values from ACK packets. .El .Sh EXAMPLES .Bd -literal -offset indent -alrlconfig arl0 name NODE1 sid 4 freq 2442 -arlconfig arl0 quality 10 seconds -arlconfig arl0 status +arlconfig arl0 name NODE1 sid 4 freq 2442 +arlconfig arl0 quality +arlconfig arl0 stat +arlconfig arl0 .Pp You can configure Arlan 655 card from /etc/start_if.arl0. For example: .Pp diff --git a/usr.sbin/arlcontrol/arlcontrol.c b/usr.sbin/arlcontrol/arlcontrol.c index 4ab5ca9..9055ddaa 100644 --- a/usr.sbin/arlcontrol/arlcontrol.c +++ b/usr.sbin/arlcontrol/arlcontrol.c @@ -1,5 +1,5 @@ /* - * $RISS: if_arl/arlconfig/arlconfig.c,v 1.3 2003/01/13 07:23:25 count Exp $ + * $RISS: if_arl/arlconfig/arlconfig.c,v 1.5 2004/03/16 05:00:21 count Exp $ */ #include <sys/cdefs.h> @@ -205,9 +205,10 @@ usage() #endif fprintf(stderr, "or: %s <ifname> stat\n", progname); fprintf(stderr, "\tprint internal arlan statistics block\n"); - fprintf(stderr, "or: %s <ifname> quality <seconds> [count <count>]\n", - progname); - fprintf(stderr, "\tprint receive packet level and quality with interval\n"); +#ifdef ARLCACHE + fprintf(stderr,"or: %s <ifname> quality\n", progname); + fprintf(stderr,"\tprint receive packet level and quality\n"); +#endif exit(0); } @@ -307,105 +308,31 @@ print_stb( struct arl_stats stb ) stb.numNACKReceived); } -#ifdef ARL_QUALITY +#ifdef ARLCACHE void -print_qlt(struct arl_quality qlt, int count) +print_qlt(struct arl_sigcache *qlt) { - int i, s; - int v, v1; - time_t t; - int minLevel, maxLevel, avgLevel; - int minQuality, maxQuality, avgQuality; - - t = time(NULL); - localtime(&t); - printf("#%d Current date-time: %s", count, ctime(&t)); - printf(" %-39s %s\n","Receive Level","Receive Quality"); - printf( -" pkts 0.......10 11............100 > pkts 0.......10 11............100 >\n"\ -" -----+----------+-----------------+--- -----+----------+-----------------+---\n"); - - minLevel = 16; - maxLevel = 0; - avgLevel = 0; - minQuality = 16; - maxQuality = 0; - avgQuality = 0; - - for (i = 0, s = 0; i < ARLAN_MAX_QUALITY; i++) { - v = qlt.rxLevel[i]; - if (v) { - if (i < minLevel) - minLevel = i; - if (i > maxLevel) - maxLevel = i; - avgLevel += v*i; - printf(" %-4d %x", v, i); - } else - printf(" o %x", i); - s += v; - if (v < 10) - ; - else if (v < 100) - v = 10 + ((v-10) * 20) / 90; - else if (v < 1000) - v = 31; - else - v = 32; - v1 = v; - while (v) { - printf("*"); - v--; - } - - v = 33 - v1; - while (v) { - printf(" "); - v--; - } - - v = qlt.rxQuality[i]; - if (v) { - if (i < minQuality) - minQuality = i; - if (i > maxQuality) - maxQuality = i; - avgQuality += v*i; - printf("%-4d %x", v, i); - } else - printf("o %x", i); - - if (v < 10) - ; - else if (v < 100) - v = 10 + ((v-10) * 20) / 90; - else if (v < 1000) - v = 31; - else - v = 32; - } - v1 = v; - while (v) { - printf("*"); - v--; - } - + int i; + u_int8_t zero[6] = {0, 0, 0, 0, 0, 0}; + + for (i = 0; i < MAXARLCACHE && bcmp(qlt->macsrc, zero, 6); i++) { + printf("[%d]:", i+1); + printf(" %02x:%02x:%02x:%02x:%02x:%02x,", + qlt->macsrc[0]&0xff, + qlt->macsrc[1]&0xff, + qlt->macsrc[2]&0xff, + qlt->macsrc[3]&0xff, + qlt->macsrc[4]&0xff, + qlt->macsrc[5]&0xff); + printf(" rx lvl/qlty: %d/%d,", qlt->level[ARLCACHE_RX], + qlt->quality[ARLCACHE_RX]); + printf(" tx lvl/qlty: %d/%d", qlt->level[ARLCACHE_TX], + qlt->quality[ARLCACHE_TX]); printf("\n"); + qlt++; } - printf(" -----+----------+-----------------+--- -----+----------+-----------------+---\n"); - if (minLevel > 15) - minLevel = 0; - if (minQuality > 15) - minQuality = 0; - printf("\tPackets count %-6d\n", s); - if (!s) - s++; - printf("\tLevel min %d/avg %d/max %d\n", - minLevel, avgLevel/s, maxLevel); - printf("\tQuality min %d/avg %d/max %d\n", - minQuality, avgQuality/s, maxQuality); } -#endif /* ARL_QUALITY */ +#endif int main(int argc, char *argv[]) @@ -414,11 +341,10 @@ main(int argc, char *argv[]) struct arl_req arl_io; struct ether_addr *ea; struct arl_stats stb; - /*static arl_quality qlt;*/ + struct arl_sigcache qlt[MAXARLCACHE]; int sd, argind, val = -1; long val2; char *param, *value, *value2; - /*int end_count, i;*/ if (argc < 2) usage(); @@ -448,30 +374,18 @@ main(int argc, char *argv[]) print_stb(stb); exit(0); } -#ifdef ARL_QUALITY - if (!strcasecmp(argv[2],"quality") && argc > 3) { - val = atoi(argv[3]); - if (val < 0 || val >= 3601) - err(1,"Bad time range"); - end_count = 0; - if (argc > 5 && !strcasecmp(argv[4], "count")) - end_count = atoi(argv[5]); +#ifdef ARLCACHE + if (!strcasecmp( argv[2],"quality")) { printf("\n"); - i = 0; - while (i < end_count || !end_count) { /* loop */ - if (i++) - sleep(val); - strncpy(ifr.ifr_name, - argv[1], sizeof(ifr.ifr_name)); - ifr.ifr_addr.sa_family = AF_INET; - ifr.ifr_data = (caddr_t)&qlt; - if (ioctl(sd, SIOCGARLQLT, (caddr_t)&ifr)) - err(1,"Get QLT"); - print_qlt(qlt, i); - } + strncpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name)); + ifr.ifr_addr.sa_family = AF_INET; + ifr.ifr_data = (caddr_t)qlt; + if (ioctl(sd, SIOCGARLQLT, (caddr_t)&ifr)) + err(1,"Get QLT"); + print_qlt(qlt); exit(0); } -#endif /* ARL_QUALITY */ +#endif } arl_io.what_set = 0; |