220.127.116.11.1. Build and Install Netdev Driver 18.104.22.168.2. Enable VFs if SRIOV is Supported 22.214.171.124.3. Configure the Number of Channels Supported on the Device 126.96.36.199.4. Configure the MTU Value 188.8.131.52.5. Configure the Device Communication 184.108.40.206.6. Configure Transmit Queue Selection Mechanism 220.127.116.11.7. Test Procedure by Using Name Space Environment 18.104.22.168.8. PIO Test
3.3.3. Example Testbench Flow for DMA Test with Avalon-ST Packet Generate/Check Design Example
The DMA testbench for the Avalon-ST Packet Generate/Check design example demonstrates the following two major tasks:
- Host-to-Device: Transferring packets stored in the host memory to the Packet Checker in the design example user logic, where a checker module verifies the integrity of the packet
- Device-to-Host: Packets generated from a Generator module are transferred to the host memory where the host checks the packet integrity
Note: This testbench implements transfer of one packet with length of 4096 bytes.
The DMA testbench for the design example completes the following tasks
- Set up 4096 bytes of incrementing data pattern for testing data movement from the host to the device and then back to the host.
- Write the expected packet length value (4096 bytes) to the Packet Generation and Checker in the design example user logic through the PIO. This value is used by the Packet checker module for testing packet integrity.
- MSI-X is enabled and configured for launching a memory write to signal the end of each descriptor’s DMA transaction. Write-Back function is kept disabled for the simulation.
- Set up the H2D (Host-to-Device) queue in the Multi Channel DMA.
- Set up three H2D descriptors in the host memory, with the source address pointing to the incrementing data pattern locations in the host memory. The start of packet (SOF) and end of packet (EOF) markers along with packet length are indicated in the descriptors.
- At the last step of the Queue programming, the Multi Channel DMA tail pointer register is written, which triggers the Multi Channel DMA to start the H2D DMA transaction.
- The previous step instructs the H2D Data Mover to fetch the descriptors from the host memory.
- The Multi Channel DMA H2D Data Mover reads the data from the host memory and forwards the packet to the Packet Generator and Checker through the AVST Streaming interface.
- The checker module receives the packet and checks for integrity by testing the data pattern, length as expected and proper receipt of the “end of packet” marker. If the packet is found to be proper, the good packet count is incremented by 1 else the bad packet count is incremented.
- The testbench does a PIO read access of the Good Packet Count and Bad Packet Count registers and displays the test success or failure status.
- MSI-X write commands are triggered for every description or completion which are checked by the testbench for proper receipt.
- Next, set up the D2H (Device-to-Host) Queue.
- Setup three D2H descriptors in the host memory, with the destination address pointing to a new address space in host memory which is pre-filled with all zeroes.
- At the last step of the Queue programming, the Multi Channel DMA tail pointer register is written, which triggers the Multi Channel DMA to start the D2H DMA transaction.
- The previous step instructs the H2D Data Mover to fetch the descriptors from the host memory to start the D2H DMA transaction.
- The Multi Channel DMA D2H Data Mover reads the incoming packet from the Packet Generator and writes the data to the host memory according to the descriptors fetched in the previous step.
- MSI-X write commands are triggered for every description completion which are checked by the testbench for proper receipt.
- Compares the data written back to the system memory in D2H task with the standard incrementing pattern and declare test success/failure.
The simulation reports Simulation stopped due to successful completion if no errors occur.