IB/hfi1: Add 16B trace support
authorDon Hiatt <don.hiatt@intel.com>
Fri, 4 Aug 2017 20:54:29 +0000 (13:54 -0700)
committerDoug Ledford <dledford@redhat.com>
Tue, 22 Aug 2017 18:22:37 +0000 (14:22 -0400)
Add trace support to 16B bypass packets during send and
receive.

Sample input header trace:
<idle>-0     [000] d.h. 271742.509477: input_ibhdr: [0000:05:00.0] (16B)
len:24 sc:0 dlid:0xf0000b slid:0x10002 age:0 becn:0 fecn:0 l4:10 rc:0
sc:0 pkey:0x8001 entropy:0x0000 op:0x65,UD_SEND_ONLY_WITH_IMMEDIATE se:0
m:1 pad:3 tver:0 qpn:0xffffff a:0 psn:0x00000001 hlen:248 deth qkey
0x01234567 sqpn 0x000004

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Don Hiatt <don.hiatt@intel.com>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/hfi.h
drivers/infiniband/hw/hfi1/trace.c
drivers/infiniband/hw/hfi1/trace_ibhdrs.h

index 7e21192..b07f42c 100644 (file)
@@ -381,6 +381,11 @@ struct hfi1_packet {
 #define OPA_16B_PKEY_SHIFT     16
 #define OPA_16B_LEN_MASK       0x7FF00000ull
 #define OPA_16B_LEN_SHIFT      20
+#define OPA_16B_RC_MASK                0xE000000ull
+#define OPA_16B_RC_SHIFT       25
+#define OPA_16B_AGE_MASK       0xFF0000ull
+#define OPA_16B_AGE_SHIFT      16
+#define OPA_16B_ENTROPY_MASK   0xFFFFull
 
 /*
  * OPA 16B L2/L4 Encodings
@@ -434,6 +439,26 @@ static inline u16 hfi1_16B_get_pkey(struct hfi1_16b_header *hdr)
        return (u16)((hdr->lrh[2] & OPA_16B_PKEY_MASK) >> OPA_16B_PKEY_SHIFT);
 }
 
+static inline u8 hfi1_16B_get_rc(struct hfi1_16b_header *hdr)
+{
+       return (u8)((hdr->lrh[1] & OPA_16B_RC_MASK) >> OPA_16B_RC_SHIFT);
+}
+
+static inline u8 hfi1_16B_get_age(struct hfi1_16b_header *hdr)
+{
+       return (u8)((hdr->lrh[3] & OPA_16B_AGE_MASK) >> OPA_16B_AGE_SHIFT);
+}
+
+static inline u16 hfi1_16B_get_len(struct hfi1_16b_header *hdr)
+{
+       return (u16)((hdr->lrh[0] & OPA_16B_LEN_MASK) >> OPA_16B_LEN_SHIFT);
+}
+
+static inline u16 hfi1_16B_get_entropy(struct hfi1_16b_header *hdr)
+{
+       return (u16)(hdr->lrh[3] & OPA_16B_ENTROPY_MASK);
+}
+
 /*
  * BTH
  */
index b80b74d..9938bb9 100644 (file)
@@ -47,7 +47,7 @@
 #define CREATE_TRACE_POINTS
 #include "trace.h"
 
-u8 hfi1_trace_ib_hdr_len(struct ib_header *hdr)
+static u8 __get_ib_hdr_len(struct ib_header *hdr)
 {
        struct ib_other_headers *ohdr;
        u8 opcode;
@@ -61,9 +61,60 @@ u8 hfi1_trace_ib_hdr_len(struct ib_header *hdr)
               0 : hdr_len_by_opcode[opcode] - (12 + 8);
 }
 
+static u8 __get_16b_hdr_len(struct hfi1_16b_header *hdr)
+{
+       struct ib_other_headers *ohdr;
+       u8 opcode;
+
+       if (hfi1_16B_get_l4(hdr) == 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);
+}
+
+u8 hfi1_trace_packet_hdr_len(struct hfi1_packet *packet)
+{
+       if (packet->etype != RHF_RCV_TYPE_BYPASS)
+               return __get_ib_hdr_len(packet->hdr);
+       else
+               return __get_16b_hdr_len(packet->hdr);
+}
+
+u8 hfi1_trace_opa_hdr_len(struct hfi1_opa_header *opa_hdr)
+{
+       if (!opa_hdr->hdr_type)
+               return __get_ib_hdr_len(&opa_hdr->ibh);
+       else
+               return __get_16b_hdr_len(&opa_hdr->opah);
+}
+
 const char *hfi1_trace_get_packet_str(struct hfi1_packet *packet)
 {
-       return "IB";
+       if (packet->etype != RHF_RCV_TYPE_BYPASS)
+               return "IB";
+
+       switch (hfi1_16B_get_l2(packet->hdr)) {
+       case 0:
+               return "0";
+       case 1:
+               return "1";
+       case 2:
+               return "16B";
+       case 3:
+               return "9B";
+       }
+       return "";
+}
+
+const char *hfi1_trace_get_packet_type_str(u8 l4)
+{
+       if (l4)
+               return "16B";
+       else
+               return "9B";
 }
 
 #define IMM_PRN  "imm:%d"
@@ -89,10 +140,10 @@ static const char *parse_syndrome(u8 syndrome)
        return "";
 }
 
