Investigating PNET IDs
![]()
You can find the PNET IDs for PCIe devices and for CCW group devices in sysfs.
PCIe devices
The PNET IDs of PCI devices can be read, in EBCDIC format, as the value of the
util_string attribute of the device in sysfs. If the PCIe device
is connected through a RoCE adapter, the contents of the util_string attribute
depends on the adapter:- On RoCE Express adapters, the attribute contains two PNET IDs as fixed 16-character blocks in sequence.
- On RoCE Express2 adapters have one PCI device per port, and the attribute contains a single PNET ID.
# cat /sys/devices/pci<function_name>/<function_address>/util_string | iconv -f IBM-1047 -t ASCII
In the command,
/sys/devices/pci<function_name>/<function_address>
represents the PCI device in sysfs.
Alternatively, use the smc_rnics command that is part of the smc-tools package.
Example:
# cat /sys/devices/pci0000:00/0000:00:00.0/util_string | iconv -f IBM-1047 -t ASCII
NET1
The PNET ID of the example is NET1. If there is no command output or if the
output is blank, no PNET ID is assigned to the device.
Alternatively, using
smc_rnics:
# smc_rnics
FID Power PCI_ID PCHID Type PPrt PNET_ID Net-Dev
-----------------------------------------------------------------------------------------
8ca 1 0002:00:00.0 01c8 RoCE_Express2 0 NET1 enP2p0s0np0
8ea 1 0003:00:00.0 01c8 RoCE_Express2 1 NET2 enP3p0s0np0
...
CCW group devices
The PNET IDs of CCW group devices can be read, in EBCDIC format, as the value of theutil_string of the corresponding channel path ID in
sysfs. For adapters with multiple ports, the PNET IDs are given in sequential
16-character blocks corresponding to the ports. To find the channel path ID of a CCW group
device, read its chpid attribute in sysfs.Example:
# cat cat /sys/bus/ccwgroup/devices/0.0.b1f0/chpid
4a
To find the PNET IDs issue a command of this
form:
# cat /sys/devices/css0/chp0.<chpid>/util_string | iconv -f IBM-1047 -t ASCII
where
<chpid> is the channel path ID.Example:
# cat /sys/devices/css0/chp0.4a/util_string | iconv -f IBM-1047 -t ASCII
NET1
The PNET ID of the example is NET1. If there is no command output or
if the output is blank, no PNET ID is assigned to the device.
Tips
- The output of the iconv command does not have a trailing line break, so
displayed PNET IDs are followed by a command prompt. Pipe the output to a suitable
sed command, for example
sed 's/$/\n/', to display the PNET IDs on a separate linedonknow. - Use the following command to display a list of all CCW devices and their PNET
IDs:
# for device in `ls -1 /sys/bus/ccwgroup/devices`; do chpid=`cat /sys/bus/ccwgroup/devices/$device/chpid | tr [A-F] [a-f]`; pnetid="`cat /sys/devices/css0/chp0.$chpid/util_string | iconv -f IBM-1047 -t ASCII | sed 's/^/ /'`"; echo " device: $device chpid: $chpid pnetID: $pnetid"; done