summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_xl.c
Commit message (Collapse)AuthorAgeFilesLines
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-231-1/+1
| | | | | | | | | | | | | bus_setup_intr() o add an int return code to all fast handlers o retire INTR_FAST/IH_FAST For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current Reviewed by: many Approved by: re@
* - Revert the parts of the previous revision which reloaded the watchdogmarius2006-12-081-3/+2
| | | | | | | | | | | timer in xl_txeof()/xl_txeof_90xB(); xl_poll_locked() unconditionally invokes xl_txeof()/xl_txeof_90xB(), effectively circumventing that the watchdog ever fires in the DEVICE_POLLING case as its timer is constantly reloaded. - Remove the banal and pedantically outdated comment regarding setting xl_wdog_timer to 0 in xl_txeof(). Pointed out by: bde
* - Use the xl_stats_update() callout instead of if_slowtimo() formarius2006-12-061-22/+26
| | | | | | | | driving xl_watchdog() in order to avoid races accessing if_timer. While at it relax the watchdog a bit by reloading it in xl_txeof()/ xl_txeof_90xB() if there are still packets enqueued. - Use bus_get_dma_tag() so xl(4) works on platforms requiring it. - Don't bother to set if_mtu to ETHERMTU, ether_ifattach() does that.
* Consistently use if_printf() only in interface methods: if_start,glebius2006-09-151-31/+30
| | | | | | | | | | if_ioctl, if_watchdog, etc, or in functions that are used by these methods only. In all other cases use device_printf(). This also fixes several panics, when if_printf() is called before softc->ifp was initialized. Submitted by: Alex Lyashkov <umka sevcity.net>
* Don't reset Tx threshold value whenever xl_init_locked() is called.yongari2006-08-121-1/+3
| | | | | | Instead the threshould is initialized in device attach. Later the threshold could be increased in Tx underrun error and the new threshold should be used in xl_init_locked().
* Make sure to check frames in Tx queue are empty before clearingyongari2006-08-121-4/+4
| | | | watchdog timer.
* Do not touch ifp->if_baudrate in miibus aware drivers.glebius2006-02-141-2/+0
|
* Check ifp before dereferencing it in xl_detach(). xl_detach() can be calledglebius2006-01-181-1/+1
| | | | | | from xl_attach(), when ifp is not defined yet. Found with: Coverity Prevent(tm)
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-3/+3
| | | | | | | | | | rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr. - Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead.
* Catch up with IFP2ENADDR() type change (array -> pointer).ru2005-11-111-2/+2
|
* In detach method, move if_free() after bus_teardown_intr().ru2005-10-131-2/+3
|
* - Don't pollute opt_global.h with DEVICE_POLLING and introduceglebius2005-10-051-0/+4
| | | | | | | | | opt_device_polling.h - Include opt_device_polling.h into appropriate files. - Embrace with HAVE_KERNEL_OPTION_HEADERS the include in the files that can be compiled as loadable modules. Reviewed by: bde
* Big polling(4) cleanup.glebius2005-10-011-41/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Axe poll in trap. o Axe IFF_POLLING flag from if_flags. o Rework revision 1.21 (Giant removal), in such a way that poll_mtx is not dropped during call to polling handler. This fixes problem with idle polling. o Make registration and deregistration from polling in a functional way, insted of next tick/interrupt. o Obsolete kern.polling.enable. Polling is turned on/off with ifconfig. Detailed kern_poll.c changes: - Remove polling handler flags, introduced in 1.21. The are not needed now. - Forget and do not check if_flags, if_capenable and if_drv_flags. - Call all registered polling handlers unconditionally. - Do not drop poll_mtx, when entering polling handlers. - In ether_poll() NET_LOCK_GIANT prior to locking poll_mtx. - In netisr_poll() axe the block, where polling code asks drivers to unregister. - In netisr_poll() and ether_poll() do polling always, if any handlers are present. - In ether_poll_[de]register() remove a lot of error hiding code. Assert that arguments are correct, instead. - In ether_poll_[de]register() use standard return values in case of error or success. - Introduce poll_switch() that is a sysctl handler for kern.polling.enable. poll_switch() goes through interface list and enabled/disables polling. A message that kern.polling.enable is deprecated is printed. Detailed driver changes: - On attach driver announces IFCAP_POLLING in if_capabilities, but not in if_capenable. - On detach driver calls ether_poll_deregister() if polling is enabled. - In polling handler driver obtains its lock and checks IFF_DRV_RUNNING flag. If there is no, then unlocks and returns. - In ioctl handler driver checks for IFCAP_POLLING flag requested to be set or cleared. Driver first calls ether_poll_[de]register(), then obtains driver lock and [dis/en]ables interrupts. - In interrupt handler driver checks IFCAP_POLLING flag in if_capenable. If present, then returns.This is important to protect from spurious interrupts. Reviewed by: ru, sam, jhb
* Fix "struct ifnet" leaks when attach() fails in the middle, e.g.ru2005-09-161-2/+2
| | | | | | when mii_phy_probe() or bus_setup_intr() fails. For drivers that call their detach() in this case, call if_free() there to cover this case too.
* Various fixups to locking:jhb2005-08-181-48/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | - Remove a lot of superfluous locking during attach. There is no need to lock access to the driver until some other thread has a way of getting to it. For ethernet drivers the other ways include registering an interrupt handler via bus_setup_intr(), calling ether_ifattach() to hook into the network stack, and kicking off a callout-driven timer via callout_reset(). - Use callout_* rather than timeout/untimeout. - Break out of xl_rxeof() if IFF_DRV_RUNNING is clear after ifp->if_input returns to handle the case where the interface was stopped while we were passing a packet up the stack. Don't call xl_rxeof() in xl_rxeof_task() unless IFF_DRV_RUNNING is set. With these fixes in place, any outstanding task will gracefully terminate as soon as it gets a chance to run after the interface has been stopped via xl_stop(). As a result, taskqueue_drain() is no longer required in xl_stop(). The task is still drained in detach() however to make sure that detach() can safely destroy the driver mutex at the end of the function. - Lock the driver lock in the ifmedia callouts and don't lock across ifmedia_ioctl() in xl_ioctl(). Note: glebius came up with most of (3) as well independently. I took a rather roundabout way of arriving at the same conclusion. MFC after: 3 days
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-12/+12
| | | | | | | | | | | | | | 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
* Modify device drivers supporting multicast addresses to lock if_addr_mtxrwatson2005-08-031-0/+4
| | | | | | | | 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
* The 575A doesn't have funcregs in memio. So don't claim that it does.imp2005-07-271-3/+8
| | | | | | | This gets my 575A card probing. Card provided by: James Flemer MFC After: 3 days
* NET_LOCK_GIANT() when entering network code.glebius2005-07-131-0/+2
| | | | | Pointy hat to: glebius Reported by: rodrigc
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-43/+50
| | | | | | | | | | | | | | | | | | | | 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
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386nyan2005-05-291-2/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* Calling xl_rxeof() at the end of xl_start_locked() leads to recursionglebius2005-05-201-1/+19
| | | | | | | | | in case of IP fast forwarding. Enqueue a taskqueue(9) task instead of calling xl_rxeof() directly. Reported & tested by: Slava Alpatov Reviewed by: wpaul MFC after: 1 week
* xl(4) meets polling(4). Hardware for this work kindly provided byru2005-03-261-0/+119
| | | | | | Eric Masson. MFC after: 3 weeks
* Fix style(9) issues with __P removal.imp2005-02-241-61/+56
| | | | Noticed by: bde
* Return BUS_PROBE_DEFAULT instead of 0.imp2005-02-241-1/+1
|
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Add PCI and device ID's to if_xl to support:rwatson2005-01-031-1/+5
| | | | | | | | | | | 3C920B-EMB-WNM Integrated Fast Ethernet Controller Submitter reports that the card appears to autonegotiate properly, and operate well with high levels of NFS traffic. PR: 75253 Submitted by: "Oleg V. Nauman" <oleg at reis dot zp dot ua> MFC after: 2 weeks
* Another missing ! in front of IFQ_DRV_IS_EMPTY, this time in an even moremlaier2004-11-081-3/+7
| | | | | | | | | | sensitive, but less excercised location (the watchdog). While here use the *_start_locked function directly to avoid drop, grab, drop lock. I have to be very careful with future ALTQ patches! Found & reviewed by: rwatson MFC after: 3 days
* style: Move the { back to the else line to match the }.johan2004-09-261-2/+2
| | | | | Discussed with: glebius X-MFC after: 5.3-Release
* Do not call xl_init_locked() unconditionally when we are bringed UP. Callglebius2004-09-091-2/+3
| | | | | | | | | | | it only if we weren't UP before. In some cases xl_init causes long media re-negotiation, and ppp(8) fails to open PPPoE connection because it sets IFF_UP every time before opening PPPoE connection. PR: kern/69133 Patch by: mdodd Approved by: wpaul, julian (mentor) MFC after: 1 week
* Do not attempt to clean up data that has not been initialized yet.roam2004-08-061-2/+4
| | | | | | | This fixes two kernel panics on boot when the xl driver fails to allocate bus/port/memory resources. Reviewed by: silence on -net
* Further improve locking in xl(4):bms2004-07-091-21/+34
| | | | | | | | | | | | | | - Avoid an additional lock acquire/release when leaving xl_intr(), by changing xl_start*() to xl_start*_locked(), and calling the appropriate routine by chip revision (as the DMA descriptors are different). - Simplify the appropriate routines now that they are called with the lock held. This should save a significant amount of CPU cycles spent on servicing each interrupt for both UP and SMP whilst remaining MPSAFE. Tested by: rwatson
* Reintroduce and clean up locking in xl(4).bms2004-07-051-88/+178
| | | | | | | | | | | | | | - Eliminate the use of a recursive mutex. - Mark the driver as INTR_MPSAFE. - Split the default media choice code out into xl_choose_media() to avoid making poor assumptions about the state of the lock during attach. - The miibus upcall/downcall paths may still be racy. Change to commented-out locking assertions there for now. - Tested with nfsclient, routed, ssh, ntp, dhclient and quagga bgpd. - This needs SMP test coverage. I do not have such resources. Tested on: UP, !debug.mpsafenet && debug.mpsafenet Hardware: 3C905B-TX (0x905510b7)
* Use if_printf() and device_printf() where appropriate, i.e.:bms2004-07-051-88/+92
| | | | | | | - Use device_printf() during device probe/attach. - Move if_xname initialization to before xl_reset() is called. - Use if_printf() at all other times after struct ifnet has been initialized.
* ANSIfy function definitions.bms2004-07-041-259/+99
| | | | | Remove unnecessary return keywords. Other minor stylistic changes.
* Fix whitespace, indentation, long line wrapping and comments.bms2004-07-041-126/+122
|
* Bring in the first chunk of altq driver modifications. This covers themlaier2004-07-021-6/+8
| | | | | | | | | | | following drivers: bfe(4), em(4), fxp(4), lnc(4), tun(4), de(4) rl(4), sis(4) and xl(4) More patches are pending on: http://peoples.freebsd.org/~mlaier/ Please take a look and tell me if "your" driver is missing, so I can fix this. Tested-by: many No-objection: -current, -net
* Remove burn bridges code that saved/restored the pci config registersimp2004-06-281-41/+0
| | | | | that are now handled in the pci bus layer. They are no longer necessary.
* Replace handrolled CRC calculation with ether_crc32_[lb]e().naddy2004-06-091-40/+14
|
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* Boomerang 10/100BT (found in 2c905-TX) chips apparently suffer theimp2004-04-131-0/+1
| | | | | | | | same problems as their Hurricane 575* bretheren in that one could set the memory mapped port, but that has no effect. Add a quirk for this. # I'll have to see if I can dig up documentation on these parts to see # if there's someway software can know this other than a table...
* solid reports that it is buggy *and* that it slows down transmitsilby2004-03-191-0/+20
| | | | | | | | | speed. Buggy report: Matt Dillon & others Slowness report: I can't find the e-mail MFC After: 1 minute
* Convert callers to the new bus_alloc_resource_any(9) API.njl2004-03-171-7/+5
| | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
* Announce ethernet MAC addresss in ether_ifattach().mdodd2004-03-141-5/+0
|
* Stop setting ifp->if_output to ether_output() since ether_ifattach()mux2004-03-111-1/+0
| | | | does it for us already.
* Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.obrien2003-12-081-5/+5
| | | | Requested by: bde,imp
* Sometimes cardbus attachments don't attach, so while we track downimp2003-11-281-0/+1
| | | | | | | | this problem put these lines back in. While they should be unnecessary, they appear to be sometimes necessary. Reviewed in concept: dfr Approved by: re (scottl@)
* Drop the driver lock around calls to if_input to avoid a LOR whensam2003-11-141-0/+4
| | | | | | | | the packets are immediately returned for sending (e.g. when bridging or packet forwarding). There are more efficient ways to do this but for now use the least intrusive approach. Reviewed by: imp, rwatson
* Remove duplicate FBSDID's, move others to their right place.obrien2003-11-141-4/+3
|
* Try to create some sort of consistency in how the routings to find theobrien2003-11-131-12/+11
| | | | | | | multicast hash are written. There are still two distinct algorithms used, and there actually isn't any reason each driver should have its own copy of this function as they could all share one copy of it (if it grew an additional argument).
OpenPOWER on IntegriCloud