• Julian Wiedmann's avatar
    s390/qdio: don't merge ERROR output buffers · 5a768873
    Julian Wiedmann authored
    commit 0cf1e051 upstream.
    
    On an Output queue, both EMPTY and PENDING buffer states imply that the
    buffer is ready for completion-processing by the upper-layer drivers.
    
    So for a non-QEBSM Output queue, get_buf_states() merges mixed
    batches of PENDING and EMPTY buffers into one large batch of EMPTY
    buffers. The upper-layer driver (ie. qeth) later distuingishes PENDING
    from EMPTY by inspecting the slsb_state for
    QDIO_OUTBUF_STATE_FLAG_PENDING.
    
    But the merge logic in get_buf_states() contains a bug that causes us to
    erronously also merge ERROR buffers into such a batch of EMPTY buffers
    (ERROR is 0xaf, EMPTY is 0xa1; so ERROR & EMPTY == EMPTY).
    Effectively, most outbound ERROR buffers are currently discarded
    silently and processed as if they had succeeded.
    
    Note that this affects _all_ non-QEBSM device types, not just IQD with CQ.
    
    Fix it by explicitly spelling out the exact conditions for merging.
    
    For extracting the "get initial state" part out of the loop, this relies
    on the fact that get_buf_states() is never called with a count of 0. The
    QEBSM path already strictly requires this, and the two callers with
    variable 'count' make sure of it.
    
    Fixes: 104ea556 ("qdio: support asynchronous delivery of storage blocks")
    Cc: <stable@vger.kernel.org> #v3.2+
    Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
    Reviewed-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
    Reviewed-by: default avatarBenjamin Block <bblock@linux.vnet.ibm.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    5a768873
qdio_main.c 45 KB