Mark
Mark

Reputation: 6464

DMA in Linux and CPU-driver interaction

The other day I was reading an article where the author was talking about DMA, and how it helps copy packets across the PCI bus into memory, without the CPU being involved.

Then it says:

The only overhead is that about once a millisecond, the CPU needs to wake up and tell the driver which packet buffers are free.

This part I don't quite understand -- why would the CPU tell driver about available buffers and how exactly this works? Any link/reference would be greatly appreciated.

Thanks.

Upvotes: 0

Views: 133

Answers (1)

Jonathon Reinhart
Jonathon Reinhart

Reputation: 137398

Once the driver's transmit(), etc. function is called, the hardware "owns" the memory. Without the behavior you describe, that memory would be leaked. So the DMA subsystem informs the driver / relevant subsystem that the hardware is "finished" accessing the memory. At that point it can be reclaimed for use by someone else.

Upvotes: 1

Related Questions