Commit f8675858 authored by Kevin Wolf's avatar Kevin Wolf

e1000: Initialise status field in Rx Descriptors

Checking whether bit 0 has been set in the status field only works for
determining whether a descriptor has been used by the NIC if the bit is
properly cleared before handing it to the device.
Signed-off-by: Kevin Wolf's avatarKevin Wolf <kevin@tyndur.org>
parent 5d1c4ad4
......@@ -384,6 +384,7 @@ static void reset_nic(struct e1000_device* netcard)
for (i = 0; i < RX_BUFFER_NUM; i++) {
netcard->rx_desc[i].length = RX_BUFFER_SIZE;
netcard->rx_desc[i].buffer = PHYS(netcard, rx_buffer[i * RX_BUFFER_SIZE]);
netcard->rx_desc[i].status = 0;
#ifdef DEBUG
printf("e1000: [%d] Rx: Buffer @ phys %08llx, Desc @ phys %08x\n",
......@@ -626,6 +627,9 @@ static void e1000_handle_interrupt(struct cdi_device* device)
&netcard->rx_buffer[netcard->rx_cur_buffer * RX_BUFFER_SIZE],
size);
cdi_barrier();
netcard->rx_desc[netcard->rx_cur_buffer].status = 0;
netcard->rx_cur_buffer++;
netcard->rx_cur_buffer %= RX_BUFFER_NUM;
}
......
......@@ -25,6 +25,8 @@
extern "C" {
#endif
#define cdi_barrier() do { asm volatile("" ::: "memory"); } while(0)
/**
* Registiert einen neuen IRQ-Handler.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment