RTL8169: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
m Reverted edits by Melina148 (talk) to last revision by Klakap
m Bot: Replace deprecated source tag with syntaxhighlight
Line 32: Line 32:


ex:
ex:
<source lang="c">
<syntaxhighlight lang="c">
outportb(ioaddr + 0x37, 0x10); /*set the Reset bit (0x10) to the Command Register (0x37)*/
outportb(ioaddr + 0x37, 0x10); /*set the Reset bit (0x10) to the Command Register (0x37)*/
while(inportb(ioaddr + 0x37) & 0x10)
while(inportb(ioaddr + 0x37) & 0x10)
;/*setting a timeout could be useful if the card is problematic*/
;/*setting a timeout could be useful if the card is problematic*/
</syntaxhighlight>
</source>


== Setting up the Rx Descriptors ==
== Setting up the Rx Descriptors ==
Line 97: Line 97:


eg:
eg:
<source lang="c">
<syntaxhighlight lang="c">
outportl(ioaddr + 0x40, 0x03000700); /* IFG: normal, MXDMA: unlimited */
outportl(ioaddr + 0x40, 0x03000700); /* IFG: normal, MXDMA: unlimited */
</syntaxhighlight>
</source>


=== RxConfig ===
=== RxConfig ===
Line 105: Line 105:


eg:
eg:
<source lang="c">
<syntaxhighlight lang="c">
outportl(ioaddr + 0x44, 0x0000E70F) /* RXFTH: unlimited, MXDMA: unlimited, AAP: set (promisc. mode set) */
outportl(ioaddr + 0x44, 0x0000E70F) /* RXFTH: unlimited, MXDMA: unlimited, AAP: set (promisc. mode set) */
</syntaxhighlight>
</source>
== Max Packet Sizes ==
== Max Packet Sizes ==
=== Max Transmit Packet Size ===
=== Max Transmit Packet Size ===
Line 113: Line 113:


eg:
eg:
<source lang="c">
<syntaxhighlight lang="c">
outportb(ioaddr + 0xEC, 0x3B); /* Maximum tx packet size */
outportb(ioaddr + 0xEC, 0x3B); /* Maximum tx packet size */
</syntaxhighlight>
</source>
=== Receive Packet Maximum Size ===
=== Receive Packet Maximum Size ===
The RMS register is located at offset 0xDA and is used for setting the maximum packet size that can be received into the NIC. If set to zero, the NIC will accept no packets (must be set prior to normal operation!). The maximum size that can be set is 0x3FFF (16k - 1), but if a packet larger than 8k is received error bits are set and a lengthier process must be started in order to determine if the packet is actually good or not. I keep this value to 0x1FFF (8k - 1) as it is rare to receive such large packets and it also ensures that error packets are actually error packets and not false positives.
The RMS register is located at offset 0xDA and is used for setting the maximum packet size that can be received into the NIC. If set to zero, the NIC will accept no packets (must be set prior to normal operation!). The maximum size that can be set is 0x3FFF (16k - 1), but if a packet larger than 8k is received error bits are set and a lengthier process must be started in order to determine if the packet is actually good or not. I keep this value to 0x1FFF (8k - 1) as it is rare to receive such large packets and it also ensures that error packets are actually error packets and not false positives.


eg:
eg:
<source lang="c">
<syntaxhighlight lang="c">
outportw(ioaddr + 0xDA, 0x1FFF); /* Maximum rx packet size */
outportw(ioaddr + 0xDA, 0x1FFF); /* Maximum rx packet size */
</syntaxhighlight>
</source>
== Full Reset Example ==
== Full Reset Example ==
This is a barebones example of how to reset the RTL8169 without anything like auto-negotiation (explained later) or (G)MII interactions.
This is a barebones example of how to reset the RTL8169 without anything like auto-negotiation (explained later) or (G)MII interactions.