a question about DMA (realtek ethernet chip driver)

Chan Kim ckim at etri.re.kr
Wed May 13 06:00:41 EDT 2015


Hi,
I need help in understanding realtek8139 ethernet chip driver. (it's about basic DMA operation)
in http://lxr.free-electrons.com/source/drivers/net/ethernet/realtek/8139cp.c?v=3.4#L707
in cp_start_xmit which is linked to start_xmit of netdev_ops of teh net_device, I see the driver uses dma_map_single to convert the sk_buf's data address to dma_address_t. (physical address). I understand the sk_buf is coming from upper protocol layer.
For an address range to be used as DMA address, it should be physical address and non-cacheable.
Also, during the initialization(cp_init_hw function) dma_alloc_cohererent is called to allocate DMA buffer and this address is written in the driver data (ring_dma), and also this DMA buffer address is written to the chip.
Is the data in sk_buf copied to the DMA ring somewhere? if it is, where in the code is it done?
Is it always like this? (using cacheable memory for sk_buf for speed and copy the data to DMA area and let the I/O chip or DMA controller take the data using DMA). I'm just curious if we don't use non-cacheable memory (DMA buffer) for sk_buf.
Thanks,
Chan Kim



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150513/12c68f5f/attachment.html 


More information about the Kernelnewbies mailing list