-void hfi1_trace_parse_bth(struct ib_other_headers *ohdr,
-                         u8 *ack, u8 *becn, u8 *fecn, u8 *mig,
-                         u8 *se, u8 *pad, u8 *opcode, u8 *tver,
-                         u16 *pkey, u32 *psn, u32 *qpn)
+void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr,
+                            u8 *ack, u8 *becn, u8 *fecn, u8 *mig,
+                            u8 *se, u8 *pad, u8 *opcode, u8 *tver,
+                            u16 *pkey, u32 *psn, u32 *qpn)
 {
        *ack = ib_bth_get_ackreq(ohdr);
        *becn = ib_bth_get_becn(ohdr);
@@ -107,8 +158,22 @@ void hfi1_trace_parse_bth(struct ib_other_headers *ohdr,
        *qpn = ib_bth_get_qpn(ohdr);
 }
 
+void hfi1_trace_parse_16b_bth(struct ib_other_headers *ohdr,
+                             u8 *ack, u8 *mig, u8 *opcode,
+                             u8 *pad, u8 *se, u8 *tver,
+                             u32 *psn, u32 *qpn)
+{
+       *ack = ib_bth_get_ackreq(ohdr);
+       *mig = ib_bth_get_migreq(ohdr);
+       *opcode = ib_bth_get_opcode(ohdr);
+       *pad = ib_bth_get_pad(ohdr);
+       *se = ib_bth_get_se(ohdr);
+       *tver = ib_bth_get_tver(ohdr);
+       *psn = ib_bth_get_psn(ohdr);
+       *qpn = ib_bth_get_qpn(ohdr);
+}
+
 void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5,
-                            struct ib_other_headers **ohdr,
                             u8 *lnh, u8 *lver, u8 *sl, u8 *sc,
                             u16 *len, u32 *dlid, u32 *slid)
 {
@@ -119,11 +184,79 @@ void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5,
        *len = ib_get_len(hdr);
        *dlid = ib_get_dlid(hdr);
        *slid = ib_get_slid(hdr);
+}
+
+void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr,
+                             u8 *age, u8 *becn, u8 *fecn,
+                             u8 *l4, u8 *rc, u8 *sc,
+                             u16 *entropy, u16 *len, u16 *pkey,
+                             u32 *dlid, u32 *slid)
+{
+       *age = hfi1_16B_get_age(hdr);
+       *becn = hfi1_16B_get_becn(hdr);
+       *fecn = hfi1_16B_get_fecn(hdr);
+       *l4 = hfi1_16B_get_l4(hdr);
+       *rc = hfi1_16B_get_rc(hdr);
+       *sc = hfi1_16B_get_sc(hdr);
+       *entropy = hfi1_16B_get_entropy(hdr);
+       *len = hfi1_16B_get_len(hdr);
+       *pkey = hfi1_16B_get_pkey(hdr);
+       *dlid = hfi1_16B_get_dlid(hdr);
+       *slid = hfi1_16B_get_slid(hdr);
+}
+
+#define LRH_PRN "len:%d sc:%d dlid:0x%.4x slid:0x%.4x "
+#define LRH_9B_PRN "lnh:%d,%s lver:%d sl:%d"
+#define LRH_16B_PRN "age:%d becn:%d fecn:%d l4:%d " \
+                   "rc:%d sc:%d pkey:0x%.4x entropy:0x%.4x"
+const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
+                              u8 age, u8 becn, u8 fecn, u8 l4,
+                              u8 lnh, const char *lnh_name, u8 lver,
+                              u8 rc, u8 sc, u8 sl, u16 entropy,
+                              u16 len, u16 pkey, u32 dlid, u32 slid)
+{
+       const char *ret = trace_seq_buffer_ptr(p);
+
+       trace_seq_printf(p, LRH_PRN, len, sc, dlid, slid);
+
+       if (bypass)
+               trace_seq_printf(p, LRH_16B_PRN,
+                                age, becn, fecn, l4, rc, sc, pkey, entropy);
 
-       if (*lnh == HFI1_LRH_BTH)
-               *ohdr = &hdr->u.oth;
        else
-               *ohdr = &hdr->u.l.oth;
+               trace_seq_printf(p, LRH_9B_PRN,
+                                lnh, lnh_name, lver, sl);
+       trace_seq_putc(p, 0);
+
+       return ret;
+}
+
+#define BTH_9B_PRN \
+       "op:0x%.2x,%s se:%d m:%d pad:%d tver:%d pkey:0x%.4x " \
+       "f:%d b:%d qpn:0x%.6x a:%d psn:0x%.8x"
+#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, u8 becn, u8 fecn, u8 mig,
+                              u8 se, u8 pad, u8 opcode, const char *opname,
+                              u8 tver, u16 pkey, u32 psn, u32 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);
+
+       else
+               trace_seq_printf(p, BTH_9B_PRN,
+                                opcode, opname,
+                                se, mig, pad, tver, pkey, fecn, becn,
+                                qpn, ack, psn);
+       trace_seq_putc(p, 0);
+
+       return ret;
 }
 
 const char *parse_everbs_hdrs(
index 7324025..6721f84 100644 (file)
@@ -95,17 +95,39 @@ __print_symbolic(opcode,                                   \
        ib_opcode_name(UD_SEND_ONLY_WITH_IMMEDIATE),       \
        ib_opcode_name(CNP))
 
+u8 ibhdr_exhdr_len(struct ib_header *hdr);
 const char *parse_everbs_hdrs(struct trace_seq *p, u8 opcode, void *ehdrs);
-u8 hfi1_trace_ib_hdr_len(struct ib_header *hdr);
+u8 hfi1_trace_opa_hdr_len(struct hfi1_opa_header *opah);
+u8 hfi1_trace_packet_hdr_len(struct hfi1_packet *packet);
+const char *hfi1_trace_get_packet_type_str(u8 l4);
 const char *hfi1_trace_get_packet_str(struct hfi1_packet *packet);
-void hfi1_trace_parse_bth(struct ib_other_headers *ohdr,
-                         u8 *ack, u8 *becn, u8 *fecn, u8 *mig,
-                         u8 *se, u8 *pad, u8 *opcode, u8 *tver,
-                         u16 *pkey, u32 *psn, u32 *qpn);
+void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr,
+                            u8 *ack, u8 *becn, u8 *fecn, u8 *mig,
+                            u8 *se, u8 *pad, u8 *opcode, u8 *tver,
+                            u16 *pkey, u32 *psn, u32 *qpn);
 void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5,
