Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 May 2001 16:46:59 -0700 (PDT)
From:      "Bruce R. Montague" <brucem@mail.cruzio.com>
To:        freebsd-net@freebsd.org
Subject:   Linksys Wavelan WPC11 non-laptop links
Message-ID:  <200105122346.f4CNkxk00390@mail.cruzio.com>

next in thread | raw e-mail | index | archive | help


This describes setup of an 802.11b (Wi-Fi) radio
link between two desktop (non-laptop) PCs using
LinkSys Wavelan cards and without using a separate
access point,

One end of the link ran FreeBSD 4.3-RC #5 and the
other PicoBSD (same source code, that is, using 4.3
freebsd-stable). I knew little about this when I
started, and if there is a single doc capturing this
information I didn't find it.

I used two LinkSys WPC11 wireless PCMCIA cards (which
seem relatively common and reasonably cheap) and
did _not_ use a separate base station or access
point; the link is point-to-point. Although I found
a number of helpful resources, there are a number
of variables and a manual driver patch was required
(for 4.3 freebsd-stable), so I thought I'd log this
in one place.

If I'm off in the weeds anywhere in the following
or putting out bogus info, please let me know...


----------------------------------
* Helpful URLS include:

http://www.live.com/wireless/unix-base-station.html
http://www.onlamp.com/pub/a/bsd/2000/11/02/Big_Scary_Daemons.html
http://people.freebsd.org/~wpaul/wi.patch

 and the online CVS files at
http://www.freebsd.org/cgi/cvsweb.cgi


* The LinkSys WPC11 PCMCIA card is similar to the
Lucent Orinoco "gold/silver" cards, but with a few
differences (incompatibilities).  The generic name
for these cards is "WAVELAN/IEEE 802.11b".  The
FreeBSD-stable driver ("device wi") is in files
"/usr/src/sys/i386/isa/if_wi.c" and "if_wiregs.h".
This driver has been moved in freebsd-current to
the "usr/src/sys/dev/wi" directory, and appears to
be undergoing a reasonable amount of enhancement
(including mods motivated by "Linksys cards").  The
"isa/if_wi.c" source has been moved to the attic,
that is, deprecated.  The wi driver is colloquially
known as the "FreeBSD Wavelan driver" and on
non-laptops under freebsd-stable it only works with
ISA->PCMCIA bridge cards (not PCI->PCMCIA bridge
cards).

The chipset in the WPC11 is the Intersil (ex-Harris)
HFA3841/HFA3842.  The interface to the Orinoco and
similar cards is based on some sort of firmware-driven
microcontroller called the Lucent Hermes. Getting
Lucent doc for this has apparently been a source of
problems.  According to the required "if_wi.c" driver
patch for freebsd-stable, the WPC11 uses the "PRISM
II chip" as opposed to the "Lucent chip".

* Due to differences in laptop and non-laptop PCI
hardware, use of a PCI->PCMCIA bridge card in
non-laptops is not currently supported in FreeBSD-stable.
See:

http://groups.yahoo.com/group/freebsd-hackers/message/61239

 
* Thus, to use PCMCIA cards (PCCARDS) in desktop
FreeBSD systems, ISA->PCMCIA bridge cards must be
used. I had a hard time finding these. I ended
up using two "LinkSys ProConnect Desktop PCMCIA Card
Reader/Writer" (Model PCMRDWR) kits.  These include
an "internal" ISA->PCMCIA bridge card that connects
by ribbon cable to a 2-slot PCMCIA card adapter
physically similar to a floppy-drive unit.  These
are considered "external" PCMCIA kits because the
PCMCIA card does not mount directly into the bridge
card.

PCI->PCMCIA bridge kits seem to be quite popular
currently in association with Windows wireless
networks.  These seem to almost all be "internal"
kits, that is, the PCMCIA card mounts directly in
the bridge card, extending out the back of the PC.

* A patch by Bill Paul must be applied to the
FreeBSD-stable "isa/if_wi.c" driver file to support
the LinkSys WPC11. It looks like there might be a
slight version problem between the patch and 4.3
stable.



Key steps to installing and configuring picobsd and
freebsd support for the WPC11, using 4.3 freebsd-stable
source, are:

 
-------------------------------------
* In both kernel config files, assure the Wavelan
driver is added:

---
device		wi
---

This is already the case in GENERIC.  In picobsd
you probably need to put it into the PICOBSD config
file in your config directory.

-------------------------------------
* In both kernel config files, you also need the
PCMCIA driver (also already in GENERIC, you'll
probably only need one device in picobsd):

----
# PCCARD (PCMCIA) support
device		card
device		pcic0	at isa? irq 0 port 0x3e0 iomem 0xd0000
device		pcic1	at isa? irq 0 port 0x3e2 iomem 0xd4000 disable
-----


-------------------------------------
* Modify "/usr/src/sys/i386/isa/if_wi.c" and
"/usr/src/sys/i386/isa/if_wiregs.h" as per patch:

 http://people.freebsd.org/~wpaul/wi.patch

That is, download the patch in the "i386/isa"
directory and do a "patch <wi.patch".

This patch implements support for the LinkSys WPC11
(and similar cards?).  The patches to "if_wi.c"
applied cleanly, but the last patch to "if_wiregs.h"
did not.

* Manually add the following line to the end of
"struct wi_softc" in "if_wiregs.h":

-----
        int                     wi_prism2;      /* set to 1 if it uses a Prism II chip */
-----

Without this patch, operations on the LinkSys card
will hang or get bogus data. Specifically, commands
such as "ifconfig wi up" immediately hang the system.


-------------------------------------
* Modify the patched "/usr/src/sys/i386/isa/if_wi.c"
file and remove the reference to "rman_make_alignment_flags()",
which will cause 4.3-RC FreeBSD to fail on kernel
link.  In file "if_wi.c", replace:

----------------
static int wi_alloc(dev)
	device_t		dev;
{
	struct wi_softc		*sc = device_get_softc(dev);
	int			rid;

	rid = 0;
	sc->iobase = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
				0, ~0, (1 << 6),
				rman_make_alignment_flags(1 << 6) | RF_ACTIVE);
----------------

 with:

----------------
static int wi_alloc(dev)
	device_t		dev;
{
	struct wi_softc		*sc = device_get_softc(dev);
	int			rid;

	rid = 0;
	sc->iobase = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
				0, ~0, (1 << 6),
				RF_ACTIVE);
				/* rman_make_alignment_flags(1 << 6) | RF_ACTIVE); */
----------------

That is, just make the last argument "RF_ACTIVE".
The "rman_make_alignment_flags()" looks like it
works in freebsd-current.
 


------------------------------------
* Modify the FreeBSD "rc.conf" file to init the
PCCARD driver via "pccardc" and run the PCCARD
daemon, "pccardd" (add the following to "/etc/rc.conf"):

---------------
pccard_enable="YES"
pccard_mem="DEFAULT"
---------------

For picoBSD, I ran the programs directly by editing
"rc" (here "geode_ipfw" was my custom directory).
In file:

/usr/src/release/picobsd/geode_ipfw/floppy.tree/etc/rc

 add near the end:

---------------
#### Enable pccard support:
pccardc pccardmem 0xd0000 1>/dev/null && echo -n ' memory'
pccardd -f /etc/pccard.conf && echo -n ' pccardd'
#####
---------------
 
The "pccardd" command specifies a non-default
"pccard.conf" (the "-f"; there is no "/etc/defaults"
directory in a typical picoBSD configuration).


------------------------------------
* The "pccardd" daemon controls PCCARD activation
on card insert. It is driven by a "database" config
file that contains defaults for various known PCCARDS.
Under FreeBSD the file is:

/etc/defaults/pccard.conf

This file does not contain a description for the
LinkSys WPC11. The standard technique for adding
"custom" PCCARD definitions is to put them in a
"/etc/pccard.conf" file that is included by
"/etc/defaults/pccard.conf".

I created an "/etc/pccard.conf" file consisting of
the following (a definition for the WPC11):

---------------
# LinkSys WPC11: Derivative of Lucent WaveLAN/IEEE
card "Instant Wireless " " Network PC CARD"
        config  0x1 "wi0" 9  0x10000 
#        insert  sh /etc/server.sh

---------------

