Investigating PNET IDs

6.10 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

The PNET ID of PCI devices can be read, in EBCDIC format, as the value of the util_string attribute of the device in sysfs. You can use a command of the following form to read a PNET ID and convert it 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.

CCW group devices

The PNET ID 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. To find the channel path ID of a CCW group device, read its chpid attribute in sysfs.
Example:
# cat /sys/bus/ccwgroup/devices/0.0.b1f0/chpid
4a
To find the PNET ID 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 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