summaryrefslogtreecommitdiffstats
path: root/sys/dev/if_ndis
Commit message (Collapse)AuthorAgeFilesLines
* Move usb to a graveyard location under sys/legacy/dev, it is intended that thethompsa2009-02-234-10/+10
| | | | | | | new USB2 stack will fully replace this for 8.0. Remove kernel modules, a subsequent commit will update conf/files. Unhook usbdevs from the build.
* Provide a NDIS tx power level converstion to/from net80211, this uses a loookupthompsa2009-01-121-1/+30
| | | | | | table to approximate mW<->dBM. Submitted by: Paul B. Mahol
* fix a typo to set the 48Mbps data rate.weongyo2009-01-091-2/+2
| | | | | | | PR: kern/130189 Submitted by: Paul B. Mahol <onemda_at_gmail.com> Reviewed by: sam MFC after: 3 weeks
* Integrate the NDIS USB support code to CURRENT.weongyo2008-12-275-17/+189
| | | | | | | | | | | | | | | | | | | | | | | | Now the NDISulator supports NDIS USB drivers that it've tested with devices as follows: - Anygate XM-142 (Conexant) - Netgear WG111v2 (Realtek) - U-Khan UW-2054u (Marvell) - Shuttle XPC Accessory PN20 (Realtek) - ipTIME G054U2 (Ralink) - UNiCORN WL-54G (ZyDAS) - ZyXEL G-200v2 (ZyDAS) All of them succeeded to attach and worked though there are still some problems that it's expected to be solved. To use NDIS USB support, you should rebuild and install ndiscvt(8) and if you encounter a problem to attach please set `hw.ndisusb.halt' to 0 then retry. I expect no changes of the NDIS code for PCI, PCMCIA devices. Obtained from: //depot/projects/ndisusb/...
* hookup mcast and promisc callbackssam2008-11-301-0/+18
| | | | Submitted by: "Paul B. Mahol" <onemda@gmail.com>
* Fake the assoc id so that ndis can work on the latest net80211.thompsa2008-11-111-1/+10
| | | | | PR: kern/128750 Submitted by: Paul B. Mahol
* sc->ndis_txidx should be cycle between 0 and sc->ndis_maxpkts, notweongyo2008-10-042-3/+3
| | | | | | | | | NDIS_TXPKTS and don't allocate unused extra spaces for sc->ndis_txarray and sc->ndis_txpool. PR: kern/127644 Submitted by: Antoine Pelisse <apelisse_at_gmail.com> MFC after: 1 week
* Fix a mutex LOR introduced by the conversion of if_ndis from spinlocks tocokane2008-07-091-0/+2
| | | | | | | | | | | mutexes and replacing the obsolete if_watchdog interface. The ndis_ticktask function calls into ieee80211_new_state under one condition with NDIS_LOCK held. The ieee80211_new_state would call into ndis_start in some cases too, resulting in the occasional case where ndis_start acquires NDIS_LOCK from inside the NDIS_LOCK held by ndis_ticktask. Obtained from: Paul B. Mahol <onemda@gmail.com> MFC after: 1 week
* Convert ndis_spinlock to ndis_mtx and start using the sleepablecokane2008-06-112-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx interface for NDIS_LOCK/UNLOCK. This should result in less CPU utilization on behalf of the ndis driver. Additionally, this commit also fixes a potential LOR in the ndis_tick code, by not locking inside the ndis_tick function, but instead delegating that work to the helpers called through IoQueueWorkItem. The way that this is currently set up for NDIS prevents us from simply implementing a callout_init_mtx mechanism. However, the helper functions that handle the various timeout cases implement fine-grained locking using the spinlocks provided by the NDIS-compat layer, and using the mtx that is added with this commit. This leaves the following ndis_softc members operated on in ndis_tick in an unlocked context: * ndis_hang_timer - Only modified outside of ndis_tick once, before the first callout_reset to schedule ndis_tick * ifp->if_oerrors - Only incremented in two places, which should be an atomic op * ndis_tx_timer - Assigned to 5 (when guaranteed to be 0) or 0 (in txeof), to indicate to ndis_tick what to do. This is the only member of which I was suspicious for needing the NDIS_LOCK here. My testing (and another's) have been fine so far. * ndis_stat_callout - Only uses a simple set of callout routines, callout_reset only called by ndis_tick after the initial reset, and then callout_drain is used exactly once in shutdown code. The benefit is that ndis_tick doesn't acquire NDIS_LOCK unless one of the timeout conditions is flagged, and it still obeys the locking order semantics that are dictated by the NDIS layer at the moment. I have been investigating a more thorough s/spinlock/mtx/ of the NDIS layer, but the simplest naive approach (replace KeAcquireSpinLock with an mtx implementation) has anti-succeeded for me so far. This is a good first step though. Tested by: onemda@gmail.com Reviewed by: current@, jhb, thompsa Proposed by: jhb
* Update if_ndis to remove the legacy if_watchdog interface andcokane2008-06-032-44/+33
| | | | | | | | | | | bring it more up to date. The watchdog timer, and its associated code, is all collapsed into the ndis_tick function that was implemented for the NDIS-subsystem watchdog. This implementation is similar to what numerous other drivers use to implement the watchdog. Reviewed by: thompsa, jhb MFC after: 2 weeks
* Fix a panic that it's occurred when NDIS init handler returned a errorweongyo2008-05-301-5/+8
| | | | | by unknown reasons. In this case, sc->ifp is still NULL so it will cause a page fault during calling ndis_detach()
* Minor cleanup of vap create work:sam2008-05-121-1/+1
| | | | | | | | | | | | | o add IEEE80211_C_STA capability to indicate sta mode is supported (was previously assumed) and mark drivers as capable o add ieee80211_opcap array to map an opmode to the equivalent capability bit o move IEEE80211_C_OPMODE definition to where capabilities are defined so it's clear it should be kept in sync (on future additions) o check device capabilities in clone create before trying to create a vap; this makes driver checks unneeded o make error codes return on failed clone request unique o temporarily add console printfs on clone request failures to aid in debugging; these will move under DIAGNOSTIC or similar before release
* - Associate from a taskq as we can deadlock on the ndis hal and the com lock.thompsa2008-05-102-11/+49
| | | | | - Remove double vap init (ieee80211_start_all) - Keep ic_curchan in sync with the scan results.
* Partially revert the last rev. Do call ndis_setstate_80211() when we up thethompsa2008-05-101-65/+113
| | | | | | | interface but break out the associate code into a separate function. This fixes association with an 11b Apple Airport. Reported by: Ted Lindgreen
* Do not call ndis_setstate_80211() until we are ready to associate, the vap maythompsa2008-05-011-11/+9
| | | | | | | not have been created yet and will panic. This requires ndis_scan() to always set the SSID. Reported by: Ben Kaduk
* Unify all the wifi *_ioctl routinesthompsa2008-05-011-12/+50
| | | | | | | | | | | | | | - Limit grabbing the lock to SIOCSIFFLAGS. - Move ieee80211_start_all() to SIOCSIFFLAGS. - Remove SIOCSIFMEDIA as it is not useful. - Limit ether_ioctl to only SIOCGIFADDR. SIOCSIFADDR and SIOCSIFMTU have no affect as there is no input/output path in the vap parent. The vap code will handle the reinit of the mac address changes. - Split off ndis_ioctl_80211 as it was getting too different to wired devices. This fixes a copyout while locked and a lock recursion. Reviewed by: sam
* Multi-bss (aka vap) support for 802.11 devices.sam2008-04-202-329/+229
| | | | | | | | | | | Note this includes changes to all drivers and moves some device firmware loading to use firmware(9) and a separate module (e.g. ral). Also there no longer are separate wlan_scan* modules; this functionality is now bundled into the wlan module. Supported by: Hobnob and Marvell Reviewed by: many Obtained from: Atheros (some bits)
* Change the 1 in callout_init to CALLOUT_MPSAFE. I made the change in mycokane2008-04-171-1/+1
| | | | | | | tree, but never committed it into git before making my patch! Submitted by: thompsa MFC after: 1 month
* Change the timeout(9) usage in if_ndis to a callout(9) implementation,cokane2008-04-172-10/+7
| | | | | | | | | | as the former is becoming deprecated and exhibits some extraneous Giant-locking. The new callout(9) is declared MPSAFE, so it may improve concurrency. Tested by: matteo Silence from: wpaul MFC after: 1 month
* Use pause(9) instead of a tsleep() on a stack variable.jhb2008-01-171-1/+1
| | | | MFC after: 1 week
* sc->ndis_tq variable is only initialized when a driver module is for wirelessthompsa2007-12-091-2/+4
| | | | | | | NICs. PR: kern/118439 Submitted by: Weongyo Jeong
* Preallocate some space to return the scan results, some drivers do not properlythompsa2007-12-071-9/+25
| | | | | | | | | pass back the desired buffer length. This fixes scanning with the Marvell 88W8335 and BCM4328 wireless cards. PR: kern/118370 Submitted by: Weongyo Jeong Tested by: Ed Schouten
* Cast address of 'bssid' to uint8_t since printf() expects to get unsignedwkoszek2007-12-041-1/+1
| | | | | | | | | argument in %6D case. Submitted by: thompsa Compile-tested: wkoszek Reviewed by: cognet (mentor) Approved by: cognet (mentor)
* Remove compatibilty defines to simplify reading the code, this is around 10% ofthompsa2007-12-033-325/+0
| | | | | the total LOC. These are mostly for the 6.x branch and it will be easier to cherrypick any changes (if at all).
* Hide a debug printf, NDIS_DEBUG is always defined and we test the sysctl.thompsa2007-12-021-3/+5
| | | | MFC after: 3 days
* Rename the kthread_xxx (e.g. kthread_create()) callsjulian2007-10-201-1/+1
| | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls.
* Fix up ndis interaction with net80211thompsa2007-07-261-59/+98
| | | | | | | | | | | | | | | - make NDIS_DEBUG a sysctl - default to IEEE80211_MODE_11B if the card doesnt tell us the channels - dont mess with ic_des_chan when we assosciate - Allow a directed scan by setting the ESSID before scanning (verified with wireshark). Hidden APs probably wouldnt have worked before. - Grab the channel type and use it to look up the correct curchan for the scan results (mistakenly used 11B before) - Fix memory leak in the ndis_scan_results Tested by: matteo Reviewed by: sam Approved by: re (rwatson)
* Improve the net80211 handling within ndisthompsa2007-07-122-158/+303
| | | | | | | | | | | - use net80211 for scanning and pass the results back to the scan cache - use ieee80211_init_channels to fill our channel list - fix up state transitions - depreciate the old wicontrol ioctls - add some debugging lines (#define NDIS_DEBUG) Reviewed by: sam Approved by: re (kensmith)
* finish removing usb_port.h macros.imp2007-06-181-14/+14
| | | | | Use device_foo_t to declare functions a little de-k&r
* Expand USB_ATTACH_{ERROR,SUCCESS}_RETURN inline and eliminate fromimp2007-06-121-3/+3
| | | | usb_port.h. They aren't needed, and are a legacy of this code's past.
* Update 802.11 wireless support:sam2007-06-111-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o major overhaul of the way channels are handled: channels are now fully enumerated and uniquely identify the operating characteristics; these changes are visible to user applications which require changes o make scanning support independent of the state machine to enable background scanning and roaming o move scanning support into loadable modules based on the operating mode to enable different policies and reduce the memory footprint on systems w/ constrained resources o add background scanning in station mode (no support for adhoc/ibss mode yet) o significantly speedup sta mode scanning with a variety of techniques o add roaming support when background scanning is supported; for now we use a simple algorithm to trigger a roam: we threshold the rssi and tx rate, if either drops too low we try to roam to a new ap o add tx fragmentation support o add first cut at 802.11n support: this code works with forthcoming drivers but is incomplete; it's included now to establish a baseline for other drivers to be developed and for user applications o adjust max_linkhdr et. al. to reflect 802.11 requirements; this eliminates prepending mbufs for traffic generated locally o add support for Atheros protocol extensions; mainly the fast frames encapsulation (note this can be used with any card that can tx+rx large frames correctly) o add sta support for ap's that beacon both WPA1+2 support o change all data types from bsd-style to posix-style o propagate noise floor data from drivers to net80211 and on to user apps o correct various issues in the sta mode state machine related to handling authentication and association failures o enable the addition of sta mode power save support for drivers that need net80211 support (not in this commit) o remove old WI compatibility ioctls (wicontrol is officially dead) o change the data structures returned for get sta info and get scan results so future additions will not break user apps o fixed tx rate is now maintained internally as an ieee rate and not an index into the rate set; this needs to be extended to deal with multi-mode operation o add extended channel specifications to radiotap to enable 11n sniffing Drivers: o ath: add support for bg scanning, tx fragmentation, fast frames, dynamic turbo (lightly tested), 11n (sniffing only and needs new hal) o awi: compile tested only o ndis: lightly tested o ipw: lightly tested o iwi: add support for bg scanning (well tested but may have some rough edges) o ral, ural, rum: add suppoort for bg scanning, calibrate rssi data o wi: lightly tested This work is based on contributions by Atheros, kmacy, sephe, thompsa, mlaier, kevlo, and others. Much of the scanning work was supported by Atheros. The 11n work was supported by Marvell.
* Initialize irql to something prior to calls that (might) set it.mjacob2007-05-201-1/+1
| | | | Whined about: gcc 4.2
* Use strcasecmp() from libkern.pjd2007-04-061-4/+4
|
* change ic_modecaps to a bit vector and use setbit, et. al.sam2007-03-111-18/+17
|
* Fix shared authentication mode.jkim2006-12-281-0/+8
|
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-5/+6
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Static -> static.mjacob2006-09-071-3/+3
|
* Catch up with USB changes, device_ptr_t was removed, we need device_t here.trhodes2006-09-071-3/+3
|
* When ndis_attach() runs, it has to very briefly initialize the cardwpaul2006-02-041-14/+34
| | | | | | | | | | | | | | | | | | | | | | | | in order to query the underlying Windows driver for the station address and some other properties. There is a slim chance that the card may receive a packet and indicate it up to us before ndis_attach() can call ndis_halt_nic(). This is bad, because both the softc structure and the ifnet structure aren't fully initialized yet: many pointers are still NULL, so if we make it into ndis_rxeof(), we will panic. To fix this, we need to do the following: - Move the calls to IoAllocateWorkItem() to before the call to ndis_init_nic(). - Move the initialization of the RX DPC and status callback function pointers to before ndis_init_nic() as well. - Modify ndis_rxeof() to check if the IFF_DRV_RUNNING flag is set. If it isn't, we return any supplied NDIS_PACKETs to the NIC without processing them. This fixes a crash than can occur when activating a wireless NIC in close proximity to a very busy wireless network, reported by Ryan Beasley (ryan%^$!ATgoddamnbastard-****!!!DOTorg. MFC after: 3 days
* In ndis_rxeof_eth(), avoid acquiring the NDIS miniport block spinlock forwpaul2005-12-161-2/+4
| | | | | | | serialized miniports when updating the packet list. This fixes a deadlock that can occur with the Ralink RT2500 driver when using wpa_supplicant.
* The latest version of the Intel 2200BG/2915ABG driver (9.0.0.3-9) fromwpaul2005-11-061-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intel's web site requires some minor tweaks to get it to work: - The driver seems to have been released with full WMI tracing enabled, and makes references to some WMI APIs, namely IoWMIRegistrationControl(), WmiQueryTraceInformation() and WmiTraceMessage(). Only the first one is ever called (during intialization). These have been implemented as do-nothing stubs for now. Also added a definition for STATUS_NOT_FOUND to ntoskrnl_var.h, which is used as a return code for one of the WMI routines. - The driver references KeRaiseIrqlToDpcLevel() and KeLowerIrql() (the latter as a function, which is unusual because normally KeLowerIrql() is a macro in the Windows DDK that calls KfLowewIrql()). I'm not sure why these are being called since they're not really part of WDM. Presumeably they're being used for backwards compatibility with old versions of Windows. These have been implemented in subr_hal.c. (Note that they're _stdcall routines instead of _fastcall.) - When querying the OID_802_11_BSSID_LIST OID to get a BSSID list, you don't know ahead of time how many networks the NIC has found during scanning, so you're allowed to pass 0 as the list length. This should cause the driver to return an 'insufficient resources' error and set the length to indicate how many bytes are actually needed. However for some reason, the Intel driver does not honor this convention: if you give it a length of 0, it returns some other error and doesn't tell you how much space is really needed. To get around this, if using a length of 0 yields anything besides the expected error case, we arbitrarily assume a length of 64K. This is similar to the hack that wpa_supplicant uses when doing a BSSID list query.
* Tests with my dual Opteron system have shown that it's possiblewpaul2005-11-021-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | for code to start out on one CPU when thunking into Windows mode in ctxsw_utow(), and then be pre-empted and migrated to another CPU before thunking back to UNIX mode in ctxsw_wtou(). This is bad, because then we can end up looking at the wrong 'thread environment block' when trying to come back to UNIX mode. To avoid this, we now pin ourselves to the current CPU when thunking into Windows code. Few other cleanups, since I'm here: - Get rid of the ndis_isr(), ndis_enable_interrupt() and ndis_disable_interrupt() wrappers from kern_ndis.c and just invoke the miniport's methods directly in the interrupt handling routines in subr_ndis.c. We may as well lose the function call overhead, since we don't need to export these things outside of ndis.ko now anyway. - Remove call to ndis_enable_interrupt() from ndis_init() in if_ndis.c. We don't need to do it there anyway (the miniport init routine handles it, if needed). - Fix the logic in NdisWriteErrorLogEntry() a little. - Change some NDIS_STATUS_xxx codes in subr_ntoskrnl.c into STATUS_xxx codes. - Handle kthread_create() failure correctly in PsCreateSystemThread().
* Fix ndis_getstate_80211() so that it properly reports the authmodewpaul2005-10-291-32/+77
| | | | | | and channel to ifconfig. Also use the SSID and channel info from the association info that we already have instead of using ndis_get_info() to ask the driver for it again.
* Correct some __FreeBSD_version conditionals to use version bumps closerwpaul2005-10-252-12/+27
| | | | | | to the actual dates when code actually changed. Also add special case link state change handling for RELENG_5, which doesn't have if_link_state_change(). No actual operational changes are done.
* Do not allow ndis_ticktask() to run after ndis_halt_nic() has been called.wpaul2005-10-241-0/+11
| | | | | (It may have been queued up in one of the workitem threads, and letting it fire after the NIC has been halted will cause a crash in some cases.)
* Correct the size used to allocate ndis_txarray. It should bewpaul2005-10-191-1/+1
| | | | NDIS_TXPKTS now, not ndis_maxpkts.
* Another round of cleanups and fixes:wpaul2005-10-182-16/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Change ndis_return() from a DPC to a workitem so that it doesn't run at DISPATCH_LEVEL (with the dispatcher lock held). - In if_ndis.c, submit packets to the stack via (*ifp->if_input)() in a workitem instead of doing it directly in ndis_rxeof(), because ndis_rxeof() runs in a DPC, and hence at DISPATCH_LEVEL. This implies that the 'dispatch level' mutex for the current CPU is being held, and we don't want to call if_input while holding any locks. - Reimplement IoConnectInterrupt()/IoDisconnectInterrupt(). The original approach I used to track down the interrupt resource (by scanning the device tree starting at the nexus) is prone to problems when two devices share an interrupt. (E.g removing ndis1 might disable interrupts for ndis0.) The new approach is to multiplex all the NDIS interrupts through a common internal dispatcher (ntoskrnl_intr()) and allow IoConnectInterrupt()/IoDisconnectInterrupt() to add or remove interrupts from the dispatch list. - Implement KeAcquireInterruptSpinLock() and KeReleaseInterruptSpinLock(). - Change the DPC and workitem threads to use the KeXXXSpinLock API instead of mtx_lock_spin()/mtx_unlock_spin(). - Simplify the NdisXXXPacket routines by creating an actual packet pool structure and using the InterlockedSList routines to manage the packet queue. - Only honor the value returned by OID_GEN_MAXIMUM_SEND_PACKETS for serialized drivers. For deserialized drivers, we now create a packet array of 64 entries. (The Microsoft DDK documentation says that for deserialized miniports, OID_GEN_MAXIMUM_SEND_PACKETS is ignored, and the driver for the Marvell 8335 chip, which is a deserialized miniport, returns 1 when queried.) - Clean up timer handling in subr_ntoskrnl. - Add the following conditional debugging code: NTOSKRNL_DEBUG_TIMERS - add debugging and stats for timers NDIS_DEBUG_PACKETS - add extra sanity checking for NdisXXXPacket API NTOSKRNL_DEBUG_SPINLOCKS - add test for spinning too long - In kern_ndis.c, always start the HAL first and shut it down last, since Windows spinlocks depend on it. Ntoskrnl should similarly be started second and shut down next to last.
* Fix build: remove stale KASSERT() for mutex that no longer exists.wpaul2005-10-111-2/+0
|
* Grrr. Add one more missing NDIS_UNLOCK().wpaul2005-10-101-1/+3
|
* Add missing NDIS_UNLOCK() in one of the failure cases in SIOCGPRIVATE_0.wpaul2005-10-101-1/+3
|
OpenPOWER on IntegriCloud