-                            struct ib_other_headers **ohdr,
                             u8 *lnh, u8 *lver, u8 *sl, u8 *sc,
                             u16 *len, u32 *dlid, u32 *slid);
+void hfi1_trace_parse_16b_bth(struct ib_other_headers *ohdr,
+                             u8 *ack, u8 *mig, u8 *opcode,
+                             u8 *pad, u8 *se, u8 *tver,
+                             u32 *psn, u32 *qpn);
+void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr,
+                             u8 *age, u8 *becn, u8 *fecn,
+                             u8 *l4, u8 *rc, u8 *sc,
+                             u16 *entropy, u16 *len, u16 *pkey,
+                             u32 *dlid, u32 *slid);
+
+const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
+                              u8 age, u8 becn, u8 fecn, u8 l4,
+                              u8 lnh, const char *lnh_name, u8 lver,
+                              u8 rc, u8 sc, u8 sl, u16 entropy,
+                              u16 len, u16 pkey, u32 dlid, u32 slid);
+
+const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass,
+                              u8 ack, u8 becn, u8 fecn, u8 mig,
+                              u8 se, u8 pad, u8 opcode, const char *opname,
+                              u8 tver, u16 pkey, u32 psn, u32 qpn);
 
 #define __parse_ib_ehdrs(op, ehdrs) parse_everbs_hdrs(p, op, ehdrs)
 
