aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/if_ndis
Commit message (Collapse)AuthorAgeFilesLines
...
* Do not call ndis_setstate_80211() until we are ready to associate, the vap mayAndrew Thompson2008-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 Notes: svn path=/head/; revision=178705
* Unify all the wifi *_ioctl routinesAndrew Thompson2008-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 Notes: svn path=/head/; revision=178704
* Multi-bss (aka vap) support for 802.11 devices.Sam Leffler2008-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) Notes: svn path=/head/; revision=178354
* Change the 1 in callout_init to CALLOUT_MPSAFE. I made the change in myColeman Kane2008-04-171-1/+1
| | | | | | | | | | tree, but never committed it into git before making my patch! Submitted by: thompsa MFC after: 1 month Notes: svn path=/head/; revision=178288
* Change the timeout(9) usage in if_ndis to a callout(9) implementation,Coleman Kane2008-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 Notes: svn path=/head/; revision=178286
* Use pause(9) instead of a tsleep() on a stack variable.John Baldwin2008-01-171-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=175410
* sc->ndis_tq variable is only initialized when a driver module is for wirelessAndrew Thompson2007-12-091-2/+4
| | | | | | | | | | NICs. PR: kern/118439 Submitted by: Weongyo Jeong Notes: svn path=/head/; revision=174490
* Preallocate some space to return the scan results, some drivers do not properlyAndrew Thompson2007-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 Notes: svn path=/head/; revision=174401
* Cast address of 'bssid' to uint8_t since printf() expects to get unsignedWojciech A. Koszek2007-12-041-1/+1
| | | | | | | | | | | | argument in %6D case. Submitted by: thompsa Compile-tested: wkoszek Reviewed by: cognet (mentor) Approved by: cognet (mentor) Notes: svn path=/head/; revision=174270
* Remove compatibilty defines to simplify reading the code, this is around 10% ofAndrew Thompson2007-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). Notes: svn path=/head/; revision=174234
* Hide a debug printf, NDIS_DEBUG is always defined and we test the sysctl.Andrew Thompson2007-12-021-3/+5
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=174157
* Rename the kthread_xxx (e.g. kthread_create()) callsJulian Elischer2007-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. Notes: svn path=/head/; revision=172836
* Fix up ndis interaction with net80211Andrew Thompson2007-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) Notes: svn path=/head/; revision=171602
* Improve the net80211 handling within ndisAndrew Thompson2007-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) Notes: svn path=/head/; revision=171390
* finish removing usb_port.h macros.Warner Losh2007-06-181-14/+14
| | | | | | | | Use device_foo_t to declare functions a little de-k&r Notes: svn path=/head/; revision=170934
* Expand USB_ATTACH_{ERROR,SUCCESS}_RETURN inline and eliminate fromWarner Losh2007-06-121-3/+3
| | | | | | | usb_port.h. They aren't needed, and are a legacy of this code's past. Notes: svn path=/head/; revision=170612
* Update 802.11 wireless support:Sam Leffler2007-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. Notes: svn path=/head/; revision=170530
* Initialize irql to something prior to calls that (might) set it.Matt Jacob2007-05-201-1/+1
| | | | | | | Whined about: gcc 4.2 Notes: svn path=/head/; revision=169800
* Use strcasecmp() from libkern.Pawel Jakub Dawidek2007-04-061-4/+4
| | | | Notes: svn path=/head/; revision=168423
* change ic_modecaps to a bit vector and use setbit, et. al.Sam Leffler2007-03-111-18/+17
| | | | Notes: svn path=/head/; revision=167468
* Fix shared authentication mode.Jung-uk Kim2006-12-281-0/+8
| | | | Notes: svn path=/head/; revision=165573
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-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> Notes: svn path=/head/; revision=164033
* Static -> static.Matt Jacob2006-09-071-3/+3
| | | | Notes: svn path=/head/; revision=162102
* Catch up with USB changes, device_ptr_t was removed, we need device_t here.Tom Rhodes2006-09-071-3/+3
| | | | Notes: svn path=/head/; revision=162101
* When ndis_attach() runs, it has to very briefly initialize the cardBill Paul2006-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 Notes: svn path=/head/; revision=155311
* In ndis_rxeof_eth(), avoid acquiring the NDIS miniport block spinlock forBill Paul2005-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. Notes: svn path=/head/; revision=153480
* The latest version of the Intel 2200BG/2915ABG driver (9.0.0.3-9) fromBill Paul2005-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. Notes: svn path=/head/; revision=152136
* Tests with my dual Opteron system have shown that it's possibleBill Paul2005-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(). Notes: svn path=/head/; revision=151977
* Fix ndis_getstate_80211() so that it properly reports the authmodeBill Paul2005-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. Notes: svn path=/head/; revision=151832
* Correct some __FreeBSD_version conditionals to use version bumps closerBill Paul2005-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. Notes: svn path=/head/; revision=151652
* Do not allow ndis_ticktask() to run after ndis_halt_nic() has been called.Bill Paul2005-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.) Notes: svn path=/head/; revision=151625
* Correct the size used to allocate ndis_txarray. It should beBill Paul2005-10-191-1/+1
| | | | | | | NDIS_TXPKTS now, not ndis_maxpkts. Notes: svn path=/head/; revision=151460
* Another round of cleanups and fixes:Bill Paul2005-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. Notes: svn path=/head/; revision=151451
* Fix build: remove stale KASSERT() for mutex that no longer exists.Bill Paul2005-10-111-2/+0
| | | | Notes: svn path=/head/; revision=151241
* Grrr. Add one more missing NDIS_UNLOCK().Bill Paul2005-10-101-1/+3
| | | | Notes: svn path=/head/; revision=151217
* Add missing NDIS_UNLOCK() in one of the failure cases in SIOCGPRIVATE_0.Bill Paul2005-10-101-1/+3
| | | | Notes: svn path=/head/; revision=151216
* This commit makes a big round of updates and fixes many, many things.Bill Paul2005-10-102-483/+849
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First and most importantly, I threw out the thread priority-twiddling implementation of KeRaiseIrql()/KeLowerIrq()/KeGetCurrentIrql() in favor of a new scheme that uses sleep mutexes. The old scheme was really very naughty and sought to provide the same behavior as Windows spinlocks (i.e. blocking pre-emption) but in a way that wouldn't raise the ire of WITNESS. The new scheme represents 'DISPATCH_LEVEL' as the acquisition of a per-cpu sleep mutex. If a thread on cpu0 acquires the 'dispatcher mutex,' it will block any other thread on the same processor that tries to acquire it, in effect only allowing one thread on the processor to be at 'DISPATCH_LEVEL' at any given time. It can then do the 'atomic sit and spin' routine on the spinlock variable itself. If a thread on cpu1 wants to acquire the same spinlock, it acquires the 'dispatcher mutex' for cpu1 and then it too does an atomic sit and spin to try acquiring the spinlock. Unlike real spinlocks, this does not disable pre-emption of all threads on the CPU, but it does put any threads involved with the NDISulator to sleep, which is just as good for our purposes. This means I can now play nice with WITNESS, and I can safely do things like call malloc() when I'm at 'DISPATCH_LEVEL,' which you're allowed to do in Windows. Next, I completely re-wrote most of the event/timer/mutex handling and wait code. KeWaitForSingleObject() and KeWaitForMultipleObjects() have been re-written to use condition variables instead of msleep(). This allows us to use the Windows convention whereby thread A can tell thread B "wake up with a boosted priority." (With msleep(), you instead have thread B saying "when I get woken up, I'll use this priority here," and thread A can't tell it to do otherwise.) The new KeWaitForMultipleObjects() has been better tested and better duplicates the semantics of its Windows counterpart. I also overhauled the IoQueueWorkItem() API and underlying code. Like KeInsertQueueDpc(), IoQueueWorkItem() must insure that the same work item isn't put on the queue twice. ExQueueWorkItem(), which in my implementation is built on top of IoQueueWorkItem(), was also modified to perform a similar test. I renamed the doubly-linked list macros to give them the same names as their Windows counterparts and fixed RemoveListTail() and RemoveListHead() so they properly return the removed item. I also corrected the list handling code in ntoskrnl_dpc_thread() and ntoskrnl_workitem_thread(). I realized that the original logic did not correctly handle the case where a DPC callout tries to queue up another DPC. It works correctly now. I implemented IoConnectInterrupt() and IoDisconnectInterrupt() and modified NdisMRegisterInterrupt() and NdisMDisconnectInterrupt() to use them. I also tried to duplicate the interrupt handling scheme used in Windows. The interrupt handling is now internal to ndis.ko, and the ndis_intr() function has been removed from if_ndis.c. (In the USB case, interrupt handling isn't needed in if_ndis.c anyway.) NdisMSleep() has been rewritten to use a KeWaitForSingleObject() and a KeTimer, which is how it works in Windows. (This is mainly to insure that the NDISulator uses the KeTimer API so I can spot any problems with it that may arise.) KeCancelTimer() has been changed so that it only cancels timers, and does not attempt to cancel a DPC if the timer managed to fire and queue one up before KeCancelTimer() was called. The Windows DDK documentation seems to imply that KeCantelTimer() will also call KeRemoveQueueDpc() if necessary, but it really doesn't. The KeTimer implementation has been rewritten to use the callout API directly instead of timeout()/untimeout(). I still cheat a little in that I have to manage my own small callout timer wheel, but the timer code works more smoothly now. I discovered a race condition using timeout()/untimeout() with periodic timers where untimeout() fails to actually cancel a timer. I don't quite understand where the race is, using callout_init()/callout_reset()/callout_stop() directly seems to fix it. I also discovered and fixed a bug in winx32_wrap.S related to translating _stdcall calls. There are a couple of routines (i.e. the 64-bit arithmetic intrinsics in subr_ntoskrnl) that return 64-bit quantities. On the x86 arch, 64-bit values are returned in the %eax and %edx registers. However, it happens that the ctxsw_utow() routine uses %edx as a scratch register, and x86_stdcall_wrap() and x86_stdcall_call() were only preserving %eax before branching to ctxsw_utow(). This means %edx was getting clobbered in some cases. Curiously, the most noticeable effect of this bug is that the driver for the TI AXC110 chipset would constantly drop and reacquire its link for no apparent reason. Both %eax and %edx are preserved on the stack now. The _fastcall and _regparm wrappers already handled everything correctly. I changed if_ndis to use IoAllocateWorkItem() and IoQueueWorkItem() instead of the NdisScheduleWorkItem() API. This is to avoid possible deadlocks with any drivers that use NdisScheduleWorkItem() themselves. The unicode/ansi conversion handling code has been cleaned up. The internal routines have been moved to subr_ntoskrnl and the RtlXXX routines have been exported so that subr_ndis can call them. This removes the incestuous relationship between the two modules regarding this code and fixes the implementation so that it honors the 'maxlen' fields correctly. (Previously it was possible for NdisUnicodeStringToAnsiString() to possibly clobber memory it didn't own, which was causing many mysterious crashes in the Marvell 8335 driver.) The registry handling code (NdisOpen/Close/ReadConfiguration()) has been fixed to allocate memory for all the parameters it hands out to callers and delete whem when NdisCloseConfiguration() is called. (Previously, it would secretly use a single static buffer.) I also substantially updated if_ndis so that the source can now be built on FreeBSD 7, 6 and 5 without any changes. On FreeBSD 5, only WEP support is enabled. On FreeBSD 6 and 7, WPA-PSK support is enabled. The original WPA code has been updated to fit in more cleanly with the net80211 API, and to eleminate the use of magic numbers. The ndis_80211_setstate() routine now sets a default authmode of OPEN and initializes the RTS threshold and fragmentation threshold. The WPA routines were changed so that the authentication mode is always set first, followed by the cipher. Some drivers depend on the operations being performed in this order. I also added passthrough ioctls that allow application code to directly call the MiniportSetInformation()/MiniportQueryInformation() methods via ndis_set_info() and ndis_get_info(). The ndis_linksts() routine also caches the last 4 events signalled by the driver via NdisMIndicateStatus(), and they can be queried by an application via a separate ioctl. This is done to allow wpa_supplicant to directly program the various crypto and key management options in the driver, allowing things like WPA2 support to work. Whew. Notes: svn path=/head/; revision=151207
* Remove bridge(4) from the tree. if_bridge(4) is a full functionalMax Laier2005-09-271-2/+0
| | | | | | | | | | | replacement and has additional features which make it superior. Discussed on: -arch Reviewed by: thompsa X-MFC-after: never (RELENG_6 as transition period) Notes: svn path=/head/; revision=150636
* Make sure that we call if_free(ifp) after bus_teardown_intr. Since weWarner Losh2005-09-191-2/+3
| | | | | | | | | | could get an interrupt after we free the ifp, and the interrupt handler depended on the ifp being still alive, this could, in theory, cause a crash. Eliminate this possibility by moving the if_free to after the bus_teardown_intr() call. Notes: svn path=/head/; revision=150306
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andRobert Watson2005-08-091-9/+9
| | | | | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days Notes: svn path=/head/; revision=148887
* Modify device drivers supporting multicast addresses to lock if_addr_mtxRobert Watson2005-08-031-0/+3
| | | | | | | | | | | over iteration of their multicast address lists when synchronizing the hardware address filter with the network stack-maintained list. Problem reported by: Ed Maste (emaste at phaedrus dot sandvine dot ca> MFC after: 1 week Notes: svn path=/head/; revision=148654
* Move if_alloc() higher in the attach function so sc->ifp is populatedBrooks Davis2005-06-141-6/+6
| | | | | | | | | | | | early. I've moved it all the way to the top rather than part way up as the submitter did. Submitted by: Jung-uk Kim <jkim at niksun dot com> Reported by: submitter, le, dougb Approved by: re (ifnet blanket) Notes: svn path=/head/; revision=147386
* Stop embedding struct ifnet at the top of driver softcs. Instead theBrooks Davis2005-06-102-27/+29
| | | | | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam Notes: svn path=/head/; revision=147256
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386Yoshihiro Takahashi2005-05-291-2/+0
| | | | | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr) Notes: svn path=/head/; revision=146734
* Deal with a few bootstrap issues:Bill Paul2005-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't call KeFlushQueuedDpcs() during bootstrap (cold == 1), since the flush operation sleeps to wait for completion, and we can't sleep here (clowns will eat us). On an i386 SMP system, if we're loaded/probed/attached during bootstrap, smp_rendezvous() won't run us anywhere except CPU 0 (since the other CPUs aren't launched until later), which means we won't be able to set up the GDTs anywhere except CPU 0. To deal with this case, ctxsw_utow() now checks to see if the TID for the current processor has been properly initialized and sets up the GTD for the current CPU if not. Lastly, in if_ndis.c:ndis_shutdown(), do an ndis_stop() to insure we really halt the NIC and stop interrupts from happening. Note that loading a driver during bootstrap is, unfortunately, kind of a hit or miss sort of proposition. In Windows, the expectation is that by the time a given driver's MiniportInitialize() method is called, the system is already in 'multiuser' state, i.e. it's up and running enough to support all the stuff specified in the NDIS API, which includes the underlying OS-supplied facilities it implicitly depends on, such as having all CPUs running, having the DPC queues initialized, WorkItem threads running, etc. But in UNIX, a lot of that stuff won't work during bootstrap. This causes a problem since we need to call MiniportInitialize() at least once during ndis_attach() in order to find out what kind of NIC we have and learn its station address. What this means is that some cards just plain won't work right if you try to pre-load the driver along with the kernel: they'll only be probed/attach correctly if the driver is kldloaded _after_ the system has reached multiuser. I can't really think of a way around this that would still preserve the ability to use an NDIS device for diskless booting. Notes: svn path=/head/; revision=146427
* In ndis_halt_nic(), invalidate the miniportadapterctx early to try andBill Paul2005-05-201-2/+0
| | | | | | | | | | | | prevent anything from making calls to the NIC while it's being shut down. This is yet another attempt to stop things like mdnsd from trying to poke at the card while it's not properly initialized and panicking the system. Also, remove unneeded debug message from if_ndis.c. Notes: svn path=/head/; revision=146424
* Correct type for workitem routines.Bill Paul2005-05-161-3/+3
| | | | Notes: svn path=/head/; revision=146279
* Add support for NdisMEthIndicateReceive() and MiniportTransferData().Bill Paul2005-05-152-0/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Ralink RT2500 driver uses this API instead of NdisMIndicateReceivePacket(). Drivers use NdisMEthIndicateReceive() when they know they support 802.3 media and expect to hand their packets only protocols that want to deal with that particular media type. With this API, the driver does not manage its own NDIS_PACKET/NDIS_BUFFER structures. Instead, it lets bound protocols have a peek at the data, and then they supply an NDIS_PACKET/NDIS_BUFFER combo to the miniport driver, into which it copies the packet data. Drivers use NdisMIndicateReceivePacket() to allow their packets to be read by any protocol, not just those bound to 802.3 media devices. To make this work, we need an internal pool of NDIS_PACKETS for receives. Currently, we check to see if the driver exports a MiniportTransferData() method in its characteristics structure, and only allocate the pool for drivers that have this method. This should allow the RT2500 driver to work correctly, though I still have to fix ndiscvt(8) to parse its .inf file properly. Also, change kern_ndis.c:ndis_halt_nic() to reap timers before acquiring NDIS_LOCK(), since the reaping process might entail sleeping briefly (and we can't sleep with a lock held). Notes: svn path=/head/; revision=146230
* More fixes for multibus drivers. When calling out to the matchBill Paul2005-05-082-4/+14
| | | | | | | | function in if_ndis_pci.c and if_ndis_pccard.c, provide the bustype too so the stubs can ignore devlists that don't concern them. Notes: svn path=/head/; revision=146016
* Fix support for Windows drivers that support both PCI and PCMCIA devices atBill Paul2005-05-081-1/+2
| | | | | | | | | | | | | | | | the same time. Fix if_ndis_pccard.c so that it sets sc->ndis_dobj and sc->ndis_regvals. Correct IMPORT_SFUNC() macros for the READ_PORT_BUFFER_xxx() routines, which take 3 arguments, not 2. This fixes it so that the Windows driver for my Cisco Aironet 340 PCMCIA card works again. (Yes, I know the an(4) driver supports this card natively, but it's the only PCMCIA device I have with a Windows XP driver.) Notes: svn path=/head/; revision=146015