summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_rl.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@
* Change the remainder of the drivers for DMA'ing devices enabled in themarius2007-01-211-1/+1
| | | | | | | | sparc64 GENERIC and the sound device drivers known working on sparc64 to use bus_get_dma_tag() to obtain the parent DMA tag so we can get rid of the sparc64_root_dma_tag kludge eventually. Except for ath(4), sk(4), stge(4) and ti(4) these changes are runtime tested (unless I booted up the wrong kernels again...).
* Don't assume IF_LLADDR returns aligned memory address.yongari2006-12-181-4/+5
| | | | | | | | | | Because accessing ID registers in rtl81x9 needs 32bit register access and RL_IDR4/RL_IDR5 registers are reservered registers bzero() is needed before copying ethernet address. This fixes unaligned memory accesses panic in sparc64. PR: kern/106801 MFC after: 3 days
* if_watchdog -> rl_watchdogru2006-12-011-14/+15
|
* Consistently use if_printf() only in interface methods: if_start,glebius2006-09-151-4/+5
| | | | | | | | | | 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>
* Do not touch ifp->if_baudrate in miibus aware drivers.glebius2006-02-141-1/+0
|
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-2/+2
| | | | | | | | | | 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.
* Replace FreeBSD 3.x syntax (controller miibus0) with 4.x syntaximp2005-10-221-1/+1
| | | | (device miibus) in time for 7.0 :-)
* 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-36/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* - Use if_printf() and device_printf() in re(4) and remove rl_unit fromjhb2005-09-291-17/+11
| | | | | | | | | | | | | | | | the softc. - Use callout_init_mtx() and rather than timeout/untimeout in both rl(4) and re(4). - Fix locking for ifmedia by locking the driver in the ifmedia handlers rather than in the miibus functions. (re(4) didn't lock the mii stuff at all!) - Fix some locking in re_ioctl(). Note: the two drivers share the same softc declared in if_rlreg.h, so they had to be change simultaneously. MFC after: 1 week Tested by: several on rl(4), none on re(4)
* Fix "struct ifnet" leaks when attach() fails in the middle, e.g.ru2005-09-161-5/+3
| | | | | | 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.
* Fixed "Memory modified after free" panic in rl_detach() dueru2005-09-141-4/+3
| | | | | | to rl_stop() accessing already freed "struct ifnet". Fixed LOR between rl mutex and some ACPI mutex in rl_detach().
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-6/+6
| | | | | | | | | | | | | | 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/+2
| | | | | | | | 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
* Move if_alloc() up so it's before mii_phy_probe().brooks2005-06-111-6/+7
|
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-16/+24
| | | | | | | | | | | | | | | | | | | | 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)
* Fix style(9) issues with __P removal.imp2005-02-241-37/+37
| | | | Noticed by: bde
* Return BUS_PROBE_DEFAULT instead of 0.imp2005-02-241-1/+1
|
* Adjust TX threshold on every TX underrun. Some supported cards (8139-based)mlaier2005-02-111-6/+10
| | | | | | | | | | | | can retransmit on TX underrun and set TOK in addition to TUND. Also add a check to prevent overflow of the addressable threshold. This fixes some reports of rl(4) slowness, believed to be related to ALTQ before. PR: kern/61448 Submitted by: Tim Draegen-Gilman <timNOeudaemonSPAMnet> (with changes) MFC after: 1 week
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Fix rl(4)'s lock behavior upon deinitialization. I would get a panicgreen2004-08-091-5/+6
| | | | when kldunloading due to its private locking being acquired recursively.
* Further rl(4) locking improvements:bms2004-07-091-48/+71
| | | | | | | | | | | - Avoid unnecessary re-acquisition elsewhere by adding *_locked() entry points as needed. - Correct locking for the DEVICE_POLLING case. - Hold the driver lock for the entire duration of interrupt servicing, to avoid unneeded, expensive re-acquisition; use *_locked() entry points as needed. Reviewed by: -net (silence)
* Locking cleanup for rl(4).bms2004-07-051-52/+60
| | | | | | | | | | | | | - Eliminate the use of a recursive mutex. - Mark the driver INTR_MPSAFE. This work is incomplete and will be refined in a future commit. - Most notably, _locked() variants of entry points need to be introduced. - The mii upcall/downcall may still be racy. - Add a stubbed-out guard against racing rl_detach() for the time being. Tested on: UP, debug.mpsafenet && !debug.mpsafenet Reviewed by: silence on -net
* style(9) and whitespace cleanup.bms2004-07-051-348/+196
| | | | | | | | Use C99 types. Use ANSI function definitions. Sort prototypes. Split long lines correctly. Punctuate/wordsmith comments. Use device_printf()/if_printf() where possible. Reviewed by: -net (silence)
* Bring in the first chunk of altq driver modifications. This covers themlaier2004-07-021-4/+6
| | | | | | | | | | | 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-57/+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-29/+2
|
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* Wrap the code to save/restore PCI config registers on suspend/resume injhb2004-05-241-0/+8
| | | | | | #ifndef BURN_BRIDGES. Noticed by: phk
* A handler for ioctl(SIOCSIFCAP) should not alter a bit inyar2004-05-231-1/+2
| | | | | | | if_capenable unless the interface driver is actually able to toggle the respective capability on and off. Reviewed by: ru
* Implemented per-interface polling(4) control.ru2004-04-111-1/+12
|
* Fixed a few bugs in the rl(4) driver:ru2004-04-031-8/+10
| | | | | | | | | | | | | | | | | | | | Under polling(4), we counted non-existent output packets and wasted CPU cycles, corrected. (PR kern/64975.) The fix in revision 1.71 to correct resetting of the watchdog timer was wrong. In rl(4), the TX list does not have a gap between the consumer and producer, so the "empty TX list" test was wrong, corrected. Also, resetting the timer to five each time we know there is still some TX work to do was a bad idea -- under polling(4), if the chip goes out to lunch, this results in the watchdog routine to _never_ be called. Instead, let the timer downgrade to zero and fire the watchdog, then reset it to five when it is zero AND there is some TX work left. (Most other network drivers need this fix too.) MFC after: 3 days
* Convert callers to the new bus_alloc_resource_any(9) API.njl2004-03-171-5/+4
| | | | | 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.
* Calculate the right register offset when clearing TX buffer pointerwpaul2004-01-211-1/+2
| | | | | | registers in rl_stop(). PR: kern/60250
* Fix detection of RealTek 8129 PCI cards. Apparently, these cardswpaul2004-01-021-1/+2
| | | | | | | | | | report a hardware rev of 0x00000000. Sadly, the 8169 gigE MAC also reports 0x00000000, so testing against this for exclusion results in both cards being skipped by rl_probe(). Make the 8169 test more specific by matching against both the hwrev and the PCI ID for this chip. PR: kern/60824
* Catch a few places where NULL (pointer) was used where 0 (integer) waspeter2003-12-231-1/+1
| | | | expected.
* 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-13/+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).
* Remove explicit cardbus attachments from drivers where this is identicaldfr2003-11-031-1/+0
| | | | | | | to the pci attachment. Cardbus is a derived class of pci so all pci drivers are automatically available for matching against cardbus devices. Reviewed by: imp
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-2/+1
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* Re-enable VLAN_MTU capability for this driver. (Got reverted whenwpaul2003-09-111-0/+1
| | | | I pulled out the C+/8169 bits.)
* Add a PHY driver to support the built-in gigE PHY in the 8169S/8110Swpaul2003-09-111-1/+2
| | | | | | | | | | | | | | | | | | ethernet chips. This driver is pretty simple, however it contains special DSP initialization code which is needed in order to get the chip to negotiate a gigE link. (This special initialization may not be needed in subsequent chip revs.) Also: - Fix typo in if_rlreg.h (RL_GMEDIASTAT_1000MPS -> RL_GMEDIASTAT_1000MBPS) - Deal with shared interrupts in re_intr(): if interface isn't up, return. - Fix another bug in re_gmii_writereg() (properly apply data field mask) - Allow PHY driver to read the RL_GMEDIASTAT register via the re_gmii_readreg() register (this is register needed to determine real time link/media status).
OpenPOWER on IntegriCloud