@@ -114,13 +136,8 @@ void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5,
 __print_symbolic(lrh,                    \
        lrh_name(LRH_BTH),               \
        lrh_name(LRH_GRH))
-
-#define LRH_PRN "len:%d sc:%d dlid:0x%.4x slid:0x%.4x"
-#define LRH_9B_PRN "lnh:%d,%s lver:%d sl:%d "
-#define BTH_PRN \
-       "op:0x%.2x,%s se:%d m:%d pad:%d tver:%d pkey:0x%.4x " \
-       "f:%d b:%d qpn:0x%.6x a:%d psn:0x%.8x"
-#define EHDR_PRN "hlen:%d %s"
+#define PKT_ENTRY(pkt) __string(ptype,  hfi1_trace_get_packet_str(packet))
+#define PKT_ASSIGN(pkt) __assign_str(ptype, hfi1_trace_get_packet_str(packet))
 
 DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template,
                    TP_PROTO(struct hfi1_devdata *dd,
@@ -129,75 +146,125 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template,
                    TP_ARGS(dd, packet, sc5),
                    TP_STRUCT__entry(
                        DD_DEV_ENTRY(dd)
+                       PKT_ENTRY(packet)
+                       __field(bool, bypass)
+                       __field(u8, ack)
+                       __field(u8, age)
+                       __field(u8, becn)
+                       __field(u8, fecn)
+                       __field(u8, l4)
                        __field(u8, lnh)
                        __field(u8, lver)
-                       __field(u8, sl)
-                       __field(u16, len)
-                       __field(u32, dlid)
-                       __field(u8, sc)
-                       __field(u32, slid)
-                       __field(u8, opcode)
-                       __field(u8, se)
                        __field(u8, mig)
+                       __field(u8, opcode)
                        __field(u8, pad)
+                       __field(u8, rc)
+                       __field(u8, sc)
+                       __field(u8, se)
+                       __field(u8, sl)
                        __field(u8, tver)
+                       __field(u16, entropy)
+                       __field(u16, len)
                        __field(u16, pkey)
-                       __field(u8, fecn)
-                       __field(u8, becn)
-                       __field(u32, qpn)
-                       __field(u8, ack)
+                       __field(u32, dlid)
                        __field(u32, psn)
+                       __field(u32, qpn)
+                       __field(u32, slid)
                        /* extended headers */
                        __dynamic_array(u8, ehdrs,
-                                       hfi1_trace_ib_hdr_len(packet->hdr))
+                                       hfi1_trace_packet_hdr_len(packet))
                        ),
                    TP_fast_assign(
-                          struct ib_other_headers *ohdr;
+                       DD_DEV_ASSIGN(dd);
+                       PKT_ASSIGN(packet);
 
-                          DD_DEV_ASSIGN(dd);
+                       if (packet->etype == RHF_RCV_TYPE_BYPASS) {
+                               __entry->bypass = true;
+                               hfi1_trace_parse_16b_hdr(packet->hdr,
+                                                        &__entry->age,
+                                                        &__entry->becn,
+                                                        &__entry->fecn,
+                                                        &__entry->l4,
+                                                        &__entry->rc,
+                                                        &__entry->sc,
+                                                        &__entry->entropy,
+                                                        &__entry->len,
+                                                        &__entry->pkey,
+                                                        &__entry->dlid,
+                                                        &__entry->slid);
 
-                          hfi1_trace_parse_9b_hdr(packet->hdr, sc5,
-                                                  &ohdr,
-                                                  &__entry->lnh,
-                                                  &__entry->lver,
-                                                  &__entry->sl,
-                                                  &__entry->sc,
-                                                  &__entry->len,
-                                                  &__entry->dlid,
-                                                  &__entry->slid);
+                                 hfi1_trace_parse_16b_bth(packet->ohdr,
+                                                          &__entry->ack,
+                                                          &__entry->mig,
+                                                          &__entry->opcode,
+                                                          &__entry->pad,
+                                                          &__entry->se,
+                                                          &__entry->tver,
+                                                          &__entry->psn,
+                                                          &__entry->qpn);
+                       } else {
+                               __entry->bypass = false;
+                               hfi1_trace_parse_9b_hdr(packet->hdr, sc5,
+                                                       &__entry->lnh,
+                                                       &__entry->lver,
+                                                       &__entry->sl,
+                                                       &__entry->sc,
+                                                       &__entry->len,
+                                                       &__entry->dlid,
+                                                       &__entry->slid);
 
-                         hfi1_trace_parse_bth(ohdr, &__entry->ack,
-                                              &__entry->becn, &__entry->fecn,
-                                              &__entry->mig, &__entry->se,
-                                              &__entry->pad, &__entry->opcode,
-                                              &__entry->tver, &__entry->pkey,
-                                              &__entry->psn, &__entry->qpn);
-                         /* extended headers */
-                         memcpy(__get_dynamic_array(ehdrs), &ohdr->u,
-                                __get_dynamic_array_len(ehdrs));
+                                 hfi1_trace_parse_9b_bth(packet->ohdr,
+                                                         &__entry->ack,
+                                                         &__entry->becn,
+                                                         &__entry->fecn,
+                                                         &__entry->mig,
+                                                         &__entry->se,
+                                                         &__entry->pad,
+                                                         &__entry->opcode,
+                                                         &__entry->tver,
+                                                         &__entry->pkey,
+                                                         &__entry->psn,
+                                                         &__entry->qpn);
+                               }
+                               /* extended headers */
+                               memcpy(__get_dynamic_array(ehdrs),
+                                      &packet->ohdr->u,
+                                      __get_dynamic_array_len(ehdrs));
                         ),
