Skip to contentSkip to conversation

mpt2sas: Added command line option diag_buffer_enable.

PATCH New Kashyap, Desai 1 participant 1 message Sep 23, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 8/20 mpt2sas: Added command line option diag_buffer_enable.

Added command line option diag_buffer_enable. When the command line option is set, the driver will automatically post diag buffers at driver load time. The command line option diag_buffer_enable is bitwise, so it's possible to enable both and/or snapshot + trace buffers. For trace, the driver will allocate 1MB buffer, whereas for snapshot its 2MB. The purpose for this is so the enduser doesn't have to manually use an application to setup diag buffers for debugging firmware related issues.

Here is some examples
trace:

# insmod mpt2sas.ko diag_buffer_enable=1

snapshot:

# insmod mpt2sas.ko diag_buffer_enable=2

both trace and snapshot:

# insmod mpt2sas.ko diag_buffer_enable=3

---

drivers/scsi/mpt2sas/mpt2sas_base.c +13 -0
index ec3f577..1d2374b 100644
@@ -77,6 +77,17 @@ static int msix_disable = -1;
 module_param(msix_disable, int, 0);
 MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)");
 
+/* diag_buffer_enable is bitwise
+ * bit 0 set = MPI2_DIAG_BUF_TYPE_TRACE(1)
+ * bit 1 set = MPI2_DIAG_BUF_TYPE_SNAPSHOT(2)
+ *
+ * Either bit can be set, or both
+ */
+static int diag_buffer_enable;
+module_param(diag_buffer_enable, int, 0);
+MODULE_PARM_DESC(diag_buffer_enable, " enable diag buffer at driver load "
+    "time (TRACE=1/SNAP=2/default=0)");
+
 int mpt2sas_fwfault_debug;
 MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault "
     "and halt firmware - (default=0)");
@@ -3588,6 +3599,8 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
 		goto out_free_resources;
 
 	mpt2sas_base_start_watchdog(ioc);
+	if (diag_buffer_enable != 0)
+		mpt2sas_enable_diag_buffer(ioc, diag_buffer_enable);
 	return 0;
 
  out_free_resources:
drivers/scsi/mpt2sas/mpt2sas_base.h +3 -0
index 0c75c0e..e658cf9 100644
@@ -886,6 +886,9 @@ u8 mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
 void mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER *ioc,
     Mpi2EventNotificationReply_t *mpi_reply);
 
+void mpt2sas_enable_diag_buffer(struct MPT2SAS_ADAPTER *ioc,
+	u8 bits_to_regsiter);
+
 /* transport shared API */
 u8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
     u32 reply);
drivers/scsi/mpt2sas/mpt2sas_ctl.c +88 -37

174 lines not on this page · raw message