Hi All,

I'm developing the driver for e1000 82540em card in a new os. I follow the
sample code in osdev at this link,

http://www.randomaccessit.com/osdev/i825xx.c

After fixing some minor bugs in this code, now I can successfully transmit
packets. However, when I called the rx_process function repeatedly to
process received packets. I met the following situation:

When I use another socket program on another machine to send k (assume k =
8) ICMP packets to my 82540em card in Virtual Box, it fires a ICR with
value 80, meaning the receiving timer interrupt, and I can correctly
receive these 8 packets. However, when the driver is still running by
reading ICR repeatedly and I use the socket program to send another 8 ICMP
packets to the card, no interrupt will be fired again. The situation can be
hacked if I reset RDH as 0 and RDT as NUM_RX_DESCRIPTORS_1 after the
rx_process routine is called. The 8254x manual says the RDH register should
only be written by driver at the reset time. But keeping resetting it at
every interrupt is no doubt an efficient way. Could anyone give me some
advice on what could be wrong with my code? My rx_process code is as
follows:


void E1000_card::process_receive()
{
    printf("processing received pkts\n");

    while( (rx_desc[rx_buf_pos]->status & (1 << 0)) )//DD bit is set
    {


        //the code to push the packet to upper layer protocol stack is
omitted

        // update RX counts and the tail pointer
        rcv_counter++;
        rx_desc[rx_buf_pos]->status = (uint16_t)(0);
        rx_desc[rx_buf_pos]->errors = (uint16_t)(0);
        //printf("rx_desc[%d]->status after processing is %x\n",
rx_buf_pos, rx_desc[rx_buf_pos]->status);
        rx_buf_pos = (rx_buf_pos + 1) % NUM_RX_DESCRIPTORS;

        // write the tail to the device
        mmio_write32(E1000_RDT(0), rx_buf_pos);
        printf("E1000_RDH=%x\n", mmio_read32(E1000_RDH(0)));
        printf("E1000_RDT=%x\n", mmio_read32(E1000_RDT(0)));

    }
    /*this few lines will reset the RDH and RDT register, hacking this
problem, but is not efficient
    mmio_write32(E1000_RDH(0), 0);
    mmio_write32(E1000_RDT(0), NUM_RX_DESCRIPTORS-1);
    rx_buf_pos = 0;
    sleep(20);*/
    printf("----------------process done, restarted rx_init\n");
}


-- 
Qiao Xiang
PhD student
Computer Science Department
Wayne State University
5057 Woodward Avenue, Suite 3010
Detroit, MI 48202
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit 
http://communities.intel.com/community/wired

Reply via email to