# Realtek 8168E Network Adaptor - Data transmission using loopback



## RRao (Jul 17, 2013)

I am facing problem in sending/receiving data to Network adapter using loopback mechanism.
(Writing to Tx and reading from Rx buffer)

NIC adapter: Realtek 8168E
Data sheet referred: Realtek 8168B 

Transmitter side configuration

Allocated  a memory for TX descriptor as per the specification given in the data sheet (page no:55).
Aligned descriptor to 256 byte alignment.
Also allocated a separate buffer (TXBuffer) to store the data to be transmitted.
Placed the address of TXBuffer into the specified field in the TX descriptor.
Enabled the MAC loopback bit in the TX config register (40h).
Then we have enabled the NPQ bit in the TxPoll register (38h).
After that, we have done the NIC reset by offset 37h.
Then we have enabled the loopback bit in BMCR register.
Enabled the Tx OK, and Tx Descriptor Unavailable interrupts in interrupt mask register (3Ch).
Placed the Tx Descriptor address into the MAC register TNPDS (20h).
Then at last enabled the TE bit in command register (37h).
Similarly I did required configuration in Rx side.

While reading Rx buffer, we don*'*t get any data.
While reading interrupt status we get TDU and RDU set to 1.(i.e. Tx and Rx Descriptor unavailable)

Please suggest how to debug such situation. Also if you know the correct sequence of Tx and Rx descriptor configuration, please share.

Thank you for your support.


----------



## DutchDaemon (Jul 17, 2013)

Do not post questions in the HowTo & FAQs Forum: Posting in Howtos & FAQs


----------



## RRao (Jul 17, 2013)

Hi,

But this post is under the following path: The FreeBSD Forums > Server & Networking > Networking.


-RRao


----------



## DutchDaemon (Jul 17, 2013)

Yes. It is now. Look here: http://forums.freebsd.org/forumdisplay.php?f=39


----------

