[Solved] what’s the point of DMA proxy. Or can we use kernel data structures in userspace which makes no sense


What’s the point of all of this for example if I am looking at NIC card, then whatever I suppose to get with the mmap call in Userspace application and Kernel implementation of MMAP in proxy driver will have kernel data structure.

What do kernel data structures have to do with it? If you are using DMA to get data from a NIC then surely you are getting raw data (ethernet frames, for example). The layout of such data is defined by the applicable network protocol and whatever higher-level protocols apply to the payload.

The kernel sources do define C structure types whose layouts map the fields of ethernet headers, IP headers, TCP headers, etc, but these follow the externally-defined layout of the data, not the other way around.

in case of NIC card the RX/TX will be the device specific data structures representation in kernel memory space

The formats of network transmissions are not device-specific (generally speaking).

since geting struct ethhdr / struct iphdr / struct tcphdr / etc. from return of mmap is not possible since the above paragraph from thesis says conversion of virtual addresses to Userspace addresses is probably not possible (basically it says physical address. I am assuming this from the text read)

Irrelevant (see above). Nevertheless, the quoted thesis excerpt says nothing at all like what you describe. It’s not talking about user space versus kernel space at all, but rather about hardware programming interfaces vs kernel code. It is expressing some of the complications involved in writing (kernel-space) drivers.

how can the return of mmap calls be used in applications

The driver provides an interface to userspace in the form of a character device. Mmapping an appropriate range of bytes from that device into a program’s memory space provides access to whatever data the driver exposes that way. In the case of an interface for DMA, that would presumably be the contents of the (physical) memory involved in the DMA transfer.

4

solved what’s the point of DMA proxy. Or can we use kernel data structures in userspace which makes no sense