• Sreekanth Reddy's avatar
    scsi: mpt3sas: Maintain owner of buffer through UniqueID · 08e7378e
    Sreekanth Reddy authored
    Application A has registered a diag buffer and looking for particular event
    to happen to release & read the trace buffer. Meanwhile application B has
    unregistered the diag buffer and now Application A can't get the required
    diag buffer. So proper diag buffer ownership is missing.
    
    Each application has to maintain its own Unique ID. Now driver has to save
    the Application's UniqueID for each diag buffer type when diag buffer is
    registered. And driver has to allow 'release', 'read' & 'unregister' diag
    commands only if application's UniqueID matches with saved UniqueID for the
    corresponding diag buffer type.
    
    When diag buffer is registered by the driver, then the UniqueID saved by
    the driver is "BRCM" (i.e. 0x4252434D) for SAS3 and above generations HBA
    devices. For SAS2 HBAs, driver keeps the legacy UniqueID 0x07075900 for
    maintaining compatibility with the legacy SAS2 application and this
    improvement won't be applicable for SAS2 HBA devices.
    
    Any application can own the buffer registered by the driver by sending
    diag register request to driver with same buffer type and size
    (Application can get the buffer size by sending 'query' command). Then
    driver changes the ownership of the buffer by saving application's
    UniqueID for that corresponding buffer type.
    
    Also, application can re-register the diag buffer with same size without
    un-registering it, but diag buffer should be released before re-registering
    it. By allowing this, driver no need to deallocate and allocate a new
    buffer for re-register command, same buffer can be re-used.
    
    Link: https://lore.kernel.org/r/1568379890-18347-6-git-send-email-sreekanth.reddy@broadcom.comSigned-off-by: default avatarSreekanth Reddy <sreekanth.reddy@broadcom.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    08e7378e
mpt3sas_ctl.c 107 KB