summaryrefslogtreecommitdiffstats
path: root/sys/dev/vr
Commit message (Collapse)AuthorAgeFilesLines
* Forcibly disable interrupts, if we find ourselves servicing one whenbms2004-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
* Workaround for a recursive acquisition of the driver mutex during devicebms2004-10-261-0/+2
| | | | | | | | detach; triggered by ether_ifdetach() -> if_delmulti() -> vr_ioctl(). MFC candidate. PR: kern/62889 MFC after: 3 days
* Really really fix typo this time.bms2004-10-191-1/+0
|
* Fix typo sc -> dev.bms2004-10-191-1/+1
|
* Detach the Rhine completely on shutdown, rather than merely stopping itbms2004-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
* Revert rev 1.93 and replace it by grabbing the vr lock before callingscottl2004-08-111-2/+2
| | | | | | mii_pollstat(). The previous was causing the vr lock to recurse. PR: kern/70189
* Acquire vr lock before entering vr_setcfg() in vr_miibus_statchg(),rwatson2004-08-071-0/+2
| | | | | | since vr_setcfg() expects it. Reported by: Mike Bristow <mike@urgle.com>
* Unbreak DEVICE_POLLING build / LINT. Sorry!mlaier2004-08-021-1/+1
| | | | Submitted by: roam
* Second part of ALTQ driver modifications, covering:mlaier2004-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)
* Further locking improvements for vr(4):bms2004-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)
* Add a 'suspended' flag to softc so that we can avoid races on detach.bms2004-07-091-0/+1
|
* SMPng locking cleanup for vr(4).bms2004-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
* - Another whitespace pass; make locking calls more obvious.bms2004-07-031-12/+10
| | | | - Use C99 types for vr_miibus_readreg().
* style(9) compliance.bms2004-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
* Remove burn bridges code that saved/restored the pci config registersimp2004-06-281-24/+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
|
* Implemented per-interface polling(4) control.ru2004-04-111-1/+13
|
* - Rewritten TX to use only two pointers to track producer/consumer.ru2004-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().
* Convert callers to the new bus_alloc_resource_any(9) API.njl2004-03-171-3/+2
| | | | | 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
* Drop the driver lock around calls to if_input to avoid a LOR whensam2003-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
* 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).
* 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)
* Prefer new location of pci include files (which have only been in theimp2003-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.
* Due to extreme bogusness in the pci bus layer, these drivers wereimp2003-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.
* Use newly minted device_is_attached rather than device_is_alive to seeimp2003-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
* Revise attach/detach resource cleanupnjl2003-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
* - Don't call pci_enable_io() in drivers (unless needed for resume).mdodd2003-04-161-18/+0
| | | | | - Don't test memory/port status and emit an error message; the PCI bus code will do this now.
* - Express hard dependencies on bus (pci, isa, pccard) andmdodd2003-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.)
* Fix if_vr's handling of vr_encap failures. 3 parts:silby2003-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
* Use __FBSDID rather than rcsid[].obrien2003-04-031-7/+3
|
* Add missing ()'s so that these drivers all compile again.jhb2003-03-311-1/+1
| | | | | Noticed by: jake Tested on: i386 (compile)
* Clean up locking and resource management for pci/if_*njl2003-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
* Switch vr_encap over to using m_defrag instead of its own versionsilby2003-03-291-14/+2
| | | | | | | | | of the function. No functional change, this driver already handled long mbuf chains correctly. MFC after: 2 weeks
* Back out M_* changes, per decision of the TRB.imp2003-02-191-4/+4
| | | | Approved by: trb
* Add deviceids for 6105 and 6105M chips. Further changes will be necessarysilby2003-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
* Switch the if_vr driver from using our generic MII routines over tosilby2003-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
* Fixes from Thomas Nystrom to fix hanging problems experienced by vr cardssilby2003-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
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-4/+4
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* When reading PHY regs over the i2c bus, the turnaround ACK bitmbr2003-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
* Import some relevant changes from Via's if_fet driver:silby2002-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
* o track either_ifattach/ether_ifdetach API changessam2002-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
* Be consistent about functions being static.phk2002-10-161-9/+9
| | | | | | Properly put macro args in (). Spotted by: FlexeLint.
* style: put return types on a line by themselves.alfred2002-08-241-31/+62
|
* Improve handling of TX errors. Early reports indicate that thissilby2002-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
* Make sure to set the DMA transfer length register, plus onesilby2002-08-051-1/+6
| | | | | | small style fix. Submitted by: Thomas Nystrom <thn@saeab.se>
OpenPOWER on IntegriCloud