Ring Buffer / DMA / MMIO explanation is needed

Thread Starter

Ab Abrams

Joined Apr 27, 2017
25
I am struggling to understand these three concepts.
Can anyone help me please to clarify some things in my mind.

DMA is a hardware component of the motherboard? I mean, perhaps there are motherboards that do not support DMA right? Motherboard specifications tell if supports DMA?
DMA is for transferring data from an I/O device to memory without interrupt CPU?

MMIO is the component that data from an I/O device use the same Address bus with the other programms in the system?
Motherboard's specification defines if it uses a PIO or a MMIO method?

And Ring buffer is a hardware component of a NIC? I mean, a Network interface card defines the capacity and the structure of the Ring buffer? Is not a hardware component of motherboard?

Does anyone knows how these 3 components are connected to each other?

If I am right, I know that the packets are stored in the ring buffer and then through a DMA stored to memory which if is MMIO then is the main physical memory of the system. not a separate kind of memory.

Please help me to understand these parts

Many thanks!
 

Papabravo

Joined Feb 24, 2006
22,058
DMA (Direct Memory Access) is a device that shares the memory bus with the CPU. It does two things very well. It transfers one or more bytes from memory to an IO device by sharing the memory bus with the CPU. It also transfers one or more bytes from an IO device to memory, again by sharing the memory bus with the CPU. DMA is a technique that is much older than motherboards, it was available on hardware extant in the 1950's and 1960's.

MMIO(Memory Mapped Input Output) is just an alternate way of allowing a CPU to talk to hardware devices. The kind of device that resides at an address is completely arbitrary. An advantage of MMIO is that the CPU architecture does not need special instructions to move data to and from a hardware device.

A ring or circular buffer is a section of main memory that is used to store and retrieve data. It normally uses a FIFO (First In First Out) access method. Besides being used by a NIC for packets it can also be used for a serial port for transmitting and receiving characters. In broad terms, the implementation, involves a put pointer, a get pointer, and a count of the number of items in the buffer. When updating the pointers the successor to the last item (the one with the highest address) is the first item (the one with the lowest address). Both poinjters start at the beginning of the buffer and the buffer is empty when the are equal. As soon as you put an item in, the put pointer is advanced to the next location. Now the pointers are unequal and there is data in the buffer. To get the data out you use the get pointer and advance it to the next location, so the pointers are equal again and the buffer is empty.
 
Top