* Note that it is _imperative_ that the strings on
the "card" line be given exactly as specified, that
is, with the trailing and leading spaces.  These
are the names that are displayed by the "pccardc
dumpcis" command (see below).  If these strings do
not match, the "pccardd" daemon will complain - "No
card in database for "Instant Wireless "(" Network
PC CARD")".

* The "9" in the "config" line is the IRQ used by
the WPC11. This must be correct, that is, an available
unused IRQ.  Find an unused IRQ by doing a "dmesg
| egrep irq" and using knowledge of the machine.
A wrong irq often results in messages of the form
"wi0: device timeout".

* The " 0x10000 " in the "config" line is a set of
control flags passed to the driver. IT IS ACTUALLY
THESE FLAGS, not any hardware signature, that
determines whether the driver treats the hardware
as a Prism II or Lucent chip (vitally important).

* Remove the comment # on the "insert" line after
your "server.sh" (or whatever path/name) startup-script
has been manually verified.


------------------------------------
* The last line in the "pccard.conf" file must be
terminated by a new-line or the "pccardd" program
will hang forever.


------------------------------------
* In picoBSD, you do not want to include the entire
"pccard.conf" file, just the data you need.  Create
a file (using your config dir):

/usr/src/release/picobsd/geode_ipfw/floppy.tree/etc/pccard.conf

 that consists of the following:

---------------
# picoBSD PCCARD configuration file
#
# Generally available IO ports
io      0x240-0x360
# Generally available IRQs (Built-in sound-card owners remove 5)
irq     3 5 10 11 15
# Available memory slots
memory  0xd4000  96k
#
#
#
# LinkSys WPC11: Derivative of Lucent WaveLAN/IEEE
card "Instant Wireless " " Network PC CARD"
       config  auto "wi" ? 0x10000 
#      insert  sh /etc/client.sh
#

---------------

Again note that the last line in "pccard.conf" must
end in a newline to avoid a "pccardd" hang.  Depending
on your hardware configuration, you may need to
hardcode the "config" similar to the FreeBSD case.
Remove the comment # from the "insert" line after
your "client.sh" startup-script has been manually
verified.



------------------------------------
* For picoBSD, add "pccardc", "pccardd", and
"wicontrol" to the system to be built. In my
example, in file:

/usr/src/release/picobsd/geode_ipfw/crunch.conf

 add the following:

-------
srcdirs /usr/src/usr.sbin/pccard
#
-------

 and

-------
progs pccardc
progs pccardd
progs wicontrol
-------

The "source directories" needed in "crunch.conf"
are the directories where the "Makefile" that builds
the program is located.


------------------------------------
* The "card0" device node needs to exist in "/dev".

* In picoBSD, edit the file named "config" in your
configuration directory, for instance, in my case
I edited file:

/usr/src/release/picobsd/geode_ipfw/config:

 and added "card0" to the end:

MY_DEVS=" ... card0"


 A complete example for my device build line is:
-------
MY_DEVS="std tun2 vty10 fd0 ad0 ad0s1 ad0s2 acd0 pty0 cuaa0 cuaa1 bpf0 bpf1 bpf2 ad0s1a ad0s1b ad0s1c ad0s2a ad0s2b ad0s2c card0"
-------


------------------------------------
* Create start-scripts to bring up both sides of the link.
The smallest connectivity-test scripts I used were:

On the FreeBSD system, "/etc/server.sh":

------------------
#
# Server-side 802.11b (WiFi) radio set-up.
#
# Note if you are using 40-bit cards, that
# names are limited to 5 characters (5*8).
# Newer cards may be 128-bit cards.
#
ifconfig wi0 down
#
wicontrol -i wi0 -c 0
wicontrol -i wi0 -p 3
#
ifconfig wi0 192.168.0.2
#
------------------

 On the picoBSD system, in:

/usr/src/release/picobsd/geode_ipfw/floppy.tree/etc/client.sh

 file contents:
 
------------------
#
# client-side 802.11b (WiFi) radio set-up.
#
# Note if you are using 40-bit cards, that
# names are limited to 5 characters (5*8).
# Newer cards may be 128-bit cards.
#
#
ifconfig wi0 down
#
wicontrol -i wi0 -c 0
wicontrol -i wi0 -p 3
#
ifconfig wi0 192.168.0.14
#
------------------

(naturally your IP addresses will differ).

The "-c 0" means not to create (or join?) a BSS
(cell) and "-p 3" means to operate the "port"
in ad-hoc mode. In ad-hoc mode PCs talk directly
to each other (as if on an ethernet link).

Although apparently not necessary in ad-hoc mode,
it seems reasonable to assign "station" (node) names
("-s") and the name of the "radio network" ("service
set", SS, similar to a "cell") that one wants to
join ("-n"). To actually create the named SS, use
"-q" on the ``server'' (this probably only has meaning
in BSS mode).  Also, using encryption (WEP) and 
setting a key should be done in real operation.

A more realistic set of startup-scripts is:

------------------
#
# Server-side 802.11b (WiFi) radio set-up.
#
# Note if you are using 40-bit cards, that
# names are limited to 5 characters (5*8).
# Newer cards may be 128-bit cards.
#
ifconfig wi0 down
#
wicontrol -i wi0 -s srv1  # `station' (node) name.
wicontrol -i wi0 -n bruce  # Name of `radio-net/set' to join.
wicontrol -i wi0 -q bruce  # Name of `radio-net/set' to create.
#
wicontrol -i wi0 -e 1                 # WEP encryption ON.
wicontrol -i wi0 -k 0x1234512345 -v 1 # Set key 1.
wicontrol -i wi0 -T 1                 # Use key 1.
#
wicontrol -i wi0 -c 0    # No IBSS (AP).
wicontrol -i wi0 -p 3    # Ad-hoc mode.
#
ifconfig wi0 192.168.0.2 # IP address.
#
------------------

------------------
#
# client-side 802.11b (WiFi) radio set-up.
#
# Note if you are using 40-bit cards, that
# names are limited to 5 characters (5*8).
# Newer cards may be 128-bit cards.
#
#
ifconfig wi0 down
#
wicontrol -i wi0 -s foo    # `station' (node) name.
wicontrol -i wi0 -n bruce  # Name of `radio-net/set' to join.
#
#
wicontrol -i wi0 -e 1                 # WEP encryption ON.
wicontrol -i wi0 -k 0x1234512345 -v 1 # Set key 1.
wicontrol -i wi0 -T 1                 # Use key 1.
#
wicontrol -i wi0 -c 0      # No IBSS.
wicontrol -i wi0 -p 3      # Ad-hoc mode.
#
ifconfig wi0 192.168.0.14  # IP address.
#
------------------



------------------------------------
* Both systems should be rebuilt, and then booted
once with the verbose switch (on FreeBSD, press
enter on countdown and then "boot -v"). For (the
new non-/boot/loader) picoBSD, at the "boot:"
countdown prompt, type "-v" and hit Enter.

* After boot, scan the output of "dmesg" for:

 "wi0: found PrismII chip"

If you see "wi0: found Lucent chip", your "pccard.conf"
file has something wrong.


------------------------------------
* In FreeBSD, assure that "card0" exists.  "cd /dev"
and do a "MAKEDEV card0" if no "card0" exists.


------------------------------------
* Manually execute and test the startup-scripts that
contain the "wicontrol" commands. The "wicontrol"
program can be considered a logical extension to
"ifconfig" (in NetBSD it is apparently called
"wiconfig").

* Before executing the scripts, an "ifconfig" will
show "wi0" is not "UP", and the red LED on the WPC11
card will blink constantly.

* Assigning "wi0" an IP address will also bring the
device "UP". When this happens, the red LED on the
WPC11 will stay solidly on.

* A "wi0: init failed" always occurs on driver
startup. This is a timeout. It appears innocuous.

* Naturally, before using the link you need to
configure your routing tables with commands on both
systems similar to:

 netstat -rn
 route add default 192.168.0.2


* After this, the link should work.  Verify with a
"ping" to the other system, then exercise other
TCP/IP traffic.


------------------------------------
* Commands that can be used to display status:

--------------
* To display WPC11 settings:

>wicontrol
or
>wicontrol -i wi0

Both these commands produce the same output; the
default argument is "-i wi0".  Output of this command
includes the station (node) and "service set ID"
(radio network) names:

Station name:                           [ srv1 ]
SSID for IBSS creation:                 [ bruce ]
Current netname (SSID):                 [ bruce ]
Desired netname (SSID):                 [ bruce ]
Current BSSID:                          [ 00:00:00:00:00:00 ]

These names are not to be confused with DNS or other
names. The BSSID is 0 in 802.11b ad-hoc mode. Other values
of interest are:

Port type (1=BSS, 3=ad-hoc):            [ 3 ]
MAC address:                            [ 00:dd:e5:c0:00:72 ]
TX rate (selection):                    [ 3 ]
TX rate (actual speed):                 [ 11 ]

Create IBSS:                            [ Off ]

WEP encryption:                         [ Off ]
TX encryption key:                      [ 1 ]
Encryption keys:                        [  ][  ][  ][  ]


The "Off" flag for "Create IBSS" indicates the card
is in 802.11b ad-hoc mode. To see the values for
transmit (TX) rate, do a "man wicontrol", which
shows 3 to be "auto select high".


--------------
* To display 802.11b link stats:

>wicontrol -o

This is useful for checking error rates on wireless
links.


--------------
* To display firmware PCMCIA values/settings in the
WPC11 card:

>pccardc dumpcis

This shows the PCMCIA "Card Information Structure",
which for the WPC11 includes:

  Version = 5.0, Manuf = [Instant Wireless ], card vers = [ Network PC CARD]
  Addit. info = [Version 01.02],[]

This command can be given as soon as the "wi" driver
is included in the kernel and the "pccardc pccardmem
0xd0000 " executed (that is, before the "pccard.conf"
database is correct).


 


===================
==== Remarks ======
==================

The above only applies to 4.3 stable. Under
freebsd-current the same basic procedure should work
but the patches should not be needed.

Helpful man pages: wi, wicontrol, pccardd, pccardc,
pcard.conf.

There appears to be some confusion in terminology
between "ad-hoc", BSS, IBSS, and ESS modes.  What 
appears to be a fairly widespread 3COM white paper, 
"What's New in Wireless LANs: The IEEE 802.11b 
Standard" (one copy at):

http://www.pulsewan.com/data101/802_11_b_basics.htm

defines ad-hoc mode as the same as IBSS ("Independent
Basic Service Set"). In this mode an access point
(AP, essentially a cell-controller) is not used;
the wireless cards simply provide the equivalent of
a local ethernet cable.  In the 3COM doc a BSS is
a "cell" controlled by an AP, and an ESS (extended
SS) is a network of APs.

I assumed the "wicontrol" BSS "port type" means an
access point is to be used, and ad-hoc means no AP
is used.  I never did get the WPC11s to operate in
BSS mode, that is, not in ad-hoc mode (but then, I
did not have an AP).  Ross Finlayson's experience
at:

http://www.live.com/wireless/unix-base-station.html

(also without an AP) is presumably different because
he was using Lucent Orinoco cards, perhaps with
"updated" firmware?


The WPC11 cards do not all appear the same.  Some
(presumably older) come with doc that says they work
with 40-bit WEP encryption, others with doc that
says they will work up to 128 bits. Both old and
new cards seem to interoperate OK at 40-bits or with
WEP off.

I'm assuming some version of freebsd-current will
eventually support PCI->PCMCIA bridges. Does
freebsd-current already do this?

I don't know if PC-104 (an ISA derivative) will work
with ISA->PCMCIA bridges, although I assume something
like these must exist.  PicoBSD folks probably have
experience with WPC11 cards and PC-104?

The same WPC11 card, in the same machine, will not 
necessarily reuse the same MAC address across boots
(presumably it uses an address that does not appear
to be in use in the "cell"?) Rebooting a system may
thus result in console/log messages on other systems
of the form:

"arp: <ip addr> moved from <MAC addr> to <MAC addr> on wi0"

This does not appear to cause any problems.  It
appears to be the last byte of the MAC address that
changes... but?

I don't know if it's possible to use antennas with
the WPC11 cards. People seem to only use antennas
with true access point units, but somewhere some
doc suggested that the access points are actually
just using the same cards (with different firmware
or settings?), so maybe there is a way to connect
an antenna? Although 802.11b seems short-range
using just the cards, people seem to achieve 802.11b
links the better part of 10 miles using directional
antennas (amplified? higher power?).





- bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105122346.f4CNkxk00390>