From patchwork Wed Apr 7 02:04:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kashyap Desai X-Patchwork-Id: 417893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3238EC433ED for ; Wed, 7 Apr 2021 02:04:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1248A613B8 for ; Wed, 7 Apr 2021 02:04:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344051AbhDGCFB (ORCPT ); Tue, 6 Apr 2021 22:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343951AbhDGCEt (ORCPT ); Tue, 6 Apr 2021 22:04:49 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6094C061756 for ; Tue, 6 Apr 2021 19:04:40 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id g10so8537479plt.8 for ; Tue, 06 Apr 2021 19:04:40 -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=LCw+mCnirKny0ZbZtTJPKG+lNeivowMF7Homn9kOAds=; b=hDvR5FzDWF92HkVk566YBLzcbfVpbvW4KeO8dNjz3DUIBj4jQQIKU2ZIXp+OyB5D0U S3IHMxWGcadZUSYsMjzH4f9k0jZfIXFr43AV86V3oVXWwe8r3k8HJSrRrJz0eHxGWR0V 7D/8FL60A/AWkdQqwrbchTDFTcpCVVEqINY4w= 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=LCw+mCnirKny0ZbZtTJPKG+lNeivowMF7Homn9kOAds=; b=YaT2P2rPNx0XTZlCpjJxQAeUHR8r3wc7GubsBJ4wkMqlM+AMBZK5f8fPbM7K1USpBB oz6HutHrSTI3oJmjcZhe6vfRBTrqhrC+MpZEK9JrtAI890CE3cH6KeqK/CwqDItRpw2E rdi4McCTKunZlhjWhtllO+lEKDZFS25kDej/slidvZxUFnQtohqMI4I5V2TYXgqE2XNb bb3oe1B4vHEs+TOAQ1KW9U6N1xrepT27PsixrIUU0rJeTrFgQ2aEOHLTR+B7ys55PvbH 9zOpZQby3qC/jd26fIh/TgnLBXI+Yy27kpfFXEnnVVGowjlBuR9XT6XVLskTGilOYEml HOVg== X-Gm-Message-State: AOAM531EJxxuHoxtlBHLPknFoBWGrGBHiG/PYbliLcgtoapw5mAULSc5 hCtK7SkYaUXL9Klza1ejpMy/Z4oLEB/mu7/ehUHmu9uR6dLVDSgHw6PD41XibIKSdPcKpmSR8QI tVdRkwAxrsrifJ+WJw1Rv2g1ztJ2ohknG7oagAI0+mUGiU082pZV8m/47B2S98jOnNV+maVvKO0 sRDt0F1w== X-Google-Smtp-Source: ABdhPJxtTR1ft5yNDksIbWGH94QvOPfLCxKF79aYJXDp/9COHSTPt4b0xZwiVlXcfcnIs7SE7i7Ceg== X-Received: by 2002:a17:902:e752:b029:e9:5e60:b866 with SMTP id p18-20020a170902e752b02900e95e60b866mr1039383plf.55.1617761079975; Tue, 06 Apr 2021 19:04:39 -0700 (PDT) Received: from drv-bst-rhel8.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id y9sm3435858pja.50.2021.04.06.19.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 19:04:39 -0700 (PDT) From: Kashyap Desai To: linux-scsi@vger.kernel.org Cc: Kashyap Desai , sathya.prakash@broadcom.com Subject: [PATCH v2 11/24] mpi3mr: print ioc info for debugging Date: Wed, 7 Apr 2021 07:34:38 +0530 Message-Id: <20210407020451.924822-12-kashyap.desai@broadcom.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210407020451.924822-1-kashyap.desai@broadcom.com> References: <20210407020451.924822-1-kashyap.desai@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Kashyap Desai Cc: sathya.prakash@broadcom.com Reviewed-by: Tomas Henzl --- drivers/scsi/mpi3mr/mpi3mr_fw.c | 80 +++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index d47031d05322..c3882fef2d2a 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -2550,6 +2550,85 @@ int mpi3mr_issue_port_enable(struct mpi3mr_ioc *mrioc, u8 async) return retval; } +/* Protocol type to name mapper structure*/ +static const struct { + u8 protocol; + char *name; +} mpi3mr_protocols[] = { + { MPI3_IOCFACTS_PROTOCOL_SCSI_INITIATOR, "Initiator" }, + { MPI3_IOCFACTS_PROTOCOL_SCSI_TARGET, "Target" }, + { MPI3_IOCFACTS_PROTOCOL_NVME, "NVMe attachment" }, +}; + +/* Capability to name mapper structure*/ +static const struct { + u32 capability; + char *name; +} mpi3mr_capabilities[] = { + { MPI3_IOCFACTS_CAPABILITY_RAID_CAPABLE, "RAID" }, +}; + +/** + * mpi3mr_print_ioc_info - Display controller information + * @mrioc: Adapter instance reference + * + * Display controller personalit, capability, supported + * protocols etc. + * + * Return: Nothing + */ +static void +mpi3mr_print_ioc_info(struct mpi3mr_ioc *mrioc) +{ + int i = 0; + char personality[16]; + char protocol[50] = {0}; + char capabilities[100] = {0}; + bool is_string_nonempty = false; + struct mpi3mr_compimg_ver *fwver = &mrioc->facts.fw_ver; + + switch (mrioc->facts.personality) { + case MPI3_IOCFACTS_FLAGS_PERSONALITY_EHBA: + strcpy(personality, "Enhanced HBA"); + break; + case MPI3_IOCFACTS_FLAGS_PERSONALITY_RAID_DDR: + strcpy(personality, "RAID"); + break; + default: + strcpy(personality, "Unknown"); + break; + } + + ioc_info(mrioc, "Running in %s Personality", personality); + + ioc_info(mrioc, "FW Version(%d.%d.%d.%d.%d.%d)\n", + fwver->gen_major, fwver->gen_minor, fwver->ph_major, + fwver->ph_minor, fwver->cust_id, fwver->build_num); + + for (i = 0; i < ARRAY_SIZE(mpi3mr_protocols); i++) { + if (mrioc->facts.protocol_flags & + mpi3mr_protocols[i].protocol) { + if (is_string_nonempty) + strcat(protocol, ","); + strcat(protocol, mpi3mr_protocols[i].name); + is_string_nonempty = true; + } + } + + is_string_nonempty = false; + for (i = 0; i < ARRAY_SIZE(mpi3mr_capabilities); i++) { + if (mrioc->facts.protocol_flags & + mpi3mr_capabilities[i].capability) { + if (is_string_nonempty) + strcat(capabilities, ","); + strcat(capabilities, mpi3mr_capabilities[i].name); + is_string_nonempty = true; + } + } + + ioc_info(mrioc, "Protocol=(%s), Capabilities=(%s)\n", + protocol, capabilities); +} /** * mpi3mr_cleanup_resources - Free PCI resources @@ -2808,6 +2887,7 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc, u8 re_init) } } + mpi3mr_print_ioc_info(mrioc); retval = mpi3mr_alloc_reply_sense_bufs(mrioc); if (retval) {