Commit Graph

59 Commits

Author SHA1 Message Date
Poul-Henning Kamp
419d8080a4 Currently, each wireless networking driver has it's own control program
despite the fact that most people want to set exactly the same settings
regardless of which card they have.  It has been repeatidly suggested
that this configuration should be done via ifconfig.  This patch
implements the required functionality in ifconfig and add support to the
wi and an drivers.  It also provides partial, untested support for the
awi driver.

PR:		25577
Submitted by:	Brooks Davis <brooks@one-eyed-alien.net>
2001-05-26 09:27:08 +00:00
John Baldwin
8107ed2eda Disable the wi driver locking for now. The driver tries to tsleep with the
driver lock held on detach which can lead to annoying and useless panics.
2001-05-17 22:20:54 +00:00
Greg Lehey
e6d1172096 Fix world-breaking typo in previous commit. 2001-05-11 07:06:06 +00:00
Bill Paul
d639723b88 Try to read the station address twice during the probe. I've seen
a LinkSys card here in the office where reading the station address
fails the first time, but works find afterwards. Without this, the
probe fails. I don't think this will negatively impact any existing
cards, but I want to confirm this before MFC'ing.
2001-05-10 17:17:24 +00:00
Alfred Perlstein
43d97995d8 Add more diagnostic output for failure.
s/1518/ETHER_MAX_LEN

Some style changes, add some braces, mostly residual from having
a lot of debug hooks added while working on this driver.

Bring in a plethora of changes from NetBSD:

	revision 1.58
	date: 2001/03/08 11:07:08;  author: ichiro;  state: Exp;  lines: +17 -1
	it wait until busy flag disappears.
	it was able to prevent some cards with late initializing faling in wi_reset().

	revision 1.41
	date: 2000/10/13 19:15:08;  author: jonathan;  state: Exp;  lines: +4 -2
	Fix wi_intr() to avoid touching card registers during insert/remove  events,
	when sharing an interrupt with other devices:
	check sc->sc_enabled,  and drop the interrupt if its' off.

	revision 1.30
	date: 2000/08/18 04:11:48;  author: jhawk;  state: Exp;  lines: +4 -4
	Copy wi_{dst,src}_addr from struct wi_frame into faked-up ether_header
	instead of addr1 and addr2. THis means that tcpdump -e will show the
	correct MAC address for communications with access points instead of showing
	the BSSID.

	In the future there should be 802.11 support for bpf/libpcap/tcpdump,
	but that is aways down the road.
2001-04-10 05:29:26 +00:00
Warner Losh
f8ef5bfb0d Two minor fixes:
o Change the number of init tries from 5 to a #define.
	o Allow up to 5s rather than 2s for commands to complete.  This
	  is still much less than 51 minutes, but makes my intel card init
	  with more reliability than before.
2001-04-09 06:33:36 +00:00
Alfred Perlstein
b9d311049e use correct contants (from net/ethernet.h)
ETHER_TYPE_LEN instead of sizeof(u_int16_t) when looking at an ethernet
  header

ETHERTYPE_IP instead of 0x800
2001-04-06 22:21:57 +00:00
Alfred Perlstein
85d6297f46 replace hardcoded 1518 with ETHER_MAX_LEN 2001-04-06 21:48:19 +00:00
Alfred Perlstein
6857ad1f30 test should be for == 0, not < 0 2001-04-05 09:47:07 +00:00
Alfred Perlstein
34702f7e67 WI_TIMEOUT is 65536
65536 * 10msec == 10 minutes 55 seconds == hung machine

Instead wait for the busy bits for a max of ~2 seconds (200 * 10msec)
2001-04-05 09:25:37 +00:00
Alfred Perlstein
8da738fd11 Don't leak resources:
Don't leak iospace when irq allocation fails.  (call wi_free())

Call bus_release_resource() with the correct "rid" obtained from
bus_alloc_resource() that's saved in the softc instead of a hardcoded
0.
2001-04-05 06:56:10 +00:00
Alfred Perlstein
627d3c9285 call a watchdog timeout like it is. 2001-04-04 21:56:25 +00:00
Warner Losh
5ea63116b8 Doh! Last second change introduced two compile warnings. Fix them. 2001-04-04 06:05:46 +00:00
Warner Losh
840709e709 Try to INIT the cards up to 5 times in a row rather than just once.
It appears that some of the new PRISM2 cards need it.

Fail the probe if we fail to read the MAC address.

Fix a comment.

