At the time of starting the application, by using the APIs provided by driver, it reads the MCDMA capabilities, creates 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, associate the queue to the thread and submit DMA transactions one at a time independently. As part of this, driver updates the tail register of that channel. Update tid ID update, hardware picks up the channel and start DMA operation.
- 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, userspace driver (libmqdma) handles synchronization problems while performing channel management.
As POSIX libraries are being used for thread management, Linux scheduler takes care of scheduling the threads, there is no custom scheduler which takes care of scheduling the threads.
- Reads number of channels from user (-c <num>)
- Reads number of threads from user (-a <num>)
- Calculate number of queues DMA need to perform from one thread
- After every TID update, perfq_app swaps out a queue and swaps in other queue to perform DMA operation.
Did you find the information on this page useful?