Commit Graph

44 Commits

Author SHA1 Message Date
dyoung 7f9c7dad5a For a proper IBSS merge, we have to discard the old beacon packet,
create and queue a new one that carries the new BSSID.  I mined
net80211 in FreeBSD for the solution, which is to make an
IEEE80211_S_RUN->IEEE80211_S_RUN state transition---ath_newstate
discards the old beacon packet creates a new one by calling
ath_beacon_alloc.

I tested the merge as follows.  Starting at my desk on the second
floor of the building where I work:

soekris% ifconfig ath0 mediaopt adhoc ssid zzz chan 11 down

powerbook% ifconfig rtw0 mediaopt adhoc ssid zzz chan 11 up

soekris% sleep 25; ifconfig ath0 up

I raced to the elevator with my Powerbook, pressed the "Down"
button, got in, and pressed "Floor 1."  At the first floor:

powerbook% ifconfig rtw0 | grep bssid
        bssid 02:p:p:p:p:p chan 11

I waited 25 seconds.  I pressed "Floor 2."  At Floor 2, I returned to my desk.
I checked to make sure that the Soekris console read:

soekris% ath0: creating bss 02:s:s:s:s:s
ath0: bss merge 02:s:s:s:s:s -> 02:p:p:p:p:p

0:s:s:s:s:s is the Soekris' WLAN MAC.  0:p:p:p:p:p is the Powerbook's
WLAN MAC.  Each created an ad hoc-mode BSSID from its WLAN MAC by
OR'ing 0x2 with the first octet.

My Powerbook created a network while the Soekris radio was off.
The Soekris radio turned on while I was in the 802.11-impervious
elevator with my Powerbook.  When I returned to the second floor,
the Soekris "heard" beacons from my Powerbook as the elevator door
opened.  Since the Powerbook's network was approximately 25 seconds
older than the Soekris', and since it had the same SSID (zzz) as
the Soekris', the Soekris merged with the Powerbook's network (by
setting its BSSID) as it should.
2005-01-19 04:56:42 +00:00
dyoung 500260511f It's necessary to stop DMA on the beacon ring and reconfigure the
beacon after an IBSS merge, or else beacons transmissions may not
resume like we expect.  From Sam Leffler.
2005-01-16 11:43:34 +00:00
dyoung 00f3f1b613 In ad hoc mode, start the ath rate adaptation with the lowest, most
robust transmit bit rate.  From Greg Troxel.
2005-01-04 01:45:04 +00:00
dyoung 5dc6377838 IBSS-merge clean-up, inspired by some Linux patches from Jon Anderson
(mail@janderson.ca): remove ieee80211_ibss_merge's TSFT argument.
Do the TSFT comparison in the drivers (ath, atw).  Remove a lot of
extraneous debug statements from ieee80211_ibss_merge.

Set the ieee80211_node's state to IEEE80211_STA_BSS after it's been
copied to the ic_bss, not before.

In struct ieee80211_node, make the ni_tstamp field a union of a
uint64_t and the 8 TSF octets so that it's easier to compare a
neighbor's TSF with the local TSF.

