summaryrefslogtreecommitdiffstats
path: root/sys/dev/re
Commit message (Collapse)AuthorAgeFilesLines
* Add a new RTL8169 variant, 8169SB(L)/8110SB(L).yongari2008-07-021-1/+3
| | | | | Reported by: nork Tested by: nork
* Add basic support for RTL8168C, RTL8168CP, RTL8111C and RTL8111CP.yongari2008-07-021-43/+134
| | | | | | | | | | | | | | | | ATM Tx/Rx checksum offload is supported but TSO and jumbo frame is not yet supported. Because these newer controllers use different descriptor formats, a flag RL_FLAG_DESCV2 flag was introduced to handle that case in Tx/Rx handler. Also newer controllers seems to require to not touch 'enable Tx/Rx bit' in RL_CPLUS_CMD register so don't blindly try to set that bits. Note, it seems that there is still power-saving related issue where driver fails to attach PHY. Rebooting seems to fix that issue but number of required reboots varys. Many thanks to users that helped during developement. I really appreciate their patient and test/feedbacks.
* Display detected chip revision in device attach. This will help toyongari2008-07-021-2/+5
| | | | | diagnose revision specific issues in future. Also add 0x to notify that the revision number is in hex form.
* If MSI is not active make sure to disable MSI in EEPROM.yongari2008-07-021-0/+11
|
* In device detach don't access ifnet structure unless device isyongari2008-07-021-4/+4
| | | | | attached. This fixes NULL pointer dereference when polling(9) is active and unsupported hardware is detected in device attach.
* Toggling IFF_ALLMULTI flag does not require full interfaceyongari2008-07-021-1/+1
| | | | reintialization.
* Instead of allocating variables for each events/hardware flags, useyongari2008-07-021-47/+41
| | | | | | | | | a dedicated flag that represents controller capabilities/events. This will simplify many part of code that requires different workaround for each controller revisions and will enhance readability. While I'm here move PHY wakeup code up before mii_phy_probe() which seems to help to wake PHY in some cases.
* Switch to memory space register mapping over IO space. If thatyongari2008-07-021-21/+21
| | | | mapping fails fall back to traditional IO space access.
* While accessing EEPROM command register use pre-defined constantyongari2008-07-021-3/+3
| | | | instead of hardcoded value.
* After the change of r176757 re(4) no longer relys on readingyongari2008-07-021-32/+18
| | | | | | | | RL_TXCFG register to identify a device in device probe. Reflect the fact by modifing device description with general ethernet controller family. Note, rl_basetype in struct rl_type is not used and the more detailed information is provided with rl_hwrev structure.
* Remove duplicated H/W revision check.yongari2008-07-021-5/+0
|
* Don't touch MSI enable bit in RL_CFG2 register. For unknown reasonyongari2008-04-151-12/+6
| | | | | | | | clearing MSI enable bit for MSI capable hardwares resulted in Tx problems. MSI enable bit is set only when MSI is requested from user. Tested by: remko
* Padding more bytes than necessary one broke another variants ofyongari2008-03-311-1/+1
| | | | | | | | PCIe RealTek chips. Only pad IP packets if the payload is less than 28 bytes. Obtained from: NetBSD PR: kern/122221
* In revision 1.70, 1.71 and 1.84 re(4) tried to workaround checksumyongari2008-03-281-12/+14
| | | | | | | | | | | | | | | | | | offload bugs by manual padding for short IP/UDP frames. Unfortunately it seems that these workaround does not work reliably on newer PCIe variants of RealTek chips. To workaround the hardware bug, always pad short frames if Tx IP checksum offload is requested. It seems that the hardware has a bug in IP checksum offload handling. NetBSD manually pads short frames only when the length of IP frame is less than 28 bytes but I chose 60 bytes to safety. Also unconditionally set IP checksum offload bit in Tx descriptor if any TCP or UDP checksum offload is requested. This is the same way as Linux does but it's not mentioned in data sheet. Obtained from: NetBSD Tested by: remko, danger
* MSI handling on some RealTek chips are broken so disable it byyongari2008-03-231-1/+1
| | | | | | | default. Reported by: Giulio Ferro ( auryn AT zirakzigil DOT org ) Tested by: Giulio Ferro ( auryn AT zirakzigil DOT org )
* For MSI capable hardwares, enable MSI enable bit in RL_CFG2yongari2008-03-231-0/+13
| | | | | register. If MSI was disabled by hw.re.msi_disable tunable expliclty clear the MSI enable bit.
* Some RealTek chips are known to be buggy on DAC handling, soyongari2008-03-231-1/+6
| | | | disable DAC by default.
* VLAN hardware tag information should be set for all desciptors of ayongari2008-03-231-11/+13
| | | | | | | | | multi-descriptor transmission attempt. Datasheet said nothing about this requirements. This should fix a long-standing VLAN hardware tagging issues with re(4). Reported by: Giulio Ferro ( auryn AT zirakzigil DOT org ) Tested by: Giulio Ferro ( auryn AT zirakzigil DOT org )
* Always honor configured VLAN/checksum offload capabilities.yongari2008-03-231-3/+8
| | | | | | Previously re(4) used to blindly enable VLAN hardware tag stripping and Rx checksum offload regardless of enabled optional features of interface.
* Don't map memory/IO resource in device probe and just use PCIyongari2008-03-031-42/+33
| | | | | | vendor/revision/sub device id of the hardware to probe it. This is the same way as NetBSD does and it enhances readabilty a lot.
* Don't allow jumbo frame on 8139C+ controller.yongari2008-03-031-3/+11
| | | | While I'm here add a check for minimal MTU length.
* Implement WOL.yongari2008-03-031-0/+108
| | | | Tested by: Fabian Keil ( freebsd-listen AT fabienkeli DOT de )
* - Retire npe_defrag(), gem_defrag(), msk_defrag(), nfe_defrag(), andjhb2008-01-171-91/+1
| | | | | | re_defrag() and use m_collapse() instead. - Replace a reference to ath_defrag() in a comment in if_wpi.c with m_collapse().
* Fix build.yongari2008-01-151-1/+1
|
* Overhaul re(4).yongari2008-01-151-360/+484
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Increased number of Rx/Tx descriptors to 256 for 8169 GigEs because it's hard to push the hardware to the limit with default 64 descriptors. TSO requires large number of Tx descriptors to pass a full sized TCP segment(65535 bytes IP packet) to hardware. Previously it consumed 32 Tx descriptors, assuming MCLBYTES DMA segment size, to send the TCP segment which means re(4) couldn't queue more than two full sized IP packets. For 8139C+ it still uses 64 Rx/Tx descriptors due to its hardware limitations. With this changes there are (very) small waste of memory for 8139C+ users but I don't think it would affect 8139C+ users for most cases. o Various bus_dma(9) fixes. - The hardware supports DAC so allow 64bit DMA operations. - Removed BUS_DMA_ALLOC_NOW flag. - Increased DMA segment size to 4096 from MCLBYTES because TSO consumes too many descriptors with MCLBYTES DMA segment size. - Tx/Rx side bus_dmamap_load_mbuf_sg(9) support. With these changes the code is more readable than previous one and got a (slightly) better performance as it doesn't need to pass/ decode arguments to/from callback function. - Removed unnecessary callback function re_dmamap_desc() and nuked rl_dmaload_arg structure which was used in the callback. - Additional protection for DMA map load failure. In case of failure reuse current map instead of returning a bogus DMA map. - Deferred DMA map unloading/sync operation for maximum performance until we really need to load new DMA map. If we happen to reuse current map(e.g. input error) there is no need to sync/unload/load again. - The number of allowable Tx DMA segments for a mbuf chains are now 32 instead of magic nseg value. If the number of available Tx descriptors are short enough to send highly fragmented mbuf chains an optimized re_defrag() is called to collapse mbuf chains which is supposed to be much faster than m_defrag(9). re_defrag() was borrowed from ath(4). - Separated Rx/Tx DMA tag from a common DMA tag such that Rx DMA tag correctly uses DMA maps that were created with DMA alignment restriction(8bytes alignments). Tx DMA tag does not have such alignment limitation. - Added additional sanity checks for DMA ring map load failure. - Added additional spare Rx DMA map for graceful handling of Rx DMA map load failure. - Fixed misused bus_dmamap_sync(9) and added missing bus_dmamap_sync(9) in re_encap()/re_txeof()/re_rxeof(). o Enabled TSO again as re(4) have reasonable number of Tx descriptors. o Don't touch DMA address of a Tx descriptor in re_txeof(). It's not needed. o Fix incorrect update of if_ierrors counter. For Rx buffer shortage it should update if_qdrops as the buffer is reused. o Added checks for unsupported H/W revisions and return ENXIO for these hardwares. This is required to remove resource allocation code in re_probe as other drivers do in device probe routine. o Modified descriptor index manipulation macros as it's now possible to have different number of descriptors for Rx/Tx. o In re_start, to save a lock operation, use IFQ_DRV_IS_EMPTY before trying to invoke IFQ_DRV_DEQUEUE. Also don't blindly call re_encap since we already know the number of available Tx descriptors in advance. o Removed RL_TX_DESC_THLD which was used to reserve RL_TX_DESC_THLD descriptors in Tx path. There is no such a limitation mentioned in 8139C+/8169/8110/8168/8101/8111 datasheet and it seems to work ok without reserving RL_TX_DESC_THLD descriptors. o Fix a comment for RL_GTXSTART. The register is 8bits register. o Added comments for 8169/8139C+ hardware restrictions on descriptors. o Removed forward declaration for "struct rl_softc", it's not needed. o Added a new structure rl_txdesc for Tx descriptor managements and a structure rl_rxdesc for Rx descriptor managements. o Removed unused member variable rl_intlock in driver softc. There are still several unused member variables which are supposed to be used to access hardware statistics counters. But it seems that accessing hardware counters were not implemented yet.
* By definition promiscuous mode should see all unicast frames as wellyongari2007-12-201-2/+6
| | | | | | | | | as multicast/broadcast frames. Previously re(4) ignored multicast frames in promiscuous mode. The RTL8169 datasheet was not clear how it handles multicast frames in promiscuous mode. PR: kern/118572 MFC after: 3 days
* Add another RTL8168 revision 3 which is found on RTL8111-GR Gigabityongari2007-12-081-3/+13
| | | | | | | | | Ethernet Controller. Multicast filtering wasn't tested and needs more expore. While I'm here change complex if statements with switch statement which would improve readability. Reported by: Abdullah Ibn Hamad Al-Marri < wearabnet AT yahoo DOT ca > Tested by: Abdullah Ibn Hamad Al-Marri < wearabnet AT yahoo DOT ca >
* Always honor promiscuous flag prior to programming Rx multicastyongari2007-12-031-2/+6
| | | | | | | filter. This fixes a regression introduced in rev 1.89. PR: 114632 MFC after: 3 days
* Fix function prototype for device_shutdown method.yongari2007-11-221-2/+4
|
* Add support for D-Link DGE-528(T) Rev.B1remko2007-11-121-0/+2
| | | | | | | PR: 112774 Submitted by: Denis Fortin <fortin at acm dot org> Approved by: imp (mentor), yongari MFC After: 3 days
* Make sure to take PHY out of power down mode in device attach.yongari2007-08-141-0/+22
| | | | | | | | | | | | | | | | | Without this the PHY wouldn't work as expected. This should fix dual-boot Windows XP machine where RealTek Windows drivers put the PHY in power down mode during shutdown. The magic PHY register accesses come from RealTek driver. No datasheets mention the magic PHY registers. In general, the PHY wakeup code should go into PHY driver. However it seems that it only apply to RTL8169S single chip and it would be another hack if we have rgephy(4) check what parent driver/chip model is attached. Reported by: lofi, Laurens Timmermans ( laurens AT timkapel DOT nl ) Tested by: lofi Obtained from: RealTek FreeBSD driver Approved by: re (Ken Smith)
* Initialize the rl_vlanctl field of the descriptors to zero (in ordermarius2007-08-051-0/+1
| | | | | | | | | to clear RL_TDESC_VLANCTL_TAG). This fixes sending packets in the native VLAN when running both tagged and an untagged VLAN over the same trunk and descriptors are recycled. Approved by: re (kensmith) MFC after: 1 week
* style(9)yongari2007-07-271-2/+2
| | | | | Pointed out by: cnst Approved by: re (kensmith)
* Add MSI support.yongari2007-07-241-15/+80
| | | | | | | | | | | | Ever since switching to adaptive polling re(4) occasionally spews watchdog timeouts on systems with MSI capability. This change is minimal one for supporting MSI and re(4) also needs MSIX support for RTL8111C in future. Because softc structure of re(4) is shared with rl(4), rl(4) was touched to use the modified softc. Reported by: cnst Tested by: cnst Approved by: re (kensmith)
* re(4) devices requires an external EEPROM. Depending on models ityongari2007-07-061-2/+2
| | | | | | | | | | | | | | | | | | | would be 93C46(1Kbit) or 93C56(2Kbit). One of differences between them is number of address lines required to access the EEPROM. For example, 93C56 EEPROM needs 8 address lines to read/write data. If 93C56 recevied premature end of required number of serial clock(CLK) to set OP code/address of EEPROM, the result would be unexpected behavior. Previously it tried to detect 93C46, which requires 6 address lines, and then assumed it would be 93C56 if read data was not expected value. However, this approach didn't work in some models/situations as 93C56 requries 8 address lines to access its data. In order to fix it, change EEPROM probing order such that 93C56 is detected reliably. While I'm here change hard-coded address line numbers with defined constant to enhance readability. PR: 112710 Approved by: re (mux)
* Disable TSO support.yongari2007-06-161-2/+2
| | | | | | | Without bus_dma clean up and increment of number of Tx descriptors it's hard to guarantee correct Tx operation in TSO case. The TSO support would be enabled again when I get more feeback from re(4) patch posted to current.
* Don't reinitialize the hardware if only PROMISC flag was changed.yongari2007-04-181-4/+12
| | | | | | | | | | Previously whenever PROMISC mode turned on/off link renegotiation occurs and it could resulted in network unavailability for serveral seconds.(Depending on switch STP settings it could last several tens seconds.) Reported by: Prokofiev S.P. < proks AT logos DOT uptel DOT net > Tested by: Prokofiev S.P. < proks AT logos DOT uptel DOT net >
* Add support for the RTL8110SC driver.remko2007-03-281-0/+2
| | | | | | | | PR: 110804 Submitted by: Daan Vreeken Sponsored by: Vitsch Electronics (patch) Approved by: imp (mentor) MFC After: 3 days
* Catch up the rest of the drivers with the ether_vlan_mtap modifications.csjp2007-03-041-1/+1
| | | | | | | | | | If these drivers are setting M_VLANTAG because they are stripping the layer 2 802.1Q headers, then they need to be re-inserting them so any bpf(4) peers can properly decode them. It should be noted that this is compiled tested only. MFC after: 3 weeks
* Use taskqueue_drain() to wait for any pending tasks to complete ratherjhb2007-02-271-4/+2
| | | | than just pausing for a second.
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-231-6/+6
| | | | | | | | | | | | | 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@
* The TCP checksum offload handling in the 8111B/8168B and 8101E PCIe canwpaul2007-01-251-1/+6
| | | | | | | | | | | | | | | apparently be confused by short TCP segments that have been manually padded to the minimum ethernet frame size. The driver does short frame padding in software as a workaround for a bug in the 8169 PCI devices that causes short IP fragments to be corrupted due to an apparent conflict between the hardware autopadding and hardware IP checksumming. To fix this, we avoid software padding for short TCP segments, since the hardware seems to autopad and checksum these correctly (even the older 8169 NICs get these right). Short UDP packets appear to be handled correctly in all cases. This should work around the IP header checksum bug in the 8169 while not tripping the TCP checksum bug in the 8111B/8168B and 8101E.
* It seems that enabling Tx and Rx before setting descriptor DMAyongari2007-01-231-15/+17
| | | | | | | | | | | | | addresses shall access invalid descriptor DMA addresses on PCIe hardwares and then panicked the system. To fix it set descriptor DMA addresses before enabling Tx and Rx such that hardware can see valid descriptor DMA addresses. Also set RL_EARLY_TX_THRESH before starting Tx and Rx. Reported by: steve.tell AT crashmail DOT de Tested by: steve.tell AT crashmail DOT de Obtained from: NetBSD MFC after: 1 week
* o In re_newbuf() and re_encap() if re_dma_map_desc() aborts the mappingmarius2007-01-161-47/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | operation as it ran out of free descriptors or if there are too many segments in the first place, call bus_dmamap_unload() in order to unload the already loaded segments. For trying to map the defragmented mbuf (chain) in re_encap() this introduces re_dma_map_desc() setting arg.rl_maxsegs to 0 as a new failure mode. Previously we just ignored this case, corrupting our view of the TX ring. o In re_txeof(): - Don't clear IFF_DRV_OACTIVE unless there are at least 4 free TX descriptors. Further down the road re_encap() will bail if there aren't at least 4 free TX descriptors, causing re_start() to abort and prepend the dequeued mbuf again so it makes no sense to pretend we could process mbufs again when in fact we won't. While at it replace this magic 4 with a macro RL_TX_DESC_THLD throughout this driver. - Don't cancel the watchdog timeout as soon as there's at least one free TX descriptor but instead only if all descriptors have been handled. It's perfectly normal, especially in the DEVICE_POLLING case, that re_txeof() is called when only a part of the enqueued TX descriptors have been handled, causing the watchdog to be disarmed prematurely. o In re_encap(): - If m_defrag() fails just drop the packet like other NIC drivers do. This should only happen when there's a mbuf shortage, in which case it was possible to end up with an IFQ full of packets which couldn't be processed as they couldn't be defragmented as they were taking up all the mbufs themselves. This includes adjusting re_start() to not trying to prepend the mbuf (chain) if re_encap() has freed it. - Remove dupe initialization of members of struct rl_dmaload_arg to values that didn't change since trying to process the fragmented mbuf chain. While at it remove an unused member from struct rl_dmaload_arg. o In re_start() remove a abandoned, banal comment. The corresponding code was moved to re_attach() some time ago. With these changes re(4) now survives one day (until stopped) of hammering out packets here. Reviewed by: yongari MFC after: 2 weeks
* Fix re_setmulti() so that it works correctly for PCIe chips wherewpaul2007-01-111-2/+19
| | | | | the multicast hash table are in reverse order compared to older devices.
* - Use the re_tick() callout instead of if_slowtimo() for drivingmarius2006-12-201-35/+23
| | | | | | | | | re_watchdog() in order to avoid races accessing if_timer. - Use bus_get_dma_tag() so re(4) works on platforms requiring it. - Remove invalid BUS_DMA_ALLOCNOW when creating the parent DMA tag and the tags that are used for static memory allocations. - Don't bother to set if_mtu to ETHERMTU, ether_ifattach() does that. - Remove an unused variable in re_intr().
* Fix typo.yongari2006-11-211-1/+1
|
* Add TSO support.yongari2006-11-211-10/+24
| | | | Tested by: wilko, Pieter de Goeje < pieter AT degoeje DOT nl >
* o Correctly set IFCAP_VLAN_HWCSUM as re(4) can do VLAN tagging/checksumyongari2006-11-211-5/+17
| | | | | offloading in hardware. o Correctly set media header length for VLAN.
* Don't set RL_CFG1_FULLDUPLEX bit. The RL_CFG1_FULLDUPLEX bit inyongari2006-11-211-1/+1
| | | | config register 1 is only valid on 8129.
OpenPOWER on IntegriCloud