mpt2sas: Added sysfs support for trace buffer
PATCH 8/17 mpt2sas: Added sysfs support for trace buffer
Added support so the diag ring buffer can be pulled via sysfs Added three new shost attributes: host_trace_buffer, host_trace_buffer_enable, and host_trace_buffer_size. The host_trace_buffer_enable attribute is used to either post or release
the trace buffers. The host_trace_buffer_size attribute contains
the size of the trace buffer. The host_trace_buffer atttribute contains a maximum 4KB window of the buffer. In order to read the entire host buffer, you will need to write the offset to host_trace_buffer prior to reading it. release the host buffer, then write the entire host buffer contents to a file.
In addition to this enhancement, we moved the automatic posting of host buffers at driver load time to be called prior to port_enable, instead of after. That way discovery is available in the host buffer.
---
drivers/scsi/mpt2sas/mpt2sas_base.c +6 -4
@@ -3529,8 +3529,12 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)if (sleep_flag ==CAN_SLEEP )_base_static_config_pages (ioc); -if (ioc->wait_for_port_enable_to_complete && disable_discovery >0 ) -return r; +if (ioc->wait_for_port_enable_to_complete) { +if (diag_buffer_enable !=0 ) +mpt2sas_enable_diag_buffer (ioc, diag_buffer_enable); +if (disable_discovery >0 ) +return r; + } r =_base_send_port_enable (ioc, sleep_flag);if (r)
@@ -3679,8 +3683,6 @@ 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 +2 -0
@@ -750,6 +750,8 @@ struct MPT2SAS_ADAPTER {Mpi2ManufacturingPage10_t manu_pg10;u32 product_specific[MPI2_DIAG_BUF_TYPE_COUNT ][23 ];u32 diagnostic_flags[MPI2_DIAG_BUF_TYPE_COUNT ]; +u32 ring_buffer_offset; +u32 ring_buffer_sz; }; typedef u8 (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
drivers/scsi/mpt2sas/mpt2sas_ctl.c +192 -0
204 lines not on this page · raw message