On Mon, Mar 25, 2019 at 06:10:46PM +0100, Bernard Metzler wrote: > Signed-off-by: Bernard Metzler <bmt@xxxxxxxxxxxxxx> > --- > drivers/infiniband/sw/siw/siw_debug.c | 88 +++++++++++++++++++++++++++ > drivers/infiniband/sw/siw/siw_debug.h | 34 +++++++++++ > 2 files changed, 122 insertions(+) > create mode 100644 drivers/infiniband/sw/siw/siw_debug.c > create mode 100644 drivers/infiniband/sw/siw/siw_debug.h > > diff --git a/drivers/infiniband/sw/siw/siw_debug.c b/drivers/infiniband/sw/siw/siw_debug.c > new file mode 100644 > index 000000000000..0e84004cd4d1 > --- /dev/null > +++ b/drivers/infiniband/sw/siw/siw_debug.c > @@ -0,0 +1,88 @@ > +/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ > + > +/* Authors: Bernard Metzler <bmt@xxxxxxxxxxxxxx> */ > +/* Copyright (c) 2008-2019, IBM Corporation */ > + > +#include <linux/types.h> > +#include <linux/printk.h> > + > +#include "siw.h" > + > +void siw_print_hdr(union iwarp_hdr *hdr, int qp_id, char *string) > +{ > + enum rdma_opcode op = __rdmap_get_opcode(&hdr->ctrl); > + u16 mpa_len = be16_to_cpu(hdr->ctrl.mpa_len); > + > + switch (op) { > + case RDMAP_RDMA_WRITE: > + pr_info("siw: [QP %d]: %s(WRITE, DDP len %d): %08x %016llx\n", > + qp_id, string, ddp_data_len(op, mpa_len), > + hdr->rwrite.sink_stag, hdr->rwrite.sink_to); > + break; > + > + case RDMAP_RDMA_READ_REQ: > + pr_info("siw: [QP %d]: %s(RREQ, DDP len %d): %08x %08x %08x %08x %016llx %08x %08x %016llx\n", > + qp_id, string, ddp_data_len(op, mpa_len), > + be32_to_cpu(hdr->rreq.ddp_qn), > + be32_to_cpu(hdr->rreq.ddp_msn), > + be32_to_cpu(hdr->rreq.ddp_mo), > + be32_to_cpu(hdr->rreq.sink_stag), > + be64_to_cpu(hdr->rreq.sink_to), > + be32_to_cpu(hdr->rreq.read_size), > + be32_to_cpu(hdr->rreq.source_stag), > + be64_to_cpu(hdr->rreq.source_to)); > + > + break; > + > + case RDMAP_RDMA_READ_RESP: > + pr_info("siw: [QP %d]: %s(RRESP, DDP len %d): %08x %016llx\n", > + qp_id, string, ddp_data_len(op, mpa_len), > + be32_to_cpu(hdr->rresp.sink_stag), > + be64_to_cpu(hdr->rresp.sink_to)); > + break; > + > + case RDMAP_SEND: > + pr_info("siw: [QP %d]: %s(SEND, DDP len %d): %08x %08x %08x\n", > + qp_id, string, ddp_data_len(op, mpa_len), > + be32_to_cpu(hdr->send.ddp_qn), > + be32_to_cpu(hdr->send.ddp_msn), > + be32_to_cpu(hdr->send.ddp_mo)); > + break; > + > + case RDMAP_SEND_INVAL: > + pr_info("siw: [QP %d]: %s(S_INV, DDP len %d): %08x %08x %08x %08x\n", > + qp_id, string, ddp_data_len(op, mpa_len), > + be32_to_cpu(hdr->send_inv.inval_stag), > + be32_to_cpu(hdr->send_inv.ddp_qn), > + be32_to_cpu(hdr->send_inv.ddp_msn), > + be32_to_cpu(hdr->send_inv.ddp_mo)); > + break; > + > + case RDMAP_SEND_SE: > + pr_info("siw: [QP %d]: %s(S_SE, DDP len %d): %08x %08x %08x\n", > + qp_id, string, ddp_data_len(op, mpa_len), > + be32_to_cpu(hdr->send.ddp_qn), > + be32_to_cpu(hdr->send.ddp_msn), > + be32_to_cpu(hdr->send.ddp_mo)); > + break; > + > + case RDMAP_SEND_SE_INVAL: > + pr_info("siw: [QP %d]: %s(S_SE_INV, DDP len %d): %08x %08x %08x %08x\n", > + qp_id, string, ddp_data_len(op, mpa_len), > + be32_to_cpu(hdr->send_inv.inval_stag), > + be32_to_cpu(hdr->send_inv.ddp_qn), > + be32_to_cpu(hdr->send_inv.ddp_msn), > + be32_to_cpu(hdr->send_inv.ddp_mo)); > + break; > + > + case RDMAP_TERMINATE: > + pr_info("siw: [QP %d]: %s(TERM, DDP len %d):\n", qp_id, string, > + ddp_data_len(op, mpa_len)); > + break; > + > + default: > + pr_info("siw: [QP %d]: %s (undefined opcode %d)", qp_id, string, > + op); > + break; > + } > +} > diff --git a/drivers/infiniband/sw/siw/siw_debug.h b/drivers/infiniband/sw/siw/siw_debug.h > new file mode 100644 > index 000000000000..b7f4c4286535 > --- /dev/null > +++ b/drivers/infiniband/sw/siw/siw_debug.h > @@ -0,0 +1,34 @@ > +/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ > + > +/* Authors: Bernard Metzler <bmt@xxxxxxxxxxxxxx> */ > +/* Copyright (c) 2008-2019, IBM Corporation */ > + > +#ifndef _SIW_DEBUG_H > +#define _SIW_DEBUG_H > + > +#define siw_dbg(ddev, fmt, ...) \ > + dev_dbg(&(ddev)->base_dev.dev, "cpu%2d %s: " fmt, smp_processor_id(), \ > + __func__, ##__VA_ARGS__) > + > +#define siw_dbg_qp(qp, fmt, ...) \ > + siw_dbg(qp->hdr.sdev, "[QP %d]: " fmt, QP_ID(qp), ##__VA_ARGS__) > + > +#define siw_dbg_cep(cep, fmt, ...) \ > + siw_dbg(cep->sdev, "[CEP 0x%p]: " fmt, cep, ##__VA_ARGS__) > + > +#define siw_dbg_obj(obj, fmt, ...) \ > + siw_dbg(obj->hdr.sdev, "[OBJ ID %d]: " fmt, obj->hdr.id, ##__VA_ARGS__) > + I assume that Gal is working to create general print messages. > +#ifdef DEBUG_HDR Was it defined? > + > +#define siw_dprint_hdr(hdr, qpn, msg) siw_print_hdr(hdr, qpn, msg) > + > +#else > + > +#define siw_dprint_hdr(hdr, qpn, msg) \ > + do { \ > + } while (0) > + > +#endif > + > +#endif > -- > 2.17.2 >
Attachment:
signature.asc
Description: PGP signature