• Nicholas Bellinger's avatar
    target/qla2xxx: Honor max_data_sg_nents I/O transfer limit · 8f9b5654
    Nicholas Bellinger authored
    This patch adds an optional fabric driver provided SGL limit
    that target-core will honor as it's own internal I/O maximum
    transfer length limit, as exposed by EVPD=0xb0 block limits
    parameters.
    
    This is required for handling cases when host I/O transfer
    length exceeds the requested EVPD block limits maximum
    transfer length. The initial user of this logic is qla2xxx,
    so that we can avoid having to reject I/Os from some legacy
    FC hosts where EVPD=0xb0 parameters are not honored.
    
    When se_cmd payload length exceeds the provided limit in
    target_check_max_data_sg_nents() code, se_cmd->data_length +
    se_cmd->prot_length are reset with se_cmd->residual_count
    plus underflow bit for outgoing TFO response callbacks.
    It also checks for existing CDB level underflow + overflow
    and recalculates final residual_count as necessary.
    
    Note this patch currently assumes 1:1 mapping of PAGE_SIZE
    per struct scatterlist entry.
    Reported-by: default avatarCraig Watson <craig.watson@vanguard-rugged.com>
    Cc: Craig Watson <craig.watson@vanguard-rugged.com>
    Tested-by: default avatarHimanshu Madhani <himanshu.madhani@qlogic.com>
    Cc: Roland Dreier <roland@purestorage.com>
    Cc: Arun Easi <arun.easi@qlogic.com>
    Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
    Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Hannes Reinecke <hare@suse.de>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
    8f9b5654
target_core_transport.c 79.3 KB