Rust-for-Linux/linux

There is a need to add `dma_sync_single_for_cpu` in the dma safety abstraction and provide a safe way of accessing the ptr of pic::device.

Richardhongyu opened this issue · 2 comments

With some effort, I successfully run the rust-e1000 driver developed by Fujita on a physical e1000 nic. During this phase, I find some needs to change some of the RFL safe abstractions.

The first is to provide a safety wrapper of dma_sync_single_for_cpu of the DMA subsystem. This function can fetch data from nic to memory by a DMA device. Without it, the data from the nic will be random. All the received packages will be dropped. The specific situation can be seen in this issue.

The second is to provide a safe way of accessing the PCI::device. The current draft PR uses a hack of changing the ptr of the device from pub(crate) to pub. It's definitely incorrect. We need a safe interface to do this.

fujita commented

I've not checked but Andreas might have abstractions for the DMA mapping API? The NVME driver surely needs them.
I can't work on this now. I resume the e1000 stuff with abstractions for network device drivers someday but I'll try to work on abstractions for PHY drivers first after the discussion on netdev.