Remove the wl(4) driver and wlconfig(8) utility.
The wl(4) driver supports pre-802.11 PCCard wireless adapters that are slower than 802.11b. They do not work with any of the 802.11 framework and the driver hasn't been reported to actually work in a long time. Relnotes: yes
This commit is contained in:
parent
d538f1bd40
commit
09b9789b28
@ -38,6 +38,10 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20160819: Remove wl(4) and wlconfig(8)
|
||||
OLD_FILES+=usr/share/man/man4/i386/wl.4.gz
|
||||
OLD_FILES+=usr/sbin/wlconfig
|
||||
OLD_FILES+=usr/share/man/man8/i386/wlconfig.8.gz
|
||||
# 20160819: Remove si(4) and sicontrol(8)
|
||||
OLD_FILES+=usr/share/man/man4/si.4.gz
|
||||
OLD_FILES+=usr/sbin/sicontrol
|
||||
|
@ -1023,9 +1023,6 @@
|
||||
Intersil PRISM-2.5, Intersil Prism-3, and Symbol Spectrum24
|
||||
chipsets (&man.wi.4; driver)</para>
|
||||
|
||||
<para>[&arch.i386;] NCR / AT&T / Lucent Technologies WaveLan
|
||||
T1-speed ISA/radio LAN cards (&man.wl.4; driver)</para>
|
||||
|
||||
<para>[&arch.i386;, &arch.amd64;] Intel PRO/Wireless 3945ABG
|
||||
MiniPCI network adapters (&man.wpi.4; driver)</para>
|
||||
|
||||
|
@ -31,8 +31,7 @@ MAN= aic.4 \
|
||||
streams.4 \
|
||||
svr4.4 \
|
||||
vpd.4 \
|
||||
vx.4 \
|
||||
wl.4
|
||||
vx.4
|
||||
|
||||
MLINKS= CPU_ELAN.4 CPU_SOEKRIS.4
|
||||
MLINKS+=pae.4 PAE.4
|
||||
|
@ -1,193 +0,0 @@
|
||||
.\"
|
||||
.\" Copyright (c) 1997, Jim Binkley
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by Jim Binkley
|
||||
.\" 4. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.Dd September 29, 2006
|
||||
.Dt WL 4 i386
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm wl
|
||||
.Nd T1 speed ISA/radio lan card
|
||||
.Sh SYNOPSIS
|
||||
.Cd "device wl0 at isa? port 0x300 irq 5"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver controls a radio lan card system made originally by
|
||||
NCR, then ATT, now Lucent.
|
||||
The system is spread-spectrum radio
|
||||
at around 915 MHz (or 2.4 GHz).
|
||||
With the supplied omni-directional antennae,
|
||||
about 400 feet (indoors, more outdoors) can be covered in circumference.
|
||||
This card can talk to the companion (wlp0) pccard.
|
||||
Speeds vary
|
||||
from 1 megabit to theoretically 2 megabits (roughly T1 in speed).
|
||||
.Pp
|
||||
The card has three fundamental hardware
|
||||
units, a so-called PSA or programmable storage area, a radio modem,
|
||||
and a Ethernet lan controller.
|
||||
The latter component is the
|
||||
ancient (and not very honorable) Intel 82586 Ethernet chip.
|
||||
Fundamentally it appears to the operating system as an Ethernet system,
|
||||
and speaks IEEE MAC addresses.
|
||||
The radio modem simply translates
|
||||
Ethernet packets to/from radio packets, that are either at 2.4 GHz
|
||||
or 915 MHz depending on the radio modem.
|
||||
It supports a collision
|
||||
avoidance scheme.
|
||||
The lan controller
|
||||
supports promiscuous mode, broadcast, and multicasting
|
||||
(although there is a glitch
|
||||
in the latter).
|
||||
"It thinks it is Ethernet".
|
||||
.Pp
|
||||
How it is used
|
||||
depends on the kind of antennae deployed with it.
|
||||
Point to point
|
||||
applications are possible as are Ethernet-like lan use.
|
||||
The vendor
|
||||
ships an omni-directional antennae that works in the
|
||||
vicinity of 400 feet (indoors).
|
||||
Point to point antennae can be purchased that will go miles.
|
||||
.Sh SETUP
|
||||
The card can either be initialized with the vendor supplied DOS setup software.
|
||||
Typically minimally an IRQ, port, and Network ID must be supplied.
|
||||
Michael Smith's
|
||||
.Xr wlconfig 8
|
||||
utility can now be used to do this work from
|
||||
the UNIX side.
|
||||
The card is "not" plug and play.
|
||||
The network id controls whether one set of cards can hear another.
|
||||
If different, cards will read physical packets, but they will be discarded
|
||||
by the radio modem.
|
||||
.Sh CONTROL
|
||||
In addition to the config utility, there are several sysctl
|
||||
switches that can be used to modify runtime parameters.
|
||||
The
|
||||
.Xr sysctl 8
|
||||
variables are as follows:
|
||||
.Bl -diag
|
||||
.It "machdep.wl_xmit_delay <useconds>"
|
||||
This variable will cause the driver to insert a delay on transmit.
|
||||
250 is the default.
|
||||
The delay should probably be a bit longer
|
||||
on faster cpus and less on slower cpus.
|
||||
It exists because the 82586
|
||||
was not designed to work with Pentium-speed cpu systems and if overdriven
|
||||
will have copious xmit side errors.
|
||||
.It machdep.wl_ignore_nwid <0 | 1>
|
||||
This switch defaults to 0; i.e., the nwid is not ignored.
|
||||
It can
|
||||
be set to 1 to cause the nwid to not be used.
|
||||
This may be useful
|
||||
when the device is in promiscuous mode as one can watch for all
|
||||
packets and ignore nwid differences.
|
||||
.It machdep.wl_xmit_watch <milliseconds>
|
||||
This switch is not currently useful.
|
||||
.It machdep.wl_gather_snr <milliseconds>
|
||||
This switch is not currently useful.
|
||||
.Pp
|
||||
There is also a signal strength cache in the driver.
|
||||
It may be interrogated
|
||||
with
|
||||
.Xr wlconfig 8 .
|
||||
Incoming packets
|
||||
are checked for certain hardware radio-modem values including signal
|
||||
strength, silence, and quality, which range fro 0..63, 0..63, and 0..15
|
||||
respectively.
|
||||
Thus one can read out signal strenth values to see
|
||||
how close/far peer nodes are.
|
||||
The signal strength cache is indexed by
|
||||
sender MAC address.
|
||||
There are two sysctls that change how it filters packets.
|
||||
Both are on
|
||||
by default.
|
||||
.It machdep.wl_wlcache_mcastonly <0 | 1>
|
||||
By default this switch is on.
|
||||
It forces the cache to filter out
|
||||
unicast packets.
|
||||
Only broadcast or multicast packets are accepted.
|
||||
.It machdep.wl_wlcache_iponly <0 | 1>
|
||||
By default this switch is on.
|
||||
It forces the driver to discard non-IP
|
||||
packets and also stores the IP src address.
|
||||
ARP packets are ignored,
|
||||
as are any other network protocol barring IPv4 packets.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr sysctl 8 ,
|
||||
.Xr wlconfig 8
|
||||
.Pp
|
||||
.Pa http://www.wavelan.com
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
driver was written by
|
||||
.An Anders Klemets
|
||||
(thousands of years ago?) and
|
||||
appears to be based on an even older Intel 82586 driver.
|
||||
The 82586
|
||||
controller was one of the first (if not the first?) integrated lan
|
||||
controller on the block.
|
||||
That does not mean it was the best either.
|
||||
Anders ported and or created a driver for the ISA wavelan and PCCARD
|
||||
wavelan system too (wlp).
|
||||
.An Robert T. Morris, Jr.
|
||||
ported the Mach drivers to BSDI.
|
||||
.An Jim Binkley
|
||||
ported them to
|
||||
.Fx 2.1 .
|
||||
.An Michael Smith
|
||||
ported the
|
||||
.Nm
|
||||
driver only to 2.2.2.
|
||||
Jim and Michael have been
|
||||
maintaining them.
|
||||
The current state of the driver is NOT ANYONE'S
|
||||
FAULT.
|
||||
Thanks to
|
||||
.An Bernie Doehner
|
||||
and
|
||||
.An Robert Buaas
|
||||
for contributions.
|
||||
.Sh AUTHORS
|
||||
Too numerous to mention.
|
||||
See above.
|
||||
.Sh CAVEATS
|
||||
The 82586 has numerous defects.
|
||||
It may experience transmit-side
|
||||
errors when modern faster cpus send packets at it faster than it can handle.
|
||||
The driver (and probably the chip) does not support an all multicast mode.
|
||||
As a result, it can be used with applications like
|
||||
.Xr mrouted 8 Pq Pa ports/net/mrouted ,
|
||||
but it must go into promiscuous mode for that to work.
|
||||
The driver
|
||||
is slow to change modes from "normal" to promiscuous mode, presumably
|
||||
due to delays in the configuration code.
|
@ -2933,7 +2933,6 @@ dev/wb/if_wb.c optional wb pci
|
||||
dev/wi/if_wi.c optional wi
|
||||
dev/wi/if_wi_pccard.c optional wi pccard
|
||||
dev/wi/if_wi_pci.c optional wi pci
|
||||
dev/wl/if_wl.c optional wl isa
|
||||
dev/wpi/if_wpi.c optional wpi pci
|
||||
wpifw.c optional wpifw \
|
||||
compile-with "${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:153229 -mwpi -c${.TARGET}" \
|
||||
|
@ -218,8 +218,6 @@ SW_WATCHDOG opt_watchdog.h
|
||||
TURNSTILE_PROFILING
|
||||
UMTX_PROFILING
|
||||
VERBOSE_SYSINIT
|
||||
WLCACHE opt_wavelan.h
|
||||
WLDEBUG opt_wavelan.h
|
||||
|
||||
# POSIX kernel options
|
||||
P1003_1B_MQUEUE opt_posix.h
|
||||
|
2620
sys/dev/wl/if_wl.c
2620
sys/dev/wl/if_wl.c
File diff suppressed because it is too large
Load Diff
@ -1,133 +0,0 @@
|
||||
/*-
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain all copyright
|
||||
* notices, this list of conditions and the following disclaimer.
|
||||
* 2. The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
/* Definitions for WaveLAN driver */
|
||||
|
||||
#ifndef _IF_WL_H
|
||||
#define _IF_WL_H
|
||||
|
||||
#define STATUS_TRIES 15000
|
||||
|
||||
#define N_FD 100
|
||||
#define N_RBD 100
|
||||
#define N_TBD 72
|
||||
#define RCVBUFSIZE 540
|
||||
#define I82586NULL 0xffff
|
||||
|
||||
#define DSF_RUNNING 1
|
||||
|
||||
#define MOD_ENAL 1
|
||||
#define MOD_PROM 2
|
||||
|
||||
typedef struct {
|
||||
rbd_t r;
|
||||
char rbd_pad[2];
|
||||
char rbuffer[RCVBUFSIZE];
|
||||
} ru_t;
|
||||
|
||||
/* Board 64k RAM layout. Offsets from 0x0000 */
|
||||
|
||||
#define OFFSET_RU 0x0000 /* 0x64 * fd_t = 0x898 */
|
||||
#define OFFSET_RBD 0x0900 /* 0x64 * ru_t = 0xd7a0 */
|
||||
#define OFFSET_CU 0xe0a0 /* 0x100 */
|
||||
#define OFFSET_TBD 0xe1a0 /* 0x48 * tbd_t = 0x240 */
|
||||
#define OFFSET_TBUF 0xe3e0 /* 0x1bfe */
|
||||
#define OFFSET_SCB 0xffde /* 0x1 * scb_t = 0x10 */
|
||||
#define OFFSET_ISCP 0xffee /* 0x1 * iscp_t = 0x8 */
|
||||
#define OFFSET_SCP 0xfff6 /* 0x1 * scp_t = 0xa */
|
||||
|
||||
/* WaveLAN host interface definitions */
|
||||
|
||||
#define HACR 0x0 /* Host Adapter Command Register */
|
||||
#define HASR 0x0 /* Host Adapter Status Register */
|
||||
#define MMCR 0x2 /* Modem Management Ctrl Register */
|
||||
#define PIOR0 0x4 /* Program I/O Address Register 0 */
|
||||
#define PIOP0 0x6 /* Program I/O Port 0 */
|
||||
#define PIOR1 0x8 /* Program I/O Address Register 1 */
|
||||
#define PIOP1 0xa /* Program I/O Port 1 */
|
||||
#define PIOR2 0xc /* Program I/O Address Register 2 */
|
||||
#define PIOP2 0xe /* Program I/O Port 2 */
|
||||
|
||||
/* Program I/O Mode Register values */
|
||||
|
||||
#define STATIC_PIO 0 /* Mode 1: static mode */
|
||||
#define AUTOINCR_PIO 1 /* Mode 2: auto increment mode */
|
||||
#define AUTODECR_PIO 2 /* Mode 3: auto decrement mode */
|
||||
#define PARAM_ACCESS_PIO 3 /* Mode 4: LAN parameter access mode */
|
||||
#define PIO_MASK 3 /* register mask */
|
||||
#define PIOM(cmd,piono) ((u_short)cmd << 10 << (piono * 2))
|
||||
|
||||
/* Host Adapter status register definitions */
|
||||
|
||||
#define HASR_INTR 0x0001 /* Interrupt request from 82586 */
|
||||
#define HASR_MMC_INTR 0x0002 /* Interrupt request from MMC */
|
||||
#define HASR_MMC_BUSY 0x0004 /* MMC busy indication */
|
||||
#define HASR_PARA_BUSY 0x0008 /* LAN parameter storage area busy */
|
||||
|
||||
/* Host Adapter command register definitions */
|
||||
|
||||
#define HACR_RESET 0x0001 /* Reset board */
|
||||
#define HACR_CA 0x0002 /* Set Channel Attention for 82586 */
|
||||
#define HACR_16BITS 0x0004 /* 1==16 bits operation, 0==8 bits */
|
||||
#define HACR_OUT1 0x0008 /* General purpose output pin */
|
||||
#define HACR_OUT2 0x0010 /* General purpose output pin */
|
||||
#define HACR_MASK_82586 0x0020 /* Mask 82586 interrupts, 1==unmask */
|
||||
#define HACR_MASK_MMC 0x0040 /* Mask MMC interrupts, 1==unmask */
|
||||
#define HACR_INTR_CLEN 0x0080 /* interrupt status clear enable */
|
||||
|
||||
#define HACR_DEFAULT (HACR_OUT1 | HACR_OUT2 | HACR_16BITS | PIOM(STATIC_PIO, 0) | PIOM(AUTOINCR_PIO, 1) | PIOM(PARAM_ACCESS_PIO, 2))
|
||||
#define HACR_INTRON (HACR_MASK_82586 | HACR_MASK_MMC | HACR_INTR_CLEN)
|
||||
|
||||
#define WL_READ_1(sc, reg) bus_read_1((sc)->res_ioport, (reg))
|
||||
#define WL_READ_2(sc, reg) bus_read_2((sc)->res_ioport, (reg))
|
||||
#define WL_READ_MULTI_2(sc, reg, buf, len) \
|
||||
bus_read_multi_2((sc)->res_ioport, (reg), (uint16_t *)(buf), (len))
|
||||
#define WL_WRITE_1(sc, reg, val) \
|
||||
bus_write_1((sc)->res_ioport, (reg), (val))
|
||||
#define WL_WRITE_2(sc, reg, val) \
|
||||
bus_write_2((sc)->res_ioport, (reg), (val))
|
||||
#define WL_WRITE_MULTI_2(sc, reg, buf, len) \
|
||||
bus_write_multi_2((sc)->res_ioport, (reg), (uint16_t *)(buf), (len))
|
||||
|
||||
#define CMD(sc) \
|
||||
{ \
|
||||
WL_WRITE_2(sc, HACR, sc->hacr); \
|
||||
/* delay for 50 us, might only be needed sometimes */ \
|
||||
DELAY(DELAYCONST); \
|
||||
}
|
||||
|
||||
/* macro for setting the channel attention bit. No delays here since
|
||||
* it is used in critical sections
|
||||
*/
|
||||
#define SET_CHAN_ATTN(sc) \
|
||||
{ \
|
||||
WL_WRITE_2(sc, HACR, sc->hacr | HACR_CA); \
|
||||
}
|
||||
|
||||
|
||||
#define MMC_WRITE(cmd,val) \
|
||||
while (WL_READ_2(sc, HASR) & HASR_MMC_BUSY) ; \
|
||||
WL_WRITE_2(sc, MMCR, \
|
||||
(u_short)(((u_short)(val) << 8) | ((cmd) << 1) | 1))
|
||||
|
||||
#endif /* _IF_WL_H */
|
||||
|
@ -1,266 +0,0 @@
|
||||
/*-
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
/*
|
||||
Copyright 1988, 1989 by Olivetti Advanced Technology Center, Inc.,
|
||||
Cupertino, California.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appears in all
|
||||
copies and that both the copyright notice and this permission notice
|
||||
appear in supporting documentation, and that the name of Olivetti
|
||||
not be used in advertising or publicity pertaining to distribution
|
||||
of the software without specific, written prior permission.
|
||||
|
||||
OLIVETTI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
|
||||
IN NO EVENT SHALL OLIVETTI BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
|
||||
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
|
||||
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUR OF OR IN CONNECTION
|
||||
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Defines for managing the status word of the 82586 cpu. For details see
|
||||
* the Intel LAN Component User's Manual starting at p. 2-14.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SCB_SW_INT 0xf000
|
||||
#define SCB_SW_CX 0x8000 /* CU finished w/ int. bit set */
|
||||
#define SCB_SW_FR 0x4000 /* RU finished receiving a frame */
|
||||
#define SCB_SW_CNA 0x2000 /* CU left active state */
|
||||
#define SCB_SW_RNR 0x1000 /* RU left ready state */
|
||||
|
||||
/*
|
||||
* Defines for managing the Command Unit Status portion of the 82586
|
||||
* System Control Block.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SCB_CUS_IDLE 0x0000
|
||||
#define SCB_CUS_SUSPND 0x0100
|
||||
#define SCB_CUS_ACTV 0x0200
|
||||
|
||||
/*
|
||||
* Defines for managing the Receive Unit Status portion of the System
|
||||
* Control Block.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SCB_RUS_IDLE 0x0000
|
||||
#define SCB_RUS_SUSPND 0x0010
|
||||
#define SCB_RUS_NORESRC 0x0020
|
||||
#define SCB_RUS_READY 0x0040
|
||||
|
||||
/*
|
||||
* Defines that manage portions of the Command Word in the System Control
|
||||
* Block of the 82586. Below are the Interrupt Acknowledge Bits and their
|
||||
* appropriate masks.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SCB_ACK_CX 0x8000
|
||||
#define SCB_ACK_FR 0x4000
|
||||
#define SCB_ACK_CNA 0x2000
|
||||
#define SCB_ACK_RNR 0x1000
|
||||
|
||||
/*
|
||||
* Defines for managing the Command Unit Control word, and the Receive
|
||||
* Unit Control word. The software RESET bit is also defined.
|
||||
*
|
||||
*/
|
||||
|
||||
#define SCB_CU_STRT 0x0100
|
||||
#define SCB_CU_RSUM 0x0200
|
||||
#define SCB_CU_SUSPND 0x0300
|
||||
#define SCB_CU_ABRT 0x0400
|
||||
|
||||
#define SCB_RESET 0x0080
|
||||
|
||||
#define SCB_RU_STRT 0x0010
|
||||
#define SCB_RU_RSUM 0x0020
|
||||
#define SCB_RU_SUSPND 0x0030
|
||||
#define SCB_RU_ABRT 0x0040
|
||||
|
||||
|
||||
/*
|
||||
* The following define Action Commands for the 82586 chip.
|
||||
*
|
||||
*/
|
||||
|
||||
#define AC_NOP 0x00
|
||||
#define AC_IASETUP 0x01
|
||||
#define AC_CONFIGURE 0x02
|
||||
#define AC_MCSETUP 0x03
|
||||
#define AC_TRANSMIT 0x04
|
||||
#define AC_TDR 0x05
|
||||
#define AC_DUMP 0x06
|
||||
#define AC_DIAGNOSE 0x07
|
||||
|
||||
|
||||
/*
|
||||
* Defines for General Format for Action Commands, both Status Words, and
|
||||
* Command Words.
|
||||
*
|
||||
*/
|
||||
|
||||
#define AC_SW_C 0x8000
|
||||
#define AC_SW_B 0x4000
|
||||
#define AC_SW_OK 0x2000
|
||||
#define AC_SW_A 0x1000
|
||||
#define TC_CARRIER 0x0400
|
||||
#define TC_CLS 0x0200
|
||||
#define TC_DMA 0x0100
|
||||
#define TC_DEFER 0x0080
|
||||
#define TC_SQE 0x0040
|
||||
#define TC_COLLISION 0x0020
|
||||
#define AC_CW_EL 0x8000
|
||||
#define AC_CW_S 0x4000
|
||||
#define AC_CW_I 0x2000
|
||||
|
||||
/*
|
||||
* Specific defines for the transmit action command.
|
||||
*
|
||||
*/
|
||||
|
||||
#define TBD_SW_EOF 0x8000
|
||||
#define TBD_SW_COUNT 0x3fff
|
||||
|
||||
/*
|
||||
* Specific defines for the receive frame actions.
|
||||
*
|
||||
*/
|
||||
|
||||
#define RBD_SW_EOF 0x8000
|
||||
#define RBD_SW_COUNT 0x3fff
|
||||
|
||||
#define RFD_DONE 0x8000
|
||||
#define RFD_BUSY 0x4000
|
||||
#define RFD_OK 0x2000
|
||||
#define RFD_CRC 0x0800
|
||||
#define RFD_ALN 0x0400
|
||||
#define RFD_RSC 0x0200
|
||||
#define RFD_DMA 0x0100
|
||||
#define RFD_SHORT 0x0080
|
||||
#define RFD_EOF 0x0040
|
||||
#define RFD_EL 0x8000
|
||||
#define RFD_SUSP 0x4000
|
||||
/*
|
||||
* 82586 chip specific structure definitions. For details, see the Intel
|
||||
* LAN Components manual.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_short scp_sysbus;
|
||||
u_short scp_unused[2];
|
||||
u_short scp_iscp;
|
||||
u_short scp_iscp_base;
|
||||
} scp_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_short iscp_busy;
|
||||
u_short iscp_scb_offset;
|
||||
u_short iscp_scb;
|
||||
u_short iscp_scb_base;
|
||||
} iscp_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_short scb_status;
|
||||
u_short scb_command;
|
||||
u_short scb_cbl_offset;
|
||||
u_short scb_rfa_offset;
|
||||
u_short scb_crcerrs;
|
||||
u_short scb_alnerrs;
|
||||
u_short scb_rscerrs;
|
||||
u_short scb_ovrnerrs;
|
||||
} scb_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_short tbd_offset;
|
||||
u_char dest_addr[6];
|
||||
u_short length;
|
||||
} transmit_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_short fifolim_bytecnt;
|
||||
u_short addrlen_mode;
|
||||
u_short linprio_interframe;
|
||||
u_short slot_time;
|
||||
u_short hardware;
|
||||
u_short min_frame_len;
|
||||
} configure_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_short ac_status;
|
||||
u_short ac_command;
|
||||
u_short ac_link_offset;
|
||||
union {
|
||||
transmit_t transmit;
|
||||
configure_t configure;
|
||||
u_char iasetup[6];
|
||||
} cmd;
|
||||
} ac_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_short act_count;
|
||||
u_short next_tbd_offset;
|
||||
u_short buffer_addr;
|
||||
u_short buffer_base;
|
||||
} tbd_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_short status;
|
||||
u_short command;
|
||||
u_short link_offset;
|
||||
u_short rbd_offset;
|
||||
u_char destination[6];
|
||||
u_char source[6];
|
||||
u_short length;
|
||||
} fd_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
u_short status;
|
||||
u_short next_rbd_offset;
|
||||
u_short buffer_addr;
|
||||
u_short buffer_base;
|
||||
u_short size;
|
||||
} rbd_t;
|
@ -648,11 +648,6 @@ hint.sbni.0.port="0x210"
|
||||
hint.sbni.0.irq="0xefdead"
|
||||
hint.sbni.0.flags="0"
|
||||
device vmx # VMware VMXNET3 Ethernet
|
||||
device wl
|
||||
hint.wl.0.at="isa"
|
||||
hint.wl.0.port="0x300"
|
||||
options WLCACHE # enables the signal-strength cache
|
||||
options WLDEBUG # enables verbose debugging output
|
||||
device wpi # Intel 3945ABG wireless NICs.
|
||||
|
||||
# IEEE 802.11 adapter firmware modules
|
||||
|
@ -391,7 +391,6 @@ SUBDIR= \
|
||||
wb \
|
||||
${_wbwd} \
|
||||
${_wi} \
|
||||
${_wl} \
|
||||
wlan \
|
||||
wlan_acl \
|
||||
wlan_amrr \
|
||||
@ -728,7 +727,6 @@ _ctau= ctau
|
||||
.endif
|
||||
_dpt= dpt
|
||||
_ex= ex
|
||||
_wl= wl
|
||||
.elif ${MACHINE} == "pc98"
|
||||
_canbepm= canbepm
|
||||
_canbus= canbus
|
||||
|
@ -1,10 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../dev/wl
|
||||
|
||||
KMOD= if_wl
|
||||
SRCS= if_wl.c
|
||||
SRCS+= bus_if.h device_if.h isa_if.h
|
||||
SRCS+= opt_inet.h opt_wavelan.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
@ -865,8 +865,7 @@ DIRDEPS.i386= \
|
||||
usr.sbin/spkrtest \
|
||||
usr.sbin/zzz \
|
||||
usr.sbin/acpi \
|
||||
usr.sbin/boot0cfg \
|
||||
usr.sbin/wlconfig
|
||||
usr.sbin/boot0cfg
|
||||
|
||||
DIRDEPS.arm64= \
|
||||
usr.sbin/acpi \
|
||||
|
@ -8744,9 +8744,6 @@ OLD_FILES+=usr/sbin/hostapd
|
||||
OLD_FILES+=usr/sbin/hostapd_cli
|
||||
OLD_FILES+=usr/sbin/ndis_events
|
||||
OLD_FILES+=usr/sbin/wlandebug
|
||||
.if ${TARGET_ARCH} == "i386"
|
||||
OLD_FILES+=usr/sbin/wlconfig
|
||||
.endif
|
||||
OLD_FILES+=usr/sbin/wpa_cli
|
||||
OLD_FILES+=usr/sbin/wpa_passphrase
|
||||
OLD_FILES+=usr/sbin/wpa_supplicant
|
||||
@ -8761,9 +8758,6 @@ OLD_FILES+=usr/share/man/man5/wpa_supplicant.conf.5.gz
|
||||
OLD_FILES+=usr/share/man/man8/ancontrol.8.gz
|
||||
OLD_FILES+=usr/share/man/man8/hostapd.8.gz
|
||||
OLD_FILES+=usr/share/man/man8/hostapd_cli.8.gz
|
||||
.if ${TARGET_ARCH} == "i386"
|
||||
OLD_FILES+=usr/share/man/man8/i386/wlconfig.8.gz
|
||||
.endif
|
||||
OLD_FILES+=usr/share/man/man8/ndis_events.8.gz
|
||||
OLD_FILES+=usr/share/man/man8/wlandebug.8.gz
|
||||
OLD_FILES+=usr/share/man/man8/wpa_cli.8.gz
|
||||
|
@ -1,21 +0,0 @@
|
||||
# Doxyfile 1.5.2
|
||||
|
||||
# $FreeBSD$
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "FreeBSD kernel WL device code"
|
||||
OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_wl/
|
||||
EXTRACT_ALL = YES # for undocumented src, no warnings enabled
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = $(DOXYGEN_SRC_PATH)/dev/wl/ \
|
||||
$(NOTREVIEWED)
|
||||
|
||||
GENERATE_TAGFILE = dev_wl/dev_wl.tag
|
||||
|
||||
@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH)
|
||||
@INCLUDE = common-Doxyfile
|
||||
|
@ -29,9 +29,6 @@ SUBDIR+= boot0cfg
|
||||
.if ${MK_HYPERV} != "no"
|
||||
SUBDIR+= hyperv
|
||||
.endif
|
||||
.if ${MK_WIRELESS} != "no"
|
||||
SUBDIR+= wlconfig
|
||||
.endif
|
||||
.elif ${MACHINE} == "pc98"
|
||||
SUBDIR+= boot98cfg
|
||||
.endif
|
||||
|
@ -1,9 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= wlconfig
|
||||
MAN= wlconfig.8
|
||||
MANSUBDIR= /i386
|
||||
|
||||
WARNS?= 2
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,16 +0,0 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -1,143 +0,0 @@
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 26, 1996
|
||||
.Dt WLCONFIG 8 i386
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm wlconfig
|
||||
.Nd read/write wavelan config parameters
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Ar ifname
|
||||
.Op Ar param value ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility can be used to read and set parameters for the NCR/AT&T Wavelan
|
||||
radio LAN card.
|
||||
Various parameters stored in the non-volatile Parameter
|
||||
Storage Area (PSA) on the card can be modified with this program, replacing
|
||||
the DOS-based
|
||||
.Nm instconf.exe
|
||||
program.
|
||||
It can also be used to interrogate the optional signal
|
||||
strength cache which may have been compiled into the driver.
|
||||
.Pp
|
||||
The
|
||||
.Ar ifname
|
||||
parameter specifies the wavelan interface name (eg.
|
||||
.Pa wl0 ) .
|
||||
If no other arguments are supplied, the current contents of the PSA
|
||||
are interpreted and displayed.
|
||||
.Pp
|
||||
The
|
||||
.Ar param
|
||||
and
|
||||
.Ar value
|
||||
arguments can be used to change the value of several parameters.
|
||||
Any number of
|
||||
.Ar param value
|
||||
pairs may be supplied.
|
||||
.Bl -tag -width 15n -offset indent
|
||||
.It Va param
|
||||
.Va value
|
||||
.It irq
|
||||
IRQ value (used at next reset), may be one of 3,4,5,6,10,11,12,15.
|
||||
.It mac
|
||||
Local MAC value (ethernet address).
|
||||
.It macsel
|
||||
.Sq soft
|
||||
(as set by the
|
||||
.Sq mac
|
||||
parameter) or
|
||||
.Sq default
|
||||
(as set at the factory).
|
||||
.It nwid
|
||||
The NWID is a 2-byte parameter passed to the card's radio modem.
|
||||
NWIDs allow multiple logically discrete networks to operate
|
||||
independently whilst occupying the same airspace.
|
||||
Packets with a different NWID are simply ignored by the modem.
|
||||
In the hardware, NWIDs are stored long-term in non-volatile memory
|
||||
(called the PSA or programmable storage area), and are loaded by
|
||||
software into the radio modem when the driver is
|
||||
initialized.
|
||||
This sets the default NWID loaded at startup.
|
||||
.It currnwid
|
||||
This sets the current operating NWID (but does not save it to the
|
||||
PSA).
|
||||
.It cache
|
||||
The driver may maintain a per interface fixed size cache of signal strength,
|
||||
silence, and quality levels, which are indexed by sender MAC addresses.
|
||||
Input packets are stored in the cache, and when received, the values
|
||||
stored in the radio modem are interrogated and stored.
|
||||
There are also two sysctl values (iponly and multicast only) which
|
||||
can be used for filtering out some input packets.
|
||||
By default, the
|
||||
cache mechanism stores only non-unicast IP packets, but this can
|
||||
be changed with
|
||||
.Xr sysctl 8 .
|
||||
Each non-filtered
|
||||
input packet causes a cache update, hence one can monitor
|
||||
the antennae signal strength to a remote system.
|
||||
There are three commands that can be given as values:
|
||||
.Sq raw ,
|
||||
which prints out the raw signal strength data as found in the radio
|
||||
modem hardware value,
|
||||
.Sq scale ,
|
||||
which scales the raw hardware values to 0..100%, and
|
||||
.Sq zero
|
||||
which clears out the cache in case you want to store new samples.
|
||||
.El
|
||||
.Pp
|
||||
Note that if the IRQ on the Wavelan card is incorrect, the interface
|
||||
will be configured, but will not function.
|
||||
The
|
||||
.Nm
|
||||
utility should then be used to reconfigure the card to a sensible
|
||||
value.
|
||||
.Sh EXAMPLES
|
||||
Set the NWID to 0x1234:
|
||||
.Bd -literal -offset indent
|
||||
# wlconfig wl0 nwid 0x1234
|
||||
.Ed
|
||||
.Pp
|
||||
Show the current settings:
|
||||
.Bd -literal -offset indent
|
||||
# wlconfig wl0
|
||||
Board type : ISA
|
||||
Base address options : 0x300, 0x390, 0x3c0, 0x3e0
|
||||
Waitstates : 0
|
||||
Bus mode : ISA
|
||||
IRQ : 10
|
||||
Default MAC address : 08:00:0e:20:3d:4b
|
||||
Soft MAC address : 00:00:00:00:00:00
|
||||
Current MAC address : Default
|
||||
Adapter compatibility : PC-AT 2.4GHz
|
||||
Threshold preset : 1
|
||||
Call code required : NO
|
||||
Subband : 2425MHz
|
||||
Quality threshold : 3
|
||||
Hardware version : 0 (Rel1/Rel2)
|
||||
Network ID enable : YES
|
||||
NWID : 0xdead
|
||||
Datalink security : NO
|
||||
Databus width : 16 (variable)
|
||||
Configuration state : unconfigured
|
||||
CRC-16 : 0x3c26
|
||||
CRC status : OK
|
||||
.Ed
|
||||
.Pp
|
||||
Print a scaled version of the signal strength cache:
|
||||
.Bd -literal -offset indent
|
||||
# wlconfig wl0 cache scale
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr wl 4 ,
|
||||
.Xr sysctl 8
|
||||
.Sh HISTORY
|
||||
This implementation of the
|
||||
.Nm
|
||||
utility is completely new, written for Hilink Internet by
|
||||
.An Michael Smith ,
|
||||
and updated by
|
||||
.An Jim Binkley &c .
|
@ -1,417 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 1996
|
||||
* Michael Smith. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Michael Smith AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL Michael Smith OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* wlconfig.c
|
||||
*
|
||||
* utility to read out and change various WAVELAN parameters.
|
||||
* Currently supports NWID and IRQ values.
|
||||
*
|
||||
* The NWID is used by 2 or more wavelan controllers to determine
|
||||
* if packets should be received or not. It is a filter that
|
||||
* is roughly analogous to the "channel" setting with a garage
|
||||
* door controller. Two companies side by side with wavelan devices
|
||||
* that could actually hear each other can use different NWIDs
|
||||
* and ignore packets. In truth however, the air space is shared,
|
||||
* and the NWID is a virtual filter.
|
||||
*
|
||||
* In the current set of wavelan drivers, ioctls changed only
|
||||
* the runtime radio modem registers which act in a manner analogous
|
||||
* to an ethernet transceiver. The ioctls do not change the
|
||||
* stored nvram PSA (or parameter storage area). At boot, the PSA
|
||||
* values are stored in the radio modem. Thus when the
|
||||
* system reboots it will restore the wavelan NWID to the value
|
||||
* stored in the PSA. The NCR/ATT dos utilities must be used to
|
||||
* change the initial NWID values in the PSA. The wlconfig utility
|
||||
* may be used to set a different NWID at runtime; this is only
|
||||
* permitted while the interface is up and running.
|
||||
*
|
||||
* By contrast, the IRQ value can only be changed while the
|
||||
* Wavelan card is down and unconfigured, and it will remain
|
||||
* disabled after an IRQ change until reboot.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <machine/if_wl_wavelan.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* translate IRQ bit to number */
|
||||
/* array for maping irq numbers to values for the irq parameter register */
|
||||
static int irqvals[16] = {
|
||||
0, 0, 0, 0x01, 0x02, 0x04, 0, 0x08, 0, 0, 0x10, 0x20, 0x40, 0, 0, 0x80
|
||||
};
|
||||
|
||||
/* cache */
|
||||
static int w_sigitems; /* count of valid items */
|
||||
static struct w_sigcache wsc[MAXCACHEITEMS];
|
||||
|
||||
int
|
||||
wlirq(int irqval)
|
||||
{
|
||||
int irq;
|
||||
|
||||
for(irq = 0; irq < 16; irq++)
|
||||
if(irqvals[irq] == irqval)
|
||||
return(irq);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *compat_type[] = {
|
||||
"PC-AT 915MHz",
|
||||
"PC-MC 915MHz",
|
||||
"PC-AT 2.4GHz",
|
||||
"PC-MC 2.4GHz",
|
||||
"PCCARD or 1/2 size AT, 915MHz or 2.4GHz"
|
||||
};
|
||||
|
||||
char *subband[] = {
|
||||
"915MHz/see WaveModem",
|
||||
"2425MHz",
|
||||
"2460MHz",
|
||||
"2484MHz",
|
||||
"2430.5MHz"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
** print_psa
|
||||
**
|
||||
** Given a pointer to a PSA structure, print it out
|
||||
*/
|
||||
void
|
||||
print_psa(u_char *psa, int currnwid)
|
||||
{
|
||||
int nwid;
|
||||
|
||||
/*
|
||||
** Work out what sort of board we have
|
||||
*/
|
||||
if (psa[0] == 0x14) {
|
||||
printf("Board type : Microchannel\n");
|
||||
} else {
|
||||
if (psa[1] == 0) {
|
||||
printf("Board type : PCCARD\n");
|
||||
} else {
|
||||
printf("Board type : ISA");
|
||||
if ((psa[4] == 0) &&
|
||||
(psa[5] == 0) &&
|
||||
(psa[6] == 0))
|
||||
printf(" (DEC OEM)");
|
||||
printf("\n");
|
||||
printf("Base address options : 0x300, 0x%02x0, 0x%02x0, 0x%02x0\n",
|
||||
(int)psa[1], (int)psa[2], (int)psa[3]);
|
||||
printf("Waitstates : %d\n",psa[7] & 0xf);
|
||||
printf("Bus mode : %s\n",(psa[7] & 0x10) ? "EISA" : "ISA");
|
||||
printf("IRQ : %d\n",wlirq(psa[8]));
|
||||
}
|
||||
}
|
||||
printf("Default MAC address : %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
psa[0x10],psa[0x11],psa[0x12],psa[0x13],psa[0x14],psa[0x15]);
|
||||
printf("Soft MAC address : %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
psa[0x16],psa[0x17],psa[0x18],psa[0x19],psa[0x1a],psa[0x1b]);
|
||||
printf("Current MAC address : %s\n",(psa[0x1c] & 0x1) ? "Soft" : "Default");
|
||||
printf("Adapter compatibility : ");
|
||||
if (psa[0x1d] < 5) {
|
||||
printf("%s\n",compat_type[psa[0x1d]]);
|
||||
} else {
|
||||
printf("unknown\n");
|
||||
}
|
||||
printf("Threshold preset : %d\n",psa[0x1e]);
|
||||
printf("Call code required : %s\n",(psa[0x1f] & 0x1) ? "YES" : "NO");
|
||||
if (psa[0x1f] & 0x1)
|
||||
printf("Call code : 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
||||
psa[0x30],psa[0x31],psa[0x32],psa[0x33],psa[0x34],psa[0x35],psa[0x36],psa[0x37]);
|
||||
printf("Subband : %s\n",subband[psa[0x20] & 0xf]);
|
||||
printf("Quality threshold : %d\n",psa[0x21]);
|
||||
printf("Hardware version : %d (%s)\n",psa[0x22],psa[0x22] ? "Rel3" : "Rel1/Rel2");
|
||||
printf("Network ID enable : %s\n",(psa[0x25] & 0x1) ? "YES" : "NO");
|
||||
if (psa[0x25] & 0x1) {
|
||||
nwid = (psa[0x23] << 8) + psa[0x24];
|
||||
printf("NWID : 0x%04x\n",nwid);
|
||||
if (nwid != currnwid) {
|
||||
printf("Current NWID : 0x%04x\n",currnwid);
|
||||
}
|
||||
}
|
||||
printf("Datalink security : %s\n",(psa[0x26] & 0x1) ? "YES" : "NO");
|
||||
if (psa[0x26] & 0x1) {
|
||||
printf("Encryption key : ");
|
||||
if (psa[0x27] == 0) {
|
||||
printf("DENIED\n");
|
||||
} else {
|
||||
printf("0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
||||
psa[0x27],psa[0x28],psa[0x29],psa[0x2a],psa[0x2b],psa[0x2c],psa[0x2d],psa[0x2e]);
|
||||
}
|
||||
}
|
||||
printf("Databus width : %d (%s)\n",
|
||||
(psa[0x2f] & 0x1) ? 16 : 8, (psa[0x2f] & 0x80) ? "fixed" : "variable");
|
||||
printf("Configuration state : %sconfigured\n",(psa[0x38] & 0x1) ? "" : "un");
|
||||
printf("CRC-16 : 0x%02x%02x\n",psa[0x3e],psa[0x3d]);
|
||||
printf("CRC status : ");
|
||||
switch(psa[0x3f]) {
|
||||
case 0xaa:
|
||||
printf("OK\n");
|
||||
break;
|
||||
case 0x55:
|
||||
printf("BAD\n");
|
||||
break;
|
||||
default:
|
||||
printf("Error\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,"usage: wlconfig ifname [param value ...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
get_cache(int sd, struct ifreq *ifr)
|
||||
{
|
||||
/* get the cache count */
|
||||
if (ioctl(sd, SIOCGWLCITEM, (caddr_t)ifr))
|
||||
err(1, "SIOCGWLCITEM - get cache count");
|
||||
w_sigitems = (int) ifr->ifr_data;
|
||||
|
||||
ifr->ifr_data = (caddr_t) &wsc;
|
||||
/* get the cache */
|
||||
if (ioctl(sd, SIOCGWLCACHE, (caddr_t)ifr))
|
||||
err(1, "SIOCGWLCACHE - get cache count");
|
||||
}
|
||||
|
||||
static int
|
||||
scale_value(int value, int max)
|
||||
{
|
||||
double dmax = (double) max;
|
||||
if (value > max)
|
||||
return(100);
|
||||
return((value/dmax) * 100);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_cache(int rawFlag)
|
||||
{
|
||||
int i;
|
||||
int signal, silence, quality;
|
||||
|
||||
if (rawFlag)
|
||||
printf("signal range 0..63: silence 0..63: quality 0..15\n");
|
||||
else
|
||||
printf("signal range 0..100: silence 0..100: quality 0..100\n");
|
||||
|
||||
/* after you read it, loop through structure,i.e. wsc
|
||||
* print each item:
|
||||
*/
|
||||
for(i = 0; i < w_sigitems; i++) {
|
||||
printf("[%d:%d]>\n", i+1, w_sigitems);
|
||||
printf("\tip: %d.%d.%d.%d,",((wsc[i].ipsrc >> 0) & 0xff),
|
||||
((wsc[i].ipsrc >> 8) & 0xff),
|
||||
((wsc[i].ipsrc >> 16) & 0xff),
|
||||
((wsc[i].ipsrc >> 24) & 0xff));
|
||||
printf(" mac: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
wsc[i].macsrc[0]&0xff,
|
||||
wsc[i].macsrc[1]&0xff,
|
||||
wsc[i].macsrc[2]&0xff,
|
||||
wsc[i].macsrc[3]&0xff,
|
||||
wsc[i].macsrc[4]&0xff,
|
||||
wsc[i].macsrc[5]&0xff);
|
||||
if (rawFlag) {
|
||||
signal = wsc[i].signal;
|
||||
silence = wsc[i].silence;
|
||||
quality = wsc[i].quality;
|
||||
}
|
||||
else {
|
||||
signal = scale_value(wsc[i].signal, 63);
|
||||
silence = scale_value(wsc[i].silence, 63);
|
||||
quality = scale_value(wsc[i].quality, 15);
|
||||
}
|
||||
printf("\tsignal: %d, silence: %d, quality: %d, ",
|
||||
signal,
|
||||
silence,
|
||||
quality);
|
||||
printf("snr: %d\n", signal - silence);
|
||||
}
|
||||
}
|
||||
|
||||
#define raw_cache() dump_cache(1)
|
||||
#define scale_cache() dump_cache(0)
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int sd;
|
||||
struct ifreq ifr;
|
||||
u_char psabuf[0x40];
|
||||
int val, argind, i;
|
||||
char *cp, *param, *value;
|
||||
struct ether_addr *ea;
|
||||
int work = 0;
|
||||
int currnwid;
|
||||
|
||||
if ((argc < 2) || (argc % 2))
|
||||
usage();
|
||||
|
||||
/* get a socket */
|
||||
sd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sd < 0)
|
||||
err(1,"socket");
|
||||
strncpy(ifr.ifr_name, argv[1], sizeof(ifr.ifr_name));
|
||||
ifr.ifr_addr.sa_family = AF_INET;
|
||||
|
||||
/* get the PSA */
|
||||
ifr.ifr_data = (caddr_t)psabuf;
|
||||
if (ioctl(sd, SIOCGWLPSA, (caddr_t)&ifr))
|
||||
err(1,"get PSA");
|
||||
|
||||
/* get the current NWID */
|
||||
if (ioctl(sd, SIOCGWLCNWID, (caddr_t)&ifr))
|
||||
err(1,"get NWID");
|
||||
currnwid = (int)ifr.ifr_data;
|
||||
|
||||
/* just dump and exit? */
|
||||
if (argc == 2) {
|
||||
print_psa(psabuf, currnwid);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* loop reading arg pairs */
|
||||
for (argind = 2; argind < argc; argind += 2) {
|
||||
|
||||
param = argv[argind];
|
||||
value = argv[argind+1];
|
||||
|
||||
/* What to do? */
|
||||
|
||||
if (!strcasecmp(param,"currnwid")) { /* set current NWID */
|
||||
val = strtol(value,&cp,0);
|
||||
if ((val < 0) || (val > 0xffff) || (cp == value))
|
||||
errx(1,"bad NWID '%s'",value);
|
||||
|
||||
ifr.ifr_data = (caddr_t)val;
|
||||
if (ioctl(sd, SIOCSWLCNWID, (caddr_t)&ifr))
|
||||
err(1,"set NWID (interface not up?)");
|
||||
continue ;
|
||||
}
|
||||
|
||||
if (!strcasecmp(param,"irq")) {
|
||||
val = strtol(value,&cp,0);
|
||||
val = irqvals[val];
|
||||
if ((val == 0) || (cp == value))
|
||||
errx(1,"bad IRQ '%s'",value);
|
||||
psabuf[WLPSA_IRQNO] = (u_char)val;
|
||||
work = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcasecmp(param,"mac")) {
|
||||
if ((ea = ether_aton(value)) == NULL)
|
||||
errx(1,"bad ethernet address '%s'",value);
|
||||
for (i = 0; i < 6; i++)
|
||||
psabuf[WLPSA_LOCALMAC + i] = ea->octet[i];
|
||||
work = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcasecmp(param,"macsel")) {
|
||||
if (!strcasecmp(value,"local")) {
|
||||
psabuf[WLPSA_MACSEL] |= 0x1;
|
||||
work = 1;
|
||||
continue;
|
||||
}
|
||||
if (!strcasecmp(value,"universal")) {
|
||||
psabuf[WLPSA_MACSEL] &= ~0x1;
|
||||
work = 1;
|
||||
continue;
|
||||
}
|
||||
errx(1,"bad macsel value '%s'",value);
|
||||
}
|
||||
|
||||
if (!strcasecmp(param,"nwid")) {
|
||||
val = strtol(value,&cp,0);
|
||||
if ((val < 0) || (val > 0xffff) || (cp == value))
|
||||
errx(1,"bad NWID '%s'",value);
|
||||
psabuf[WLPSA_NWID] = (val >> 8) & 0xff;
|
||||
psabuf[WLPSA_NWID+1] = val & 0xff;
|
||||
work = 1;
|
||||
continue;
|
||||
}
|
||||
if (!strcasecmp(param,"cache")) {
|
||||
|
||||
/* raw cache dump
|
||||
*/
|
||||
if (!strcasecmp(value,"raw")) {
|
||||
get_cache(sd, &ifr);
|
||||
raw_cache();
|
||||
continue;
|
||||
}
|
||||
/* scaled cache dump
|
||||
*/
|
||||
else if (!strcasecmp(value,"scale")) {
|
||||
get_cache(sd, &ifr);
|
||||
scale_cache();
|
||||
continue;
|
||||
}
|
||||
/* zero out cache
|
||||
*/
|
||||
else if (!strcasecmp(value,"zero")) {
|
||||
if (ioctl(sd, SIOCDWLCACHE, (caddr_t)&ifr))
|
||||
err(1,"zero cache");
|
||||
continue;
|
||||
}
|
||||
errx(1,"unknown value '%s'", value);
|
||||
}
|
||||
errx(1,"unknown parameter '%s'",param);
|
||||
}
|
||||
if (work) {
|
||||
ifr.ifr_data = (caddr_t)psabuf;
|
||||
if (ioctl(sd, SIOCSWLPSA, (caddr_t)&ifr))
|
||||
err(1,"set PSA");
|
||||
}
|
||||
return(0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user