srpwho.d Reports SRP Events on a Remote HCA Port

This simple script produces a report of the remote HCA port and a count of srp events. This is intended to provide a quick summary of srp activity when run on the SRP target server:

#!/usr/sbin/dtrace -s

#pragma D option quiet

dtrace:::BEGIN
{
        printf("Tracing... Hit Ctrl-C to end.\n");
}

srp:::login-command,
srp:::login-response,
srp:::task-command,
srp:::task-response,
srp:::scsi-command,
srp:::scsi-response,
srp:::xfer-start,
srp:::xfer-done
{
        @events[args[0]->ci_remote, probename] = count();
}

dtrace:::END
{
        printf("   %-33s %14s %8s\n", "REMOTE GID", "iSCSI EVENT", "COUNT");
        printa("   %-33s %14s %@8d\n", @events);
}

This output shows the host and the number of iSCSI operations:

# dtrace -s ./srpwho.d
Tracing... Hit Ctrl-C to end.
^C
   REMOTE GID                           iSCSI EVENT    COUNT
   fe80000000000000:0003ba000100386d  login-command        1
   fe80000000000000:0003ba000100386d login-response        1
   fe80000000000000:0003ba0001003851  login-command        2
   fe80000000000000:0003ba0001003851 login-response        2
   fe80000000000000:0003ba0001003852  login-command        2
   fe80000000000000:0003ba0001003852 login-response        2
   fe80000000000000:0003ba0001004d32      xfer-done        9
   fe80000000000000:0003ba0001004d32     xfer-start        9
   fe80000000000000:0003ba0001004d31      xfer-done       18
   fe80000000000000:0003ba0001004d31     xfer-start       18
   fe80000000000000:0003ba0001004d32   scsi-command       22
   fe80000000000000:0003ba0001004d32  scsi-response       22
   fe80000000000000:0003ba0001004d32   task-command       22
   fe80000000000000:0003ba0001004d32  task-response       22
   fe80000000000000:0003ba0001004d31   scsi-command       42
   fe80000000000000:0003ba0001004d31  scsi-response       42
   fe80000000000000:0003ba0001004d31   task-command       42
   fe80000000000000:0003ba0001004d31  task-response       42

The following table describes the command output fields.

Field Description

REMOTE GID

GID of the client HCA port

SRP EVENT

srp event type

COUNT

Number of events traced