Page 1 of 1

Need help on e1000 nic driver

Posted: Thu Aug 16, 2012 5:27 pm
by tonytian
Hello,

After booted, my driver does not work correctly sometimes when I sent one packet to it. It can get my 80-byte test packet (sent from another machine) in some runs. The success rate is about 50%! During failing runs, I can see that the Ethernet card moves RDH more than one slot forward, although I send one packet each time. The error/status of each rx descriptors seem to be arbitrary values, while length is the total length of the packet buffer I set up in the descriptor. I don't understand why my card has so weird behavior. It treats one small packet as several packets and uses more than one descriptor to deal with it. Those packets are not the one I originally sent. I suspect there are some initialization routine I missed, so I get this nondeterministic behaviors. What I did for receiving is quite simple

Code: Select all

mmio_write32(E1000_RCTL, (RDMTS_HALF | RCTL_BSIZE_2048 | RCTL_SECRC | RCTL_EN));
mmio_write32(E1000_CTRL, (mmio_read32(E1000_CTRL) | CTRL_SLU));

Is that enough?

For the descriptor setup, I have checked so many times. Only one place I am not sure, that is RDT setting.
I am not sure it should be

Code: Select all

mmio_write32(E1000_RDT(0), NUM_RX_DESCRIPTORS);
or

Code: Select all

mmio_write32(E1000_RDT(0), NUM_RX_DESCRIPTORS-1);
.

But I tried both, none is helpful. Anybody can help me?

Re: Need help on e1000 nic driver

Posted: Thu Aug 16, 2012 5:34 pm
by tonytian
By the way,

E1000_PRC127 tells me I received one packet. But why this packet is handled by several rx descriptors? I really don't understand. :-(

Re: Need help on e1000 nic driver

Posted: Fri Aug 17, 2012 5:46 pm
by tonytian
I tested my driver code on a couple of different machines, and it works perfectly. The machine that gives me indeterministic results is a Dell OPTIPLEX990 server. Does anybody have any ideas?

tonytian wrote:By the way,

E1000_PRC127 tells me I received one packet. But why this packet is handled by several rx descriptors? I really don't understand. :-(

Re: Need help on e1000 nic driver

Posted: Sat Aug 18, 2012 2:54 am
by hidnplayr
Did you align the descriptors address?