aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/re
Commit message (Collapse)AuthorAgeFilesLines
...
* When driver is not running, do not send DUMP command to controllerPyun YongHyeon2011-01-101-0/+5
| | | | | | | | | and just show old (cached) values. Controller will not respond to the command unless MAC is enabled so DUMP request for down interface caused request timeout. Notes: svn path=/head/; revision=217247
* Implement TSO on RealTek RTL8168/8111 C or later controllers.Pyun YongHyeon2011-01-101-21/+19
| | | | | | | | | | | | | | | RealTek changed TX descriptor format for later controllers so these controllers require MSS configuration in different location of TX descriptor. TSO is enabled by default for controllers that use new descriptor format. For old controllers, TSO is still disabled by default due to broken frames under certain conditions but users can enable it. Special thanks to Hayes Wang at RealTek. MFC after: 2 weeks Notes: svn path=/head/; revision=217246
* Add flow control for all re(4) controllers. re(4) controllers doPyun YongHyeon2010-11-151-1/+1
| | | | | | | | | | not provide any MAC configuration interface for resolved flow control parameters. There is even no register that configures water mark which will control generation of pause frames. However enabling flow control surely enhanced performance a lot. Notes: svn path=/head/; revision=215329
* Only moderate TX completion interrupts. Relying on taskqueue toPyun YongHyeon2010-11-091-1/+1
| | | | | | | | suppress RX interrupts seems to give better RX performance than RX interrupt moderation. Notes: svn path=/head/; revision=215025
* Follow the lead of vendor's interrupt moderation mechanism.Pyun YongHyeon2010-11-081-0/+18
| | | | | | | | | | | | | | | | | It seems RTL8169/RTL8168/RTL810xE has a kind of interrupt moderation mechanism but it is not documented at all. The magic value dramatically reduced number of interrupts without noticeable performance drops so apply it to all RTL8169/RTL8169 controllers. Vendor's FreeBSD driver also applies it to RTL810xE controllers but their Linux driver explicitly cleared the register, so do not enable interrupt moderation for RTL810xE controllers. While I'm here sort 8169 specific registers. Obtained from: RealTek FreeBSD driver Notes: svn path=/head/; revision=215017
* Reduce spin wait time consumed in GMII register access routine.Pyun YongHyeon2010-11-081-4/+12
| | | | | | | | | | | | | | | There were a couple of attempts in the past to reduce it since it took more than 1ms. Because mii_tick() periodically polls link status, waiting more than 1ms for each GMII register access was overkill. Unfortunately all previous attempts were failed with various ways on different controllers. This time, add additional 20us dealy at the end of GMII register access which seems to requirement of all RealTek controllers to issue next GMII register access request. This is the same way what Linux does. Notes: svn path=/head/; revision=214992
* Add simple MAC statistics counter reading support. UnfortunatelyPyun YongHyeon2010-11-051-15/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | useful counters like rl_missed_pkts is 16 bits quantity which is too small to hold meaningful information happened in a second. This means driver should frequently read these counters in order not to lose accuracy and that approach is too inefficient in driver's view. Moreover it seems there is no way to trigger an interrupt to detect counter near-full or wraparound event as well as lacking clearing the MAC counters. Another limitation of reading the counters from RealTek controllers is lack of interrupt firing at the end of DMA cycle of MAC counter read request such that driver have to poll the end of the DMA which is a time consuming process as well as inefficient. The more severe issue of the MAC counter read request is it takes too long to complete the DMA. All these limitation made maintaining MAC counters in driver impractical. For now, just provide simple sysctl interface to trigger reading the MAC counters. These counters could be used to track down driver issues. Users can read MAC counters maintained in controller with the following command. #sysctl dev.re.0.stats=1 While I'm here add check for validity of dma map and allocated memory before unloading/freeing them. Tested by: rmacklem Notes: svn path=/head/; revision=214844
* style(9).Pyun YongHyeon2010-11-051-3/+3
| | | | Notes: svn path=/head/; revision=214842
* Remove extra white spaces.Pyun YongHyeon2010-11-051-3/+3
| | | | Notes: svn path=/head/; revision=214841
* Enable 64bit DMA addressing for RTL810xE/RTL8168/RTL8111 PCIePyun YongHyeon2010-11-051-2/+6
| | | | | | | | | controllers. Some old PCI controllers may work with DAC but it was known to be buggy so 64bit DMA addressing is used only on PCIe controllers. Notes: svn path=/head/; revision=214840
* Convert the PHY drivers to honor the mii_flags passed down and convertMarius Strobl2010-10-151-17/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari Notes: svn path=/head/; revision=213893
* Don't change PCIe maximum read request size to 2048 on RTL810xPyun YongHyeon2010-05-071-3/+5
| | | | | | | | | | | controllers. It caused device timeouts. Reported by: McLone < mclone <> gmail dot com > Tested by: McLone < mclone <> gmail dot com > MFC after: 5 days Notes: svn path=/head/; revision=207763
* Add preliminary support for 8168E/8111E PCIe controller.Pyun YongHyeon2010-04-091-2/+12
| | | | | | | | | | While I'm here simplify device description string. Tested by: Michael Beckmann < michael <> apfel dot de > MFC after: 5 days Notes: svn path=/head/; revision=206433
* Add TSO on VLANs. Because re(4) has a TSO limitation for jumboPyun YongHyeon2010-02-221-9/+17
| | | | | | | | | | | frame, make sure to update VLAN capabilities whenever jumbo frame is configured. While I'm here rearrange interface capabilities configuration. The controller requires VLAN hardware tagging to make TSO work on VLANs so explicitly check this requirement. Notes: svn path=/head/; revision=204219
* Increase PCIe maximuim read request size to 2048. Because re(4) usesPyun YongHyeon2010-02-211-0/+3
| | | | | | | | | | | Tx DMA burst size 2048, I beleive PCIe maximum read request size also should match to the value of Tx DMA burst size. With this change I can get more than 800Mbps for TCP bulk transfers. Previously I was not able to get more than 700Mbps. If I enable TSO it now shows 927Mbps. Notes: svn path=/head/; revision=204155
* Add initial support for RTL8103E PCIe fastethernet.Pyun YongHyeon2010-01-271-1/+8
| | | | | | | PR: kern/142974 Notes: svn path=/head/; revision=203082
* Move interface reinitialization down after disabling WOL in resumePyun YongHyeon2009-11-191-4/+5
| | | | | | | path. Notes: svn path=/head/; revision=199565
* Minimize interface reinitialization by checking IFF_DRV_RUNNINGPyun YongHyeon2009-11-191-4/+16
| | | | | | | | | | flag. This fixes unnecessary interface UP/DOWNs during getting an IP address via DHCP. Tested by: Warren Block ( wblock<> wonkity dot com ) Notes: svn path=/head/; revision=199564
* Add a check to know whether driver is still running afterPyun YongHyeon2009-11-021-0/+2
| | | | | | | | | | | | | | | | reacquiring driver lock in Rx handler. re(4) drops a driver lock before passing received frame to upper stack and reacquire the lock. During the time window ioctl calls could be executed and if the ioctl was interface down request, driver will stop the controller and free allocated mbufs. After that when driver comes back to Rx handler again it does not know what was happend so it could access free mbufs which in turn cause panic. Reported by: Norbert Papke < npapk <> acm dot org > Tested by: Norbert Papke < npapk <> acm dot org > Notes: svn path=/head/; revision=198814
* Add RTL8168DP/RTL8111DP device id. While I'm here append "8111D" toPyun YongHyeon2009-08-241-3/+5
| | | | | | | | | | | the description of RTL8168D as RL_HWREV_8168D can be either RTL8168D or RTL8111D. PR: kern/137672 MFC after: 3 days Notes: svn path=/head/; revision=196516
* Adding hardware ID for RTL810x PCIe found on HP Pavilion DV2-1022AX.Tai-hwa Liang2009-07-141-0/+2
| | | | | | | | Reviewed by: yongari Approved by: re (kib, kensmith) Notes: svn path=/head/; revision=195675
* Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/Robert Watson2009-06-261-2/+2
| | | | | | | | | | | | | | | | IF_ADDR_UNLOCK() across network device drivers when accessing the per-interface multicast address list, if_multiaddrs. This will allow us to change the locking strategy without affecting our driver programming interface or binary interface. For two wireless drivers, remove unnecessary locking, since they don't actually access the multicast address list. Approved by: re (kib) MFC after: 6 weeks Notes: svn path=/head/; revision=195049
* When user_frac in the polling subsystem is low it is going to busy theAttilio Rao2009-05-301-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | CPU for too long period than necessary. Additively, interfaces are kept polled (in the tick) even if no more packets are available. In order to avoid such situations a new generic mechanism can be implemented in proactive way, keeping track of the time spent on any packet and fragmenting the time for any tick, stopping the processing as soon as possible. In order to implement such mechanism, the polling handler needs to change, returning the number of packets processed. While the intended logic is not part of this patch, the polling KPI is broken by this commit, adding an int return value and the new flag IFCAP_POLLING_NOCOUNT (which will signal that the return value is meaningless for the installed handler and checking should be skipped). Bump __FreeBSD_version in order to signal such situation. Reviewed by: emaste Sponsored by: Sandvine Incorporated Notes: svn path=/head/; revision=193096
* For RTL8139C+ controllers, have controller handle padding shortPyun YongHyeon2009-04-201-4/+6
| | | | | | | | | | | | | | | | checksum offload frames. Software workaround used for broken controllers(RTL8169, RTL8168, RTL8168B) seem to cause watchdog timeouts on RTL8139C+. Introduce a new flag RL_FLAG_AUTOPAD to mark automatic padding feature of controller and set it for RTL8139C+ and controllers that use new descriptor format. This fixes watchdog timeouts seen on RTL8139C+. Reported by: Dimitri Rodis < DimitriR <> integritasystems dot com > Tested by: Dimitri Rodis < DimitriR <> integritasystems dot com > Notes: svn path=/head/; revision=191301
* Partial revert r185756.Pyun YongHyeon2009-03-311-0/+2
| | | | | | | | | | | | | It seems that RTL8168D and RTL8102EL requires additional settle time to complete RL_PHYAR register write. Accessing RL_PHYAR register right after the write causes errors for subsequent PHY register accesses. Tested by: george at luckytele dot com, Steve Wills < STEVE at stevenwills dot com > Notes: svn path=/head/; revision=190587
* remove now-redunant cardbus attachment lines.Warner Losh2009-03-091-1/+0
| | | | Notes: svn path=/head/; revision=189576
* Add a new tunable hw.re.prefer_iomap which disables memory registerPyun YongHyeon2009-03-091-13/+25
| | | | | | | | | | | | mapping. The tunable is OFF for all controllers except RTL8169SC family. RTL8169SC seems to require more magic to use memory register mapping. r187483 added a fix for RTL8169SCe controller but it does not looke like fix other variants of RTL8169SC. Tested by: Gavin Stone-Tolcher g.stone-tolcher <> its dot uq dot edu dot au Notes: svn path=/head/; revision=189555
* Allocating 2 MSI messages do not seem to work on certain controllersPyun YongHyeon2009-02-111-1/+2
| | | | | | | | | | so use just 1 MSI message. This fixes regression introduced in r188381. Tested by: many Notes: svn path=/head/; revision=188474
* Reclaim transmitted frames in re_tick(). This is for PCIePyun YongHyeon2009-02-091-1/+8
| | | | | | | | | controllers that lose Tx completion interrupts under certain conditions. With this change it's safe to use MSI on PCIe controllers so enable MSI on these controllers. Notes: svn path=/head/; revision=188381
* - Add support for 8110SCe part. Some magic registers were taken fromJung-uk Kim2009-01-201-19/+39
| | | | | | | | | | Linux driver. - Swap hardware revisions for 8110S and 8169S as Linux driver claims. Reviewed by: yongari (early version) Notes: svn path=/head/; revision=187483
* Retire RL_FLAG_INVMAR bit to match its comment and reality.Jung-uk Kim2009-01-201-11/+9
| | | | Notes: svn path=/head/; revision=187482
* - Do not read and write RX configuration register multiple times.Jung-uk Kim2009-01-201-66/+31
| | | | | | | | | | | | - Always program RX configuration register from scratch instead of doing read/modify/write. - Rename re_setmulti() to re_set_rxmode() to be reflect reality. - Simplify hash filter logic a little while I am here. Reviewed by: yongari (early version) Notes: svn path=/head/; revision=187481
* Sometimes RTL8168B seems to take long time to access GMII registersPyun YongHyeon2009-01-191-4/+4
| | | | | | | | | | | in device attach phase. Double GMII register access timeout value to fix the issue. Reported by: wkoszek Tested by: wkoszek Notes: svn path=/head/; revision=187417
* Since we don't request reset for rlphy(4), the link state 'UP'Pyun YongHyeon2008-12-221-0/+2
| | | | | | | | | | | | | event from mii(4) may not be delivered if valid link was already established. To address the issue, check current link state after driving MII_TICK. This should fix a regression introduced in r185753 on fast ethernet controllers. Reported by: csjp, Bruce Cran < bruce <> cran DOT org DOT uk > Tested by: csjp, Bruce Cran (initial version) Notes: svn path=/head/; revision=186389
* It seems that RealTek PCIe controllers require an explicit Tx pollPyun YongHyeon2008-12-171-10/+15
| | | | | | | | | | | | | | | | | | | | | | command whenever Tx completion interrupt is raised. The Tx poll bit is cleared when all packets waiting to be transferred have been processed. This means the second Tx poll command can be silently ignored as the Tx poll bit could be still active while processing of previous Tx poll command is in progress. To address the issue re(4) used to invoke the Tx poll command in Tx completion handler whenever it detects there are pending packets in TxQ. However that still does not seem to completely eliminate watchdog timeouts seen on RealTek PCIe controllers. To fix the issue kick Tx poll command only after Tx completion interrupt is raised as this would indicate Tx is now idle state such that it can accept new Tx poll command again. While here apply this workaround for PCIe based controllers as other controllers does not seem to have this limitation. Tested by: Victor Balada Diaz < victor <> bsdes DOT net > Notes: svn path=/head/; revision=186214
* For RTL8168C SPIN2 controllers, make sure to take the controllerPyun YongHyeon2008-12-171-1/+28
| | | | | | | | | | | out of sleep mode prior to accessing to PHY. This should fix device attach failure seen on these controllers. Also enable the sleep mode when device is put into sleep state. PR: kern/123123, kern/123053 Notes: svn path=/head/; revision=186210
* Make WOL work on RTL8168B. This controller seems to requirePyun YongHyeon2008-12-111-0/+5
| | | | | | | | | explicit command to enable Rx MAC prior to entering D3. Tested by: Cyrus Rahman <crahman <> gmail DOT com> Notes: svn path=/head/; revision=185903
* Don't access undocumented register 0x82 on controllers thatPyun YongHyeon2008-12-111-2/+14
| | | | | | | | | | have no such register. While here clear undocumented PHY register 0x0B for RTL8110S. Obtained from: RealTek FreeBSD driver Notes: svn path=/head/; revision=185901
* Newer RealTek controllers requires setting stop request bit toPyun YongHyeon2008-12-111-3/+9
| | | | | | | terminate active Tx/Rx operation. Notes: svn path=/head/; revision=185900
* Always put controller into known state before device intialization.Pyun YongHyeon2008-12-111-7/+5
| | | | | | | | While here remove re_reset calls invoked in system error case as controller reset is always done in device initialization. Notes: svn path=/head/; revision=185897
* Partly revert r185756. RTL8169SC doesn't like reduced delays inPyun YongHyeon2008-12-111-2/+2
| | | | | | | | | | | GMII access while Tx/Rx is in progress. Reported by: Jaakko Heinonen <jh <> saunalahti DOT fi>, Anton Yuzhaninov <citrin <> citrin DOT ru> Tested by: Jaakko Heinonen <jh <> saunalahti DOT fi> Notes: svn path=/head/; revision=185896
* Reduce spin wait time consumed in GMII register access routines.Pyun YongHyeon2008-12-081-4/+2
| | | | | | | | | | | Waiting for 1ms for each GMII register access looks overkill and it may also decrease overall performance of driver because re(4) invokes mii_tick for every hz. Tested by: rpaulo Notes: svn path=/head/; revision=185756
* o Implemented miibus_statchg handler. It detects whether re(4)Pyun YongHyeon2008-12-081-28/+51
| | | | | | | | | | | | | | | | | | | established a valid link or not. In miibus_statchg handler add a check for established link is valid one for the controller(e.g. 1000baseT is not a valid link for fastethernet controllers.) o Added a flag RE_FLAG_FASTETHER to mark fastethernet controllers. o Added additional check to know whether we've really encountered watchdog timeouts or missed Tx completion interrupts. This change may help to track down the cause of watchdog timeouts. o In interrupt handler, removed a check for link state change interrupt. Not all controllers have the bit and re(4) did not rely on the event for a long time. In addition, re(4) didn't request the interrupt in RL_IMR register. Tested by: rpaulo Notes: svn path=/head/; revision=185753
* Make sure to return the result of meida change request.Pyun YongHyeon2008-12-081-2/+3
| | | | | | | Previously it used to return success regardless of the result. Notes: svn path=/head/; revision=185752
* Add 8168D support.Pyun YongHyeon2008-12-021-1/+3
| | | | | | | Submitted by: Andrew < andrewwtulloch <> gmail DOT com > Notes: svn path=/head/; revision=185542
* Read ethernet address from ID registers for RTL8102E/RTL8102EL asPyun YongHyeon2008-09-061-1/+2
| | | | | | | | | | reading from EEPROM doesn't seem to work on these controllers. Reported by: Milan Obuch ( freebsd-net at dino dot sk ) Tested by: Milan Obuch ( freebsd-net at dino dot sk ) Notes: svn path=/head/; revision=182808
* Fix VLAN hardware tag insertion/stripping on big-endianPyun YongHyeon2008-08-131-2/+2
| | | | | | | | | | | architectures. Reported by: naddy Tested on: sparc64 MFC after: 1 week Notes: svn path=/head/; revision=181655
* Rearrange conditional compilation directives. This makes syntaxPyun YongHyeon2008-08-041-2/+3
| | | | | | | highlighting work in vim. Notes: svn path=/head/; revision=181275
* Remove return keyword at the end of functions that return void.Pyun YongHyeon2008-08-041-14/+0
| | | | Notes: svn path=/head/; revision=181274
* Remove register keyword.Pyun YongHyeon2008-08-041-4/+4
| | | | Notes: svn path=/head/; revision=181273