From patchwork Fri Apr 26 09:37:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918945 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 729AA1575 for ; Fri, 26 Apr 2019 09:38:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61A5928D55 for ; Fri, 26 Apr 2019 09:38:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5605328D69; Fri, 26 Apr 2019 09:38:51 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 F186728D55 for ; Fri, 26 Apr 2019 09:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726267AbfDZJiu (ORCPT ); Fri, 26 Apr 2019 05:38:50 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45494 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726058AbfDZJiu (ORCPT ); Fri, 26 Apr 2019 05:38:50 -0400 Received: by mail-pl1-f195.google.com with SMTP id o5so1282741pls.12 for ; Fri, 26 Apr 2019 02:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dcCoZiF26ORknzMxcBW3zcM05iT1n+AfBsRDn09t5Cc=; b=HeixsCd8jwBGOqASS0SbtNvhjf1OpoTHEbtRMkH9UA1JWadvC3JQepjg/J6x+SOx5z vyCClESgW052YKGvHmStYoHLZdJUP8UEcZnTYM99jfaacTN3mF6iufZ1PmN7T6T+SOo4 dsLbesGxeMJa+cuTyujO5hGumLk681sF14X0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dcCoZiF26ORknzMxcBW3zcM05iT1n+AfBsRDn09t5Cc=; b=ttTELQ7QIHPIfugrFLYNjQ92CGFZNBp1XjzTIqvTBktScwybH9OrGUL//y4rcH55nf 3j9H7mTAj9a6NoZctRaORA7m26UyMMKkqXFEbgNGngy7v65Qw+LAnenxv/Tp4GLvwpz9 DoVhWrBt3I+5LyWPQb1iQr8Nc3KYRW6HxlRb3amW7il8Qstd8KsbPM9deU4HaNMDldgx gAKvI/8cSWg8up/qL4ax72WVkiRBXSmCj8uy3BD8LO3vmm93qYjJJDFVCgJg7IpJySoN zLVp+2hr8xw/nqZSLEQpRPEDaUBnu+FTcAcOgH1mTSsnj5lUEbLFxljxVshsAcTuHksE i9Ng== X-Gm-Message-State: APjAAAUg5s4BBtph0K/lqnbcpdLlRe085DZYVc7RwhynKT2HRgVuXveF sdu4UFGUuzqtY0VVcLwuoEwNLBftLwizFf6C/nCGuFWuHbbEkyupIv6liLgRay467e7aLY0LDn7 o6lWtZIsd5LlZcomexaye64KGjIF0bjSxwcvuKaZh8tfpBE3C7k13pg43Zl6CyYoMgvr1Qjamt4 SfY1h0lJ2nrruTrZMf3vzD X-Google-Smtp-Source: APXvYqypgtZb7UpwcH9n3yyzbuH14DiXdCbFU5O8WzP1QWAhxsa8rxUdn/G825Ob5km+qLyZqVaHxw== X-Received: by 2002:a17:902:758b:: with SMTP id j11mr7627549pll.87.1556271529375; Fri, 26 Apr 2019 02:38:49 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:48 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 10/21] megaraid_sas: Add formatting option for megasas_dump Date: Fri, 26 Apr 2019 02:37:04 -0700 Message-Id: <1556271435-27252-11-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add option to format the buffer that is being dumped. Currently, the IO frame and chain frame dumped in the syslog is getting split across multiple lines based on the formatting. Fix this by using KERN_CONT in printk. Signed-off-by: Sumit Saxena Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 7449df36a092..d0fd307e30af 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -2838,22 +2838,28 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) } /** - * megasas_dump - This function will provide hexdump - * @ptr: Pointer starting which memory should be dumped - * @size: Size of memory to be dumped + * megasas_dump - This function will print hexdump of provided buffer. + * @buf: Buffer to be dumped + * @sz: Size in bytes + * @format: Different formats of dumping e.g. format=n will + * cause only 'n' 32 bit words to be dumped in a single + * line. */ inline void -megasas_dump(void *ptr, int sz) +megasas_dump(void *buf, int sz, int format) { int i; - __le32 *loc = (__le32 *)ptr; + __le32 *buf_loc = (__le32 *)buf; - for (i = 0; i < sz / sizeof(__le32); i++) { - if (i && ((i % 8) == 0)) - printk("\n\t"); - printk("%08x ", le32_to_cpu(loc[i])); + for (i = 0; i < (sz / sizeof(__le32)); i++) { + if ((i % format) == 0) { + if (i != 0) + printk(KERN_CONT "\n"); + printk(KERN_CONT "%08x: ", (i * 4)); + } + printk(KERN_CONT "%08x ", le32_to_cpu(buf_loc[i])); } - printk("\n"); + printk(KERN_CONT "\n"); } /** @@ -2887,10 +2893,10 @@ megasas_dump_fusion_io(struct scsi_cmnd *scmd) printk(KERN_INFO "IO request frame:\n"); megasas_dump(cmd->io_request, - MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE); + MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE, 8); printk(KERN_INFO "Chain frame:\n"); megasas_dump(cmd->sg_frame, - instance->max_chain_frame_sz); + instance->max_chain_frame_sz, 8); } }