-                   TP_printk("[%s] (IB) " LRH_PRN " " LRH_9B_PRN " "
-                             BTH_PRN " " EHDR_PRN,
+                   TP_printk("[%s] (%s) %s %s hlen:%d %s",
                              __get_str(dev),
-                             __entry->len,
-                             __entry->sc,
-                             __entry->dlid,
-                             __entry->slid,
-                             __entry->lnh, show_lnh(__entry->lnh),
-                             __entry->lver,
-                             __entry->sl,
-                             /* BTH */
-                             __entry->opcode, show_ib_opcode(__entry->opcode),
-                             __entry->se,
-                             __entry->mig,
-                             __entry->pad,
-                             __entry->tver,
-                             __entry->pkey,
-                             __entry->fecn,
-                             __entry->becn,
-                             __entry->qpn,
-                             __entry->ack,
-                             __entry->psn,
+                             __get_str(ptype),
+                             hfi1_trace_fmt_lrh(p,
+                                                __entry->bypass,
+                                                __entry->age,
+                                                __entry->becn,
+                                                __entry->fecn,
+                                                __entry->l4,
+                                                __entry->lnh,
+                                                show_lnh(__entry->lnh),
+                                                __entry->lver,
+                                                __entry->rc,
+                                                __entry->sc,
+                                                __entry->sl,
+                                                __entry->entropy,
+                                                __entry->len,
+                                                __entry->pkey,
+                                                __entry->dlid,
+                                                __entry->slid),
+                             hfi1_trace_fmt_bth(p,
+                                                __entry->bypass,
+                                                __entry->ack,
+                                                __entry->becn,
+                                                __entry->fecn,
+                                                __entry->mig,
+                                                __entry->se,
+                                                __entry->pad,
+                                                __entry->opcode,
+                                                show_ib_opcode(__entry->opcode),
+                                                __entry->tver,
+                                                __entry->pkey,
+                                                __entry->psn,
+                                                __entry->qpn),
                              /* extended headers */
                              __get_dynamic_array_len(ehdrs),
                              __parse_ib_ehdrs(
@@ -213,78 +280,136 @@ DEFINE_EVENT(hfi1_input_ibhdr_template, input_ibhdr,
 
 DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template,
                    TP_PROTO(struct hfi1_devdata *dd,
-                            struct hfi1_opa_header *opah,
-                            bool sc5),
+                            struct hfi1_opa_header *opah, bool sc5),
                    TP_ARGS(dd, opah, sc5),
                    TP_STRUCT__entry(
                        DD_DEV_ENTRY(dd)
+                       __field(bool, bypass)
+                       __field(u8, ack)
+                       __field(u8, age)
+                       __field(u8, becn)
+                       __field(u8, fecn)
+                       __field(u8, l4)
                        __field(u8, lnh)
                        __field(u8, lver)
-                       __field(u8, sl)
-                       __field(u16, len)
-                       __field(u32, dlid)
-                       __field(u8, sc)
-                       __field(u32, slid)
-                       __field(u8, opcode)
-                       __field(u8, se)
                        __field(u8, mig)
+                       __field(u8, opcode)
                        __field(u8, pad)
+                       __field(u8, rc)
+                       __field(u8, sc)
+                       __field(u8, se)
+                       __field(u8, sl)
                        __field(u8, tver)
+                       __field(u16, entropy)
+                       __field(u16, len)
                        __field(u16, pkey)
-                       __field(u8, fecn)
-                       __field(u8, becn)
-                       __field(u32, qpn)
-                       __field(u8, ack)
+                       __field(u32, dlid)
                        __field(u32, psn)
+                       __field(u32, qpn)
+                       __field(u32, slid)
                        /* extended headers */
                        __dynamic_array(u8, ehdrs,
-                                       hfi1_trace_ib_hdr_len(&opah->ibh))
+                                       hfi1_trace_opa_hdr_len(opah))
                        ),
                    TP_fast_assign(
                        struct ib_other_headers *ohdr;
-                       struct ib_header *hdr = &opah->ibh;
 
                        DD_DEV_ASSIGN(dd);
 
-                       hfi1_trace_parse_9b_hdr(hdr, sc5,
-                                               &ohdr, &__entry->lnh,
-                                               &__entry->lver, &__entry->sl,
-                                               &__entry->sc, &__entry->len,
-                                               &__entry->dlid, &__entry->slid);
+                       if (opah->hdr_type)  {
+                               __entry->bypass = true;
+                               hfi1_trace_parse_16b_hdr(&opah->opah,
+                                                        &__entry->age,
+                                                        &__entry->becn,
+                                                        &__entry->fecn,
+                                                        &__entry->l4,
+                                                        &__entry->rc,
+                                                        &__entry->sc,
+                                                        &__entry->entropy,
+                                                        &__entry->len,
+                                                        &__entry->pkey,
+                                                        &__entry->dlid,
+                                                        &__entry->slid);
 
-                       hfi1_trace_parse_bth(ohdr, &__entry->ack,
-                                            &__entry->becn, &__entry->fecn,
-                                            &__entry->mig, &__entry->se,
-                                            &__entry->pad, &__entry->opcode,
-                                            &__entry->tver, &__entry->pkey,
-                                            &__entry->psn, &__entry->qpn);
+                               if (entry->l4 == OPA_16B_L4_IB_LOCAL)
+                                       ohdr = &opah->opah.u.oth;
+                               else
+                                       ohdr = &opah->opah.u.l.oth;
+                               hfi1_trace_parse_16b_bth(ohdr,
+                                                        &__entry->ack,
+                                                        &__entry->mig,
+                                                        &__entry->opcode,
+                                                        &__entry->pad,
+                                                        &__entry->se,
+                                                        &__entry->tver,
+                                                        &__entry->psn,
+                                                        &__entry->qpn);
+                       } else {
+                               __entry->bypass = false;
+                               hfi1_trace_parse_9b_hdr(&opah->ibh, sc5,
+                                                       &__entry->lnh,
+                                                       &__entry->lver,
+                                                       &__entry->sl,
+                                                       &__entry->sc,
+                                                       &__entry->len,
+                                                       &__entry->dlid,
+                                                       &__entry->slid);
+                               if (entry->lnh == HFI1_LRH_BTH)
+                                       ohdr = &opah->ibh.u.oth;
+                               else
+                                       ohdr = &opah->ibh.u.l.oth;
+                               hfi1_trace_parse_9b_bth(ohdr,
+                                                       &__entry->ack,
+                                                       &__entry->becn,
+                                                       &__entry->fecn,
+                                                       &__entry->mig,
+                                                       &__entry->se,
+                                                       &__entry->pad,
+                                                       &__entry->opcode,
+                                                       &__entry->tver,
+                                                       &__entry->pkey,
+                                                       &__entry->psn,
+                                                       &__entry->qpn);
+                       }
 
                        /* extended headers */
                        memcpy(__get_dynamic_array(ehdrs),
                               &ohdr->u, __get_dynamic_array_len(ehdrs));
                    ),
-                   TP_printk("[%s] (IB) " LRH_PRN " " LRH_9B_PRN " "
-                             BTH_PRN " " EHDR_PRN,
+                   TP_printk("[%s] (%s) %s %s hlen:%d %s",
                              __get_str(dev),
-                             __entry->len,
-                             __entry->sc,
-                             __entry->dlid,
-                             __entry->slid,
-                             __entry->lnh, show_lnh(__entry->lnh),
-                             __entry->lver,
-                             __entry->sl,
-                             /* BTH */
-                             __entry->opcode, show_ib_opcode(__entry->opcode),
-                             __entry->se,
-                             __entry->mig,
-                             __entry->pad,
-                             __entry->tver,
-                             __entry->pkey,
-                             __entry->fecn,
-                             __entry->becn,
-                             __entry->qpn,
-                             __entry->ack,
-                             __entry->psn,
+                             hfi1_trace_get_packet_type_str(__entry->l4),
+                             hfi1_trace_fmt_lrh(p,
+                                                __entry->bypass,
+                                                __entry->age,
+                                                __entry->becn,
+                                                __entry->fecn,
+                                                __entry->l4,
+                                                __entry->lnh,
+                                                show_lnh(__entry->lnh),
+                                                __entry->lver,
+                                                __entry->rc,
+                                                __entry->sc,
+                                                __entry->sl,
+                                                __entry->entropy,
+                                                __entry->len,
+                                                __entry->pkey,
+                                                __entry->dlid,
+                                                __entry->slid),
+                             hfi1_trace_fmt_bth(p,
+                                                __entry->bypass,
+                                                __entry->ack,
+                                                __entry->becn,
+                                                __entry->fecn,
+                                                __entry->mig,
+                                                __entry->se,
+                                                __entry->pad,
+                                                __entry->opcode,
+                                                show_ib_opcode(__entry->opcode),
+                                                __entry->tver,
+                                                __entry->pkey,
+                                                __entry->psn,
+                                                __entry->qpn),
                              /* extended headers */
                              __get_dynamic_array_len(ehdrs),
                              __parse_ib_ehdrs(