I am having some real difficulties getting the Intel 8254x to receive properly. Here's my current code:
https://github.com/madd-games/glidix/bl ... 00/e1000.cI'm not sure at all where i might be going wrong, but the situation is as follows: the device sometimes fails to report received packets to the system on time (or at all). This usually happens if some packets are received early. I have attached a wireshark capture of the situation where this bug is triggered; the 4 M-SEARCH packets are received just as glidix is booting, then when glidix sends out DHCP discovery, it is not seeing the DHCP offer. As seen in the code, I added a kprintf_debug() to test which interrupts are arriving. I got the "receive" interrupt (bit 7, 0x0080) 4 times; and it receives the M-SEARCH packets, but not the DHCP offers. LATER, however, when more packets arrive, it DOES receive the bit 7 interrupt again, and the packets arrive; but why am I not getting an interrupt at the moment the packets acually arrive?
Is this the wrong way of receiving on said device?
Furthermore, on line 313 I have a commented-out loop which tries to get as many packets as possible by testing the "descriptor done" bit in the descriptor's status. When I uncomment this loop, then the situation is better, but STILL fails sometimes (mainly if there is more traffic). There has to be some sort of a race somewhere...
I am really stuck on this because any attempts at debugging seem to just hide the bug; suddenly when I dump packets the bug becomes extremely rare, and when I catch it, all I see is that the packets, once again, simply arrive late.
Does anyone have any suggestions at all?
(EDIT: attached the wireshark dump, which i forgot to do)