Log IBSS merges (Greg Troxel's suggestion).  Also log IBSS creation.
These are rare and important events that deserve to be logged.
2005-01-04 00:56:51 +00:00
dyoung 5ca7c3d3af Disconnect the "stop transmitter/receiver" function from the
"power-off NIC" function, by adding a 'disable' argument to ath_stop.
Pass disable=0 to ath_stop() at the top of ath_init, so that we
don't power-off the Cardbus slot before resetting the HAL.  Thanks
to Greg Troxel for his analysis of this bug.
2004-12-27 07:01:00 +00:00
yamt 478d44cb16 ath_getmbuf: check MCLGET failure. 2004-09-28 11:34:37 +00:00
enami 5cdda6c35f ath_debug is bitmask and takes much wider value than 0, 1, or 2. 2004-09-07 01:15:59 +00:00
dyoung c9108ddfc8 Hubert Feyrer points out that hw.ath.countrycode really ought to
be writeable.  Make hw.ath.outdoor writeable while I am here.
2004-08-18 21:59:39 +00:00
dyoung 2bcbb9cb72 IBSS fixes: get IBSS beacon generation right. Merge with a same-SSID,
same-channel IBSS.
2004-08-10 01:03:52 +00:00
dyoung 8abb07d1ac Make the node table into an LRU cache: least-recently used nodes
are at the end of the node queue.  Change the reference-counting
discipline: ni->ni_refcnt indicates how many times net80211 has
granted ni to the driver.  Every node in the table with ni_refcnt=0
is eligible to be garbage-collected.  The mere presence of a node
in the table does not any longer indicate its auth/assoc state;
nodes have a ni_state variable, now.  A sysctl,
net.link.ieee80211.maxnodecache, controls the maximum LRU cache
size.

While I am here, patch ieee80211_find_node_for_beacon to do a "best
match" by bssid/ssid/channel, not a "perfect match."  This keeps
net80211 from caching duplicate nodes in the table.
2004-08-10 00:57:20 +00:00
yamt 96e7bb0952 ath_init1: return EIO rather than -1 on a failure of ath_hal_reset.
-1 isn't appropriate for if_init.
2004-08-08 13:01:03 +00:00
dyoung 49dce0aac4 Synchronize with the WEP code in madwifi. Konstantin KABASSANOV
verified for me that this fixes his WEP problems.  The HAL ABI for
WEP had changed.
2004-08-03 20:06:54 +00:00
mycroft 85e28ec5ee Only discard beacons in AHDEMO mode, where we ignore management frames
completely.  In particular, accept them in monitor mode (where we generally
aren't doing anything unless we're in promiscuous mode anyway) and host-AP
mode (where we want to see neighbor APs).
2004-07-30 17:40:57 +00:00
dyoung 110ceded85 Finalize import of the Atheros HAL 0.9.9.13, bringing ath(4)
up-to-date where the HAL API changed.
2004-07-28 08:57:40 +00:00
mycroft f526e7326b Cleanup of ieee80211_node from madwifi:
* Don't use ifp pointers; use ieee80211com.
* Implement the locking macros that are used under FreeBSD and Linux.
2004-07-23 10:15:13 +00:00
mycroft 50d44f4f07 IEEE80211_F_WEPON -> IEEE80211_F_PRIVACY 2004-07-23 08:31:39 +00:00
mycroft ff96f8f444 Support promiscuous mode for an AP too(!). 2004-07-22 18:52:44 +00:00
dyoung ee1c094dae No need for ath_start to set the WEP bit in the frame header, the
802.11 layer does it for us.
2004-05-31 11:39:39 +00:00
atatat 16122fe06c Remaining sysctl descriptions under hw subtree (ath and bge) 2004-05-25 04:38:36 +00:00
dyoung 4c4f215885 From FreeBSD. Lots has changed. I lazily yank text from the
FreeBSD commit log:

----------------------------
use correct malloc type to allocate struct ieee80211_node's

Noticed by:	phk
----------------------------
do proper subclassing of node free+copy; the previous hack falls apart when
the 802.11 layer does useful work

Obtained from:	madwifi
----------------------------
transmit beacon frames directly instead of defering them to a swi; there
was too much delay

Obtained from:	madwifi
----------------------------
update copyright notice for 2004
----------------------------
check more quickly (and directly) if an interrupt is pending; this reduces
work done in ath_intr when the irq is shared

Obtained from:	madwifi
----------------------------
cleanup descriptor allocation if attach fails

Obtained from:	madwifi
----------------------------
remove use IEEE80211_C_RCVMGT
----------------------------
radiotap updates:

o force little-endian byte order for header
o pad header to 32-bit boundary to guard against applications that assume
  packet data alignment
----------------------------
Don't announce MAC addresses twice.
(ieee80211_ifattach() calls ether_ifattach().)
----------------------------
Make this compile on amd64.

"I'll cope" by:  sam
----------------------------
When draining the tx queue reclaim any node references held in packets.
This fixes a problem when operating as an AP where clients would get
stuck in the node table because the reference count never went to zero.
----------------------------
When ath_hal_stoptxdma returns an error dma is still likely stopped
so don't just stop trying to send a beacon frame or we'll be more likely
to lose sync.  This only seems to happen on some older chips.
----------------------------
use ath_reset instead of ath_init when recovering from a watchdog timeout:
resetting the hardware is sufficient, no need to reset the 802.11 fsm
----------------------------
make hw.ath.debug a tunable
----------------------------
make hw.ath.outdoor and hw.ath.countrycode tunables
----------------------------
split debugging messages up into classes;
ah_debug is now treated as a bit vector
----------------------------
update radiotap support to reflect recent changes:

o move tx taps from ath_start to ath_tx_start so lots more
  state is available to tap
o add tx flags
o add tx rate
o add tx power (constant for the moment)
o add tx antenna state
----------------------------
o eliminate widespread on-stack mbuf use for bpf by introducing
  a new bpf_mtap2 routine that does the right thing for an mbuf
  and a variable-length chunk of data that should be prepended.
o while we're sweeping the drivers, use u_int32_t uniformly when
  when prepending the address family (several places were assuming
  sizeof(int) was 4)
o return M_ASSERTVALID to BPF_MTAP* now that all stack-allocated
  mbufs have been eliminated; this may better be moved to the bpf
  routines
2004-04-30 23:59:48 +00:00
atatat b233127eb3 GC ath_node_root as well, but modify to work around the single
(tightly scoped) reason for recording the node address by recording
the assigned number.  Dink pci/if_bge.c to match, since ic/ath.c was
used as the archetype.
2004-03-27 04:37:59 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
dyoung 224491add0 Move the ath(4) sysctls to hw.ath from ath. 2004-03-15 03:26:04 +00:00
dyoung a0e5ea5bcb Enable extended channel set.
Add some debug code for printing the HAL's notion of available
channels if hw.ath.debug = 1.
2004-03-13 05:43:08 +00:00
dyoung 3644406951 Attach the ath(4) sysctls:
ath.dwell: channel dwell time (ms) for AP/station scanning
ath.calibrate: chip calibration interval (secs)
ath.outdoor: enable/disable outdoor operation
ath.countrycode: (opaque?) country code
ath.regdomain: (opaque?) regulatory domain
ath.debug: 0 (no debug messages), 1 (some messages), 2 (all messages)
2004-03-01 01:19:45 +00:00
dyoung d68ab48dd5 Update ath(4)'s Hardware Abstraction Layer (HAL) to version 0.9.6.11.
Both the API and ABI changed, hence the changes to so many .c and
.h files.
2004-02-29 00:47:21 +00:00
dyoung 59eb8ab913 Synchronize with FreeBSD:
* add constants to enums

 * HAL update: stops panics, fixes ad hoc-mode beacons, some API
   changes

 * get and use mac/phy/rf front-end revision codes

 * add a custom ath(4) ic_node_getrssi callback which does RSSI
   averaging

 * do not immediately scan, but re-associate after missing beacons.

 * bug fix: don't if_init after detach.

 * HAL diagnostics ioctl, SIOCGATHDIAG

 * send DS parameters element in beacons

 * const-ify some pointers

 * consolidate rx-filter settings into ath_calcrxfilter

 * abstract FreeBSD `ticks', NetBSD `hardclock_ticks' with ATH_TICKS()

 * misc. other changes
2003-12-16 06:48:08 +00:00
dyoung d942dc3968 In _STA mode, don't panic when a stray beacon-miss interrupt is
received.  Instead, ignore it. It's normal for a stray to come
during the transition to monitor mode.
2003-12-07 05:09:02 +00:00
dyoung 0c32f8693f So that the internal bridge works in AP mode, call ath_start after
processing Rx packets.
2003-11-16 09:32:01 +00:00
wiz c5670263e0 Fix some typos. From Tom Cosgrove via jmc@openbsd. 2003-11-02 11:07:44 +00:00
dyoung 76db6bfa8c Use ieee80211_find_rxnode to attribute Rx packets to the write
ieee80211_node. This reduces code duplication.  It will help us
support passive scanning and rate adaptation.
2003-11-02 01:55:40 +00:00
yamt 65995a9aa2 don't swap powerhook and shutdownhook. 2003-10-21 01:00:57 +00:00
dyoung 1ff3c191c9 Fix WEP transmission, too. From FreeBSD/Sam Leffler. 2003-10-16 09:31:08 +00:00
dyoung bcde77e394 ath(4) failed to detect when the number of DMA segments exceeded
the number of descriptors, because of a disparity between the
bus_dmamap_load_mbuf implementation in FreeBSD and NetBSD. Now I
cover up the difference using ath_dmamap_load_mbuf.

Thanks Enami Tsugutomo for diagnosing this.
2003-10-16 09:13:30 +00:00
ichiro 581dfca276 add {shutdownhook,powerhook}disestablish() 2003-10-16 07:55:18 +00:00
itojun a4a1466cb5 add $NetBSD$ 2003-10-15 23:23:39 +00:00
enami 73473f6883 Return 0 on SIOC{ADD,DEL}MULTI. 2003-10-15 22:41:22 +00:00
itojun d587f445de s/printf/DPRINTF/ for ath_rate_ctl() 2003-10-15 22:19:31 +00:00
dyoung e86c830f2a Fix WEP reception. 2003-10-15 11:40:07 +00:00
enami 8823a8da9a Port multicast handling to NetBSD. Addresses PR23151. 2003-10-15 03:04:03 +00:00
dyoung f2a9708c75 Do not index arrays using enum constants, since enums can be
re-ordered and extended. Instead, use a switch-statement or a
key->value table with appropriate bounds-checking.
2003-10-14 23:13:44 +00:00
ichiro f4f7b1ae5c add support ath on cardbus
- implement power management
2003-10-14 17:47:03 +00:00
dyoung a71225fe22 NetBSD/FreeBSD compatibility changes NetBSD, especially
locking, mbuf
2003-10-13 05:34:30 +00:00
dyoung c3139592cc Initial import of ath(4) from FreeBSD. 2003-10-07 05:27:17 +00:00