341477 |
04-Dec-2018 |
vmaffione |
MFC r339639
netmap: align codebase to the current upstream (sha 8374e1a7e6941)
Changelist: - Move large parts of VALE code to a new file and header netmap_bdg.[ch]. This is useful to reuse the code within upcoming projects. - Improvements and bug fixes to pipes and monitors. - Introduce nm_os_onattach(), nm_os_onenter() and nm_os_onexit() to handle differences between FreeBSD and Linux. - Introduce some new helper functions to handle more host rings and fake rings (netmap_all_rings(), netmap_real_rings(), ...) - Added new sysctl to enable/disable hw checksum in emulated netmap mode. - nm_inject: add support for NS_MOREFRAG
Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17364 |
331722 |
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re) |
330897 |
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg |
306309 |
25-Sep-2016 |
kevlo |
MFC r306102:
Add support for the TP-Link TG-3468 v2. This is an RTL8168 chip, which we already support so all we have to do is add the vendor ID.
PR: 212876 Submitted by: Tobias Kortkamp <t@tobik.me> |
302408 |
08-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
298307 |
19-Apr-2016 |
pfg |
sys/dev: use our nitems() macro when it is avaliable through param.h.
No functional change, only trivial cases are done in this sweep, Drivers that can get further enhancements will be done independently.
Discussed in: freebsd-current
|
296272 |
01-Mar-2016 |
jhb |
Remove taskqueue_enqueue_fast().
taskqueue_enqueue() was changed to support both fast and non-fast taskqueues 10 years ago in r154167. It has been a compat shim ever since. It's time for the compat shim to go.
Submitted by: Howard Su <howard0su@gmail.com> Reviewed by: sephe Differential Revision: https://reviews.freebsd.org/D5131
|
290946 |
16-Nov-2015 |
marius |
With r290566 in place it turned out that WOL previously only worked by accident with RTL8168G and later chips when the interface actually was brought up. This is due to the fact that with these MAC variants, RXDV gate needs be disabled for WOL to work. So do just that in re_setwol() when IFCAP_WOL is requested. Reported and tested by: dhw
MFC after: 3 days
|
290566 |
09-Nov-2015 |
marius |
- Although it doesn't make a whole lot of sense to enable RX and TX before their initial configuration is done, it turns out that r281337 has the inverse effect on some older chips. Moreover, as with newer chips before, two chips seemingly identical according to their MAC revisions may behave differently in this regard, with most working but a few not, making changes extremely hard to test. Closer inspection of the corresponding Linux code suggests that RX and TX should only be enabled after their initial configuration with RTL8168G and later chips, i. e. RTL8106E{,US}, RTL8107E, as well as RTL8168{EP,G,GU,H}, so limit the new code path to these. [1] - Distinguish between RTL8168H and RTL8107E, with the latter being the 10/100-Mbit/s-only variant of the former. - For MAC variants that can only do Fast Ethernet at a maximum, ensure that we don't advertise Gigabit Ethernet speed. - In re_stop(), do the inverse of re_init_locked() and enable RXDV gate on RTL8168G and later chips again, matching what Linux does.
PR: 203422 [1] MFC after: 1 week
|
287768 |
13-Sep-2015 |
marius |
Add preliminary support for RTL8168H, tested by Sreenath Battalahalli.
MFC after: 1 week
|
285349 |
10-Jul-2015 |
luigi |
Sync netmap sources with the version in our private tree. This commit contains large contributions from Giuseppe Lettieri and Stefano Garzarella, is partly supported by grants from Verisign and Cisco, and brings in the following:
- fix zerocopy monitor ports and introduce copying monitor ports (the latter are lower performance but give access to all traffic in parallel with the application)
- exclusive open mode, useful to implement solutions that recover from crashes of the main netmap client (suggested by Patrick Kelsey)
- revised memory allocator in preparation for the 'passthrough mode' (ptnetmap) recently presented at bsdcan. ptnetmap is described in S. Garzarella, G. Lettieri, L. Rizzo; Virtual device passthrough for high speed VM networking, ACM/IEEE ANCS 2015, Oakland (CA) May 2015 http://info.iet.unipi.it/~luigi/research.html
- fix rx CRC handing on ixl
- add module dependencies for netmap when building drivers as modules
- minor simplifications to device-specific routines (*txsync, *rxsync)
- general code cleanup (remove unused variables, introduce macros to access rings and remove duplicate code,
Applications do not need to be recompiled, unless of course they want to use the new features (monitors and exclusive open).
Those willing to try this code on stable/10 can just update the sys/dev/netmap/*, sys/net/netmap* with the version in HEAD and apply the small patches to individual device drivers.
MFC after: 1 month Sponsored by: (partly) Verisign, Cisco
|
281337 |
09-Apr-2015 |
marius |
Don't enable RX and TX before their initial configuration is done, i. e. after setting up interrupt moderation but before turning interrupts on. This matches what Realtek's r8168 Linux driver does as of version 8.039.00 and fixes problems with certain incarnations of certain MAC revisions like the interface requiring an extra up/down-cycle after boot to start working or DMA configuration not being adhered to.
PR: 193743, 197535 MFC after: 1 week
|
273359 |
21-Oct-2014 |
yongari |
It seems multicast filtering of RTL8168F does not work. Workaround the silicon bug by accepting any multicast packets.
PR: 193488 MFC After: 1 week
|
271864 |
19-Sep-2014 |
glebius |
Move rl(4) to dev/rl.
|
271849 |
19-Sep-2014 |
glebius |
Mechanically convert to if_inc_counter().
|
270856 |
30-Aug-2014 |
glebius |
Use define from if_var.h to access a field inside struct if_data, that resides in struct ifnet.
Sponsored by: Nginx, Inc.
|
267363 |
11-Jun-2014 |
jhb |
Fix various NIC drivers to properly cleanup static DMA resources. In particular, don't check the value of the bus_dma map against NULL to determine if either bus_dmamem_alloc() or bus_dmamap_load() succeeded. Instead, assume that bus_dmamap_load() succeeeded (and thus that bus_dmamap_unload() should be called) if the bus address for a resource is non-zero, and assume that bus_dmamem_alloc() succeeded (and thus that bus_dmamem_free() should be called) if the virtual address for a resource is not NULL.
In many cases these bugs could result in leaks when a driver was detached.
Reviewed by: yongari MFC after: 2 weeks
|
265943 |
13-May-2014 |
yongari |
Disable TX IP/TCP/UDP checksum offloading for RTL8168C/RTL8168CP. Previously only TX IP checksum offloading was disabled but it's reported that TX checksum offloading for UDP datagrams with IP options also generates corrupted frames. Reporter's controller is RTL8168CP but I guess RTL8168C also have the same issue since it shall share the same core.
Reported and tested by: tuexen
|
261531 |
05-Feb-2014 |
marius |
- Implement the RX EARLYOFF and RXDV GATED bits as done by RealTek's Linux driver as version 8.037.00 for RTL8168{E-VL,EP,F,G,GU} and RTL8111B. This makes reception of packets work with the RTL8168G (HW rev. 0x4c000000) in my Shuttle DS47. - Consistently use RL_MSI_MESSAGES. In joint forces with: yongari
MFC after: 5 days
|
257529 |
01-Nov-2013 |
luigi |
update to the latest netmap snapshot. This includes the following: - use separate memory regions for VALE ports - locking fixes - some simplifications in the NIC-specific routines - performance improvements for the VALE switch - some new features in the pkt-gen test program - documentation updates
There are small API changes that require programs to be recompiled (NETMAP_API has been bumped so you will detect old binaries at runtime).
In particular: - struct netmap_slot now is 16 bytes to support an extra pointer, which may save one data copy when using VALE ports or VMs; - the struct netmap_if has two extra fields;
MFC after: 3 days
|
257306 |
29-Oct-2013 |
yongari |
Add preliminary support for RTL8168EP.
Submitted by: Edward O'Callaghan (eocallaghan <> alterapraxis dot com)
|
257305 |
29-Oct-2013 |
yongari |
Add preliminary support for RTL8168G, RTL8168GU and RTL8411B. RTL8168GU has two variants(GMII and MII) but it uses the same chip revision id. Driver checks PCI device id of controller and sets internal capability flag(i.e. jumbo frame and link speed down in WOL).
H/W donated by: RealTek Semiconductor Corp.
|
257176 |
26-Oct-2013 |
glebius |
The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
256828 |
21-Oct-2013 |
yongari |
Add preliminary support for RTL8106E PCIe FastEthernet.
H/W donated by: RealTek Semiconductor Corp.
|
256827 |
21-Oct-2013 |
yongari |
Correct MAC revision bits. Previously it always cleared bit 20 and bit 21.
|
252341 |
28-Jun-2013 |
pluknet |
Correct comment typos.
|
250108 |
30-Apr-2013 |
luigi |
use netmap_rx_irq() / netmap_tx_irq() to handle interrupts in netmap mode, removing the logic from individual drivers.
(note: if_lem.c not updated yet due to some other pending modifications)
|
248227 |
13-Mar-2013 |
yongari |
Disable TX IP header checksum offloading on RL_HWREV_8168CP. The controller generates wrong checksummed frame if the IP packet has IP options.
Submitted by: Alexander Bluhm via brad@openbsd
|
243857 |
04-Dec-2012 |
glebius |
Mechanically substitute flags from historic mbuf allocator with malloc(9) flags in sys/dev.
|
242625 |
05-Nov-2012 |
dim |
Remove duplicate const specifiers in many drivers (I hope I got all of them, please let me know if not). Most of these are of the form:
static const struct bzzt_type { [...list of members...] } const bzzt_devs[] = { [...list of initializers...] };
The second const is unnecessary, as arrays cannot be modified anyway, and if the elements are const, the whole thing is const automatically (e.g. it is placed in .rodata).
I have verified this does not change the binary output of a full kernel build (except for build timestamps embedded in the object files).
Reviewed by: yongari, marius MFC after: 1 week
|
240693 |
19-Sep-2012 |
gavin |
Switch some PCI register reads from using magic numbers to using the names defined in pcireg.h
MFC after: 1 week
|
240680 |
18-Sep-2012 |
gavin |
Align the PCI Express #defines with the style used for the PCI-X #defines. This also has the advantage that it makes the names more compact, iand also allows us to correct the non-uniform naming of the PCIM_LINK_* defines, making them all consistent amongst themselves.
This is a mostly mechanical rename: s/PCIR_EXPRESS_/PCIER_/g s/PCIM_EXP_/PCIEM_/g s/PCIM_LINK_/PCIEM_LINK_/g
When this is MFC'd, #defines will be added for the old names to assist out-of-tree drivers.
Discussed with: jhb MFC after: 1 week
|
239234 |
13-Aug-2012 |
emaste |
Use array notation for consistency.
|
237547 |
25-Jun-2012 |
kevlo |
Fix size of the bcopy when extracting ethernet address
Obtained from: DragonFly
|
235262 |
11-May-2012 |
kevlo |
Make sure we don't dereference a null pointer
|
234643 |
24-Apr-2012 |
bz |
Do not toggle IFCAP_TSO4 if we would also do TSO6. Given the driver does not currently announce/support TSO6 that cannot happen. Clean it up anyway for consistency.
Reviewed by: yongari MFC after: 1 week
|
232246 |
28-Feb-2012 |
yongari |
Prefer RL_GMEDIASTAT register to RGEPHY_MII_SSR register to extract a link status of PHY when parent driver is re(4). RGEPHY_MII_SSR register does not seem to report correct PHY status on some integrated PHYs used with re(4). Unfortunately, RealTek PHYs have no additional information to differentiate integrated PHYs from external ones so relying on PHY model number is not enough to know that. However, it seems RGEPHY_MII_SSR register exists for external RealTek PHYs so checking parent driver would be good indication to know which PHY was used. In other words, for non-re(4) controllers, the PHY is external one and its revision number is greater than or equal to 2. This change fixes intermittent link UP/DOWN messages reported on RTL8169 controller.
Also, mii_attach(9) is tried after setting interface name since rgephy(4) have to know parent driver name.
PR: kern/165509
|
232238 |
27-Feb-2012 |
luigi |
A bunch of netmap fixes:
USERSPACE: 1. add support for devices with different number of rx and tx queues;
2. add better support for zero-copy operation, adding an extra field to the netmap ring to indicate how many buffers we have already processed but not yet released (with help from Eddie Kohler);
3. The two changes above unfortunately require an API change, so while at it add a version field and some spares to the ioctl() argument to help detect mismatches.
4. update the manual page for the two changes above;
5. update sample applications in tools/tools/netmap
KERNEL:
1. simplify the internal structures moving the global wait queues to the 'struct netmap_adapter';
2. simplify the functions that map kring<->nic ring indexes
3. normalize device-specific code, helps mainteinance;
4. start exploring the impact of micro-optimizations (prefetch etc.) in the ixgbe driver. Use 'legacy' descriptors on the tx ring and prefetch slots gives about 20% speedup at 900 MHz. Another 7-10% would come from removing the explict calls to bus_dmamap* in the core (they are effectively NOPs in this case, but it takes expensive load of the per-buffer dma maps to figure out that they are all NULL.
Rx performance not investigated.
I am postponing the MFC so i can import a few more improvements before merging.
|
232145 |
25-Feb-2012 |
yongari |
Use correct Config registers for RTL8139 family. Unlike RTL8168 and RTL810x family , RTL8139 has different register map for Config registers.
While here, follow the lead of re(4) in WOL configuration. - Disable WOL_UCAST and WOL_MCAST capabilities by default. - Config5 register write does not need to unlock EEPROM access on RTL8139 family but unlocking EEPROM access does not affect its operation and make it consistent with re(4).
Reported by: Matt Renzelmann mjr <> cs dot wisc dot edu
|
231622 |
14-Feb-2012 |
yongari |
For RTL8168/8111D controller, make sure to wake PHY from power down mode. Otherwise, PHY access times out under certain conditions.
|
230336 |
19-Jan-2012 |
yongari |
Fix a logic error which resulted in putting PHY into sleep when WOL is active. If WOL is active driver should not put PHY into sleep. This change makes WOL work on RTL8168E.
|
230276 |
17-Jan-2012 |
yongari |
Free allocated jumbo buffers when controller is stopped.
|
230275 |
17-Jan-2012 |
yongari |
Use a RX DMA tag to free loaded RX DMA maps. Previously it used a TX DMA tag.
|
228281 |
05-Dec-2011 |
luigi |
add netmap support for "em", "lem", "igb" and "re".
On my hardware, "em" in netmap mode does about 1.388 Mpps on one card (on an Asus motherboard), and 1.1 Mpps on another card (PCIe bus). Both seem to be NIC-limited, because i have the same rate even with the CPU running at 150 MHz.
On the "re" driver the tx throughput is around 420-450 Kpps on various (8111C and the like) chipsets. On the Rx side performance seems much better, and i can receive the full load generated by the "em" cards.
"igb" is untested as i don't have the hardware.
|
227916 |
23-Nov-2011 |
yongari |
To save more power, switch to 10/100Mbps link when controller is put into suspend/shutdown. Old PCI controllers performed that operation in firmware but for RTL8111C or newer controllers, it's responsibility of driver. It's not clear whether the firmware of RTL8111B still downgrades its speed to 10/100Mbps so leave it as it was.
|
227914 |
23-Nov-2011 |
yongari |
Make sure to stop TX MAC before freeing queued TX frames. For RTL8111DP, check if the TX MAC is active by reading RL_GTXSTART register. For RTL8402/8168E-VL/8168F/8411, wait until TX queue is empty.
|
227854 |
23-Nov-2011 |
yongari |
Disable accepting frames in re_stop() to put RX MAC into idle state. Because there is no reliable way to know whether RX MAC is in stopped state, rejecting all frames would be the only way to minimize possible races. Otherwise it's possible to receive frames while stop command execution is in progress and controller can DMA the frame to freed RX buffer during that period. This was observed on recent PCIe controllers(i.e. RTL8111F).
While this change may not be required on old controllers it wouldn't make negative effects on old controllers. One side effect of this change is disabling receive so driver reprograms RL_RXCFG to receive WOL frames when it is put into suspend or shutdown.
This should address occasional 'memory modified free' errors seen on recent RealTek controllers.
|
227851 |
22-Nov-2011 |
yongari |
Perform media change after setting IFF_DRV_RUNNING flag. Without it, driver would ignore the first link state update if controller already established a link such that it would have to take additional link state handling in re_tick().
|
227850 |
22-Nov-2011 |
yongari |
Writing access to RL_CFG5 register also requires EEPROM write access. While I'm here, enable WOL through magic packet but disable waking up system via unicast, multicast and broadcast frames. Otherwise, multicast or unicast frame(e.g. ICMP echo request) can wake up system which is not probably wanted behavior on most environments. This was not known as problem because RL_CFG5 register access had not effect until this change. The capability to wake up system with unicast/multicast frames are still set in driver, default off, so users who need that feature can still activate it with ifconfig(8).
|
227843 |
22-Nov-2011 |
marius |
- There's no need to overwrite the default device method with the default one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID.
|
227639 |
17-Nov-2011 |
yongari |
Add preliminary support for RTL8168/8111F PCIe Gigabit ethernet.
H/W donated by: RealTek Semiconductor Corp.
|
227638 |
17-Nov-2011 |
yongari |
Add preliminary support for second generation RTL8105E PCIe FastEthernet.
H/W donated by: RealTek Semiconductor Corp.
|
227593 |
16-Nov-2011 |
yongari |
Disable PCIe ASPM (Active State Power Management) for all controllers. More and more RealTek controllers started to implement EEE feature. Vendor driver seems to load a kind of firmware for EEE with additional PHY fixups. It is known that the EEE feature may need ASPM support. Unfortunately there is no documentation for EEE of the controller so enabling ASPM may cause more problems.
|
227591 |
16-Nov-2011 |
yongari |
Add missing driver lock in SIOCSIFCAP handler.
|
227590 |
16-Nov-2011 |
yongari |
Add preliminary support for RTL8411 PCIe Gigabit ethernet with integrated card reader.
H/W donated by: RealTek Semiconductor Corp.
|
227587 |
16-Nov-2011 |
yongari |
Add preliminary support for RTL8402 PCIe FastEthernet with integrated card reader.
H/W donated by: RealTek Semiconductor Corp.
|
227043 |
02-Nov-2011 |
marius |
Sprinkle some const.
|
226478 |
17-Oct-2011 |
yongari |
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)
|
224506 |
30-Jul-2011 |
yongari |
Add new device id of D-Link DGE-530T Rev. C controller. DGE-503T Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C controller is re-branded RealTek 8169 controller.
PR: kern/159116 Approved by: re (kib)
|
219902 |
23-Mar-2011 |
jhb |
Do a sweep of the tree replacing calls to pci_find_extcap() with calls to pci_find_cap() instead.
|
218760 |
16-Feb-2011 |
yongari |
Add initial support for RTL8401E PCIe Fast Ethernet.
PR: 154789
|
218289 |
04-Feb-2011 |
yongari |
Disable TX IP checksum offloading for RTL8168C controllers. The controller in question generates frames with bad IP checksum value if packets contain IP options. For instance, packets generated by ping(8) with record route option have wrong IP checksum value. The controller correctly computes checksum for normal TCP/UDP packets though. There are two known RTL8168/8111C variants in market and the issue I observed happened on RL_HWREV_8168C_SPIN2. I'm not sure RL_HWREV_8168C also has the same issue but it would be better to assume it has the same issue since they shall share same core. RTL8102E which is supposed to be released at the time of RTL8168/8111C announcement does not have the issue.
Tested by: Konstantin V. Krotov ( kkv <> insysnet dot ru )
|
217911 |
26-Jan-2011 |
yongari |
Add support for RTL8105E PCIe Fast Ethernet controller. It seems the controller has a kind of embedded controller/memory and vendor applies a large set of magic code via undocumented PHY registers in device initialization stage. I guess it's a firmware image for the embedded controller in RTL8105E since the code is too big compared to other DSP fixups. However I have no idea what that magic code does and what's purpose of the embedded controller. Fortunately driver seems to still work without loading the firmware.
While I'm here change device description of RTL810xE controller.
H/W donated by: Realtek Semiconductor Corp.
|
217902 |
26-Jan-2011 |
yongari |
Do not use interrupt taskqueue on controllers with MSI/MSI-X capability. One of reason using interrupt taskqueue in re(4) was to reduce number of TX/RX interrupts under load because re(4) controllers have no good TX/RX interrupt moderation mechanism. Basic TX interrupt moderation is done by hardware for most controllers but RX interrupt moderation through undocumented register showed poor RX performance so it was disabled in r215025. Using taskqueue to handle RX interrupt greatly reduced number of interrupts but re(4) consumed all available CPU cycles to run the taskqueue under high TX/RX network load. This can happen even with RTL810x fast ethernet controller and I believe this is not acceptable for most systems.
To mitigate the issue, use one-shot timer register to moderate RX interrupts. The timer register provides programmable one-shot timer and can be used to suppress interrupt generation. The timer runs at 125MHZ on PCIe controllers so the minimum time allowed for the timer is 8ns. Data sheet says the register is 32 bits but experimentation shows only lower 13 bits are valid so maximum time that can be programmed is 65.528us. This yields theoretical maximum number of RX interrupts that could be generated per second is about 15260. Combined with TX completion interrupts re(4) shall generate less than 20k interrupts. This number is still slightly high compared to other intelligent ethernet controllers but system is very responsive even under high network load.
Introduce sysctl variable dev.re.%d.int_rx_mod that controls amount of time to delay RX interrupt processing in units of us. Value 0 completely disables RX interrupt moderation. To provide old behavior for controllers that have MSI/MSI-X capability, introduce a new tunable hw.re.intr_filter. If the tunable is set to non-zero value, driver will use interrupt taskqueue. The default value of the tunable is 0. This tunable has no effect on controllers that has no MSI/MSI-X capability or if MSI/MSI-X is explicitly disabled by administrator.
While I'm here cleanup interrupt setup/teardown since re(4) uses single MSI/MSI-X message at this moment.
|
217868 |
25-Jan-2011 |
yongari |
Remove TX taskqueue and directly invoke re_start in interrupt task.
|
217857 |
25-Jan-2011 |
yongari |
Prefer MSI-X to MSI on controllers that support MSI-X. All recent PCIe controllers(RTL8102E or later and RTL8168/8111C or later) supports either 2 or 4 MSI-X messages. Unfortunately vendor did not publicly release RSS related information yet. However switching to MSI-X is one-step forward to support RSS.
|
217832 |
25-Jan-2011 |
yongari |
Disable TSO for all Realtek controllers. Experimentation showed RTL8111C generated corrupted frames where TCP option header was broken. All other sample controllers I have did not show such problem so it could be RTL8111C specific issue. Because there are too many variants it's hard to tell how many controllers have such issue. Just disable TSO by default but have user override it.
|
217766 |
24-Jan-2011 |
yongari |
Apply TX interrupt moderation to all RTL810xE PCIe Fast Ethernet controllers. Experimentation with RTL8102E, RTL8103E and RTL8105E showed dramatic decrement of TX completion interrupts under high TX load(e.g. from 147k interrupts/second to 10k interrupts/second) With this change, TX interrupt moderation is applied to all controllers except RTL8139C+.
|
217524 |
18-Jan-2011 |
yongari |
Change model names of controller RTL_HWREV_8168_SPIN[123] to real ones. s/RL_HWREV_8168_SPIN1/RL_HWREV_8168B_SPIN1/g s/RL_HWREV_8168_SPIN2/RL_HWREV_8168B_SPIN2/g s/RL_HWREV_8168_SPIN3/RL_HWREV_8168B_SPIN3/g No functional changes.
|
217499 |
17-Jan-2011 |
yongari |
Implement initial jumbo frame support for RTL8168/8111 C/D/E PCIe GbE controllers. It seems these controllers no longer support multi-fragmented RX buffers such that driver have to allocate physically contiguous buffers.
o Retire RL_FLAG_NOJUMBO flag and introduce RL_FLAG_JUMBOV2 to mark controllers that use new jumbo frame scheme. o Configure PCIe max read request size to 4096 for standard frames and reduce it to 512 for jumbo frames. o TSO/checksum offloading is not supported for jumbo frames on these controllers. Reflect it to ioctl handler and driver initialization. o Remove unused rl_stats_no_timeout in softc. o Embed a pointer to structure rl_hwrev into softc to keep track of controller MTU limitation and remove rl_hwrev in softc since that information is available through a pointer to structure rl_hwrev.
Special thanks to Realtek for donating sample hardwares which made this possible.
H/W donated by: Realtek Semiconductor Corp.
|
217498 |
17-Jan-2011 |
yongari |
Add initial support for RTL8168E/8111E-VL PCIe GbE.
H/W donated by: Realtek Semiconductor Corp.
|
217385 |
13-Jan-2011 |
yongari |
If driver is not able to allocate RX buffer, do not start driver. While I'm here move RX buffer allocation and descriptor initialization up to not touch hardware registers in case of RX buffer allocation failure.
|
217384 |
13-Jan-2011 |
yongari |
Make sure to check validity of dma maps before destroying.
|
217382 |
13-Jan-2011 |
yongari |
re_reset() should be called only after setting device specific features.
|
217381 |
13-Jan-2011 |
yongari |
Allow TX/RX checksum offloading to be configured independently.
|
217296 |
12-Jan-2011 |
yongari |
For re(4) controllers that uses new jumbo frame scheme(RTL8168C/D/E), limit maximum RX buffer size to RE_RX_DESC_BUFLEN instead of blindly configuring it to 16KB. Due to lack of documentation, re(4) didn't allow jumbo frame on these controllers. However it seems controller is confused with jumbo frame such that it can DMA the received frame to wrong address instead of splitting it into multiple RX buffers. Of course, this caused panic.
Since re(4) does not support jumbo frames on these controllers, make controller drop frame that is longer than RE_RX_DESC_BUFLEN sized frame. Fortunately RTL810x controllers, which do not support jumbo frame, have no such issues but this change also limited maximum RX buffer size allowed to RTL810x controllers. Allowing 16KB RX buffer for controllers that have no such capability is meaningless.
MFC after: 3 days
|
217247 |
10-Jan-2011 |
yongari |
When driver is not running, do not send DUMP command to controller 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.
|
217246 |
10-Jan-2011 |
yongari |
Implement TSO on RealTek RTL8168/8111 C or later controllers. 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
|
215329 |
15-Nov-2010 |
yongari |
Add flow control for all re(4) controllers. re(4) controllers do 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.
|
215025 |
09-Nov-2010 |
yongari |
Only moderate TX completion interrupts. Relying on taskqueue to suppress RX interrupts seems to give better RX performance than RX interrupt moderation.
|
215017 |
08-Nov-2010 |
yongari |
Follow the lead of vendor's interrupt moderation mechanism. 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
|
214992 |
08-Nov-2010 |
yongari |
Reduce spin wait time consumed in GMII register access routine. 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.
|
214844 |
05-Nov-2010 |
yongari |
Add simple MAC statistics counter reading support. Unfortunately 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
|
214842 |
05-Nov-2010 |
yongari |
style(9).
|
214841 |
05-Nov-2010 |
yongari |
Remove extra white spaces.
|
214840 |
05-Nov-2010 |
yongari |
Enable 64bit DMA addressing for RTL810xE/RTL8168/RTL8111 PCIe 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.
|
213893 |
15-Oct-2010 |
marius |
Convert the PHY drivers to honor the mii_flags passed down and convert 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
|
207763 |
07-May-2010 |
yongari |
Don't change PCIe maximum read request size to 2048 on RTL810x controllers. It caused device timeouts.
Reported by: McLone < mclone <> gmail dot com > Tested by: McLone < mclone <> gmail dot com > MFC after: 5 days
|
206433 |
09-Apr-2010 |
yongari |
Add preliminary support for 8168E/8111E PCIe controller. While I'm here simplify device description string.
Tested by: Michael Beckmann < michael <> apfel dot de > MFC after: 5 days
|
204219 |
22-Feb-2010 |
yongari |
Add TSO on VLANs. Because re(4) has a TSO limitation for jumbo 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.
|
204155 |
21-Feb-2010 |
yongari |
Increase PCIe maximuim read request size to 2048. Because re(4) uses 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.
|
203082 |
27-Jan-2010 |
yongari |
Add initial support for RTL8103E PCIe fastethernet.
PR: kern/142974
|
199565 |
19-Nov-2009 |
yongari |
Move interface reinitialization down after disabling WOL in resume path.
|
199564 |
19-Nov-2009 |
yongari |
Minimize interface reinitialization by checking IFF_DRV_RUNNING flag. This fixes unnecessary interface UP/DOWNs during getting an IP address via DHCP.
Tested by: Warren Block ( wblock<> wonkity dot com )
|
198814 |
02-Nov-2009 |
yongari |
Add a check to know whether driver is still running after 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 >
|
196516 |
24-Aug-2009 |
yongari |
Add RTL8168DP/RTL8111DP device id. While I'm here append "8111D" to the description of RTL8168D as RL_HWREV_8168D can be either RTL8168D or RTL8111D.
PR: kern/137672 MFC after: 3 days
|
195675 |
14-Jul-2009 |
avatar |
Adding hardware ID for RTL810x PCIe found on HP Pavilion DV2-1022AX.
Reviewed by: yongari Approved by: re (kib, kensmith)
|
195049 |
26-Jun-2009 |
rwatson |
Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/ 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
|
193096 |
30-May-2009 |
attilio |
When user_frac in the polling subsystem is low it is going to busy the 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
|
191301 |
20-Apr-2009 |
yongari |
For RTL8139C+ controllers, have controller handle padding short 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 >
|
190587 |
31-Mar-2009 |
yongari |
Partial revert r185756. 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 >
|
189576 |
09-Mar-2009 |
imp |
remove now-redunant cardbus attachment lines.
|
189555 |
09-Mar-2009 |
yongari |
Add a new tunable hw.re.prefer_iomap which disables memory register 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
|
188474 |
11-Feb-2009 |
yongari |
Allocating 2 MSI messages do not seem to work on certain controllers so use just 1 MSI message. This fixes regression introduced in r188381.
Tested by: many
|
188381 |
09-Feb-2009 |
yongari |
Reclaim transmitted frames in re_tick(). This is for PCIe 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.
|
187483 |
20-Jan-2009 |
jkim |
- Add support for 8110SCe part. Some magic registers were taken from Linux driver. - Swap hardware revisions for 8110S and 8169S as Linux driver claims.
Reviewed by: yongari (early version)
|
187482 |
20-Jan-2009 |
jkim |
Retire RL_FLAG_INVMAR bit to match its comment and reality.
|
187481 |
20-Jan-2009 |
jkim |
- Do not read and write RX configuration register multiple times. - 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)
|
187417 |
19-Jan-2009 |
yongari |
Sometimes RTL8168B seems to take long time to access GMII registers in device attach phase. Double GMII register access timeout value to fix the issue.
Reported by: wkoszek Tested by: wkoszek
|
186389 |
22-Dec-2008 |
yongari |
Since we don't request reset for rlphy(4), the link state 'UP' 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)
|
186214 |
17-Dec-2008 |
yongari |
It seems that RealTek PCIe controllers require an explicit Tx poll 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 >
|
186210 |
17-Dec-2008 |
yongari |
For RTL8168C SPIN2 controllers, make sure to take the controller 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
|
185903 |
11-Dec-2008 |
yongari |
Make WOL work on RTL8168B. This controller seems to require explicit command to enable Rx MAC prior to entering D3.
Tested by: Cyrus Rahman <crahman <> gmail DOT com>
|
185901 |
11-Dec-2008 |
yongari |
Don't access undocumented register 0x82 on controllers that have no such register. While here clear undocumented PHY register 0x0B for RTL8110S.
Obtained from: RealTek FreeBSD driver
|
185900 |
11-Dec-2008 |
yongari |
Newer RealTek controllers requires setting stop request bit to terminate active Tx/Rx operation.
|
185897 |
11-Dec-2008 |
yongari |
Always put controller into known state before device intialization. While here remove re_reset calls invoked in system error case as controller reset is always done in device initialization.
|
185896 |
11-Dec-2008 |
yongari |
Partly revert r185756. RTL8169SC doesn't like reduced delays in 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>
|
185756 |
08-Dec-2008 |
yongari |
Reduce spin wait time consumed in GMII register access routines. 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
|
185753 |
08-Dec-2008 |
yongari |
o Implemented miibus_statchg handler. It detects whether re(4) 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
|
185752 |
08-Dec-2008 |
yongari |
Make sure to return the result of meida change request. Previously it used to return success regardless of the result.
|
185542 |
02-Dec-2008 |
yongari |
Add 8168D support.
Submitted by: Andrew < andrewwtulloch <> gmail DOT com >
|
182808 |
06-Sep-2008 |
yongari |
Read ethernet address from ID registers for RTL8102E/RTL8102EL as 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 )
|
181655 |
13-Aug-2008 |
yongari |
Fix VLAN hardware tag insertion/stripping on big-endian architectures.
Reported by: naddy Tested on: sparc64 MFC after: 1 week
|
181275 |
04-Aug-2008 |
yongari |
Rearrange conditional compilation directives. This makes syntax highlighting work in vim.
|
181274 |
04-Aug-2008 |
yongari |
Remove return keyword at the end of functions that return void.
|
181273 |
04-Aug-2008 |
yongari |
Remove register keyword.
|
181272 |
04-Aug-2008 |
yongari |
Use ANSI C declarations for all functions.
|
181271 |
04-Aug-2008 |
yongari |
Don't enable TSO by default. Users of RTL8169/8110 reported watchdog timeout issues and the root cause seems to stem from silicon bug of controller. Personally I couldn't reproduce it on RTL8169 controller but it seems it's dependent on usage pattern. For newer PCIe based controllers I have no TSO complaints but turning off TSO would be more safe. Users who are sure that their controller works with TSO can still reenable the TSO with ifconfig(8).
Reported by: Oliver Lehmann (lehmann at ans-netz dot de), Eugene Butusov (ebutusov at gmail dot com)
|
181270 |
04-Aug-2008 |
yongari |
The number of bits reserved for MSS in RealTek controllers is 11bits. This limits the maximum interface MTU size in TSO case as upper stack should not generate TCP segments with MSS greater than the limit. Armed with this information, disable TSO if interface MTU is greater than the limit.
|
180377 |
09-Jul-2008 |
yongari |
Add driver support for RTL8102E and RTL8102EL which is the second generation of RTL810x PCIe fast ethernet controller. Note, Tx/Rx descriptor format is different from that of first generation of RTL8101E series. Jumbo frame is not supported for RTL810x family.
Tested by: NAGATA Shinya ( maya AT negeta DOT com )
|
180376 |
09-Jul-2008 |
yongari |
Disable jumbo frame support for RTL810x fast ethernet controllers.
|
180177 |
02-Jul-2008 |
yongari |
Add a new RTL8169 variant, 8169SB(L)/8110SB(L).
Reported by: nork Tested by: nork
|
180176 |
02-Jul-2008 |
yongari |
Add basic support for RTL8168C, RTL8168CP, RTL8111C and RTL8111CP. 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.
|
180175 |
02-Jul-2008 |
yongari |
Display detected chip revision in device attach. This will help to diagnose revision specific issues in future. Also add 0x to notify that the revision number is in hex form.
|
180174 |
02-Jul-2008 |
yongari |
If MSI is not active make sure to disable MSI in EEPROM.
|
180173 |
02-Jul-2008 |
yongari |
In device detach don't access ifnet structure unless device is attached. This fixes NULL pointer dereference when polling(9) is active and unsupported hardware is detected in device attach.
|
180172 |
02-Jul-2008 |
yongari |
Toggling IFF_ALLMULTI flag does not require full interface reintialization.
|
180171 |
02-Jul-2008 |
yongari |
Instead of allocating variables for each events/hardware flags, use 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.
|
180169 |
02-Jul-2008 |
yongari |
Switch to memory space register mapping over IO space. If that mapping fails fall back to traditional IO space access.
|
180168 |
02-Jul-2008 |
yongari |
While accessing EEPROM command register use pre-defined constant instead of hardcoded value.
|
180167 |
02-Jul-2008 |
yongari |
After the change of r176757 re(4) no longer relys on reading 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.
|
180166 |
02-Jul-2008 |
yongari |
Remove duplicated H/W revision check.
|
178207 |
15-Apr-2008 |
yongari |
Don't touch MSI enable bit in RL_CFG2 register. For unknown reason 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
|
177771 |
31-Mar-2008 |
yongari |
Padding more bytes than necessary one broke another variants of PCIe RealTek chips. Only pad IP packets if the payload is less than 28 bytes.
Obtained from: NetBSD PR: kern/122221
|
177678 |
28-Mar-2008 |
yongari |
In revision 1.70, 1.71 and 1.84 re(4) tried to workaround checksum 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
|
177523 |
23-Mar-2008 |
yongari |
MSI handling on some RealTek chips are broken so disable it by default.
Reported by: Giulio Ferro ( auryn AT zirakzigil DOT org ) Tested by: Giulio Ferro ( auryn AT zirakzigil DOT org )
|
177522 |
23-Mar-2008 |
yongari |
For MSI capable hardwares, enable MSI enable bit in RL_CFG2 register. If MSI was disabled by hw.re.msi_disable tunable expliclty clear the MSI enable bit.
|
177521 |
23-Mar-2008 |
yongari |
Some RealTek chips are known to be buggy on DAC handling, so disable DAC by default.
|
177520 |
23-Mar-2008 |
yongari |
VLAN hardware tag information should be set for all desciptors of a 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 )
|
177519 |
23-Mar-2008 |
yongari |
Always honor configured VLAN/checksum offload capabilities. Previously re(4) used to blindly enable VLAN hardware tag stripping and Rx checksum offload regardless of enabled optional features of interface.
|
176757 |
03-Mar-2008 |
yongari |
Don't map memory/IO resource in device probe and just use PCI 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.
|
176756 |
03-Mar-2008 |
yongari |
Don't allow jumbo frame on 8139C+ controller. While I'm here add a check for minimal MTU length.
|
176754 |
03-Mar-2008 |
yongari |
Implement WOL.
Tested by: Fabian Keil ( freebsd-listen AT fabienkeli DOT de )
|
175418 |
17-Jan-2008 |
jhb |
- Retire npe_defrag(), gem_defrag(), msk_defrag(), nfe_defrag(), and re_defrag() and use m_collapse() instead. - Replace a reference to ath_defrag() in a comment in if_wpi.c with m_collapse().
|
175341 |
15-Jan-2008 |
yongari |
Fix build.
|
175337 |
15-Jan-2008 |
yongari |
Overhaul re(4). 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.
|
174809 |
20-Dec-2007 |
yongari |
By definition promiscuous mode should see all unicast frames as well 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
|
174428 |
08-Dec-2007 |
yongari |
Add another RTL8168 revision 3 which is found on RTL8111-GR Gigabit 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 >
|
174203 |
03-Dec-2007 |
yongari |
Always honor promiscuous flag prior to programming Rx multicast filter. This fixes a regression introduced in rev 1.89.
PR: 114632 MFC after: 3 days
|
173839 |
22-Nov-2007 |
yongari |
Fix function prototype for device_shutdown method.
|
173565 |
12-Nov-2007 |
remko |
Add support for D-Link DGE-528(T) Rev.B1
PR: 112774 Submitted by: Denis Fortin <fortin at acm dot org> Approved by: imp (mentor), yongari MFC After: 3 days
|
171824 |
14-Aug-2007 |
yongari |
Make sure to take PHY out of power down mode in device attach. 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)
|
171728 |
05-Aug-2007 |
marius |
Initialize the rl_vlanctl field of the descriptors to zero (in order 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
|
171604 |
27-Jul-2007 |
yongari |
style(9)
Pointed out by: cnst Approved by: re (kensmith)
|
171560 |
24-Jul-2007 |
yongari |
Add MSI support. 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)
|
171263 |
06-Jul-2007 |
yongari |
re(4) devices requires an external EEPROM. Depending on models it 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)
|
170813 |
16-Jun-2007 |
yongari |
Disable TSO support. 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.
|
168828 |
18-Apr-2007 |
yongari |
Don't reinitialize the hardware if only PROMISC flag was changed. 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 >
|
167997 |
28-Mar-2007 |
remko |
Add support for the RTL8110SC driver.
PR: 110804 Submitted by: Daan Vreeken Sponsored by: Vitsch Electronics (patch) Approved by: imp (mentor) MFC After: 3 days
|
167190 |
04-Mar-2007 |
csjp |
Catch up the rest of the drivers with the ether_vlan_mtap modifications. 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
|
167088 |
27-Feb-2007 |
jhb |
Use taskqueue_drain() to wait for any pending tasks to complete rather than just pausing for a second.
|
166901 |
23-Feb-2007 |
piso |
o break newbus api: add a new argument of type driver_filter_t to 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@
|
166223 |
25-Jan-2007 |
wpaul |
The TCP checksum offload handling in the 8111B/8168B and 8101E PCIe can 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.
|
166178 |
23-Jan-2007 |
yongari |
It seems that enabling Tx and Rx before setting descriptor DMA 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
|
166057 |
16-Jan-2007 |
marius |
o In re_newbuf() and re_encap() if re_dma_map_desc() aborts the mapping 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
|
165957 |
11-Jan-2007 |
wpaul |
Fix re_setmulti() so that it works correctly for PCIe chips where the multicast hash table are in reverse order compared to older devices.
|
165366 |
20-Dec-2006 |
marius |
- Use the re_tick() callout instead of if_slowtimo() for driving 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().
|
164465 |
21-Nov-2006 |
yongari |
Fix typo.
|
164463 |
21-Nov-2006 |
yongari |
Add TSO support.
Tested by: wilko, Pieter de Goeje < pieter AT degoeje DOT nl >
|
164462 |
21-Nov-2006 |
yongari |
o Correctly set IFCAP_VLAN_HWCSUM as re(4) can do VLAN tagging/checksum offloading in hardware. o Correctly set media header length for VLAN.
|
164461 |
21-Nov-2006 |
yongari |
Don't set RL_CFG1_FULLDUPLEX bit. The RL_CFG1_FULLDUPLEX bit in config register 1 is only valid on 8129.
|
162375 |
17-Sep-2006 |
andre |
Move ethernet VLAN tags from mtags to its own mbuf packet header field m_pkthdr.ether_vlan. The presence of the M_VLANTAG flag on the mbuf signifies the presence and validity of its content.
Drivers that support hardware VLAN tag stripping fill in the received VLAN tag (containing both vlan and priority information) into the ether_vtag mbuf packet header field:
m->m_pkthdr.ether_vtag = vlan_id; /* ntohs()? */ m->m_flags |= M_VLANTAG;
to mark the packet m with the specified VLAN tag.
On output the driver should check the mbuf for the M_VLANTAG flag to see if a VLAN tag is present and valid:
if (m->m_flags & M_VLANTAG) { ... = m->m_pkthdr.ether_vtag; /* htons()? */ ... pass tag to hardware ... }
VLAN tags are stored in host byte order. Byte swapping may be necessary.
(Note: This driver conversion was mechanic and did not add or remove any byte swapping in the drivers.)
Remove zone_mtag_vlan UMA zone and MTAG_VLAN definition. No more tag memory allocation have to be done.
Reviewed by: thompsa, yar Sponsored by: TCP/IP Optimization Fundraise 2005
|
162321 |
15-Sep-2006 |
glebius |
- Consistently use if_printf() only in interface methods: if_start(), if_watchdog, etc., or in functions used only in these methods. In all other functions in the driver use device_printf(). - Use __func__ instead of typing function name.
Submitted by: Alex Lyashkov <umka sevcity.net>
|
162138 |
08-Sep-2006 |
yongari |
Make 8139C+ work again which was broken since rev 1.68. Ever since rev 1.68 re(4) checks the validity of link in re_start. But rlphy(4) got a garbled data due to a different bit layout used on 8139C+ and it couldn't report correct link state. To fix it, ignore BMCR_LOOP and BMCR_ISO bits which have different meanings on 8139C+. I think this also make dhclient(8) work on 8139C+.
Reported by: Gerrit Kuehn <gerrit AT pmp DOT uni-hannover DOT de> Tested by: Gerrit Kuehn <gerrit AT pmp DOT uni-hannover DOT de>
|
160935 |
03-Aug-2006 |
yongari |
Fix re(4) breakge introduced in tree from rev 1.68. This should fix incorrect configuration of station address on big-endian architectures.
Reviewed by: wpaul Tested on: sparc64
|
160883 |
01-Aug-2006 |
wpaul |
Another small update to the re(4) driver:
- Change the workaround for the autopad/checksum offload bug so that instead of lying about the map size, we actually create a properly padded mbuf and map it as usual. The other trick works, but is ugly. This approach also gives us a chance to zero the pad space to avoid possibly leaking data.
- With the PCIe devices, it looks issuing a TX command while there's already a transmission in progress doesn't have any effect. In other words, if you send two packets in rapid succession, the second one may end up sitting in the TX DMA ring until another transmit command is issued later in the future. Basically, if re_txeof() sees that there are still descriptors outstanding, it needs to manually resume the TX DMA channel by issuing another TX command to make sure all transmissions are flushed out. (The PCI devices seem to keep the TX channel moving until all descriptors have been consumed. I'm not sure why the PCIe devices behave differently.)
(You can see this issue if you do the following test: plug an re(4) interface into another host via crossover cable, and from the other host do 'ping -c 2 <host with re(4) NIC>' to prime the ARP cache, then do 'ping -c 1 -s 1473 <host with re(4) NIC>'. You're supposed to see two packets sent in response, but you may only see one. If you do 'ping -c 1 -s 1473 <host with re(4) NIC>' again, you'll see two packets, but one will be the missing fragment from the last ping, followed by one of the fragments from this ping.)
- Add the PCI ID for the US Robotics 997902 NIC, which is based on the RTL8169S.
- Add a tsleep() of 1 second in re_detach() after the interrupt handler is disconnected. This should allow any tasks queued up by the ISR to drain. Now, I know you're supposed to use taskqueue_drain() for this, but something about the way taskqueue_drain() works with taskqueue_fast queues doesn't seem quite right, and I refuse to be tricked into fixing it.
|
160843 |
30-Jul-2006 |
wpaul |
Fix the following bugs in re(4)
- Correct the PCI ID for the 8169SC/8110SC in the device list (I added the macro for it to if_rlreg.h before, but forgot to use it.)
- Remove the extra interrupt spinlock I added previously. After giving it some more thought, it's not really needed.
- Work around a hardware bug in some versions of the 8169. When sending very small IP datagrams with checksum offload enabled, a conflict can occur between the TX autopadding feature and the hardware checksumming that can corrupt the outbound packet. This is the reason that checksum offload sometimes breaks NFS: if you're using NFS over UDP, and you're very unlucky, you might find yourself doing a fragmented NFS write where the last fragment is smaller than the minimum ethernet frame size (60 bytes). (It's rare, but if you keep NFS running long enough it'll happen.) If checksum offload is enabled, the chip will have to both autopad the fragment and calculate its checksum header. This confuses some revs of the 8169, causing the packet that appears on the wire to be corrupted. (The IP addresses and the checksum field are mangled.) This will cause the NFS write to fail. Unfortunately, when NFS retries, it sends the same write request over and over again, and it keeps failing, so NFS stays wedged.
(A simple way to provoke the failure is to connect the failing system to a network with a known good machine and do "ping -s 1473 <badhost>" from the good system. The ping will fail.)
Someone had previously worked around this using the heavy-handed approahch of just disabling checksum offload. The correct fix is to manually pad short frames where the TCP/IP stack has requested checksum offloading. This allows us to have checksum offload turned on by default but still let NFS work right.
- Not a bug, but change the ID strings for devices with hardware rev 0x30000000 and 0x38000000 to both be 8168B/8111B. According to RealTek, they're both the same device, but 0x30000000 is an earlier silicon spin.
|
160008 |
28-Jun-2006 |
wpaul |
Properly detect the RTL8168(B?) again. RealTek sent me a bunch of sample cards: the chips are all marked "RTL8111B", but they put stickers on the back that say "RTL8168B/8111B". The manual says there's only one HWREV code for both the 8111B and 8168B devices, which is 0x30000000, but the cards they sent me actually report HWREV of 0x38000000. Deciding to trust the hardware in front of me rather than a possibly incorrect manual (it wouldn't be the first time the HWREVs were incorrectly documented), I changed the 8168 revision code. It turns out this was a mistake though: 0x30000000 really is a valid for the 8168.
There are two possible reasons for there to be two different HWREVs:
1) 0x30000000 is used only for the 8168B and 0x38000000 is only for the 8111B. 2) There were 8111/8168 rev A devices which both used code 0x30000000, and the 8111B/8168B both use 0x38000000.
The product list on the RealTek website doesn't mention the existence of any 8168/8111 rev A chips being in production though, and I've never seen one, so until I get clarification from RealTek, I'm going to assume that 0x30000000 is just for the 8168B and 0x38000000 is for the 8111B only.
So, the HWREV code for the 8168 has been put back to 0x30000000, a new 8111 HWREV code has been added, and there are now separate entries for recognizing both devices in the device list. This will allow all devices to work, though if it turns out I'm wrong I may need to change the ID strings
|
159962 |
26-Jun-2006 |
wpaul |
Add support for the RealTek 8169SC/8110SC and RTL8101E devices. The latter is a PCIe 10/100 chip.
Finally fix the EEPROM reading code so that we can access the EEPROMs on all devices. In order to access the EEPROM, we must select 'EEPROM programming' mode, and then set the EEPROM chip select bit. Previously, we were setting both bits simultaneously, which doesn't work: they must be set in the right sequence.
Always obtain the station address from the EEPROM, now that EEPROM reading works correctly.
Make the TX interrupt moderation code based on the internal timer optional and turned off by default.
Make the re_diag() routine conditional and off by default. When it is on, only use it for the original 8169, which was the only device that that really needed it.
Modify interrupt handling to use a fast interrupt handler and fast taskqeueue.
Correct the rgephy driver so that it only applies the DSP fixup for PHY revs 0 and 1. Later chips are fixed and don't need the fixup.
Make the rgephy driver advertise both 1000_FD and 1000_HD bits in autoneg mode. A couple of the devices don't autoneg correctly unless configured this way.
|
158878 |
24-May-2006 |
glebius |
Rename device name in the last commit. According to PR, the ID is more likely to belong to chips of 8168 family.
PR: kern/96734 Submitted by: Sven Petai <hadara bsd.ee>
|
156988 |
22-Mar-2006 |
glebius |
Add support for RTL8111B chip, that can be found on some mainboards, for example ASUS P5PL2.
Tested by: Vadim Frolov <vadim uch.net>
|
156241 |
03-Mar-2006 |
glebius |
Correctly switch IFCAP_VLAN_HWTAGGING on and off.
Reported & tested by: Peter Blok <pblok bsd4all.org>
|
155859 |
20-Feb-2006 |
ticso |
Copy MAC address to fix alignment problems. Tested on alpha (AS600) with RTL8169S Suggested by: jhb
|
155671 |
14-Feb-2006 |
glebius |
Do not touch ifp->if_baudrate in miibus aware drivers.
|
153512 |
18-Dec-2005 |
glebius |
- Fix VLAN_INPUT_TAG() macro, so that it doesn't touch mtag in case if memory allocation failed. - Remove fourth argument from VLAN_INPUT_TAG(), that was used incorrectly in almost all drivers. Indicate failure with mbuf value of NULL.
In collaboration with: yongari, ru, sam
|
152681 |
22-Nov-2005 |
glebius |
Check IFF_DRV_RUNNING in the re_intr() loop. It can disappear, since re_rxeof() drops the lock for some time.
Reported & tested by: XueFeng Deng <dsnofe yahoo.com.cn>
|
152315 |
11-Nov-2005 |
ru |
- Store pointer to the link-level address right in "struct ifnet" rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr.
- Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead.
|
151544 |
22-Oct-2005 |
imp |
The controller -> device switch happened in 4.0, fix comment
|
151341 |
14-Oct-2005 |
jhb |
Only allow the sk(4) driver to attach to revision 2 of the LinkSys EG1032 cards and teach the re(4) driver to attach to revision 3 cards.
Submitted by: Fredrik Lindberg fli+freebsd-current at shapeshifter dot se MFC after: 2 weeks Reviewed by: imp, mdodd
|
150968 |
05-Oct-2005 |
glebius |
- Don't pollute opt_global.h with DEVICE_POLLING and introduce opt_device_polling.h - Include opt_device_polling.h into appropriate files. - Embrace with HAVE_KERNEL_OPTION_HEADERS the include in the files that can be compiled as loadable modules.
Reviewed by: bde
|
150789 |
01-Oct-2005 |
glebius |
Big polling(4) cleanup.
o Axe poll in trap.
o Axe IFF_POLLING flag from if_flags.
o Rework revision 1.21 (Giant removal), in such a way that poll_mtx is not dropped during call to polling handler. This fixes problem with idle polling.
o Make registration and deregistration from polling in a functional way, insted of next tick/interrupt.
o Obsolete kern.polling.enable. Polling is turned on/off with ifconfig.
Detailed kern_poll.c changes: - Remove polling handler flags, introduced in 1.21. The are not needed now. - Forget and do not check if_flags, if_capenable and if_drv_flags. - Call all registered polling handlers unconditionally. - Do not drop poll_mtx, when entering polling handlers. - In ether_poll() NET_LOCK_GIANT prior to locking poll_mtx. - In netisr_poll() axe the block, where polling code asks drivers to unregister. - In netisr_poll() and ether_poll() do polling always, if any handlers are present. - In ether_poll_[de]register() remove a lot of error hiding code. Assert that arguments are correct, instead. - In ether_poll_[de]register() use standard return values in case of error or success. - Introduce poll_switch() that is a sysctl handler for kern.polling.enable. poll_switch() goes through interface list and enabled/disables polling. A message that kern.polling.enable is deprecated is printed.
Detailed driver changes: - On attach driver announces IFCAP_POLLING in if_capabilities, but not in if_capenable. - On detach driver calls ether_poll_deregister() if polling is enabled. - In polling handler driver obtains its lock and checks IFF_DRV_RUNNING flag. If there is no, then unlocks and returns. - In ioctl handler driver checks for IFCAP_POLLING flag requested to be set or cleared. Driver first calls ether_poll_[de]register(), then obtains driver lock and [dis/en]ables interrupts. - In interrupt handler driver checks IFCAP_POLLING flag in if_capenable. If present, then returns.This is important to protect from spurious interrupts.
Reviewed by: ru, sam, jhb
|
150720 |
29-Sep-2005 |
jhb |
- Use if_printf() and device_printf() in re(4) and remove rl_unit from the softc. - Use callout_init_mtx() and rather than timeout/untimeout in both rl(4) and re(4). - Fix locking for ifmedia by locking the driver in the ifmedia handlers rather than in the miibus functions. (re(4) didn't lock the mii stuff at all!) - Fix some locking in re_ioctl().
Note: the two drivers share the same softc declared in if_rlreg.h, so they had to be change simultaneously.
MFC after: 1 week Tested by: several on rl(4), none on re(4)
|
150306 |
19-Sep-2005 |
imp |
Make sure that we call if_free(ifp) after bus_teardown_intr. Since we could get an interrupt after we free the ifp, and the interrupt handler depended on the ifp being still alive, this could, in theory, cause a crash. Eliminate this possibility by moving the if_free to after the bus_teardown_intr() call.
|
150178 |
15-Sep-2005 |
ru |
Don't recommend re_detach() (like in vr(4)) as another possible method to prevent panicing in interrupt handler after re_shutdown(), sometimes seen on SMP systems. This would work here only because re_detach() clears IFF_UP (to prevent another race) and it was demonstrated that it's not enough to call vr_detach() in vr_shutdown() to prevent a panic.
|
150175 |
15-Sep-2005 |
ru |
re_detach() fixes:
- Fixed if_free() logic screw-up that can either result in freeing a NULL pointer or leaking "struct ifnet". - Move if_free() after re_stop(); the latter accesses "struct ifnet". This bug was masked by a previous bug. - Restore the fix for a panic on detach caused by racing with BPF detach code by Bill by moving ether_ifdetach() after re_stop() and resetting IFF_UP; this got screwed up in revs. 1.30 and 1.36.
|
149232 |
18-Aug-2005 |
sobomax |
In re_shutdown() mark interface as down since otherwise we will panic if interrupt comes in later on, which can happen in some uncommon cases.
Another possible fix is to call re_detach() instead of re_stop(), like ve(4) does, but I am not sure if the latter is really RTTD, so that stick with this one-liner for now.
PR: kern/80005 Approved by: silence on -arch, no reply from selected network gurus
|
148887 |
09-Aug-2005 |
rwatson |
Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field.
Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so.
Reviewed by: pjd, bz MFC after: 7 days
|
148722 |
05-Aug-2005 |
tobez |
Recognize D-Link DGE-528(T) Gigabit as an re(4) device.
Submitted by: Andrus Nomm <andrus@members.ee> PR: 76780 MFC After: 1 week
|
148654 |
03-Aug-2005 |
rwatson |
Modify device drivers supporting multicast addresses to lock if_addr_mtx over iteration of their multicast address lists when synchronizing the hardware address filter with the network stack-maintained list.
Problem reported by: Ed Maste (emaste at phaedrus dot sandvine dot ca> MFC after: 1 week
|
147714 |
01-Jul-2005 |
yongari |
Use correct pointer type. This should fix non-functional re(4) driver on 64bit architectures.
Approved by: re (scottl)
|
147291 |
11-Jun-2005 |
brooks |
Move if_alloc() up so it's before mii_phy_probe().
|
147256 |
10-Jun-2005 |
brooks |
Stop embedding struct ifnet at the top of driver softcs. Instead the struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com.
This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go.
Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr.
Reviewed by: sobomax, sam
|
146734 |
29-May-2005 |
nyan |
Remove bus_{mem,p}io.h and related code for a micro-optimization on i386 and amd64. The optimization is a trivial on recent machines.
Reviewed by: -arch (imp, marcel, dfr)
|
143481 |
13-Mar-2005 |
mlaier |
Unbreak build with POLLING. I should really listen and test with NOTES instead of the module build.
|
143469 |
12-Mar-2005 |
mlaier |
ALTQ support for re(4).
Submitted by: Chris Dionissopoulos, Theo Schlossnagle PR: kern/78681 MFC after: 2 weeks
|
142890 |
01-Mar-2005 |
imp |
Use BUS_PROBE_DEFAULT in preference to 0 and BUS_PROBE_LOW_PRIORITY in preference to some random negative number to allow other drivers a bite at the apple.
|
140642 |
22-Jan-2005 |
imp |
Bring in support for SUGOI LAN GIGA NIC made by System TALKS, Inc from a RealTek 8169SB.
PR: 74262 Submitted by: Yoshikazu GOTO-san
# Submitter notes that he's unsure of the revision string for 8169SB
|
139749 |
06-Jan-2005 |
imp |
Start each of the license/copyright comments with /*-, minor shuffle of lines
|
139693 |
05-Jan-2005 |
cognet |
Disable checksum offloading by default. It seems to produce corrupted packets with some revisions of the chip (particularly when using multiple TX descriptors).
MFC after: 1 week
|
139555 |
02-Jan-2005 |
cognet |
In re_detach(), remove an extra call to ether_ifdetach(). This fixes a panic that occurs when unloading the kernel module.
MFC after: 3 days
|
135896 |
28-Sep-2004 |
jmg |
fix jumbo frames as much as they can be fixed for re. We now cap the MTU to 7422 since it appears that the 8169S can't transmit anything larger.. The 8169S can receive full jumbo frames, but we don't have an mru to let the upper layers know this...
add fixup so that this driver should work on alignment constrained platforms (!i386 && !amd64)
MFC after: 5 days
|
135505 |
20-Sep-2004 |
jmg |
trim trailing white space.. call the re mutex by it's name..
MFC after: 3 days
|
135468 |
19-Sep-2004 |
jmg |
spell RX correctly don't call re_rxeof a second time when we've already done the work pull common code out from if and else clauses
MFC after: 3 days
|
135435 |
18-Sep-2004 |
jmg |
pass in pointer to m_head to re_encap because m_defrag could free the original mbuf causing a free'd mbuf passed to bpf later and panic'ing the system.. This should only effect jumbo frames.
MFC after: 5 days
|
134750 |
04-Sep-2004 |
ru |
Fixed build with DEVICE_POLLING defined.
|
134711 |
03-Sep-2004 |
jmg |
merge in if_rl locking because if_re was originally based upon if_rl. This essentially merges revs 1.143-1.1445 of sys/pci/if_rl.c. This now marks the interrupt MPSAFE along with making the mutex non-recursive.
Looked over by: bms
|
134433 |
28-Aug-2004 |
sanpei |
Add support Corega CG-LAPCIGT Gigabit Ethernet(8169S)
PR: [FreeBSD-users-jp 80667] Submitted by: FUJIMOTO Kou <fujimoto@j.dendai.ac.jp> MFC after: 1 week
|
131668 |
06-Jul-2004 |
bms |
Eliminate unneeded return keywords.
|
131667 |
06-Jul-2004 |
bms |
Whitespace pass
|
131254 |
28-Jun-2004 |
imp |
Remove code to slam the config space on transition to d0.
|
130270 |
09-Jun-2004 |
naddy |
Replace handrolled CRC calculation with ether_crc32_[lb]e().
|
129879 |
30-May-2004 |
phk |
Add missing <sys/module.h> includes
|
129672 |
24-May-2004 |
jhb |
Wrap the code to save/restore PCI config registers on suspend/resume in #ifndef BURN_BRIDGES.
Noticed by: phk
|
129633 |
23-May-2004 |
yar |
A handler for ioctl(SIOCSIFCAP) should not alter a bit in if_capenable unless the interface driver is actually able to toggle the respective capability on and off.
Reviewed by: ru
|
129616 |
23-May-2004 |
mux |
We don't need to initialize if_output, ether_ifattach() does it for us.
|
128138 |
11-Apr-2004 |
ru |
Implemented per-interface polling(4) control.
|
127135 |
17-Mar-2004 |
njl |
Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde
|
126966 |
14-Mar-2004 |
mdodd |
Announce ethernet MAC addresss in ether_ifattach().
|
123289 |
08-Dec-2003 |
obrien |
Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.
Requested by: bde,imp
|
123019 |
28-Nov-2003 |
imp |
Sometimes cardbus attachments don't attach, so while we track down this problem put these lines back in. While they should be unnecessary, they appear to be sometimes necessary.
Reviewed in concept: dfr Approved by: re (scottl@)
|
122689 |
14-Nov-2003 |
sam |
Drop the driver lock around calls to if_input to avoid a LOR when 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
|
122678 |
14-Nov-2003 |
obrien |
Remove duplicate FBSDID's, move others to their right place.
|
122625 |
13-Nov-2003 |
obrien |
Try to create some sort of consistency in how the routings to find the 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).
|
121939 |
03-Nov-2003 |
dfr |
Remove explicit cardbus attachments from drivers where this is identical to the pci attachment. Cardbus is a derived class of pci so all pci drivers are automatically available for matching against cardbus devices.
Reviewed by: imp
|
121816 |
31-Oct-2003 |
brooks |
Replace the if_name and if_unit members of struct ifnet with new members 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)
|
120299 |
20-Sep-2003 |
wpaul |
Remove the dual-address cycle stuff. DAC is used to allow a bus master device to access 64-bit addresses from a 32-bit PCI bus. While the RealTek manual says you can set this bit and the chip will perform DAC only if you give it a DMA address with any of the upper 32 bits set, this appears not to be the case. If I turn on the DAC bit, the chip sets the 'system error' bit in the status register when I to do a DMA on my Athlon test box with 32-bit PCI bus (VIA chipset) even though I only have 128MB of physical memory, and thus can never give the chip a 64-bit address.
Obviously, I can't just set it and forget it, so until I figure out the right rule for when it's safe/necessary to enable it, keep it turned off.
|
120215 |
19-Sep-2003 |
wpaul |
Remove jumbo buffer #defines that I ended up not needing.
|
120208 |
18-Sep-2003 |
wpaul |
In re_diag(), there's no need for us to call re_start() ourselves: IF_HANDOFF() does it for us behind the scenes. Remove the extra call to re_start() otherwise we try to transmit twice.
In re_encap(), fix the code that guards against consuming too many descriptors in the TX ring so that it actually works. With the new 8169S chip, I was able to hit a corner case that drained the free descriptor count all the way to 0. This is not supposed to be possible.
|
120043 |
13-Sep-2003 |
wpaul |
Teach the re(4) driver about the CFG2 register, which tells us whether we're on a 32-bit/64-bit bus or not. Use this to decide if we should set the PCI dual-address cycle enable bit in the C+ command register. (Enabling DAC on a 32-bit bus seems to do bad things.)
Also, initialize the C+ command register early in the re_init() routine. The documentation says this register should be configured first.
|
119982 |
11-Sep-2003 |
wpaul |
Toggle the interface on and off before starting the diag test. This seems to be necessary for the 8139C+ under certain circumstances, and doesn't appear to hurt the other chips. (In the failure case, the packet would be sent through the TX DMA ring but not get echoed back. I suspect this has something to do with the link state changing unexpectedly.)
|
119981 |
11-Sep-2003 |
wpaul |
- For the 8169 chips, read the station address by forcing an EEPROM autoload and then copying the contends of the station address registers. For some reason, reading the EEPROM on the 8169S doesn't work right. This gets around the problem, and allows us to read the station address correctly on the 8169S.
- Insert a delay after initiating packet transmition in re_diag() to allow lots of time for the frame to echo back to the host, and wait for both the 'RX complete' and 'timeout expired' bits in the ISR register to be set.
- Deal more intelligently with the fact that the frame length field in the RX descriptor is a different width on the 8139C+ than it is on the 8169/8169S/8110S
- For the 8169, you have to set bit 17 in the TX config register to enter digital loopback mode, but for the 8139C+, you have to set both bits 17 and 18. Take this into account so that re_diag() works properly for both types of chips.
|
119976 |
11-Sep-2003 |
wpaul |
Add a PHY driver to support the built-in gigE PHY in the 8169S/8110S ethernet chips. This driver is pretty simple, however it contains special DSP initialization code which is needed in order to get the chip to negotiate a gigE link. (This special initialization may not be needed in subsequent chip revs.) Also:
- Fix typo in if_rlreg.h (RL_GMEDIASTAT_1000MPS -> RL_GMEDIASTAT_1000MBPS)
- Deal with shared interrupts in re_intr(): if interface isn't up, return.
- Fix another bug in re_gmii_writereg() (properly apply data field mask)
- Allow PHY driver to read the RL_GMEDIASTAT register via the re_gmii_readreg() register (this is register needed to determine real time link/media status).
|
119955 |
10-Sep-2003 |
wpaul |
Fix bug in re_gmii_writewreg(): we don't need to be screening out certain PHY addresses here. (The chip will only let you talk to one PHY anyway.)
|
119949 |
10-Sep-2003 |
wpaul |
Update hardware revision table. 0x04000000 appears to be the revision for the 8169S, according to my sample board. The RealTek Linux driver mentions 0x00800000. I'm assigning this to the 8110S until I get more info on it. (The (preliminary) RealTek docs only say that 8169S/8110S chips will have some combination of those two bits set, but doesn't say exactly what bit combination goes with which chip variant.)
|
119868 |
08-Sep-2003 |
wpaul |
Take the support for the 8139C+/8169/8169S/8110S chips out of the rl(4) driver and put it in a new re(4) driver. The re(4) driver shares the if_rlreg.h file with rl(4) but is a separate module. (Ultimately I may change this. For now, it's convenient.)
rl(4) has been modified so that it will never attach to an 8139C+ chip, leaving it to re(4) instead. Only re(4) has the PCI IDs to match the 8169/8169S/8110S gigE chips. if_re.c contains the same basic code that was originally bolted onto if_rl.c, with the following updates:
- Added support for jumbo frames. Currently, there seems to be a limit of approximately 6200 bytes for jumbo frames on transmit. (This was determined via experimentation.) The 8169S/8110S chips apparently are limited to 7.5K frames on transmit. This may require some more work, though the framework to handle jumbo frames on RX is in place: the re_rxeof() routine will gather up frames than span multiple 2K clusters into a single mbuf list.
- Fixed bug in re_txeof(): if we reap some of the TX buffers, but there are still some pending, re-arm the timer before exiting re_txeof() so that another timeout interrupt will be generated, just in case re_start() doesn't do it for us.
- Handle the 'link state changed' interrupt
- Fix a detach bug. If re(4) is loaded as a module, and you do tcpdump -i re0, then you do 'kldunload if_re,' the system will panic after a few seconds. This happens because ether_ifdetach() ends up calling the BPF detach code, which notices the interface is in promiscuous mode and tries to switch promisc mode off while detaching the BPF listner. This ultimately results in a call to re_ioctl() (due to SIOCSIFFLAGS), which in turn calls re_init() to handle the IFF_PROMISC flag change. Unfortunately, calling re_init() here turns the chip back on and restarts the 1-second timeout loop that drives re_tick(). By the time the timeout fires, if_re.ko has been unloaded, which results in a call to invalid code and blows up the system.
To fix this, I cleared the IFF_UP flag before calling ether_ifdetach(), which stops the ioctl routine from trying to reset the chip.
- Modified comments in re_rxeof() relating to the difference in RX descriptor status bit layout between the 8139C+ and the gigE chips. The layout is different because the frame length field was expanded from 12 bits to 13, and they got rid of one of the status bits to make room.
- Add diagnostic code (re_diag()) to test for the case where a user has installed a broken 32-bit 8169 PCI NIC in a 64-bit slot. Some NICs have the REQ64# and ACK64# lines connected even though the board is 32-bit only (in this case, they should be pulled high). This fools the chip into doing 64-bit DMA transfers even though there is no 64-bit data path. To detect this, re_diag() puts the chip into digital loopback mode and sets the receiver to promiscuous mode, then initiates a single 64-byte packet transmission. The frame is echoed back to the host, and if the frame contents are intact, we know DMA is working correctly, otherwise we complain loudly on the console and abort the device attach. (At the moment, I don't know of any way to work around the problem other than physically modifying the board, so until/unless I can think of a software workaround, this will have do to.)
- Created re(4) man page
- Modified rlphy.c to allow re(4) to attach as well as rl(4).
Note that this code works for the sample 8169/Marvell 88E1000 NIC that I have, but probably won't work for the 8169S/8110S chips. RealTek has sent me some sample NICs, but they haven't arrived yet. I will probably need to add an rlgphy driver to handle the on-board PHY in the 8169S/8110S (it needs special DSP initialization).
|