OSDN Git Service

scsi: mpt3sas: Reuse diag buffer allocated at load time
authorSreekanth Reddy <sreekanth.reddy@broadcom.com>
Fri, 13 Sep 2019 13:04:44 +0000 (09:04 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 1 Oct 2019 02:32:47 +0000 (22:32 -0400)
commita066f4c31359d07b1a2c5144b4b9a29901365fd0
tree1aa3057d4f132e3d81748a1b283137fbc40ff97c
parentdd180e4eedfd85b80020a6fd566601f4765a9d69
scsi: mpt3sas: Reuse diag buffer allocated at load time

The diag buffer which is allocated during driver load time or through sysfs
parameter is marked as driver allocated diag buffer.
MPT3_DIAG_BUFFER_IS_DRIVER_ALLOCATED bit will be set for this buffer.

This buffer won't be de-allocated even when application issues unregister
command, driver just clears the registered status bit. Same buffer will be
reused while re-registering the same diag buffer type by any application.
While re-registering the same diag buffer type application has to register
with the same size that the buffer was allocated during driver load
time. This buffer size can be read by the application by issuing diag
'query' command.

This always makes sure that the memory is available for applications for
collecting the firmware logs. Only thing is that this won't allow the
application to re-register the diag buffer with different size, but the
buffer size which is allocated during driver load time will be enough for
most of the cases for collecting the firmware logs.

Link: https://lore.kernel.org/r/1568379890-18347-8-git-send-email-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_base.h
drivers/scsi/mpt3sas/mpt3sas_ctl.c
drivers/scsi/mpt3sas/mpt3sas_ctl.h