R-Tile Avalon® Streaming Intel® FPGA IP for PCI Express* Design Example User Guide

ID 683544
Date 7/08/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

2.7.2. Running the SR-IOV Design Example

Follow the steps below to test the SR-IOV design example on hardware:
  1. Navigate to ./software/user/example under the design example directory.
  2. Compile the design example application by running the command:

    make

    Then perform the following steps:

    1. Run the link test application by running the command:

      sudo ./intel_fpga_pcie_link_test

    2. Select Option 1: Manually Select the Device
    3. Enter the BDF of the Physical Function for which the virtual functions are allocated.
    4. Enter BAR 0 to proceed to the test menu.
      **********************************************************
      Intel FPGA PCIe Link Test
      Version 2.0
      0: Automatically select a device
      1: Manually select a device
      *********************************************************
      > 1
      Enter bus number, in hex:
      > 38
      Enter device number, in hex:
      > 0
      Enter function number, in hex:
      > 0
      BDF is 0x3800
      B:D.F, in hex, is 38:0.0
      Enter BAR number (-1 for none):
      > 0
      Opened a handle to BAR 0 of a device with BDF 0x3800
      
      *********************************************************
      0: Link test - 100 writes and reads
       1: Write memory space
       2: Read memory space
       3: Write configuration space
       4: Read configuration space
       5: Change BAR for PIO
       6: Change device
       7: Enable SRIOV
       8: Do a link test for every enabled virtual function
          belonging to the current device
       9: Quit program
      *********************************************************
      > 
    5. Enter Option 7 to enable SR-IOV for the current device.
    6. Enter 16 as the number of virtual functions to be enabled for the current device.
      *********************************************************
       0: Link test - 100 writes and reads
       1: Write memory space
       2: Read memory space
       3: Write configuration space
       4: Read configuration space
       5: Change BAR for PIO
       6: Change device
       7: Enable SRIOV
       8: Do a link test for every enabled virtual function
          belonging to the current device
       9: Quit program
      *********************************************************
      > 7
      Enter the number of VFs to enable for the current device (0-31):
      > 16
      Enabled 16 VFs.
      Type 'lspci -d 1172:' in a new terminal to determine newly enabled devices' BDFs.
      [root@localhost ~]# lspci -d 1172:
      38:00.0 Unassigned class [ff00]: Altera Corporation Device 0000 (rev 01)
      38:00.2 Unassigned class [ff00]: Altera Corporation Device 0000
      38:00.3 Unassigned class [ff00]: Altera Corporation Device 0000
      38:00.4 Unassigned class [ff00]: Altera Corporation Device 0000
      38:00.5 Unassigned class [ff00]: Altera Corporation Device 0000
      38:00.6 Unassigned class [ff00]: Altera Corporation Device 0000
      38:00.7 Unassigned class [ff00]: Altera Corporation Device 0000
      38:01.0 Unassigned class [ff00]: Altera Corporation Device 0000
      38:01.1 Unassigned class [ff00]: Altera Corporation Device 0000
      38:01.2 Unassigned class [ff00]: Altera Corporation Device 0000
      38:01.3 Unassigned class [ff00]: Altera Corporation Device 0000
      38:01.4 Unassigned class [ff00]: Altera Corporation Device 0000
      38:01.5 Unassigned class [ff00]: Altera Corporation Device 0000
      38:01.6 Unassigned class [ff00]: Altera Corporation Device 0000
      38:01.7 Unassigned class [ff00]: Altera Corporation Device 0000
      38:02.0 Unassigned class [ff00]: Altera Corporation Device 0000
      38:02.1 Unassigned class [ff00]: Altera Corporation Device 0000
    7. Enter Option 8 to perform a link test for every enabled virtual function allocated within the physical function. The link test application performs 100 memory writes with a single dword of data each and then reads back the data. At the end of the testing, the application prints the number of virtual functions that failed the test.
      Testing VF with BDF 0x380d...
      Doing 100 writes and 100 reads..
      Number of write errors:       0
      Number of read errors:        0
      Number of dword mismatches:   0
      Testing VF with BDF 0x380e...
      Doing 100 writes and 100 reads..
      Number of write errors:       0
      Number of read errors:        0
      Number of dword mismatches:   0
      Testing VF with BDF 0x380f...
      Doing 100 writes and 100 reads..
      Number of write errors:       0
      Number of read errors:        0
      Number of dword mismatches:   0
      Testing VF with BDF 0x3810...
      Doing 100 writes and 100 reads..
      Number of write errors:       0
      Number of read errors:        0
      Number of dword mismatches:   0
      Testing VF with BDF 0x3811...
      Doing 100 writes and 100 reads..
      Number of write errors:       0
      Number of read errors:        0
      Number of dword mismatches:   0
      Test failed for 0 VFs out of 16 VFs
    8. Exit the application and run the command

      lspci -d 1172: | grep -c Altera

      to verify the enumeration of PFs and VFs. The expected result is the sum of PFs and VFs.

      In case you enable the 16 VFs for only one of the physical functions, you would have 18 devices reported, 2 PFs + 16 VFs of PF0. You can also repeat the same process for the second function included in the design example and you would have a total of 34 devices reported, 2 PFs + 32 VFs.

      [root@localhost ~]# lspci -d 1172: | grep -c Altera