Need help on e1000 nic driver

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
tonytian
Posts: 17
Joined: Tue Jul 12, 2011 2:53 pm

Need help on e1000 nic driver

Post 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?
tonytian
Posts: 17
Joined: Tue Jul 12, 2011 2:53 pm

Re: Need help on e1000 nic driver

Post 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. :-(
tonytian
Posts: 17
Joined: Tue Jul 12, 2011 2:53 pm

Re: Need help on e1000 nic driver

Post 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. :-(
hidnplayr
Posts: 23
Joined: Sat Aug 09, 2008 5:07 pm

Re: Need help on e1000 nic driver

Post by hidnplayr »

Did you align the descriptors address?
Post Reply