Commit 43a68c35 authored by Don Hiatt's avatar Don Hiatt Committed by Jason Gunthorpe

IB/hfi1: Add 16B Management Packet trace support

Add trace support for 16B Management Packets.
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDon Hiatt <don.hiatt@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 81cd3891
...@@ -63,13 +63,20 @@ static u8 __get_ib_hdr_len(struct ib_header *hdr) ...@@ -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) 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 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; ohdr = &hdr->u.oth;
else else
ohdr = &hdr->u.l.oth; ohdr = &hdr->u.l.oth;
opcode = ib_bth_get_opcode(ohdr); opcode = ib_bth_get_opcode(ohdr);
return hdr_len_by_opcode[opcode] == 0 ? return hdr_len_by_opcode[opcode] == 0 ?
0 : hdr_len_by_opcode[opcode] - (12 + 8 + 8); 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, ...@@ -234,17 +241,24 @@ const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
#define BTH_16B_PRN \ #define BTH_16B_PRN \
"op:0x%.2x,%s se:%d m:%d pad:%d tver:%d " \ "op:0x%.2x,%s se:%d m:%d pad:%d tver:%d " \
"qpn:0x%.6x a:%d psn:0x%.8x" "qpn:0x%.6x a:%d psn:0x%.8x"
const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass, #define L4_FM_16B_PRN \
u8 ack, bool becn, bool fecn, u8 mig, "op:0x%.2x,%s dest_qpn:0x%.6x src_qpn:0x%.6x"
u8 se, u8 pad, u8 opcode, const char *opname, const char *hfi1_trace_fmt_rest(struct trace_seq *p, bool bypass, u8 l4,
u8 tver, u16 pkey, u32 psn, u32 qpn) 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); const char *ret = trace_seq_buffer_ptr(p);
if (bypass) if (bypass)
trace_seq_printf(p, BTH_16B_PRN, if (l4 == OPA_16B_L4_FM)
opcode, opname, trace_seq_printf(p, L4_FM_16B_PRN,
se, mig, pad, tver, qpn, ack, psn); opcode, opname, dest_qpn, src_qpn);
else
trace_seq_printf(p, BTH_16B_PRN,
opcode, opname,
se, mig, pad, tver, qpn, ack, psn);
else else
trace_seq_printf(p, BTH_9B_PRN, trace_seq_printf(p, BTH_9B_PRN,
...@@ -258,12 +272,17 @@ const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass, ...@@ -258,12 +272,17 @@ const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass,
const char *parse_everbs_hdrs( const char *parse_everbs_hdrs(
struct trace_seq *p, struct trace_seq *p,
u8 opcode, u8 opcode, u8 l4, u32 dest_qpn, u32 src_qpn,
void *ehdrs) void *ehdrs)
{ {
union ib_ehdrs *eh = ehdrs; union ib_ehdrs *eh = ehdrs;
const char *ret = trace_seq_buffer_ptr(p); const char *ret = trace_seq_buffer_ptr(p);
if (l4 == OPA_16B_L4_FM) {
trace_seq_printf(p, "mgmt pkt");
goto out;
}
switch (opcode) { switch (opcode) {
/* imm */ /* imm */
case OP(RC, SEND_LAST_WITH_IMMEDIATE): case OP(RC, SEND_LAST_WITH_IMMEDIATE):
...@@ -334,6 +353,7 @@ const char *parse_everbs_hdrs( ...@@ -334,6 +353,7 @@ const char *parse_everbs_hdrs(
be32_to_cpu(eh->ieth)); be32_to_cpu(eh->ieth));
break; break;
} }
out:
trace_seq_putc(p, 0); trace_seq_putc(p, 0);
return ret; return ret;
} }
......
...@@ -96,7 +96,9 @@ __print_symbolic(opcode, \ ...@@ -96,7 +96,9 @@ __print_symbolic(opcode, \
ib_opcode_name(CNP)) ib_opcode_name(CNP))
u8 ibhdr_exhdr_len(struct ib_header *hdr); u8 ibhdr_exhdr_len(struct ib_header *hdr);
const char *parse_everbs_hdrs(struct trace_seq *p, u8 opcode, void *ehdrs); const char *parse_everbs_hdrs(struct trace_seq *p, u8 opcode,
u8 l4, u32 dest_qpn, u32 src_qpn,
void *ehdrs);
u8 hfi1_trace_opa_hdr_len(struct hfi1_opa_header *opah); u8 hfi1_trace_opa_hdr_len(struct hfi1_opa_header *opah);
u8 hfi1_trace_packet_hdr_len(struct hfi1_packet *packet); u8 hfi1_trace_packet_hdr_len(struct hfi1_packet *packet);
const char *hfi1_trace_get_packet_l4_str(u8 l4); const char *hfi1_trace_get_packet_l4_str(u8 l4);
...@@ -123,14 +125,16 @@ const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass, ...@@ -123,14 +125,16 @@ const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
u8 rc, u8 sc, u8 sl, u16 entropy, u8 rc, u8 sc, u8 sl, u16 entropy,
u16 len, u16 pkey, u32 dlid, u32 slid); u16 len, u16 pkey, u32 dlid, u32 slid);
const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass, const char *hfi1_trace_fmt_rest(struct trace_seq *p, bool bypass, u8 l4,
u8 ack, bool becn, bool fecn, u8 mig, u8 ack, bool becn, bool fecn, u8 mig,
u8 se, u8 pad, u8 opcode, const char *opname, u8 se, u8 pad, u8 opcode, const char *opname,
u8 tver, u16 pkey, u32 psn, u32 qpn); u8 tver, u16 pkey, u32 psn, u32 qpn,
u32 dest_qpn, u32 src_qpn);
const char *hfi1_trace_get_packet_l2_str(u8 l2); const char *hfi1_trace_get_packet_l2_str(u8 l2);
#define __parse_ib_ehdrs(op, ehdrs) parse_everbs_hdrs(p, op, ehdrs) #define __parse_ib_ehdrs(op, l4, dest_qpn, src_qpn, ehdrs) \
parse_everbs_hdrs(p, op, l4, dest_qpn, src_qpn, ehdrs)
#define lrh_name(lrh) { HFI1_##lrh, #lrh } #define lrh_name(lrh) { HFI1_##lrh, #lrh }
#define show_lnh(lrh) \ #define show_lnh(lrh) \
...@@ -169,6 +173,8 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template, ...@@ -169,6 +173,8 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template,
__field(u32, psn) __field(u32, psn)
__field(u32, qpn) __field(u32, qpn)
__field(u32, slid) __field(u32, slid)
__field(u32, dest_qpn)
__field(u32, src_qpn)
/* extended headers */ /* extended headers */
__dynamic_array(u8, ehdrs, __dynamic_array(u8, ehdrs,
hfi1_trace_packet_hdr_len(packet)) hfi1_trace_packet_hdr_len(packet))
...@@ -178,6 +184,8 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template, ...@@ -178,6 +184,8 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template,
__entry->etype = packet->etype; __entry->etype = packet->etype;
__entry->l2 = hfi1_16B_get_l2(packet->hdr); __entry->l2 = hfi1_16B_get_l2(packet->hdr);
__entry->dest_qpn = 0;
__entry->src_qpn = 0;
if (__entry->etype == RHF_RCV_TYPE_BYPASS) { if (__entry->etype == RHF_RCV_TYPE_BYPASS) {
hfi1_trace_parse_16b_hdr(packet->hdr, hfi1_trace_parse_16b_hdr(packet->hdr,
&__entry->age, &__entry->age,
...@@ -192,16 +200,23 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template, ...@@ -192,16 +200,23 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template,
&__entry->dlid, &__entry->dlid,
&__entry->slid); &__entry->slid);
hfi1_trace_parse_16b_bth(packet->ohdr, if (__entry->l4 == OPA_16B_L4_FM) {
&__entry->ack, __entry->opcode = IB_OPCODE_UD_SEND_ONLY;
&__entry->mig, __entry->dest_qpn = hfi1_16B_get_dest_qpn(packet->mgmt);
&__entry->opcode, __entry->src_qpn = hfi1_16B_get_src_qpn(packet->mgmt);
&__entry->pad, } else {
&__entry->se, hfi1_trace_parse_16b_bth(packet->ohdr,
&__entry->tver, &__entry->ack,
&__entry->psn, &__entry->mig,
&__entry->qpn); &__entry->opcode,
&__entry->pad,
&__entry->se,
&__entry->tver,
&__entry->psn,
&__entry->qpn);
}
} else { } else {
__entry->l4 = OPA_16B_L4_9B;
hfi1_trace_parse_9b_hdr(packet->hdr, sc5, hfi1_trace_parse_9b_hdr(packet->hdr, sc5,
&__entry->lnh, &__entry->lnh,
&__entry->lver, &__entry->lver,
...@@ -223,8 +238,9 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template, ...@@ -223,8 +238,9 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template,
&__entry->pkey, &__entry->pkey,
&__entry->psn, &__entry->psn,
&__entry->qpn); &__entry->qpn);
} }
/* extended headers */ /* extended headers */
if (__entry->l4 != OPA_16B_L4_FM)
memcpy(__get_dynamic_array(ehdrs), memcpy(__get_dynamic_array(ehdrs),
&packet->ohdr->u, &packet->ohdr->u,
__get_dynamic_array_len(ehdrs)); __get_dynamic_array_len(ehdrs));
...@@ -253,25 +269,31 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template, ...@@ -253,25 +269,31 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_template,
__entry->pkey, __entry->pkey,
__entry->dlid, __entry->dlid,
__entry->slid), __entry->slid),
hfi1_trace_fmt_bth(p, hfi1_trace_fmt_rest(p,
__entry->etype == __entry->etype ==
RHF_RCV_TYPE_BYPASS, RHF_RCV_TYPE_BYPASS,
__entry->ack, __entry->l4,
__entry->becn, __entry->ack,
__entry->fecn, __entry->becn,
__entry->mig, __entry->fecn,
__entry->se, __entry->mig,
__entry->pad, __entry->se,
__entry->opcode, __entry->pad,
show_ib_opcode(__entry->opcode), __entry->opcode,
__entry->tver, show_ib_opcode(__entry->opcode),
__entry->pkey, __entry->tver,
__entry->psn, __entry->pkey,
__entry->qpn), __entry->psn,
__entry->qpn,
__entry->dest_qpn,
__entry->src_qpn),
/* extended headers */ /* extended headers */
__get_dynamic_array_len(ehdrs), __get_dynamic_array_len(ehdrs),
__parse_ib_ehdrs( __parse_ib_ehdrs(
__entry->opcode, __entry->opcode,
__entry->l4,
__entry->dest_qpn,
__entry->src_qpn,
(void *)__get_dynamic_array(ehdrs)) (void *)__get_dynamic_array(ehdrs))
) )
); );
...@@ -310,6 +332,8 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template, ...@@ -310,6 +332,8 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template,
__field(u32, psn) __field(u32, psn)
__field(u32, qpn) __field(u32, qpn)
__field(u32, slid) __field(u32, slid)
__field(u32, dest_qpn)
__field(u32, src_qpn)
/* extended headers */ /* extended headers */
__dynamic_array(u8, ehdrs, __dynamic_array(u8, ehdrs,
hfi1_trace_opa_hdr_len(opah)) hfi1_trace_opa_hdr_len(opah))
...@@ -320,6 +344,8 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template, ...@@ -320,6 +344,8 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template,
DD_DEV_ASSIGN(dd); DD_DEV_ASSIGN(dd);
__entry->hdr_type = opah->hdr_type; __entry->hdr_type = opah->hdr_type;
__entry->dest_qpn = 0;
__entry->src_qpn = 0;
if (__entry->hdr_type) { if (__entry->hdr_type) {
hfi1_trace_parse_16b_hdr(&opah->opah, hfi1_trace_parse_16b_hdr(&opah->opah,
&__entry->age, &__entry->age,
...@@ -334,19 +360,26 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template, ...@@ -334,19 +360,26 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template,
&__entry->dlid, &__entry->dlid,
&__entry->slid); &__entry->slid);
if (__entry->l4 == OPA_16B_L4_IB_LOCAL) if (__entry->l4 == OPA_16B_L4_FM) {
ohdr = &opah->opah.u.oth; ohdr = NULL;
else __entry->opcode = IB_OPCODE_UD_SEND_ONLY;
ohdr = &opah->opah.u.l.oth; __entry->dest_qpn = hfi1_16B_get_dest_qpn(&opah->opah.u.mgmt);
hfi1_trace_parse_16b_bth(ohdr, __entry->src_qpn = hfi1_16B_get_src_qpn(&opah->opah.u.mgmt);
&__entry->ack, } else {
&__entry->mig, if (__entry->l4 == OPA_16B_L4_IB_LOCAL)
&__entry->opcode, ohdr = &opah->opah.u.oth;
&__entry->pad, else
&__entry->se, ohdr = &opah->opah.u.l.oth;
&__entry->tver, hfi1_trace_parse_16b_bth(ohdr,
&__entry->psn, &__entry->ack,
&__entry->qpn); &__entry->mig,
&__entry->opcode,
&__entry->pad,
&__entry->se,
&__entry->tver,
&__entry->psn,
&__entry->qpn);
}
} else { } else {
__entry->l4 = OPA_16B_L4_9B; __entry->l4 = OPA_16B_L4_9B;
hfi1_trace_parse_9b_hdr(&opah->ibh, sc5, hfi1_trace_parse_9b_hdr(&opah->ibh, sc5,
...@@ -376,8 +409,9 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template, ...@@ -376,8 +409,9 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template,
} }
/* extended headers */ /* extended headers */
memcpy(__get_dynamic_array(ehdrs), if (__entry->l4 != OPA_16B_L4_FM)
&ohdr->u, __get_dynamic_array_len(ehdrs)); memcpy(__get_dynamic_array(ehdrs),
&ohdr->u, __get_dynamic_array_len(ehdrs));
), ),
TP_printk("[%s] (%s) %s %s hlen:%d %s", TP_printk("[%s] (%s) %s %s hlen:%d %s",
__get_str(dev), __get_str(dev),
...@@ -399,24 +433,30 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template, ...@@ -399,24 +433,30 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_template,
__entry->pkey, __entry->pkey,
__entry->dlid, __entry->dlid,
__entry->slid), __entry->slid),
hfi1_trace_fmt_bth(p, hfi1_trace_fmt_rest(p,
!!__entry->hdr_type, !!__entry->hdr_type,
__entry->ack, __entry->l4,
__entry->becn, __entry->ack,
__entry->fecn, __entry->becn,
__entry->mig, __entry->fecn,
__entry->se, __entry->mig,
__entry->pad, __entry->se,
__entry->opcode, __entry->pad,
show_ib_opcode(__entry->opcode), __entry->opcode,
__entry->tver, show_ib_opcode(__entry->opcode),
__entry->pkey, __entry->tver,
__entry->psn, __entry->pkey,
__entry->qpn), __entry->psn,
__entry->qpn,
__entry->dest_qpn,
__entry->src_qpn),
/* extended headers */ /* extended headers */
__get_dynamic_array_len(ehdrs), __get_dynamic_array_len(ehdrs),
__parse_ib_ehdrs( __parse_ib_ehdrs(
__entry->opcode, __entry->opcode,
__entry->l4,
__entry->dest_qpn,
__entry->src_qpn,
(void *)__get_dynamic_array(ehdrs)) (void *)__get_dynamic_array(ehdrs))
) )
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment