28 Aug, 2017

17 commits

  • The SBA_REQUEST_STATE_COMPLETED state was added to keep track
    of sba_request which got completed but cannot be freed because
    underlying Async Tx descriptor was not ACKed by DMA client.

    Instead of above, we can free the sba_request with non-ACKed
    Async Tx descriptor and sba_alloc_request() will ensure that
    it always allocates sba_request with ACKed Async Tx descriptor.
    This alternate approach makes SBA_REQUEST_STATE_COMPLETED state
    redundant hence this patch removes it.

    Signed-off-by: Anup Patel
    Reviewed-by: Ray Jui
    Reviewed-by: Scott Branden
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • We should explicitly ACK mailbox message because after
    sending message we can know the send status via error
    attribute of brcm_message.

    This will also help SBA-RAID to use "txdone_ack" method
    whenever mailbox controller supports it.

    Signed-off-by: Anup Patel
    Reviewed-by: Ray Jui
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • This patch adds debugfs support to report stats via debugfs
    which in-turn will help debug hang or error situations.

    Signed-off-by: Anup Patel
    Reviewed-by: Ray Jui
    Reviewed-by: Scott Branden
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • The SBA_REQUEST_STATE_RECEIVED state is now redundant because
    received sba_request are immediately freed or moved to completed
    list in sba_process_received_request().

    This patch removes redundant SBA_REQUEST_STATE_RECEIVED state.

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • Currently, sba_process_deferred_requests() handles both pending
    and completed sba_request which is unnecessary overhead for
    sba_issue_pending() because completed sba_request handling is
    not required in sba_issue_pending().

    This patch breaks sba_process_deferred_requests() into two parts
    sba_process_received_request() and _sba_process_pending_requests().

    The sba_issue_pending() will only process pending sba_request
    by calling _sba_process_pending_requests(). This will improve
    sba_issue_pending().

    The sba_receive_message() will only process received sba_request
    by calling sba_process_received_request() for each received
    sba_request. The sba_process_received_request() will also call
    _sba_process_pending_requests() after handling received sba_request
    because we might have pending sba_request not submitted by previous
    call to sba_issue_pending().

    Signed-off-by: Anup Patel
    Reviewed-by: Scott Branden
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • We should pre-ack async tx descriptor at time of
    allocating sba_request (just like other RAID drivers).

    Signed-off-by: Anup Patel
    Reviewed-by: Ray Jui
    Reviewed-by: Scott Branden
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • When setting up RAID array on several NVMe disks we observed that
    sba_alloc_request() start failing (due to no free requests left)
    and RAID array setup becomes very slow.

    To improve performance, we do mbox channel peek when we have
    no free requests. This improves performance of RAID array setup
    because mbox requests that were completed but not processed by
    mbox completion worker will be processed immediately by mbox
    channel peek.

    Signed-off-by: Anup Patel
    Reviewed-by: Ray Jui
    Reviewed-by: Scott Branden
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • We should allocate DMA channel resources before registering the
    DMA device in sba_probe() because we can get DMA request soon
    after registering the DMA device. If DMA channel resources are
    not allocated before first DMA request then SBA-RAID driver will
    crash.

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • The pending sba_request list can become very long in real-life usage
    (e.g. setting up RAID array) which can cause sba_issue_pending() to
    run for long duration.

    This patch adds common sba_process_deferred_requests() to process
    few completed and pending requests so that it finishes in short
    duration. We use this common sba_process_deferred_requests() in
    both sba_issue_pending() and sba_receive_message().

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • Currently, we have only 1024 free sba_request created
    by sba_prealloc_channel_resources(). This is too low
    and the prep_xxx() callbacks start failing more often
    at time of RAID array setup over NVMe disks.

    This patch sets number of free sba_request created by
    sba_prealloc_channel_resources() to be:
    x 8192

    Due to above, we will have sufficient number of free
    sba_request and prep_xxx() callbacks failing is very
    unlikely.

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • Currently, we cannot have any arbitrary number of free sba_request
    because sba_prealloc_channel_resources() allocates an array of
    sba_request using devm_kcalloc() and kcalloc() cannot provide
    memory beyond certain size.

    This patch removes "reqs" (sba_request array) from sba_device
    and makes "cmds" as variable array (instead of pointer) in
    sba_request. This helps sba_prealloc_channel_resources() to
    allocate sba_request and associated SBA command in one allocation
    which in-turn allows arbitrary number of free sba_request.

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • The reqs_free_count member of sba_device is not used anywhere
    hence no point in tracking number of free sba_request.

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • Both resp and resp_dma are redundant in sba_request because
    resp is unused and resp_dma carries same information present
    in tx.phys of sba_request. This patch removes both resp and
    resp_dma from sba_request.

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • The next_count in sba_request is redundant because same information
    is captured by next_pending_count. This patch removes next_count
    from sba_request.

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • This patch merges sba_request state and fence into common
    sba_request flags. The sba_request flags not only saves
    memory but it can also be extended in-future without adding
    new members.

    We also make each sba_request state as separate bit in
    sba_request flags to help debugging situations where a
    sba_request is accidently in two states.

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • We don't require to hold "sba->reqs_lock" for long-time
    in sba_alloc_request() because lock protection is not
    required when initializing members of "struct sba_request".

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     
  • This patch does following improvments to comments:
    1. Make section comments consistent across the driver by
    avoiding " SBA " in some of the comments
    2. Add/update few more section comments

    Signed-off-by: Anup Patel
    Signed-off-by: Vinod Koul

    Anup Patel
     

19 Jul, 2017

1 commit

  • This driver builds with warnings which can be fixed by making these
    functions static.

    CC [M] drivers/dma/bcm-sba-raid.o
    drivers/dma/bcm-sba-raid.c:786:1: warning: no previous prototype for ‘sba_prep_dma_xor_req’ [-Wmissing-prototypes]
    sba_prep_dma_xor_req(struct sba_device *sba,
    ^
    drivers/dma/bcm-sba-raid.c:995:1: warning: no previous prototype for ‘sba_prep_dma_pq_req’ [-Wmissing-prototypes]
    sba_prep_dma_pq_req(struct sba_device *sba, dma_addr_t off,
    ^
    drivers/dma/bcm-sba-raid.c:1247:1: warning: no previous prototype for ‘sba_prep_dma_pq_single_req’ [-Wmissing-prototypes]
    sba_prep_dma_pq_single_req(struct sba_device *sba, dma_addr_t off,
    ^

    Signed-off-by: Vinod Koul

    Vinod Koul
     

19 May, 2017

1 commit


16 May, 2017

1 commit

  • The Broadcom stream buffer accelerator (SBA) provides offloading
    capabilities for RAID operations. This SBA offload engine is
    accessible via Broadcom SoC specific ring manager.

    This patch adds Broadcom SBA RAID driver which provides one
    DMA device with RAID capabilities using one or more Broadcom
    SoC specific ring manager channels. The SBA RAID driver in its
    current shape implements memcpy, xor, and pq operations.

    Signed-off-by: Anup Patel
    Reviewed-by: Ray Jui
    Acked-by: Dan Williams
    Signed-off-by: Vinod Koul

    Anup Patel