Page MenuHomeFreeBSD

NTB Tool: Test driver for NTB hardware drivers.
Needs ReviewPublic

Authored by on Jan 11 2019, 10:10 AM.


Group Reviewers
Core Team

NTB Tool driver is meant for testing NTB hardware driver functionalities. NTB Tool driver can test functionalities like doorbell interrupts, link events, scratchpad registers, memory window.

This is a port of ntb_tool driver from linux and this has been verified on top of AMD NTB HW driver.

Test Plan

To test ntb_tool driver first load ntb core driver and ntb_hw driver and then load ntb_tool driver.

  1. kldload ntb.ko
  2. kldload ntb_hw_amd/ntb_hw_amd.ko
  3. kldload ntb_tool/ntb_tool.ko

To check ntb port information:

Get local device port number

root@local# sysctl dev.ntb_tool.0.port

Check peer device port number

root@local# sysctl dev.ntb_tool.0.peer0.port

To tests doorbell:

Set/clear/get local doorbell mask

root@local# sysctl dev.ntb_tool.0.db_mask="s 0x1"
root@local# sysctl dev.ntb_tool.0.db_mask="c 0x1"
root@local# sysctl dev.ntb_tool.0.db_mask

Poll until local doorbell is set with the specified db bits

root@local# dev.ntb_tool.0.db_event=0x1

Ring/clear/get peer doorbell

root@local# sysctl dev.ntb_tool.0.peer_db="s 0x1"
root@local# sysctl dev.ntb_tool.0.peer_db="c 0x1"
root@local# sysctl dev.ntb_tool.0.peer_db

clear/get local doorbell

root@local# sysctl dev.ntb_tool.0.db="c ox1"
root@local# sysctl dev.ntb_tool.0.db

To tests link related events:

Set local link up/down

root@local# sysctl
root@local# sysctl

Check if link with peer device is up/down:

root@local# sysctl

Poll until the link specified as up/down. For up, value needs to be set

depends on peer index, i.e., for peer0 it is 0x1 and for down, value needs
to be set as 0x0.
root@local# sysctl dev.ntb_tool.0.peer0.link_event=0x1
root@local# sysctl dev.ntb_tool.0.peer0.link_event=0x0

To tests scratchpad registers:

Write/read to/from local scratchpad register #0

root@local# sysctl dev.ntb_tool.0.spad0=0x1023457
root@local# sysctl dev.ntb_tool.0.spad0

Write/read to/from peer scratchpad register #0

root@local# sysctl dev.ntb_tool.0.peer0.spad0=0x01020304
root@local# sysctl dev.ntb_tool.0.peer0.spad0

To tests memory window:

Create memory window buffer of specified size/get its dma address

root@local# sysctl dev.ntb_tool.0.peer0.mw_trans0=16384
root@local# sysctl dev.ntb_tool.0.peer0.mw_trans0

Write/read data to/from inbound memory window with specific pattern/random

root@local# sysctl dev.ntb_tool.0.peer0.mw0="W offset 0 nbytes 100 pattern ab"
root@local# sysctl dev.ntb_tool.0.peer0.mw0="R offset 0 nbytes 100"

Write/read data to/from outbound memory window on the local device with

specific pattern/random (on peer device)
root@local# sysctl dev.ntb_tool.0.peer0.peer_mw0="W offset 0 nbytes 100 pattern ab"
root@local# sysctl dev.ntb_tool.0.peer0.peer_mw0="R offset 0 nbytes 100"

Diff Detail

rS FreeBSD src repository
Lint Skipped
Unit Tests Skipped

Event Timeline

@mav : Reminder to please review this changes when you get a chance. Thanks.