]> git.karo-electronics.de Git - linux-beck.git/commitdiff
scsi-trace: define ZBC_IN and ZBC_OUT
authorHannes Reinecke <hare@suse.de>
Thu, 24 Mar 2016 16:23:56 +0000 (17:23 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 11 Apr 2016 20:57:09 +0000 (16:57 -0400)
Add new trace functions for ZBC_IN and ZBC_OUT.

Reviewed-by: Doug Gilbert <dgilbert@interlog.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_trace.c
include/scsi/scsi_proto.h
include/trace/events/scsi.h

index 76d4e6fd9dc18fd2c330588ab13b37fcadf038bc..0ff083bbf5b1f00b6651fc1f256ab890d533dadb 100644 (file)
@@ -317,6 +317,72 @@ out:
        return ret;
 }
 
+static const char *
+scsi_trace_zbc_in(struct trace_seq *p, unsigned char *cdb, int len)
+{
+       const char *ret = trace_seq_buffer_ptr(p), *cmd;
+       u64 zone_id;
+       u32 alloc_len;
+       u8 options;
+
+       switch (SERVICE_ACTION16(cdb)) {
+       case ZI_REPORT_ZONES:
+               cmd = "REPORT_ZONES";
+               break;
+       default:
+               trace_seq_puts(p, "UNKNOWN");
+               goto out;
+       }
+
+       zone_id = get_unaligned_be64(&cdb[2]);
+       alloc_len = get_unaligned_be32(&cdb[10]);
+       options = cdb[14] & 0x3f;
+
+       trace_seq_printf(p, "%s zone=%llu alloc_len=%u options=%u partial=%u",
+                        cmd, (unsigned long long)zone_id, alloc_len,
+                        options, (cdb[14] >> 7) & 1);
+
+out:
+       trace_seq_putc(p, 0);
+
+       return ret;
+}
+
+static const char *
+scsi_trace_zbc_out(struct trace_seq *p, unsigned char *cdb, int len)
+{
+       const char *ret = trace_seq_buffer_ptr(p), *cmd;
+       u64 zone_id;
+
+       switch (SERVICE_ACTION16(cdb)) {
+       case ZO_CLOSE_ZONE:
+               cmd = "CLOSE_ZONE";
+               break;
+       case ZO_FINISH_ZONE:
+               cmd = "FINISH_ZONE";
+               break;
+       case ZO_OPEN_ZONE:
+               cmd = "OPEN_ZONE";
+               break;
+       case ZO_RESET_WRITE_POINTER:
+               cmd = "RESET_WRITE_POINTER";
+               break;
+       default:
+               trace_seq_puts(p, "UNKNOWN");
+               goto out;
+       }
+
+       zone_id = get_unaligned_be64(&cdb[2]);
+
+       trace_seq_printf(p, "%s zone=%llu all=%u", cmd,
+                        (unsigned long long)zone_id, cdb[14] & 1);
+
+out:
+       trace_seq_putc(p, 0);
+
+       return ret;
+}
+
 static const char *
 scsi_trace_varlen(struct trace_seq *p, unsigned char *cdb, int len)
 {
@@ -373,6 +439,10 @@ scsi_trace_parse_cdb(struct trace_seq *p, unsigned char *cdb, int len)
                return scsi_trace_maintenance_in(p, cdb, len);
        case MAINTENANCE_OUT:
                return scsi_trace_maintenance_out(p, cdb, len);
+       case ZBC_IN:
+               return scsi_trace_zbc_in(p, cdb, len);
+       case ZBC_OUT:
+               return scsi_trace_zbc_out(p, cdb, len);
        default:
                return scsi_trace_misc(p, cdb, len);
        }
index c2ae21cbaa2c14b7fedd432210315a3b661925fb..d1defd1ebd95c6544577638d37d2197b97c94ce1 100644 (file)
 #define VERIFY_16            0x8f
 #define SYNCHRONIZE_CACHE_16  0x91
 #define WRITE_SAME_16        0x93
+#define ZBC_OUT                      0x94
+#define ZBC_IN               0x95
 #define SERVICE_ACTION_BIDIRECTIONAL 0x9d
 #define SERVICE_ACTION_IN_16  0x9e
 #define SERVICE_ACTION_OUT_16 0x9f
 #define MO_SET_PRIORITY       0x0e
 #define MO_SET_TIMESTAMP      0x0f
 #define MO_MANAGEMENT_PROTOCOL_OUT 0x10
+/* values for ZBC_IN */
+#define ZI_REPORT_ZONES              0x00
+/* values for ZBC_OUT */
+#define ZO_CLOSE_ZONE        0x01
+#define ZO_FINISH_ZONE       0x02
+#define ZO_OPEN_ZONE         0x03
+#define ZO_RESET_WRITE_POINTER 0x04
 /* values for variable length command */
 #define XDREAD_32            0x03
 #define XDWRITE_32           0x04
index 5c0d91f16c74ed85eb686babe840fd30e4d7ea52..9a9b3e2550af87e1d8ad2e38a2a700e90c13aa16 100644 (file)
@@ -94,6 +94,8 @@
                scsi_opcode_name(WRITE_16),                     \
                scsi_opcode_name(VERIFY_16),                    \
                scsi_opcode_name(WRITE_SAME_16),                \
+               scsi_opcode_name(ZBC_OUT),                      \
+               scsi_opcode_name(ZBC_IN),                       \
                scsi_opcode_name(SERVICE_ACTION_IN_16),         \
                scsi_opcode_name(READ_32),                      \
                scsi_opcode_name(WRITE_32),                     \