aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/vr
Commit message (Collapse)AuthorAgeFilesLines
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-072-2/+2
| | | | Notes: svn path=/head/; revision=139825
* Forcibly disable interrupts, if we find ourselves servicing one whenBruce M Simpson2004-10-271-1/+8
| | | | | | | | | | | | | | | | | | | | the device is suspended or shutting down. This will need to be rethought slightly if we implement suspend/resume support within vr(4). This appears to fix the vr_shutdown() panic on SMP machines. My theory here is there's a race somewhere during vr_detach() with vr_intr() in the SMP case which was sometimes being triggered, although quite why this was happening is unclear (vr_stop() also explicitly disables interrupts by writing to the IMR register). MFC-to-RELENG_5* candidate. PR: kern/62889 Tested by: seb at struchtrup dot com MFC after: 10 days Notes: svn path=/head/; revision=136997
* Workaround for a recursive acquisition of the driver mutex during deviceBruce M Simpson2004-10-261-0/+2
| | | | | | | | | | | detach; triggered by ether_ifdetach() -> if_delmulti() -> vr_ioctl(). MFC candidate. PR: kern/62889 MFC after: 3 days Notes: svn path=/head/; revision=136976
* Really really fix typo this time.Bruce M Simpson2004-10-191-1/+0
| | | | Notes: svn path=/head/; revision=136705
* Fix typo sc -> dev.Bruce M Simpson2004-10-191-1/+1
| | | | Notes: svn path=/head/; revision=136696
* Detach the Rhine completely on shutdown, rather than merely stopping itBruce M Simpson2004-10-191-3/+1
| | | | | | | | | | | as the original logic did. This fixes a race with vr_intr() which was masked on UP systems and manifested on SMP systems. PR: kern/62889 MFC after: 1 day Notes: svn path=/head/; revision=136693
* Revert rev 1.93 and replace it by grabbing the vr lock before callingScott Long2004-08-111-2/+2
| | | | | | | | | mii_pollstat(). The previous was causing the vr lock to recurse. PR: kern/70189 Notes: svn path=/head/; revision=133468
* Acquire vr lock before entering vr_setcfg() in vr_miibus_statchg(),Robert Watson2004-08-071-0/+2
| | | | | | | | | since vr_setcfg() expects it. Reported by: Mike Bristow <mike@urgle.com> Notes: svn path=/head/; revision=133279
* Unbreak DEVICE_POLLING build / LINT. Sorry!Max Laier2004-08-021-1/+1
| | | | | | | Submitted by: roam Notes: svn path=/head/; revision=133006
* Second part of ALTQ driver modifications, covering:Max Laier2004-08-011-5/+7
| | | | | | | | | | | | | an(4), ath(4), hme(4), ndis(4), vr(4) and wi(4) Please help testing: http://people.freebsd.org/~mlaier/ALTQ_driver/ Tested by: Vaidas Damosevicius (an, ath, wi) Roman Divacky (vr) Submitted by: yongari (hme) Notes: svn path=/head/; revision=132986
* Further locking improvements for vr(4):Bruce M Simpson2004-07-091-46/+69
| | | | | | | | | | | | | | | - Add *_locked() entry points as needed to avoid unnecessary lock thrashing. - Use these entry points wisely. - Only acquire the lock once when servicing an interrupt. - Check 'suspended' on interrupt to avoid racing detach. - Correct a mis-spelled comment. - Don't take the lock in vr_reset() to avoid lock thrashing in attach. - Comment this. Reviewed by: -net (silence) Notes: svn path=/head/; revision=131844
* Add a 'suspended' flag to softc so that we can avoid races on detach.Bruce M Simpson2004-07-091-0/+1
| | | | Notes: svn path=/head/; revision=131843
* SMPng locking cleanup for vr(4).Bruce M Simpson2004-07-031-66/+58
| | | | | | | | | | | | | | | | | | - Remove recursive locking situations. Remove the MTX_RECURSE bit. - Take the lock for any routine which is not called from within if_vr.c itself; this includes entry points called by newbus, ifnet, callout, ifmedia, and polling subsystems. - Remove spl references from the code added to miibus callbacks in rev 1.60. - Add the INTR_MPSAFE bit. - Tidy up some assignments; locks are not needed for taking the address of something at a known offset, for example. - Tested on the machine this was committed from. Tested on: UP only, !debug.mpsafenet && debug.mpsafenet Reviewed by: rwatson Notes: svn path=/head/; revision=131518
* - Another whitespace pass; make locking calls more obvious.Bruce M Simpson2004-07-031-12/+10
| | | | | | | - Use C99 types for vr_miibus_readreg(). Notes: svn path=/head/; revision=131517
* style(9) compliance.Bruce M Simpson2004-07-021-276/+164
| | | | | | | | | | | | Put some braces around the busy-wait loop in vr_rxeoc() to make the no-op semicolon more obvious. No functional changes. Running on the machine I am committing from without problems. Reviewed by: jmallett Notes: svn path=/head/; revision=131503
* Remove burn bridges code that saved/restored the pci config registersWarner Losh2004-06-281-24/+0
| | | | | | | | that are now handled in the pci bus layer. They are no longer necessary. Notes: svn path=/head/; revision=131253
* Replace handrolled CRC calculation with ether_crc32_[lb]e().Christian Weisgerber2004-06-091-29/+2
| | | | Notes: svn path=/head/; revision=130270
* Add missing <sys/module.h> includesPoul-Henning Kamp2004-05-301-0/+1
| | | | Notes: svn path=/head/; revision=129878
* Implemented per-interface polling(4) control.Ruslan Ermilov2004-04-111-1/+13
| | | | Notes: svn path=/head/; revision=128118
* - Rewritten TX to use only two pointers to track producer/consumer.Ruslan Ermilov2004-04-052-127/+161
| | | | | | | | | - Added polling(4) support! - Bugfix: don't forget to set IFF_OACTIVE when TX list is full. - Minor: tidy up vr_encap(). Notes: svn path=/head/; revision=127901
* Convert callers to the new bus_alloc_resource_any(9) API.Nate Lawson2004-03-171-3/+2
| | | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Notes: svn path=/head/; revision=127135
* Announce ethernet MAC addresss in ether_ifattach().Matthew N. Dodd2004-03-141-5/+0
| | | | Notes: svn path=/head/; revision=126966
* Stop setting ifp->if_output to ether_output() since ether_ifattach()Maxime Henrion2004-03-111-1/+0
| | | | | | | does it for us already. Notes: svn path=/head/; revision=126847
* Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.David E. O'Brien2003-12-081-5/+5
| | | | | | | Requested by: bde,imp Notes: svn path=/head/; revision=123289
* Drop the driver lock around calls to if_input to avoid a LOR whenSam Leffler2003-11-142-0/+5
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=122689
* Remove duplicate FBSDID's, move others to their right place.David E. O'Brien2003-11-141-4/+3
| | | | Notes: svn path=/head/; revision=122678
* Try to create some sort of consistency in how the routings to find theDavid E. O'Brien2003-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). Notes: svn path=/head/; revision=122625
* Replace the if_name and if_unit members of struct ifnet with new membersBrooks Davis2003-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) Notes: svn path=/head/; revision=121816
* Prefer new location of pci include files (which have only been in theWarner Losh2003-08-221-2/+2
| | | | | | | | tree for two or more years now), except in a few places where there's code to be compatible with older versions of FreeBSD. Notes: svn path=/head/; revision=119288
* Due to extreme bogusness in the pci bus layer, these drivers wereWarner Losh2003-07-031-2/+2
| | | | | | | | | | | | forced to do slightly bogus power state manipulation. However, this is one of those features that is preventing further progress, so mark them as BURN_BIRDGES like I did for the drivers in sys/dev/... This, like the other change, are a no-op unless you have BURN_BRIDGES in your kernel. Notes: svn path=/head/; revision=117208
* Use newly minted device_is_attached rather than device_is_alive to seeWarner Losh2003-04-211-1/+1
| | | | | | | | | | | | if attach succeeded. device_is_alive just tells us that probe succeeded. Since we were using it to do things like detach net interfaces, this caused problems when there were errors in the attach routine. Symptoms of problem reported by: martin blapp Notes: svn path=/head/; revision=113812
* Revise attach/detach resource cleanupNate Lawson2003-04-171-4/+14
| | | | | | | | | | | | | | | | | | - Unconditionally call *_stop() if device is in the tree. This is to prevent callouts from happening after the device is gone. Checks for bus_child_present() should be added in the future to keep from touching potentially non-existent hardware in *_detach(). Found by iedowse@. - Always check for and free miibus children, even if the device is not in the tree since some failure cases could have gotten here. - Call ether_ifdetach() in the irq setup failure case - ti(4), xl(4): move ifmedia_init() calls to the beginning of attach so that ifmedia_removeall() can be unconditionally called on detach. There is no way to detect whether ifmedia has been initialized without using a separate variable (as tl(4) does). - Add comments to indicate assumptions of code path Notes: svn path=/head/; revision=113609
* - Don't call pci_enable_io() in drivers (unless needed for resume).Matthew N. Dodd2003-04-161-18/+0
| | | | | | | | - Don't test memory/port status and emit an error message; the PCI bus code will do this now. Notes: svn path=/head/; revision=113545
* - Express hard dependencies on bus (pci, isa, pccard) andMatthew N. Dodd2003-04-151-1/+3
| | | | | | | | | | | network layer (ether). - Don't abuse module names to facilitate ifconfig module loading; such abuse isn't really needed. (And if we do need type information associated with a module then we should make it explicit and not use hacks.) Notes: svn path=/head/; revision=113506
* Fix if_vr's handling of vr_encap failures. 3 parts:Mike Silbersack2003-04-091-10/+9
| | | | | | | | | | | | | | | | | - Don't bother setting OACTIVE when the descriptors are all full or there's a vr_encap failure, it doesn't help anything. - Correctly roll back on the descriptor list after a failure so as not to corrupt the list. - Add a missing VR_UNLOCK(). Without these changes, vr_encap failure (which is assured during a low mbuf situation) would result in the card locking until the watchdog could fire. MFC after: 1 week Notes: svn path=/head/; revision=113274
* Use __FBSDID rather than rcsid[].David E. O'Brien2003-04-031-7/+3
| | | | Notes: svn path=/head/; revision=113038
* Add missing ()'s so that these drivers all compile again.John Baldwin2003-03-311-1/+1
| | | | | | | | Noticed by: jake Tested on: i386 (compile) Notes: svn path=/head/; revision=112880
* Clean up locking and resource management for pci/if_*Nate Lawson2003-03-311-35/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove locking of the softc in the attach method, instead depending on bus_setup_intr being at the end of attach (delaying interrupt enable until after ether_ifattach is called) - Call *_detach directly in the error case of attach, depending on checking in detach to only free resources that were allocated. This puts all resource freeing in one place, avoiding thinkos that lead to memory leaks. - Add bus_child_present check to calls to *_stop in the detach method to be sure hw is present before touching its registers. - Remove bzero softc calls since device_t should do this for us. - dc: move interrupt allocation back where it was before. It was unnecessary to move it. This reverts part of 1.88 - rl: move irq allocation before ether_ifattach. Problems might have been caused by allocating the irq after enabling interrupts on the card. - rl: call rl_stop before ether_ifdetach - sf: call sf_stop before ether_ifdetach - sis: add missed free of sis_tag - sis: check errors from tag creation - sis: move dmamem_alloc and dmamap_load to happen at same time as tag creation - sk: remove duplicate initialization of sk_dev - ste: add missed bus_generic_detach - ti: call ti_stop before ether_ifdetach - ti: add missed error setting in ti_rdata alloc failure - vr: add missed error setting in I/O, memory mapping cases - xl: add missed error setting in I/O, memory mapping cases - xl: remove multi-level goto on attach failure - xl: move dmamem_alloc and dmamap_load to happen at same time as tag creation - Calls to free(9) are unconditional because it is valid to call free with a null pointer. Reviewed by: imp, mdodd Notes: svn path=/head/; revision=112872
* Switch vr_encap over to using m_defrag instead of its own versionMike Silbersack2003-03-291-14/+2
| | | | | | | | | | | | of the function. No functional change, this driver already handled long mbuf chains correctly. MFC after: 2 weeks Notes: svn path=/head/; revision=112821
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-4/+4
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Add deviceids for 6105 and 6105M chips. Further changes will be necessaryMike Silbersack2003-02-012-0/+6
| | | | | | | | | | to fully support these new chips, but preliminary evidence suggests that they work acceptable with our present driver. MFC after: 1 week Notes: svn path=/head/; revision=110170
* Switch the if_vr driver from using our generic MII routines over toMike Silbersack2003-02-012-0/+93
| | | | | | | | | | | | | | | | using the Rhine's internal shift registers which are designed for the job. This reduces the amount of time we wait around shifting bits, and seems to work better with some chips. Also, provide a workaround for some newer cards which report fake PHYs at multiple addresses. (As more cards are ID'd, I'm sure this part of the code will have to be expanded to cover more cases.) Submitted by: Thomas Nystrom <thn@saeab.se> MFC after: 1 week Notes: svn path=/head/; revision=110168
* Fixes from Thomas Nystrom to fix hanging problems experienced by vr cardsMike Silbersack2003-01-312-34/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | under load. This patch has been tested by Thomas and other for more than a month now, and all (known) hangs seem to be solved. Thomas's explanation of the patch: * Fix the problem with the printing of the RX-error. * Code from if_fet do better deal with the RX-recovery including a timeout of the RX-turnoff. * The call to vr_rxeof before vr_rxeoc have been moved to a point where the RX-part of the chip is turned off. Otherwise there is a window where new data could have been written to the buffer chain before the RX-part is turned off. If this happens the chip will see a busy rx-buffer. I have no evidence that this have occured but god knows what the chip will do in this case! * I have added a timeout of the TX-turnoff. I have checked and in my 900 MHz system the flags for turnoff (both RX & TX) is seen at the first check in the loop. * I could see that I got the VR_ISR_DROPPED interrupt sometimes and started to thinking about this. I then realized that no recovery is needed for this case and therefore I only count it as an rxerror (which was not done before). * Finally I have changed the FIFO RX threshhold to 128 bytes. When I did this the VR_ISR_DROPPED interrupt went away. Theory: The chip will receive a complete frame before it tries to write it out to memory then the RX threshold is set to store'n'forward. IF the frame is large AND the next rx frame also is large AND the bus is busy transfering a TX frame to the TX fifo THEN the second received frame wont fit in the FIFO and is then dropped. By having the RX threshold set to 128 the RX fifo is emptied faster. MFC after: 5 days Notes: svn path=/head/; revision=110131
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-4/+4
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* When reading PHY regs over the i2c bus, the turnaround ACK bitMartin Blapp2003-01-101-1/+1
| | | | | | | | | | | | | is read one clock edge too late. This bit is driven low by slave (as any other input data bits from slave) when the clock is LOW. The current code did read the bit after the clock was driven high again. Reviewed by: luoqi MFC after: 2 weeks Notes: svn path=/head/; revision=109058
* Import some relevant changes from Via's if_fet driver:Mike Silbersack2002-11-252-2/+29
| | | | | | | | | | | | | | | | | | 1. Detect the revision of the Rhine chip we're using. 2. Use the force reset command on revisions which support it whenever the normal reset command fails. This should solve a wide range of "my vr0 locks up with reset failed messages" problems. (Although the root causes should be eventually tracked down.) Tested by: grenville armitage <garmitage@swin.edu.au> Obtained from: Via's if_fet driver MFC after: 3 days Approved by: re Notes: svn path=/head/; revision=107220
* o track either_ifattach/ether_ifdetach API changesSam Leffler2002-11-141-16/+5
| | | | | | | | | | | | | | o use if_input for input packet processing o don't strip the Ethernet header for input packets o use BPF_* macros bpf tapping o call ether_ioctl to handle default ioctl case o track vlan changes Reviewed by: many Approved by: re Notes: svn path=/head/; revision=106936
* Be consistent about functions being static.Poul-Henning Kamp2002-10-161-9/+9
| | | | | | | | | Properly put macro args in (). Spotted by: FlexeLint. Notes: svn path=/head/; revision=105221
* style: put return types on a line by themselves.Alfred Perlstein2002-08-241-31/+62
| | | | Notes: svn path=/head/; revision=102336
* Improve handling of TX errors. Early reports indicate that thisMike Silbersack2002-08-152-13/+28
| | | | | | | | | | | | | elimiates the driver lockup problem reported by many. Concepts used were taken from Via's if_fet driver. Verification and implementation were done by Thomas Nystrom. Submitted by: Thomas Nystrom <thn@saeab.se> MFC after: 3 days Notes: svn path=/head/; revision=101896