Re: [PATCH 11/24] mpi3mr: print ioc info for debugging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/22/20 11:11 AM, Kashyap Desai wrote:
Signed-off-by: Kashyap Desai <kashyap.desai@xxxxxxxxxxxx>
Cc: sathya.prakash@xxxxxxxxxxxx
---
  drivers/scsi/mpi3mr/mpi3mr_fw.c | 63 +++++++++++++++++++++++++++++++++
  1 file changed, 63 insertions(+)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index 10ff287e78db..aad0a2bd06b9 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -2540,6 +2540,68 @@ int mpi3mr_issue_port_enable(struct mpi3mr_ioc *mrioc, u8 async)
  	return retval;
  }
+/**
+ * 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];
+	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);
+
+	ioc_info(mrioc, "Protocol=(");
+
+	if (mrioc->facts.protocol_flags &
+	    MPI3_IOCFACTS_PROTOCOL_SCSI_INITIATOR) {
+		pr_cont("Initiator");
+		i++;
+	}
+
+	if (mrioc->facts.protocol_flags &
+	    MPI3_IOCFACTS_PROTOCOL_SCSI_TARGET) {
+		pr_cont("%sTarget", i ? "," : "");
+		i++;
+	}
+
+	if (mrioc->facts.protocol_flags &
+	    MPI3_IOCFACTS_PROTOCOL_NVME) {
+		pr_cont("%sNVMe attachment", i ? "," : "");
+		i++;
+	}
+	pr_cont("), ");
+	pr_cont("Capabilities=(");
+
+	if (mrioc->facts.ioc_capabilities &
+	    MPI3_IOCFACTS_CAPABILITY_RAID_CAPABLE)
+		pr_cont("RAID");
+
+	pr_cont(")\n");
+}
Yikes. Don't.

pr_cont() has the habit to be broken up into individual lines per call if the system has to print out lots of messages. I would seriously advocate having just one pr_XX() call per line, and use conditional statements to construct the arguments.

Cheers,

Hannes
--
Dr. Hannes Reinecke                Kernel Storage Architect
hare@xxxxxxx                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux