Commit Graph

219 Commits

Author SHA1 Message Date
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
elad d5ebb97b46 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 18:44:45 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
ad 3029ac48c7 - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
2006-07-21 16:48:45 +00:00
elad 2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
dyoung c205496a96 Note in radiotap header file and manual page that radiotap fields
are little-endian.  Fix wi(4) and atw(4) to reflect this fact.
2006-03-12 03:22:02 +00:00
thorpej 3ddf26777f Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
2006-02-20 16:50:36 +00:00
perry 93124077ae Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:27:29 +00:00
skrll 302689559d Adapt drivers to the new net80211(9).
Most of this is from dyoung@. Thanks!
2005-11-18 16:53:56 +00:00
christos c3766be38e Allow setting the MAC address via wiconfig -m (Lord Isildur) 2005-08-10 13:20:42 +00:00
drochner 53a6f78e01 disable SYSCTL_SETUP for _LKM until we have a plan how to deal with
it correctly
2005-07-23 16:09:39 +00:00
yamt d7714c3b58 #ifdef out an unused variable in the case of !WI_DEBUG. 2005-07-16 04:06:39 +00:00
dyoung 8e16397dbf Add a sysctl for turning wi(4) debugging on and off.
Do not print the number of tx commands outstanding on entrance to
wi_cmd_intr unless wi_debug > 1.
2005-07-15 22:33:29 +00:00
dyoung 1aeb04f480 Clear IEEE80211_F_DROPUNENC in ic_flags in operating states where
the NIC decryptes & decapsulates WEP frames before passing them to
the host.  "Remember" the state of IEEE80211_F_DROPUNENC in
sc_ic_flags, though, and try our best to honor it as we setup the
hardware state.

This is the second patch of this kind.  The previous patch was
badly broken because wi_mend_flags was basing its decision to clear
IEEE80211_F_DROPUNENC based on the operating state we were
transitioning FROM instead of the state we were transitioning TO.

This fixes a bug that Simon Burge reported, where dhclient wi0
would not get a lease unless and until you ran 'ifconfig wi0'
concurrently (which would frob the IEEE80211_F_DROPUNENC bit in
the right way).  This patch was tested by Simon with his Toshiba
Lucent-clone.
2005-07-14 00:28:51 +00:00
dyoung 83a9bf2c5c Historically, an(4), ath(4), atw(4), rtw(4), and wi(4) have printed
out their modes and rates at boot.  Revert to the historical
behavior.
2005-07-06 23:58:14 +00:00
dyoung 707b2b4ae1 Avoid an unnecessary API difference between NetBSD and FreeBSD:
back out my change to ieee80211_crypto_encap that made it free its
mbuf argument on error.  I had thought it was a bug.  It was not.
It's the drivers that are broken.  Make an(4), atw(4), ipw(4),
iwi(4), ral(4), rtw(4), ural(4), and wi(4) free the mbuf when
ieee80211_crypto_encap returns NULL.  Also, return ath(4) to the
way it was---i.e., free the mbuf.

Thanks to Sam Leffler to pointing out my mistake.
2005-07-06 23:44:15 +00:00
dyoung 05cab81dd8 Don't write the WEP keys to the device if it is invalid (e.g.,
unplugged) or if it is not enabled.  Fixes kern/30592.
2005-07-06 06:49:25 +00:00
erh 1b6f9cc263 Make sure there is a valid transmit key, before trying to use information
about it.  Fixes a crash when configuring wi0.
2005-06-26 21:51:37 +00:00
dyoung 7bcee8c697 Do not build AP support if 'options IEEE80211_NO_HOSTAP' is in the
kernel configuration.
2005-06-26 04:37:25 +00:00
dyoung 23304515e7 Bug fix: fix WEP by managing keys & crypto in the style of the new
net80211.  It was especially important to zero the IEEE80211_F_DROPUNENC
(discard unencrypted packets) flag in operating modes where the
firmware decrypts for us.  Otherwise, the 802.11 layer discarded
all received frames.  See wi_mend_flags.  From FreeBSD, with
improvements by me.

For better compliance with the "net80211 way":
set sc_cnfauthmode from ic->ic_bss->ni_authmode.  Enter
the RUN state through ieee80211_create_ibss instead of
ieee80211_new_state(IEEE80211_S_RUN).  To sync BSSID in ad hoc
mode, use ieee80211_sta_join() instead of
ieee80211_new_state(IEEE80211_S_RUN).  From FreeBSD.

Configure the firmware to obey IEEE80211_F_DROPUNENC.

As we change to state RUN in STA mode, generate a link-status
message on the routing socket with a call to ieee80211_notify_node_join()
instead of calling rt_ifmsg directly.

Run normal net80211 processing (ieee80211_newstate) on the ->RUN
transition.
2005-06-25 03:56:53 +00:00
dyoung 9063402978 Resolve conflicts in importation of 18-May-2005 ath(4) / net80211(9)
from FreeBSD.  Introduce compatibility shims (sys/dev/ic/ath_netbsd.[ch],
sys/net80211/ieee80211_netbsd.[ch]).  Update drivers (an, atu, atw,
awi, ipw, iwi, rtw, wi) for the new net80211(9) API.
2005-06-22 06:14:51 +00:00
dyoung 24f08f73c6 correct logic so we recognize timeout on alloc
Noticed by:     Coverity Prevent analysis tool

From FreeBSD.  Thanks Sam Leffler for bringing this to my attention.
2005-03-27 00:49:14 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
dyoung 6e9d895c23 Bug fix: use the MAC that the firmware tells us, resorting to the
CIS MAC only on error.

(NetBSD these days tries to read the MAC address from the PCMCIA
CIS.  Prism cards made by Senao set the MAC in every PCMCIA CIS to
00:02:6f:00:02:15.  In a network of Senao cards, this causes MAC
duplication.)
2005-02-13 07:33:06 +00:00
dyoung 1a198218b9 Delete an out-of-date comment. 2005-01-17 01:48:56 +00:00
dyoung ad16f31a1c In wi_stop, wait for transmit commands to complete. Extract
subroutine wi_txcmd_wait from wi_cmd and wi_stop.

This stops wi from griping, "wi0: command timed out, cmd=0x10b,
arg=0x0", when we down/up the interface.  Thanks to Pavel Cahyna
for reporting this bug.
2004-12-14 19:53:46 +00:00
dyoung 4a2df5a4d4 Bug fix: synchronize Transmit commands with all other commands.
Following Charles Hannum's wi(4) optimizations, there could be a
Transmit command outstanding after wi_tx_intr or wi_start returns.
The driver would blithely issue a second command [*] before the
first command was finished, taking the first command's WI_EV_CMD
indication to mean the second command had finished.  The driver
would be dreadfully confused when the second command's results did
not meet its expectations (e.g., a RID mismatch error would occur).
The packet transmit section of the code would never read the
WI_EV_CMD it expected, so transmissions would cease.

This patch counts the outstanding transmit commands (there can be
only one) and, if a transmit command is outstanding at the top of
wi_cmd(), wi_cmd waits for the command to complete.  If there was
a transmit command outstanding when wi_cmd begins, it calls
wi_cmd_intr() on its way out.

I have tested this on an Orinoco card.  Previously, the card would
stop transmitting or the kernel would panic as desynchronization
occurred.  Now it works beautifully.

[*] A second command could be issued by wi_ioctl or else by
    wi_intr->wi_info_intr->wi_newstate->wi_read_xrid->wi_read_rid.
2004-12-13 17:55:28 +00:00
dyoung 407495af6f In wi_tx_intr, be a little more explicit about which fields we're
reading from the Tx-Complete FID.
2004-12-13 17:24:09 +00:00
dyoung cdf3961f69 Refactor. wi_read_rid calls,
wi_read_rid(sc, rid, &val, &buflen) == 0 && buflen == sizeof(val),

become wi_read_xrid calls

  wi_read_xrid(sc, rid, &val, sizeof(val)) == 0.

If the actual RID length is different from the expected RID length,
wi_read_rid prints to the log.
2004-12-13 17:21:35 +00:00
mycroft 67325f43a5 Fix what appears to be a byte order error on big-endian systems with Symbol
cards.
2004-11-26 17:55:41 +00:00
thorpej e9818f5b5e When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
2004-10-30 18:08:34 +00:00
dyoung 1b319e72be Simplify the BSSID synchronization code. 2004-09-28 00:42:11 +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
mycroft 1afe1f83af Be much more robust with RID values during attach:
* If the device returns a length too short to even contain the RID number,
  flag it as not supported and return EOPNOTSUPP, rather than returning a
  length of -2 and trying to use the value anyway.
* Check the returned lengths to see if we actually got anything.
* If we get no rate list, fail the attach, so we don't just blow up later.
Allow the frontend to pass in a MAC address.
2004-08-07 17:12:44 +00:00
mycroft 0ba1d7c0e4 Use bpf_mtap2(). 2004-08-06 02:31:25 +00:00
mycroft ddc97f59ca Put unadulterated dB values in the radiotap header, not the converted dBm
values.
2004-08-05 22:57:32 +00:00
mycroft 50d44f4f07 IEEE80211_F_WEPON -> IEEE80211_F_PRIVACY 2004-07-23 08:31:39 +00:00
mycroft 8f64992310 Add sc_txstart and sc_txstarted, to keep track of the current FID we want to
start and the number we've started that have not been alloced yet.  Currently
sc_txstarted is constained to 0 or 1 because of the way we start the next
packet, but this will change.
2004-07-22 21:56:58 +00:00
mycroft 5e0a5ea2f8 Copyright maintenance. 2004-07-22 21:31:56 +00:00
mycroft d9907678ec Change some DELAY(2) to more sensible values. 2004-07-22 20:36:11 +00:00
mycroft 0e8c7f506b Add some histogram code (controlled by an #ifdef) to track how long various
busy-wait loops take.
2004-07-22 20:34:52 +00:00
mycroft 1854f1b055 Keep a count of packets written to the chip but not yet initiated. This
simplifies some logic, and is needed for later changes.
2004-07-22 20:30:43 +00:00
mycroft 04cd0b261d Change some names.
sc_txnext -> sc_txalloc
sc_txcur -> sc_txqueue
2004-07-22 20:25:23 +00:00
mycroft 9df2197095 Keep a count of FIDs allocated, rather than storing a packet length in the
ring.
2004-07-22 20:23:31 +00:00
mycroft f0d981931c Make the radiotap header reflect the actual transmit rate. 2004-07-22 20:13:20 +00:00
mycroft f14903982d Ack events in only one place. Reduces register writes sometimes. 2004-07-22 20:12:20 +00:00
mycroft 9951a8362a Only read the part of the frame header we use in wi_tx_intr(). 2004-07-22 20:07:38 +00:00
mycroft 94e3bc2cef Rework the rate-lowering hack:
* Update sc_txpending[] when a packet is written, even before we issue the TX
  command, since it may be active when we issue the TX command for the
  following packet.
* Do not lower the rate in ni_txrate or id_rateidx, because these are used to
  keep track of sc_txpending[], and could cause us to get "stuck" at the lower
  rate.
2004-07-22 20:06:05 +00:00
mycroft 3a862ed4bf Make the logic in wi_write_txrate() less obscure. 2004-07-22 19:56:55 +00:00