aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sis
Commit message (Collapse)AuthorAgeFilesLines
* MFC r226478:Pyun YongHyeon2011-12-311-1/+1
| | | | | | | | | | | | Close a race where SIOCGIFMEDIA ioctl get inconsistent link status. Because driver is accessing a common MII structure in mii_pollstat(), updating user supplied structure should be done before dropping a driver lock. Reported by: Karim (fodillemlinkarimi <> gmail dot com) Notes: svn path=/stable/7/; revision=229059
* MFC: r226995 (partially), r227042Marius Strobl2011-11-062-195/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Import the common MII bitbang'ing code from NetBSD and convert drivers to take advantage of it instead of duplicating it. This reduces the size of the i386 GENERIC kernel by about 8k. The only potential in-tree users left unconverted are ed(4) and xe(4). Xe(4) generally should be changed to use miibus(4) instead of implementing PHY handling on its own, as otherwise it makes not much sense to add a dependency on miibus(4)/mii_bitbang(4) to it just for the MII bitbang'ing code. Ed(4) has some chip specific things interwinded with the MII bitbang'ing code and it's unclear whether it can be converted to common code, at least not without thorough testing of all the various chips supported by ed(4). The common MII bitbang'ing code also is useful in the embedded space for using GPIO pins to implement MII access. - Based on lessons learnt with dc(4) (see r185750), add bus barriers to the MII bitbang read and write functions of the other drivers converted in order to ensure the intended ordering. Given that register access via an index register as well as register bank/window switching is subject to the same problem, also add bus barriers to the respective functions of smc(4), tl(4) and xl(4). - Sprinkle some const. Thanks to the following testers: Andrew Bliznak (nge(4)), nwhitehorn@ (bm(4)), yongari@ (sis(4) and ste(4)) Thanks to Hans-Joerg Sirtl for supplying hardware to test stge(4). Reviewed by: yongari (subset of drivers) Obtained from: NetBSD (partially) Notes: svn path=/stable/7/; revision=227279
* MFC: r221407 (partial)Marius Strobl2011-09-111-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | - Let mii_phy_add_media() also announce the support of IFM_NONE. - Add a PHY-specific reset routine is for lxtphy(4) which disables MII interrupts. - Remove redundant checks in NIC drivers for mii->mii_instance not being zero before calling the reset routines because as soon as one PHY driver attaches mii->mii_instance is incremented and we hardly can end up in their media change callbacks etc if no PHY driver has attached as mii_attach() would have failed in that case and not attach a miibus(4) instance. - Convert the mebers of the MII data structure to unsigned where appropriate. This is partly inspired by NetBSD/OpenBSD. - Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that weren't explicitly converted to support flow control before. It's unclear whether flow control actually works with these but typically it should and their net behavior should be more correct with these changes in place than without if the MAC driver sets MIIF_DOPAUSE. Obtained from: NetBSD (partially) Notes: svn path=/stable/7/; revision=225490
* MFC r219102:Pyun YongHyeon2011-03-072-3/+3
| | | | | | | | | | | | | | | | Make sure changing ownership of RX descriptor to be done as last operation. Previously ownership was transferred to hardware before setting address of new RX buffer such that it was possible for hardware to use wrong RX buffer address. While here keep compiler from re-ordering instructions by declaring descriptor members volatile. Memory barriers would do the same job but volatile is supposed to be cheaper than using memory barriers, especially on MP systems. Submitted by: marius Notes: svn path=/stable/7/; revision=219357
* MFC r217548:Pyun YongHyeon2011-01-211-91/+90
| | | | | | | | | | | | | | | | | | | Rework RX filter programming by providing separate handler for DP8381[56] and SiS 900/7016 controllers. After r212119, sis(4) no longer reinitializes controller if ALLMULTI/PROMISC was changed. However, RX filter handling code assumed some bits of the RX filter is programmed by driver initialization. This caused ALLMULTI/PROMISC configuration is ignored under certain conditions. Fix that issue by reprogramming all bits of RX filter register. While I'm here follow recommended RX filter programming steps recommended by National DP8381[56] data sheet(RX filter should be is disabled before programming). Reported by: Paul Schenkeveld < freebsd () psconsult dot nl > Tested by: Paul Schenkeveld < freebsd () psconsult dot nl > Notes: svn path=/stable/7/; revision=217669
* MFC: r213894, r213896, r214913Marius Strobl2010-11-071-4/+4
| | | | | | | | | | Converted the remainder of the NIC drivers to use the mii_attach() introduced in r213878 (MFC'ed to stable/7 in r214685) instead of mii_phy_probe(). Unlike r213893 (MFC'ed to stable/7 in r214910) these are mostly straight forward conversions though. Notes: svn path=/stable/7/; revision=214925
* MFC r214089:Pyun YongHyeon2010-10-231-4/+9
| | | | | | | | | | | | | Correct handling of shared interrupt in sis_intr(). r212116 incorrectly released a drver lock for shared interrupt case such that it caused panic. While I'm here check whether driver is still running before serving TX/RX handler. Reported by: Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au > Tested by: Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au > Notes: svn path=/stable/7/; revision=214232
* MFC r212167:Pyun YongHyeon2010-10-082-31/+124
| | | | | | | | | Initial WOL support. NS DP8315 was tested but SiS900/SiS7016 was not tested. While I'm here, clean up SIOCSIFCAP handler. Notes: svn path=/stable/7/; revision=213639
* MFC r188463:Pyun YongHyeon2010-10-081-1/+2
| | | | | | | Fix shutdown prototypes. Notes: svn path=/stable/7/; revision=213638
* MFC r212166:Pyun YongHyeon2010-10-081-0/+31
| | | | | | | Implement initial device suspend/resume method. Notes: svn path=/stable/7/; revision=213636
* MFC r212157:Pyun YongHyeon2010-10-082-10/+81
| | | | | | | | | | | | | | | | | | Unlike most other controllers, NS DP83815/DP83816 controllers seem to pad with 0xFF when it encounter short frames. According to RFC 1042 the pad bytes should be 0x00. Because manual padding consumes extra CPU cycles, introduce a new tunable which controls the padding behavior. Turning this tunable on will have driver pad manually but it's disabled by default. Users can enable software padding by setting the following tunable to non-zero value. dev.sis.%d.manual_pad="1" PR: kern/35422 (patch not used) Notes: svn path=/stable/7/; revision=213627
* MFC r212121,212156:Pyun YongHyeon2010-10-081-20/+19
| | | | | | | | | | | | | | | | | r212121: Move sis_reset() to sis_initl(). This ensures driver starts with known good state of controller. r212156: Fix the last endianness issue on handling station address which prevented driver from working on big-endian machines. Also rewrite station address programming to make it work on strict-alignment architectures. With this change, sis(4) now works on sparc64 and performance number looks good even though sis(4) have to apply fixup code to align received frames on 2 bytes boundary on sparc64. Notes: svn path=/stable/7/; revision=213625
* MFC r212120:Pyun YongHyeon2010-10-081-0/+5
| | | | | | | | | | Avoid controller reinitialization which could be triggered by dhclient(8) or alias addresses are added. PR: kern/87506 Notes: svn path=/stable/7/; revision=213623
* MFC r212117,212119:Pyun YongHyeon2010-10-082-4/+14
| | | | | | | | | | | | | | | | rr212117: Report result of link state change to caller. Previously it always returned success. r212119: Do not reinitialize controller whenever promiscuous mode or allmulti is toggled. Controller does not require reinitialization. This removes unnecessary controller reinitialization whenever tcpdump is used. While I'm here remove unnecessary variable reinitialization. Notes: svn path=/stable/7/; revision=213621
* MFC r212116:Pyun YongHyeon2010-10-082-88/+100
| | | | | | | | | | | | | | | | | | | | | | | | | Overhaul link state change handling. Previously sis(4) blindly configured TX/RX MACs before getting a valid link. After that, when link state change callback is called, it called device initialization again to reconfigure TX/RX MACs depending on resolved link state. This hack created several bad side effects and it required more hacks to not collide with sis_tick callback as well as disabling switching to currently selected media in device initialization. Also it seems sis(4) was used to be a template driver for long time so other drivers which was modeled after sis(4) also should be changed. TX/RX MACs are now reconfigured after getting a valid link. Fix for short cable error is also applied after getting a link because it's only valid when the resolved speed is 100Mbps. While I'm here slightly reorganize interrupt handler such that sis(4) always read SIS_ISR register to see whether the interrupt is ours or not. This change removes another hack and make it possible to nuke sis_stopped variable in softc. Notes: svn path=/stable/7/; revision=213618
* MFC r212113:Pyun YongHyeon2010-10-082-35/+35
| | | | | | | s/u_intXX_t/uintXX_t/g Notes: svn path=/stable/7/; revision=213615
* MFC r212109,212124,212185:Pyun YongHyeon2010-10-082-417/+494
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r212109: bus_dma(9) cleanup. o Enforce TX/RX descriptor ring alignment. NS data sheet says the controller needs 4 bytes alignment but use 16 to cover both SiS and NS controllers. I don't have SiS data sheet so I'm not sure what is alignment restriction of SiS controller but 16 would be enough because it's larger than the size of a TX/RX descriptor. Previously sis(4) ignored the alignment restriction. o Enforce RX buffer alignment, 4. Previously sis(4) ignored RX buffer alignment restriction. o Limit number of TX DMA segment to be used to 16. It seems controller has no restriction on number of DMA segments but using more than 16 looks resource waste. o Collapse long mbuf chains with m_collapse(9) instead of calling expensive m_defrag(9). o TX/RX side bus_dmamap_load_mbuf_sg(9) support and remove unnecessary callbacks. o Initial endianness support. o Prefer local alignment fixup code to m_devget(9). o Pre-allocate TX/RX mbuf DMA maps instead of creating/destroying these maps in fast TX/RX path. On non-x86 architectures, this is very expensive operation and there is no need to do that. o Add missing bus_dmamap_sync(9) in TX/RX path. o watchdog is now unarmed only when there are no pending frames on controller. Previously sis(4) blindly unarmed watchdog without checking the number of queued frames. o For efficiency, loaded DMA map is reused for error frames. o DMA map loading failure is now gracefully handled. Previously sis(4) ignored any DMA map loading errors. o Nuke unused macros which are not appropriate for endianness operation. o Stop embedding driver maintained structures into descriptor rings. Because TX/RX descriptor structures are shared between host and controller, frequent bus_dmamap_sync(9) operations are required in fast path. Embedding driver structures will increase the size of DMA map which in turn will slow down performance. r212124: Fix stupid error in r212109 which didn't swap DMA maps. This caused IOMMU panic on sparc64 under high TX load. r212185: Fix another bug introduced in r212109. We should unload DMA maps only after sending the last fragment of a frame so the mbuf pointer also should be stored in the last descriptor index. Notes: svn path=/stable/7/; revision=213613
* MFC r212103-212105:Pyun YongHyeon2010-10-082-78/+70
| | | | | | | | | | | | | | | r212103: Remove leading and trailing white spaces. No functional changes. r212104: style(9) - space after keywords. r212105: Nuke unnecessary return at the end of function. Notes: svn path=/stable/7/; revision=213610
* MFC r182065:Pyun YongHyeon2010-10-081-3/+4
| | | | | | | | | | | | | | There actually were bugs in the original handling that I missed last night. Free the children after each pci bus that is searched. Otherwise we leak them. With free in the new place, we also have to free children before going to done when we find the device we're looking for. Also, if we can't get the children of a device, just ignore that bus. Notes: svn path=/stable/7/; revision=213608
* MFC r206909:Rebecca Cran2010-09-111-12/+3
| | | | | | | | | | | | | It's not necessary to reset the chip every time an input overflow event occurs. In addition, the delay when programming the short cable fix should be 100us, not 100ms. PR: kern/64556 Submitted by: Thomas Hurst <tom at hur.st> Approved by: rrs (mentor) Notes: svn path=/stable/7/; revision=212469
* MFC r188550:Pyun YongHyeon2009-03-191-2/+3
| | | | | | | | | | | Receving VLAN oversized frames raise SIS_ISR_RX_ERR interrupt, so make sis_rxeof() handle that too. Previously it used to receive the frame and reset controller. PR: kern/131414 Notes: svn path=/stable/7/; revision=190009
* MFC r185784:Pyun YongHyeon2009-03-192-1/+10
| | | | | | | | | | | | | | | | | | | | | | Fix a long standing VLAN tagged frame handling bug. When VLAN tagged frame is received the hardware sets 'LONG' bit of Rx status word. It is always set when the size of received frame exceeded 1518 bytes, including CRC. This VLAN tagged frame clears 'OK' bit of Rx status word such that driver should not rely on 'OK' bit of Rx status word to pass the VLAN tagged frame to upper stack. To fix the bug, don't use SIS_CMDSTS_PKT_OK for Rx error check and introduce SIS_RXSTAT_ERROR macro that checks Rx errors. If we are configured to accept VLAN tagged frames and the received frame size is less than or equal to maximum allowed length of VLAN tagged frame, clear 'LONG' bit of Rx status word before checking Rx errors. Reported by: Vladimir Ermako < samflanker <> gmail DOT com > Tested by: Vladimir Ermako < samflanker <> gmail DOT com > Notes: svn path=/stable/7/; revision=190008
* MFC 181524:Warner Losh2009-03-182-0/+2802
Move sis to sys/dev/sis for consistency. Notes: svn path=/stable/7/; revision=189990