GTS AXI Multichannel DMA IP for PCI Express* User Guide
B.1.3. Application
At the time of starting the application, by using the APIs provided by the driver, it reads the MCDMA capabilities, creates the application context, open BAR registers, initializes the PCI Express functions. At the time of termination, it clears the application context and stops all the channels.
Multi-threading with Multiple Channels
Based on the input parameters, the application starts multiple threads with posix thread APIs, associates the queue to the thread and submits DMA transactions one at a time independently. As part of this, the driver updates the tail register of that channel. Update tid ID update, hardware picks up the channel and start the DMA operation.
Each thread performs the following tasks:
- Get the device context based on BDF (Bus Device Function).
- Acquire the available channel.
- Get DMA capable memory.
- Start DMA operation.
- Release the channel.
As multiple threads can try to grab and release the channel at a time, the user space driver (libmqdma) handles synchronization problems while performing channel management.
Scheduling Threads
As POSIX libraries are being used for thread management, the Linux scheduler takes care of scheduling the threads. There is no custom scheduler to take care of scheduling the threads.
perfq_app schedules multiple queues on single threads for DMA operations.
- Reads the number of channels from user (-c <num>).
- Reads the number of threads from user (-a <num>).
- Calculate the number of queues DMA needs to perform from one thread.
- After every TID update, perfq_app swaps out a queue and swaps in the other queue to perform DMA operation.