From patchwork Wed Apr 17 15:00:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernard Metzler X-Patchwork-Id: 10905483 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8424917E6 for ; Wed, 17 Apr 2019 15:01:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C7E128C06 for ; Wed, 17 Apr 2019 15:01:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60D7E28C00; Wed, 17 Apr 2019 15:01:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AF5328C08 for ; Wed, 17 Apr 2019 15:01:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732598AbfDQPBe (ORCPT ); Wed, 17 Apr 2019 11:01:34 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38726 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732636AbfDQPBd (ORCPT ); Wed, 17 Apr 2019 11:01:33 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3HF0FxT145423 for ; Wed, 17 Apr 2019 11:01:31 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2rx6df82jr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 17 Apr 2019 11:01:31 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Apr 2019 16:01:24 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 17 Apr 2019 16:01:22 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3HF1L1i24510494 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Apr 2019 15:01:21 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4BCA411C052; Wed, 17 Apr 2019 15:01:21 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2874F11C05E; Wed, 17 Apr 2019 15:01:21 +0000 (GMT) Received: from spoke.zurich.ibm.com (unknown [9.4.69.152]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 17 Apr 2019 15:01:21 +0000 (GMT) From: Bernard Metzler To: linux-rdma@vger.kernel.org Cc: Bernard Metzler Subject: [PATCH v7 11/12] SIW debugging Date: Wed, 17 Apr 2019 17:00:50 +0200 X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190417150051.365-1-bmt@zurich.ibm.com> References: <20190417150051.365-1-bmt@zurich.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19041715-0020-0000-0000-00000330E4A9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19041715-0021-0000-0000-00002183303B Message-Id: <20190417150051.365-12-bmt@zurich.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-17_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=603 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904170102 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Bernard Metzler --- drivers/infiniband/sw/siw/siw_debug.c | 91 +++++++++++++++++++++++++++ drivers/infiniband/sw/siw/siw_debug.h | 40 ++++++++++++ 2 files changed, 131 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..86460d370333 --- /dev/null +++ b/drivers/infiniband/sw/siw/siw_debug.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause + +/* Authors: Bernard Metzler */ +/* Copyright (c) 2008-2019, IBM Corporation */ + +#include +#include + +#include "siw.h" + +#define ddp_data_len(op, mpa_len) \ + (mpa_len - (iwarp_pktinfo[op].hdr_len - MPA_HDR_SIZE)) + +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 %u]: %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 %u]: %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 %u]: %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 %u]: %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 %u]: %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 %u]: %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 %u]: %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 %u]: %s(TERM, DDP len %d):\n", qp_id, string, + ddp_data_len(op, mpa_len)); + break; + + default: + pr_info("siw: [QP %u]: %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..2cfe7ce68428 --- /dev/null +++ b/drivers/infiniband/sw/siw/siw_debug.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ + +/* Authors: Bernard Metzler */ +/* 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->sdev, "[QP %u]: " fmt, qp->id, ##__VA_ARGS__) + +#define siw_dbg_cq(cq, fmt, ...) \ + siw_dbg(cq->sdev, "[CQ %u]: " fmt, cq->id, ##__VA_ARGS__) + +#define siw_dbg_pd(pd, fmt, ...) \ + siw_dbg(pd->sdev, "[PD %u]: " fmt, pd->base_pd.res.id, ##__VA_ARGS__) + +#define siw_dbg_mem(mem, fmt, ...) \ + siw_dbg(mem->sdev, "[MEM 0x%08x]: " fmt, mem->stag, ##__VA_ARGS__) + +#define siw_dbg_cep(cep, fmt, ...) \ + siw_dbg(cep->sdev, "[CEP 0x%p]: " fmt, cep, ##__VA_ARGS__) + +#ifdef DEBUG_HDR + +#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