Investigating PNET IDs

Red Hat Enterprise Linux 9.2 LPAR mode z/VM guest KVM guest

You can find the PNET IDs for PCIe devices and for CCW group devices in sysfs.

PCIe devices

Use the smc_chk command from the smc-tools package to display PNET IDs. Issue a command of the following form:
# smc_chk -i <interface>
For example:
# smc_chk -i enP10p0s0
PNET5
For more information about the smc_chk command, see smc_chk - Verify SMC setups.

The smc_rnics command, that is part of the smc-tools package, also shows the PNET IDs for PCIe devices.

Alternatively, you can use sysfs. 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, the attribute contains a single PNET ID, because adapters have one PCI device per port.
You can use a command of the following form to read PNET IDs and convert them to ASCII:
# cat /sys/bus/pci/devices/<function_address>/util_string | iconv -f IBM-1047 -t ASCII

In the command, /sys/bus/pci/devices/<function_address> represents the PCI device in sysfs.

Example:
# cat /sys/bus/pci/devices/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, with 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

Use the smc_chk command to display PNET IDs of CCW group devices. Issue a command of the following form:
# smc_chk -i <interface>
For example:
# smc_chk -i encb1f0
NET1
For more information about the smc_chk command, see smc_chk - Verify SMC setups.

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, the PNET IDs of CCW group devices can be read, in EBCDIC format, as the value of the util_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. For 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 line.
  • 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