用于 PCI Express* 的 英特尔® FPGA R-tile Avalon® Streaming IP设计实例用户指南

ID 683544
日期 4/10/2023
Public
文档目录

2.7.2. 运行SR-IOV设计实例

按照以下步骤在硬件上测试SR-IOV设计实例:
  1. 浏览到设计实例目录下的./software/user/example
  2. 运行以下命令,编译设计实例应用程序:

    make

    然后执行以下步骤:

    1. 运行以下命令以运行链路测试应用程序:

      sudo ./intel_fpga_pcie_link_test

    2. 选择Option 1: Manually Select the Device
    3. 键入虚拟功能已分配Physical Function的BDF。
    4. 键入BAR 0开始测试菜单。
      **********************************************************
      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. 键入Option 7使能当前器件的SR-IOV。
    6. 键入当前器件中要被使能的虚拟功能的编号16
      *********************************************************
       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. 键入Option 8执行对物理功能内每个已分配并已使能的虚拟功能的链路测试。链路测试应用程序以每个数据的单个dword执行100次存储器写然后读回数据。测试结束时,应用程序打印测试中失败的虚拟功能的编号。
      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. 推出应用并运行命令

      lspci -d 1172: | grep -c Altera

      以验证PFs和VFs枚举。预期结果是PFs和VFs的和。

      为避免仅使能一个物理功能的16 VFs,您应该已经看到报告的18个器件,PF0的2个PFs + 16个VFs。您还可以对设计实例中包含的第二个功能重复同样的处理,这样就将看到总共报告34个器件,2个PFs + 32个VFs。

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