3

I am writing an Ethernet driver. I would like to do it in 2 steps:

  1. write it without DMA (simple memcpy)
  2. rewrite it using DMA.

I would like to ask if it is possible to do it first without using DMA (or is it that the kernel Ethernet framework insist that the driver shall use DMA)?

sourcejedi
  • 3,051
  • 2
  • 24
  • 42
ransh
  • 1,589
  • 4
  • 30
  • 56

1 Answers1

4

Kernel's not stopping you from doing anything. But specifically, I can't see it stopping you from writing skbuffs, nor mapping the device memory.

Honestly you might have most difficulty if you want to find examples of network driver code that doesn't use DMA. If I understand correctly, even Linux netpoll (for crash logging over network) doesn't avoid DMA in the drivers.

I wasn't sure memcpy() would work though...

You need to read your docs (e.g. and specifically). Looks like you need to use memcpy_fromio() and memcpy_toio() on IO memory.

sourcejedi
  • 3,051
  • 2
  • 24
  • 42