Delete the unload printf.  The bus system now prints this message.
2001-04-04 06:03:39 +00:00
Bill Paul
5f4d50b544 Fix a couple style nits, no code changes. Turn one magic number into
a #defined constant, wrap a few long lines, etc... Also remove stupid
'all your base are belong to us' joke from comment that I don't really
care to see immortalized in the source tree.
2001-03-29 19:11:45 +00:00
Alfred Perlstein
0d5b5df5cb Add support for the Addtron AWA100 PCI wireless card.
The AWA100 is a PCI board with a PLX 9052 chip that's used to talk to
the pccard inserted into the board.

Remove a redundant $FreeBSD while I'm here.
2001-03-28 05:05:05 +00:00
Alfred Perlstein
da1aa0fd06 limit the amount of retries when sending data to prevent lockups. 2001-03-27 05:03:49 +00:00
Assar Westerlund
fd1d7a8a15 change default from adhoc mode to BSS (infrastructure) 2001-03-12 04:49:50 +00:00
Bosko Milekic
9ed346bab0 Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)
2001-02-09 06:11:45 +00:00
Poul-Henning Kamp
6817526d14 Convert if_multiaddrs from LIST to TAILQ so that it can be traversed
backwards in the three drivers which want to do that.

Reviewed by:    mikeh
2001-02-06 10:12:15 +00:00
Poul-Henning Kamp
78d82c8c59 Use LIST_FOREACH() to traverse ifp->if_multiaddrs list, instead of
<sys/queue.h> implementation details.

Created with:   /usr/sbin/sed
Reviewed with:  /sbin/md5
2001-02-03 16:29:10 +00:00
Warner Losh
96b15e09d9 wi has been converted to NEWCARD, so included it when pccard is
included.

Also, I forgot to update this to the new cis[] structure last night,
mainly due to the above omission.
2001-01-21 18:10:38 +00:00
Bosko Milekic
08812b3925 Implement MTX_RECURSE flag for mtx_init().
All calls to mtx_init() for mutexes that recurse must now include
the MTX_RECURSE bit in the flag argument variable. This change is in
preparation for an upcoming (further) mutex API cleanup.
The witness code will call panic() if a lock is found to recurse but
the MTX_RECURSE bit was not set during the lock's initialization.

The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to
MTX_RECURSED, which is more appropriate given its meaning.

The following locks have been made "recursive," thus far:
eventhandler, Giant, callout, sched_lock, possibly some others declared
in the architecture-specific code, all of the network card driver locks
in pci/, as well as some other locks in dev/ stuff that I've found to
be recursive.

Reviewed by: jhb
2001-01-19 01:59:14 +00:00
Peter Wemm
2ca37b5a4f Add NEWCARD hooks. This seems to work just fine. 2001-01-17 12:31:59 +00:00
Peter Wemm
42383764a0 Move if_wl.c from sys/i386/isa to dev/wi - it is not i386 (or even isa)
specific.
2001-01-09 00:44:33 +00:00
John Baldwin
430e72ee1c Attempt to read and verify the card's status in wi_stop() before sending it
the disable command.  On some systems, writing to the card after it has
been ejected causes the machine to hang.

Reviewed by:	wpaul
2000-12-18 23:49:56 +00:00
Bill Paul
163369c243 Apply some contributed patches to reduce number of tx buffer allocation
failures and add some support for WEP on Prism II chip.

Submitted by: YAMAMOTO Shigeru <shigeru@iij.ad.jp>
2000-12-15 23:34:13 +00:00
Alfred Perlstein
82625cf321 remove unneded sys/ucred.h includes 2000-11-30 18:52:32 +00:00
Poul-Henning Kamp
cf9fa8e725 Move suser() and suser_xxx() prototypes and a related #define from
<sys/proc.h> to <sys/systm.h>.

Correctly document the #includes needed in the manpage.

Add one now needed #include of <sys/systm.h>.
Remove the consequent 48 unused #includes of <sys/proc.h>.
2000-10-29 16:06:56 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Bill Paul
9fa3f7b0f2 Update the wi driver to use mutexes instead of spls. 2000-10-13 20:33:24 +00:00
Bill Paul
2705f23073 Close PR #20963. Do not pass encryption keys back to the caller via
wi_ioctl() unless they're the superuser.
2000-09-07 17:05:12 +00:00
Archie Cobbs
21b8ebd926 Make all Ethernet drivers attach using ether_ifattach() and detach using
ether_ifdetach().

The former consolidates the operations of if_attach(), ng_ether_attach(),
and bpfattach(). The latter consolidates the corresponding detach operations.

Reviewed by:	julian, freebsd-net
2000-07-13 22:54:34 +00:00
Ollivier Robert
a0b74543ff Bring the an(4) fixes to wi(4):
- suser check
- splx() fix.

Reminded by:	Aaron Campbell <aaron@openbsd.org>
2000-06-19 00:17:13 +00:00
Archie Cobbs
2e2de7f23f Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.

The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.

The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.

Reviewed by:	freebsd-net
2000-05-14 02:18:43 +00:00
Poul-Henning Kamp
3389ae9350 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00
Bill Paul
339dabccd7 When in infrastructure mode, use address 3 from the 802.11 header as the
source address when receiving frames (and keep using address 2 when in
pseudo-IBSS mode). This is apparently necessary in order to obtain the
true MAC address of the sending station which is needed for PPPoE.

Patch supplied by: Blaz Zupan <blaz@amis.net>
2000-04-17 18:47:28 +00:00
Robert Watson
081d19aecd Modify if_wi.c to call bpfdetach(ifp) before if_detach(ifp), so as to
prevent a page fault if the card is ejected while BPF is in use.  This
could happen if DHCP or tcpdump was in use on that interface during
ejection.  Other drivers may also require this modification.

Reviewed by:	wes
2000-03-19 05:46:50 +00:00
Bill Paul
6f76cb1e28 Add support for WEP (encryption) for silver and gold WaveLAN/IEEE turbo cards.
Also update wicontrol to enable/disable encryption, set WEP keys and set the
TX key index. Silver cards only have 40-bit keys. This is something of a quick
hack, but it works well enough for me to commit this from the LinuxWorld
exhibit floor.

The WEP support only shows up if you have a card that supports it.

Would have been approved by: jkh, if he hadn't wandered off somewhere
Approved in his place by: msmith, who's standing right here
2000-02-02 17:59:13 +00:00
Bill Paul
8647d85ac3 Correctly set the data length when transmitting 802.3 frames (we need to
subtract the length of the SNAP header).
2000-01-12 00:57:27 +00:00
Peter Wemm
664a31e496 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 04:46:21 +00:00
Bill Paul
bfe31f4f2a Fix invocation of bus_teardown_intr(). The last arg is supposed to be
sc->wi_intrhand, not &sc->wi_intrhand.
1999-12-08 02:00:10 +00:00
Bill Paul
dda0e6f54e Update the WaveLAN/IEEE driver:
- Convert to new bus attachment scheme. Thanks to Blaz Zupan for doing
  the initial work here. One thing I changed was to have the attach
  and detach routines work like the PCI drivers, which means that in
  theory you should be able to load and unload the driver like the PCI
  NIC drivers, however the pccard support for this hasn't settled down
  yet so it doesn't quite work. Once the pccard work is done, I'll have
  to revisit this.

- Add device wi0 to PCCARD. If we're lucky, people should be able to
  install via their WaveLAN cards now.

- Add support for signal strength caching. The wicontrol utility has
  also been updated to allow zeroing and displaying the signal strength
  cache.

- Add a /sys/modules/wi directory and fix a Makefile to builf if_wi.ko.
  Currently this module is only built for the i386 platform, though once
  the pccard stuff is done it should be able to work on the alpha too.
  (Theoretically you should be able to plug one of the WaveLAN/IEEE ISA
  cards into an alpha with an ISA slot, but we'll see how that turns out.

- Update LINT to use only device wi0. There is no true ISA version of
  the WaveLAN/IEEE so we'll never use an ISA attachment.

- Update files.i386 so that if_wi is dependent on card.
1999-11-25 20:45:49 +00:00
Peter Wemm
4a6eb2cc6c Fix a warning. 1999-11-18 08:39:02 +00:00
Warner Losh
e653ecce87 Disable old PCCARD_MODULE code.
This should fix LINT.

Prompted by: phk's explicit message about LINT breakage
1999-10-29 17:28:09 +00:00
Bill Paul
98a229f65e As suggested by phk, unconditionalize BPF support in these drivers. Since
there are stubs compiled into the kernel if BPF support is not enabled,
there aren't any problems with unresolved symbols. The modules in /modules
are compiled with BPF support enabled anyway, so the most this will do is
bloat GENERIC a little.
1999-09-23 03:32:57 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Mike Smith
3ed7a59b07 Clean up after removing sys/eventhandler.h from sys/systm.h at the last
minute.  This should cover all of the missed cases (and should let LINT
build again).
1999-08-21 22:10:49 +00:00
Mike Smith
fcb893a801 Implement a new generic mechanism for attaching handler functions to
events, in order to pave the way for removing a number of the ad-hoc
implementations currently in use.

Retire the at_shutdown family of functions and replace them with
new event handler lists.

Rework kern_shutdown.c to take greater advantage of the use of event
handlers.

Reviewed by:	green
1999-08-21 06:24:40 +00:00
Bill Paul
7694cd9368 Correct the alignment of some of the members in the wi_frame structure.
The structure is the right length, but some of the members (notably
wi_q_info) were off a bit. This causes the received signal strength
values to appear bogus.
1999-07-20 20:03:42 +00:00