RoCEv2Server
For conceptual usage, see:
Implementation
This Python API is implemented directly in PyRogue. It is a thin
pyrogue.Device wrapper that owns a Boost.Python-exported
rogue.protocols.rocev2.Server (see
Server) and adds the
surf.ethernet.roce._RoceEngine.RoceEngine child device for the
FPGA-side metadata-bus handshake.
The 15 LocalVariable status/configuration fields (FpgaIp,
FpgaGid, HostQpn, HostGid, MrAddr, MrRkey,
RxFrameCount, RxByteCount, ConnectionState, MaxPayload,
RxQueueDepth, HostRqPsn, HostSqPsn, FpgaQpn,
FpgaLkey) are auto-rendered by autoclass below from the
docstrings in python/pyrogue/protocols/_RoCEv2.py.
- class pyrogue.protocols.RoCEv2Server(*, ip, deviceName, ibPort=1, gidIndex=0, maxPayload=9000, rxQueueDepth=256, roceEngineOffset=0, roceMemBase=None, roceEngine=None, pmtu=5, minRnrTimer=31, rnrRetry=7, retryCount=3, pollInterval=1, **kwargs)[source]
RoCEv2 RC receive server — pyrogue Device.
Mirrors the interface of UdpRssiPack so the two can be used interchangeably inside a Root.
- Parameters:
ip (
str) – FPGA IP address. Used to derive the FPGA GID (IPv4-mapped IPv6).deviceName (
str) – ibverbs device name (e.g. ‘rxe0’ for softRoCE, ‘mlx5_0’ for HW NIC).ibPort (
int, default:1) – ibverbs port number (default: 1).gidIndex (
int, default:0) – GID table index for the host NIC’s RoCEv2 IPv4 address.maxPayload (
int, default:9000) – Maximum bytes per RDMA WRITE (default: 9000).rxQueueDepth (
int, default:256) – Number of pre-posted receive slots (default: 256).roceEngineOffset (
int, default:0) – AXI-lite offset of the RoCEv2 engine register block.roceMemBase (object) – memBase for the RoceEngine child device (the SRP object).
roceEngine (object) – Pass an existing RoceEngine instance to avoid duplicate address mapping. When set, no child RoceEngine device is created.
pmtu (
int, default:5) – Path MTU enum: 1=256 2=512 3=1024 4=2048 5=4096 (default: 5).minRnrTimer (
int, default:31) – IB-spec RNR NAK timer code embedded in the QP attributes on RTR. 1=0.01ms, 14=1ms, 18=4ms, 22=16ms, 31=491ms (default: 31).rnrRetry (
int, default:7) – FPGA QP RNR retry count. 7 means “retry indefinitely” (default: 7).retryCount (
int, default:3) – FPGA QP retry count for non-RNR transport errors (default: 3).pollInterval (
int, default:1) – Poll interval in seconds for status variables (default: 1).
- property stream
Direct access to the C++ stream master — receives every channel the FPGA emits. Use
getChannel(n)instead to get a filtered view of a single RDMA-immediate channel id (the per-channel analogue ofUdpRssiPack.application(n)).
- getChannel(channel)[source]
Return a channel-filtered view (channel id from immediate value bits [7:0]).
The RDMA WRITE-with-Immediate carries the channel id in the low 8 bits of the immediate value (Server.cpp runThread decodes wc.imm_data & 0xFF), so valid channel ids are 0..255. Out-of- range values would previously blow up with OverflowError inside the Filter ctor — validate up front and raise a clear rogue.GeneralError instead.
- Parameters:
channel (int)
- teardownFpgaQp()[source]
Tear down the FPGA QP via the metadata bus. Called explicitly from Root.stop() before the transport is torn down.
- Return type:
- addCustomBlock(block)
Add a pre-defined memory block to the device.
- addInterface(*interfaces)
Add stream or memory interfaces to manage.
- addNode(nodeClass, **kwargs)
Construct and add a node of
nodeClass.
- addNodes(nodeClass, number, stride, **kwargs)
Add a series of nodes with indexed names.
- addProtocol(*protocols)
Add protocol entities (alias of
addInterface).
- addRemoteVariables(number, stride, pack=False, **kwargs)
Add a repeating block of remote variables.
- Parameters:
number (
int) – Number of variables to add.stride (
int) – Byte stride between instances.pack (
bool, default:False) –If True, also add a
LinkVariablenamed<name>_Allwhich combines all entries into one underscore-delimited display string.The indexed
RemoteVariablecontainer remains available at the originalname. The packed alias uses each element variable’sgetDisp()andsetDisp()behavior, so formatting follows the underlying variable type. Values are joined in reverse index order: for a variable arrayField[0],Field[1],Field[2], the packed valueField_Allreads likeField[2]_Field[1]_Field[0]and writing"1_2_3"updatesField[2] = 1,Field[1] = 2, andField[0] = 3.This is intended for orthogonal register fields that are convenient to expose both as individual variables and as one combined value.
**kwargs (
Any) – Arguments forwarded toRemoteVariable.
- Return type:
- addToGroup(group)
Add this node to a group and propagate to children.
- callRecursive(func, nodeTypes=None, **kwargs)
Call a named method on this node and matching children.
- checkBlocks(*, recurse=True, variable=None, **kwargs)
Deprecated alias for
waitBlocks().
- classmethod classLogName()
Return the canonical Python logger name for this Node class.
- Return type:
- command(**kwargs)
Decorator to add inline methods as commands.
The decorated function is used as
LocalCommand(function=...). The command wrapper supplies keyword argumentsroot,dev,cmd, andarg; the function may accept any subset.
- property commands: OrderedDict[str, BaseCommand]
Return direct child commands.
- commandsByGroup(incGroups=None, excGroups=None)
Return commands filtered by group.
- Return type:
- Parameters:
- property devices: OrderedDict[str, Device]
Return direct child devices.
- devicesByGroup(incGroups=None, excGroups=None)
Return devices filtered by group.
- enableChanged(value)
Hook for reacting to enable state changes.
- filterByGroup(incGroups, excGroups)
Return True if the node passes include/exclude filters.
- find(*, recurse=True, typ=None, **kwargs)
Find all child nodes that are a base class of ‘typ’ and whose properties match all of the kwargs. For string properties, accepts regexes.
- property forceCheckEach: bool
Deprecated alias for
forceWaitEach.
- genDocuments(path, incGroups=None, excGroups=None)
Generate Sphinx documentation pages for this device.
- getNodes(typ, excTyp=None, incGroups=None, excGroups=None)
Get a filtered ordered dictionary of nodes. pass a class to typ to receive a certain type of node exc is a class type to exclude, incGroups is an optional group or list of groups that this node must be part of excGroups is an optional group or list of groups that this node must not be part of
- Parameters:
- Returns:
Ordered dictionary of nodes.
- Return type:
- getYaml(readFirst=False, modes=['RW', 'RO', 'WO'], incGroups=None, excGroups=None, recurse=True)
Return current values as YAML text.
- Parameters:
readFirst (
bool, default:False) – If True, perform a full hardware read before exporting.modes (
list[str], default:['RW', 'RO', 'WO']) – Variable modes to include. Allowed values are'RW','WO', and'RO'.incGroups (
str|list[str] |None, default:None) – Group name or group names to include.excGroups (
str|list[str] |None, default:None) – Group name or group names to exclude.recurse (
bool, default:True) – If True, recurse into child devices.
- Returns:
YAML-formatted representation of the node subtree.
- Return type:
Return True if the node is hidden.
- hideVariables(hidden, variables=None)
Hide a list of variables or variable names.
- inGroup(group)
Return True if the node is in the provided group or groups.
- isinstance(typ)
Return True if this node is an instance of
typ.
- linkVariableGet(**kwargs)
Decorator to add inline
linkedGetfunctions.The decorated function is used as
LinkVariable(linkedGet=...). The linked-get wrapper supplies keyword argumentsdev,var,read,index, andcheck; the function may accept any subset.
- loadYaml(name, writeEach, modes, incGroups=None, excGroups=None)
Load YAML configuration from files or directories.
- Parameters:
name (
str|list[str]) – Input file, directory, zip-path, or list of those entries.writeEach (
bool) – Write each variable as it is applied.modes (
list[str]) – Variable modes to include. Allowed values are'RW','WO', and'RO'.incGroups (
str|list[str] |None, default:None) – Group name or group names to include.excGroups (
str|list[str] |None, default:None) – Group name or group names to exclude.
- Returns:
Returns
Truewhen load completes.- Return type:
- makeRecursive(func, nodeTypes=None)
Create a recursive wrapper for a named method.
- manage(*interfaces)
Manage additional interfaces for start/stop.
- node(name)
Return a direct child node by name.
- nodeMatch(name)
Match a node name, including array-style accessors.
- property nodes: OrderedDict[str, Node]
Return an ordered dictionary of direct child nodes.
- printYaml(readFirst=False, modes=['RW', 'RO', 'WO'], incGroups=None, excGroups=None, recurse=False)
Print the YAML representation to stdout.
- Parameters:
readFirst (
bool, default:False) – If True, perform a full hardware read before exporting.modes (
list[str], default:['RW', 'RO', 'WO']) – Variable modes to include. Allowed values are'RW','WO', and'RO'.incGroups (
str|list[str] |None, default:None) – Group name or group names to include.excGroups (
str|list[str] |None, default:None) – Group name or group names to exclude.recurse (
bool, default:False) – If True, recurse into child devices.
- Return type:
- readAndCheckBlocks(recurse=True, variable=None, checkEach=None, *, waitEach=None)
Deprecated alias for
readAndWaitBlocks().
- readAndWaitBlocks(recurse=True, variable=None, waitEach=None, *, checkEach=None)
Read blocks and wait for read transactions to complete.
- Parameters:
recurse (
bool, default:True) – If True, recurse into child devices.variable (
Any|None, default:None) – Optional variable to read.waitEach (
bool|None, default:None) – Wait for each block transaction before starting the next one.checkEach (
bool|None, default:None) – Deprecated alias forwaitEach.
- Return type:
- readBlocks(*, recurse=True, variable=None, waitEach=None, checkEach=None, index=-1, **kwargs)
Read blocks in the background.
- Parameters:
recurse (
bool, default:True) – If True, recurse into child devices.variable (
Any|None, default:None) – Optional variable to read.waitEach (
bool|None, default:None) – Wait for each block transaction before starting the next one.checkEach (
bool|None, default:None) – Deprecated alias forwaitEach.index (
int, default:-1) – Optional index for array variables.**kwargs (
Any) – Additional arguments passed through to the transaction.
- Return type:
- removeFromGroup(group)
Remove this node from a group.
- saveYaml(name, readFirst, modes=['RW', 'RO', 'WO'], incGroups=None, excGroups=None, autoPrefix='', autoCompress=False)
Save YAML configuration or status to a file.
- Parameters:
name (
str|None) – Destination file path. If empty, a timestamped name is generated.readFirst (
bool) – Read values from hardware before exporting.modes (
list[str], default:['RW', 'RO', 'WO']) – Variable modes to include. Allowed values are'RW','WO', and'RO'.incGroups (
str|list[str] |None, default:None) – Group name or group names to include.excGroups (
str|list[str] |None, default:None) – Group name or group names to exclude.autoPrefix (
str, default:'') – Prefix for auto-generated filenames.autoCompress (
bool, default:False) – Generate a.zipfile when auto-generating names. Default False
- Returns:
Returns
Truewhen export completes.- Return type:
- classmethod setClassLogLevel(level, *, includePython=True, includeRogue=True)
Set the logging level for this Node class logger family.
- setLogLevel(level, *, includePython=True, includeRogue=True)
Set the logging level for this Node instance logger.
- setName((Slave)arg1, (str)arg2) None :
- C++ signature :
void setName(rogue::interfaces::memory::Slave {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
- setPollInterval(interval, variables=None)
Set the poll interval for a group of variables.
- setYaml(yml, writeEach, modes, incGroups=None, excGroups=None)
Set variable values from YAML text.
- Parameters:
yml (
str) – YAML text containing values to apply.writeEach (
bool) – Write each variable as it is applied.modes (
list[str]) – Variable modes to include. Allowed values are'RW','WO', and'RO'.incGroups (
str|list[str] |None, default:None) – Group name or group names to include.excGroups (
str|list[str] |None, default:None) – Group name or group names to exclude.
- Return type:
- property variableList: list[BaseVariable]
Return a recursive list of variables and commands.
- property variables: OrderedDict[str, BaseVariable]
Return direct child variables (excluding commands).
- variablesByGroup(incGroups=None, excGroups=None)
Return variables filtered by group.
- Return type:
- Parameters:
- verifyBlocks(*, recurse=True, variable=None, waitEach=None, checkEach=None, **kwargs)
Verify blocks in the background.
- Parameters:
recurse (
bool, default:True) – If True, recurse into child devices.variable (
Any|None, default:None) – Optional variable to verify.waitEach (
bool|None, default:None) – Wait for each block transaction before starting the next one.checkEach (
bool|None, default:None) – Deprecated alias forwaitEach.**kwargs (
Any) – Additional arguments passed through to the transaction.
- Return type:
- waitBlocks(*, recurse=True, variable=None, **kwargs)
Wait for block transactions and notify variable listeners.
- writeAndVerifyBlocks(force=False, recurse=True, variable=None, checkEach=None, *, waitEach=None)
Write, verify, and wait for block transactions to complete.
- Parameters:
force (
bool, default:False) – Force the write even if values are unchanged.recurse (
bool, default:True) – If True, recurse into child devices.variable (
Any|None, default:None) – Optional variable to write/verify.waitEach (
bool|None, default:None) – Wait for each block transaction before starting the next one.checkEach (
bool|None, default:None) – Deprecated alias forwaitEach.
- Return type:
- writeBlocks(*, force=False, recurse=True, variable=None, waitEach=None, checkEach=None, index=-1, **kwargs)
Write all blocks held by this device.
- Parameters:
force (
bool, default:False) – Force the write even if values are unchanged.recurse (
bool, default:True) – If True, recurse into child devices.variable (
Any|None, default:None) – Optional variable to write.waitEach (
bool|None, default:None) – Wait for each block transaction before starting the next one.checkEach (
bool|None, default:None) – Deprecated alias forwaitEach.index (
int, default:-1) – Optional index for array variables.**kwargs (
Any) – Additional arguments passed through to the transaction.
- Return type: