09 Nov, 2015

6 commits

  • resource_size_t may be 32-bit wide on some architectures, which causes
    this warning when building the NTB code:

    drivers/ntb/ntb_transport.c: In function 'ntb_transport_link_work':
    drivers/ntb/ntb_transport.c:828:46: warning: right shift count >= width of type [-Wshift-count-overflow]

    The warning is harmless but can be avoided by using the upper_32_bits()
    macro.

    Signed-off-by: Arnd Bergmann
    Fixes: e26a5843f7f5 ("NTB: Split ntb_hw_intel and ntb_transport drivers")
    Signed-off-by: Jon Mason

    Arnd Bergmann
     
  • There is no need for the upstream and downstream addresses to be different
    for the NTB configs. Go to using a single set of address. It is still
    possible to configure them differently using module parameter override
    however.

    Signed-off-by: Dave Jiang
    Acked and Tested-by: Allen Hubbe
    Signed-off-by: Jon Mason

    Dave Jiang
     
  • Order of operations issue with the QP Num and MW count, which would
    result in the receive buffer pointer being invalid if there are more
    than 1 MW. Corrected with parenthesis to enforce the proper order of
    operations.

    Reported-by: John I. Kading
    Signed-off-by: Jon Mason

    Jon Mason
     
  • These variables were not used anywhere. So remove them.

    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Jon Mason

    Sudip Mukherjee
     
  • We were accessing nt->mw_vec after freeing it. Fix the error path so
    that we free nt->mw_vec after we have finished using it.

    Signed-off-by: Sudip Mukherjee
    Signed-off-by: Jon Mason

    Sudip Mukherjee
     
  • smatch detected an issue in the function ntb_transport_max_size() where
    we could be dereferencing a dma channel pointer when it is NULL.

    Reported-by: Dan Carpenter
    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     

08 Sep, 2015

8 commits

  • The range check must exclude the upper bound.

    Signed-off-by: Allen Hubbe
    Signed-off-by: Jon Mason

    Allen Hubbe
     
  • Check that b2b_mw_idx is in range of the number of memory windows when
    initializing the device. The workaround is considered to be in effect
    only if the device b2b_idx is exactly UINT_MAX, instead of any index
    past the last memory window.

    Only print B2B MW workaround information in debugfs if the workaround is
    in effect.

    Signed-off-by: Allen Hubbe
    Signed-off-by: Jon Mason

    Allen Hubbe
     
  • Allocate two DMA channels, one for TX operation and one for RX
    operation, instead of having one DMA channel for everything. This
    provides slightly better performance, and also will make error handling
    cleaner later on.

    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     
  • The dma_sync_wait can hurt the performance of workloads mixed with both
    large and small frames. Large frames will be copied using the dma
    engine. Small frames will be copied by the cpu. The dma_sync_wait
    prevents the cpu and dma engine copying in parallel.

    In the period where the cpu is copying, the dma engine is stopped. The
    dma engine is not doing any useful work to copy large frames during that
    time, and the additional time to restart the dma engine for the next
    large frame. This will decrease the throughput for the portion of a
    workload with large frames.

    In the period where the dma engine is copying, the cpu is held up
    waiting for dma to complete. The small frames processing will be
    delayed until the dma is complete. The RX frames are completed
    in-order, and the processing of small frames takes very little time, so
    dma_sync_wait may have an insignificant impact on the respose time of
    frames. The more significant impact is to the system, because the delay
    in dma_sync_wait is implemented as busy non-blocking wait. This can
    prevent the delayed core from doing any useful work, even if it could be
    processing work for other drivers, unrelated to transport RX processing.

    After applying the earlier patch to fix out-of-order RX acknoledgement,
    the dma_sync_wait is no longer necessary. Remove it, so that cpu memcpy
    will proceed immediately for small frames, in parallel with ongoing dma
    for large frames. Do not hold up the cpu from doing work while dma is
    in progress. The prior fix will continue to ensure in-order completion
    of the RX frames to the upper layer, and in-order delivery of the RX
    acknoledgement.

    Signed-off-by: Allen Hubbe
    Signed-off-by: Jon Mason

    Allen Hubbe
     
  • Make QP stats info more readable for debugging purposes. Also add an
    entry to indicate whether DMA is being used.

    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     
  • The list should be added from the bottom and not the top in order to
    ensure the transport is provided in the same order to clients as ntb
    devices are discovered.

    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     
  • Adding PCI Device IDs for B2B (back to back), RP (root port, primary),
    and TB (transparent bridge, secondary) devices.

    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     
  • Right now if we push the NTB really hard, we start dropping packets due
    to not able to process the packets fast enough. We need to st:qop the
    upper layer from flooding us when that happens.

    A timer is necessary in order to restart the queue once the resource has
    been processed on the receive side. Due to the way NTB is setup, the
    resources on the tx side are tied to the processing of the rx side and
    there's no async way to know when the rx side has released those
    resources.

    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     

10 Aug, 2015

7 commits

  • Avoid any chance of format string expansion when calling dev_set_name.

    Signed-off-by: Kees Cook
    Signed-off-by: Jon Mason

    Kees Cook
     
  • Remove early dereference of a pointer that is checked later in the code.

    Reported-by: Dan Carpenter
    Signed-off-by: Allen Hubbe
    Signed-off-by: Jon Mason

    Allen Hubbe
     
  • A plain 32 bit integer will overflow for values over 4GiB.

    Change the plain integer size to the appropriate size type in
    ntb_set_mw. Change the type of the size parameter and two local
    variables used for size.

    Even if there is no overflow, a size of zero is invalid here.

    Reported-by: Juyoung Jung
    Signed-off-by: Allen Hubbe
    Signed-off-by: Jon Mason

    Allen Hubbe
     
  • Schedule to receive on QP link up, to make sure that the doorbell is
    properly cleared for interrupts.

    Signed-off-by: Allen Hubbe
    Signed-off-by: Jon Mason

    Allen Hubbe
     
  • When the remote side is not up, we do not have all the context for the
    transport, and that causes NULL ptr access. Have the debugfs reads check
    to see if transport is up before we make access.

    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     
  • Currently the debugfs does not have files for all NTB transport queue
    pairs. When there are multiple NTBs present in a system, the QP names
    of the last transport clobber the names of previously added transport
    QPs. Only the last added QPs can be observed via debugfs.

    Create a directory per NTB transport to associate the QPs with that
    transport. Name the directory the same as the PCI device.

    Signed-off-by: Dave Jiang
    Signed-off-by: Jon Mason

    Dave Jiang
     
  • It was possible for a synchronous update of the RX index in the error
    case to get ahead of the asynchronous RX index update in the normal
    case. Change the RX processing to preserve an RX completion order.

    There were two error cases. First, if a buffer is not present to
    receive data, there would be no queue entry to preserve the RX
    completion order. Instead of dropping the RX frame, leave the RX frame
    in the ring. Schedule RX processing when RX entries are enqueued, in
    case there are RX frames waiting in the ring to be received.

    Second, if a buffer is too small to receive data, drop the frame in the
    ring, mark the RX entry as done, and indicate the error in the RX entry
    length. Check for a negative length in the receive callback in
    ntb_netdev, and count occurrences as rx_length_errors.

    Signed-off-by: Allen Hubbe
    Signed-off-by: Jon Mason

    Allen Hubbe
     

05 Jul, 2015

19 commits