- clear re_vlanctl in DMA descriptors before starting TX and RX
to avoid stale tags
- use bswap16() rather than be16toh() or htons() on VLAN tag access
since we already use htole32()
Closes PR kern/32643 and also fixes HW VLAN tagging on big endian machines.
It causes a few second TRX stalls on each ioctls
(on ifconfig(8) or tcpdump(8) etc.) and PHY seems
initialized properly without it at least on RTL8169S
with internal rgephy(4) PHY. Closes PR kern/34517.
XXX: maybe we should also test this on the original RTL8169
with external makphy(4).
(allocating TX padding buffer in RX DMA mem to save resouces)
and use it where appropriate
- add a comment about the hack in re_attach() too
- pass a correct size on bus_dmamem_unmap() for RX DMA mem
the Reaktek's driver, which are also used in FreeBSD.
Fixes RX FIFO overrun errors on my Duron 1300MHz PC.
(Note the configuration values for rtk(4) are not changed)
Also add some debug printf's in RX error case (disabled by default).
- wait up to 1s for SStatus_DET_DEV after SControl_DET_INIT toggle (from
FreeBSD)
- reset the drive once we know it's there. It may be in some PM state and
not able to properly reply to IDENTIFY. Tested by Teemu Rinta-aho,
fixes PR kern/35049 and should also fix PR kern/35008.
I'm not sure what it exactly means, but at least, the packet in question
is reloaded in ex_txstat() and should not handle the Dn Complete event
at the moment --- it should be served on later interrupt.
- Reload packet on collision, too.
more flexible
- account a number of free txq and use it to see if packets are queued or sent
- assume free TX descriptors are not owned by the chip in re_start() and
panic if there is any inconsistency on them #ifdef DIAGNOSTIC case.
- replace a magic number (reserved TX descs?) with macro
- check status bits at once (I'm not sure how gcc optimized them though)
- no need to check (ifp->if_flags & IFF_UP) twice
(re_init() must be called at splnet() anyway)
- call re_start() only if the interrupt is actually handled here
- call re_start() directly rather than via (*ifp->if_start)()
from RTK_ or rtk_ to RE_ or re_ for maintainability of these sources.
Eventually we should split these files (and struct rtk_softc) into
three elements, rtk(4) specific one, re(4) specific one, and a common
(register definitions, eeprom and multicast functions etc) part.
While here, add a couple of comments around weird definitions.
like Tx underrun.
This should improve performance on such errors.
Handle fifo threshold properly --- actually it did not handled at all.
Note that the Tx Complete interrupts occur only on errors, and ex_txstat()
is not good place to increment sc->tx_succ_ok. Increase the sc->tx_succ_ok
count from 100 to 256, since the ex(4) does busmastering and underruns
should rarely happen in normal operations.
Possibly improve some situation for the hang-on-heavy-load problems,
such as kern/11450 and kern/27096.
it could be lost if bus_dmamap_load_mbuf(9) returns EFBIG.
(though I've never seen the "too mamy segments" message
which indicates the packet has more than 32 fragments)
- move some driver specific definitions from rtl81x9reg.h to rtl81x9var.h
- move several macro where related structures are declared
- remove unused macro
- fix some comments
- unwrap some lines
This should make 3c575CT work and fix following PRs:
kern/12965: 3com 575CT does not work
port-i386/16295: Problems in pci routing table and ex0 (3c575c-tx) networking
at an odd address (0xd9) and noted "8 bit" in rtl81x9reg.h.
XXX: FreeBSD and OpenBSD also use CSR_WRITE_1() to write RTK_GTXSTART
XXX: for 8169 even though there is a "16 bits" comment at GTXSTART macro.
XXX: Which is correct?
I can't think of a good way to avoid race condition between writeback and
DMA write against descriptors if cachelinesize > sizeof(struct rtk_desc)...
Anyway, now re(4) is functional on O2 (and probably other mips ports).
- make DMA descripter members volatile
Now re(4) works on sgimips O2.
XXX: Still re(4) sometimes stalls on NFS load on sgimips,
XXX: but I'm not sure it's sgimips specific or not.
"#if defined(__i386__) || defined(__x86_64__)".
XXX: What will happen if RTL8168B is used on !__NO_STRICT_ALIGNMENT hosts?
XXX: If 8168B can't handle RX DMA into 32bit-unaligned memory, should we
XXX: implement some code to copy RX buffers like vge(4)?
XXX: Or is 8168B available only for on-board NIC for PCs?