IB/hfi1: Add 16B Management Packet trace support
[linux-2.6-microblaze.git] / drivers / infiniband / hw / hfi1 / trace.c
index 332b9b7..7c8aed0 100644 (file)
@@ -63,13 +63,20 @@ static u8 __get_ib_hdr_len(struct ib_header *hdr)
 
 static u8 __get_16b_hdr_len(struct hfi1_16b_header *hdr)
 {
-       struct ib_other_headers *ohdr;
+       struct ib_other_headers *ohdr = NULL;
        u8 opcode;
+       u8 l4 = hfi1_16B_get_l4(hdr);
+
+       if (l4 == OPA_16B_L4_FM) {
+               opcode = IB_OPCODE_UD_SEND_ONLY;
+               return (8 + 8); /* No BTH */
+       }
 
-       if (hfi1_16B_get_l4(hdr) == OPA_16B_L4_IB_LOCAL)
+       if (l4 == OPA_16B_L4_IB_LOCAL)
                ohdr = &hdr->u.oth;
        else
                ohdr = &hdr->u.l.oth;
+
        opcode = ib_bth_get_opcode(ohdr);
        return hdr_len_by_opcode[opcode] == 0 ?
               0 : hdr_len_by_opcode[opcode] - (12 + 8 + 8);
@@ -234,17 +241,24 @@ const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
 #define BTH_16B_PRN \
        "op:0x%.2x,%s se:%d m:%d pad:%d tver:%d " \
        "qpn:0x%.6x a:%d psn:0x%.8x"
-const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass,
-                              u8 ack, bool becn, bool fecn, u8 mig,
-                              u8 se, u8 pad, u8 opcode, const char *opname,
-                              u8 tver, u16 pkey, u32 psn, u32 qpn)
+#define L4_FM_16B_PRN \
+       "op:0x%.2x,%s dest_qpn:0x%.6x src_qpn:0x%.6x"
+const char *hfi1_trace_fmt_rest(struct trace_seq *p, bool bypass, u8 l4,
+                               u8 ack, bool becn, bool fecn, u8 mig,
+                               u8 se, u8 pad, u8 opcode, const char *opname,
+                               u8 tver, u16 pkey, u32 psn, u32 qpn,
+                               u32 dest_qpn, u32 src_qpn)
 {
        const char *ret = trace_seq_buffer_ptr(p);
 
        if (bypass)
-               trace_seq_printf(p, BTH_16B_PRN,
-                                opcode, opname,
-                                se, mig, pad, tver, qpn, ack, psn);
+               if (l4 == OPA_16B_L4_FM)
+                       trace_seq_printf(p, L4_FM_16B_PRN,
+                                        opcode, opname, dest_qpn, src_qpn);
+               else
+                       trace_seq_printf(p, BTH_16B_PRN,
+                                        opcode, opname,
+                                        se, mig, pad, tver, qpn, ack, psn);
 
        else
                trace_seq_printf(p, BTH_9B_PRN,
@@ -258,12 +272,17 @@ const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass,
 
 const char *parse_everbs_hdrs(
        struct trace_seq *p,
-       u8 opcode,
+       u8 opcode, u8 l4, u32 dest_qpn, u32 src_qpn,
        void *ehdrs)
 {
        union ib_ehdrs *eh = ehdrs;
        const char *ret = trace_seq_buffer_ptr(p);
 
+       if (l4 == OPA_16B_L4_FM) {
+               trace_seq_printf(p, "mgmt pkt");
+               goto out;
+       }
+
        switch (opcode) {
        /* imm */
        case OP(RC, SEND_LAST_WITH_IMMEDIATE):
@@ -334,6 +353,7 @@ const char *parse_everbs_hdrs(
                                 be32_to_cpu(eh->ieth));
                break;
        }
+out:
        trace_seq_putc(p, 0);
        return ret;
 }