简体   繁体   English

Linux中的DMA与CPU驱动程序的交互

[英]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. 前几天,我在阅读一篇文章时,作者在谈论DMA,以及它如何在不涉及CPU的情况下将数据包通过PCI总线复制到内存中。

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. 唯一的开销是大约每毫秒一次,CPU需要唤醒并告诉驱动程序哪些数据包缓冲区可用。

This part I don't quite understand -- why would the CPU tell driver about available buffers and how exactly this works? 这部分我不太了解-为什么CPU会告诉驱动程序可用的缓冲区以及它如何工作? Any link/reference would be greatly appreciated. 任何链接/参考将不胜感激。

Thanks. 谢谢。

Once the driver's transmit() , etc. function is called, the hardware "owns" the memory. 调用驱动程序的transmit()等函数后,硬件将“拥有”内存。 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. 因此,DMA子系统会通知驱动程序/相关子系统,硬件已“完成”访问内存。 At that point it can be reclaimed for use by someone else. 在那时,可以将其回收以供其他人使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM