Hi everyone.
I had spend a whole week working on RTL8101L driver but I am still getting nowhere. Transmitting is fine, I sent a packet to the line and successfully captured it by Wireshark on another computer. But when I repeatedly sent ping packet to RTL8101L, it showed no sign of having received packet (no interrupt, Interrupt Status Register is 0, Missed Packet Counter is 0).
RTL8101L is just an RTL8139 with AC'97 sound controller, so I follow the RTL8139 development guide. Here is my initialization step:
[*] Soft reset (send 10h to Command Register)
[*] Setting Interrupt Mask Register
[*] Setting Receive Buffer Start address
[*] Setting Receive Configuration Register (RCR = 3Fh, accept all type of packets)
[*] Send 0Ch to Command Register, enable TX and RX.
I can not understand why it didn't receive any packet. Could anyone point down my errors?
My RTL8101L can transmit but not receive packet
Re: My RTL8101L can transmit but not receive packet
My reset procedure is a bit different from yours, but I got the IRQ fired:
This works with qemu's 8139 emulation (IRQ fired by sending a broadcast packet). Hope this help.
By the way, I suggest to narrow down the issue:
1. only enable receive - so you don't need to worry on bugs from transmission handler that messed things up.
2. there is 0.00001% chance that you did not ack the PIC.
3. double check the IRQ number, did you got it from PCI?
4. check your "test packet", do it routed properly to the target machine?
Code: Select all
// Reset Packet
outb( (uint16_t) (nic->io_addr + RTL8139_COMMAND), 0x10);
while ( (inb( (uint16_t) (nic->io_addr + RTL8139_COMMAND)) & 0x10) != 0 ) {}
// Setup receive buffer location
outl( (uint16_t) (nic->io_addr + 0x30), (uint32_t)rtl8139_rx_buffer );
// Buffer type
outl( (uint16_t) (nic->io_addr + 0x44), 0xF | (1<<7) );
// IRQ
outw( (uint16_t) (nic->io_addr + 0x3C), 5); // TOK + ROK
// Enable receive
outb( (uint16_t) (nic->io_addr + RTL8139_COMMAND), 1<<3 );
By the way, I suggest to narrow down the issue:
1. only enable receive - so you don't need to worry on bugs from transmission handler that messed things up.
2. there is 0.00001% chance that you did not ack the PIC.
3. double check the IRQ number, did you got it from PCI?
4. check your "test packet", do it routed properly to the target machine?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: My RTL8101L can transmit but not receive packet
4b: Check the destination MAC address? Wireshark puts the card in promiscuous mode to make it receive packets with other MAC addresses as well. Your NIC doesn't pick up arbitrary messages by default.
Re: My RTL8101L can transmit but not receive packet
Sorry, I didn't make it clear. Here is my detail problem:
I have 2 machines, A and B. A is a PXE boot server. B is my testing machine with RTL8101L.
During booting stage, B receive a boot file from A. This boot file contain my RTL8101L driver code. This code reset and re-init the RTL8101L, after that it sent a ping packet back to A.
The Wireshark program on A captured this packet successfully. A sent a reply back to B, but B showed no signed of having received a packet. Even when I ran "ping B" on A, nothing was changed on B, although the signal LED of network line between B and the switch was constant flashing.
No problem with IRQ because when the packet was transmitted from B to A, an IRQ was fired. So I think that I didn't config my RTL8101L properly.
I have 2 machines, A and B. A is a PXE boot server. B is my testing machine with RTL8101L.
During booting stage, B receive a boot file from A. This boot file contain my RTL8101L driver code. This code reset and re-init the RTL8101L, after that it sent a ping packet back to A.
The Wireshark program on A captured this packet successfully. A sent a reply back to B, but B showed no signed of having received a packet. Even when I ran "ping B" on A, nothing was changed on B, although the signal LED of network line between B and the switch was constant flashing.
No problem with IRQ because when the packet was transmitted from B to A, an IRQ was fired. So I think that I didn't config my RTL8101L properly.
Re: My RTL8101L can transmit but not receive packet
Eureka! I have found my error, the reason it can not receive any packets is that I set RBSTART and Receive Configuration Register before enable RX. When I config RBSTART and RCR after enabling the receiver, it works like a charm. What a strangle problem!
Re: My RTL8101L can transmit but not receive packet
This sound strange to me, if you enable RX before you set the configuration, there may be hidden problems due to bogus states in those nano seconds.
On the other hand, I see no issue to set configuration before enable RX.
On the other hand, I see no issue to set configuration before enable RX.