nvmet: add tracing of authentication commands
authorGuixin Liu <kanie@linux.alibaba.com>
Wed, 28 Feb 2024 08:37:54 +0000 (16:37 +0800)
committerKeith Busch <kbusch@kernel.org>
Fri, 8 Mar 2024 14:58:20 +0000 (06:58 -0800)
Add nvme_fabrics_type_auth_send and nvme_fabrics_type_auth_receive
to the nvme target's tracing facility.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/trace.c

index 6ee1f3db81d04071e761b39640e573c9770aa32f..ca537fae37300047f30069143426ce1c65ed22ea 100644 (file)
@@ -176,6 +176,34 @@ static const char *nvmet_trace_fabrics_property_get(struct trace_seq *p,
        return ret;
 }
 
+static const char *nvmet_trace_fabrics_auth_send(struct trace_seq *p, u8 *spc)
+{
+       const char *ret = trace_seq_buffer_ptr(p);
+       u8 spsp0 = spc[1];
+       u8 spsp1 = spc[2];
+       u8 secp = spc[3];
+       u32 tl = get_unaligned_le32(spc + 4);
+
+       trace_seq_printf(p, "spsp0=%02x, spsp1=%02x, secp=%02x, tl=%u",
+                        spsp0, spsp1, secp, tl);
+       trace_seq_putc(p, 0);
+       return ret;
+}
+
+static const char *nvmet_trace_fabrics_auth_receive(struct trace_seq *p, u8 *spc)
+{
+       const char *ret = trace_seq_buffer_ptr(p);
+       u8 spsp0 = spc[1];
+       u8 spsp1 = spc[2];
+       u8 secp = spc[3];
+       u32 al = get_unaligned_le32(spc + 4);
+
+       trace_seq_printf(p, "spsp0=%02x, spsp1=%02x, secp=%02x, al=%u",
+                        spsp0, spsp1, secp, al);
+       trace_seq_putc(p, 0);
+       return ret;
+}
+
 static const char *nvmet_trace_fabrics_common(struct trace_seq *p, u8 *spc)
 {
        const char *ret = trace_seq_buffer_ptr(p);
@@ -195,6 +223,10 @@ const char *nvmet_trace_parse_fabrics_cmd(struct trace_seq *p,
                return nvmet_trace_fabrics_connect(p, spc);
        case nvme_fabrics_type_property_get:
                return nvmet_trace_fabrics_property_get(p, spc);
+       case nvme_fabrics_type_auth_send:
+               return nvmet_trace_fabrics_auth_send(p, spc);
+       case nvme_fabrics_type_auth_receive:
+               return nvmet_trace_fabrics_auth_receive(p, spc);
        default:
                return nvmet_trace_fabrics_common(p, spc);
        }