Page MenuHomeFreeBSD

NTB Tool: Test driver for NTB hardware drivers.
ClosedPublic

Authored by babupalit_gmail.com on Jan 11 2019, 10:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 1:16 PM
Unknown Object (File)
Thu, Dec 5, 11:14 PM
Unknown Object (File)
Wed, Dec 4, 12:49 AM
Unknown Object (File)
Nov 21 2024, 7:21 AM
Unknown Object (File)
Nov 21 2024, 6:41 AM
Unknown Object (File)
Nov 10 2024, 10:24 PM
Unknown Object (File)
Nov 10 2024, 1:56 AM
Unknown Object (File)
Nov 10 2024, 1:56 AM
Subscribers

Details

Summary

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 dev.ntb_tool.0.link=Y
root@local# sysctl dev.ntb_tool.0.link=N

Check if link with peer device is up/down:

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

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

This revision was not accepted when it landed; it landed in state Needs Review.Aug 16 2019, 8:14 PM
This revision was automatically updated to reflect the committed changes.

Looking through the code (sorry for enormous delay), I found significant number of random issues. That is why I made some efforts to clean up the code as I see fit, not rewriting it too much, but making it build on amd64 and i386 and quickly testing functionality. If you have any objections or improvements, I'll happily discuss them.

Hi @mav , give me sometime, I will look into the code. Analyze and get back to you.