• Jorgen Hansen's avatar
    VMCI: dma dg: add support for DMA datagrams receive · 463713eb
    Jorgen Hansen authored
    Use the DMA based receive operation instead of the ioread8_rep
    based datagram receive when DMA datagrams are supported.
    
    In the receive operation, configure the header to point to the
    page aligned VMCI_MAX_DG_SIZE part of the receive buffer
    using s/g configuration for the header. This ensures that the
    existing dispatch routine can be used with little modification.
    Initiate the receive by writing the lower 32 bit of the buffer
    to the VMCI_DATA_IN_LOW_ADDR register, and wait for the busy
    flag to be changed by the device using a wait queue.
    
    The existing dispatch routine for received  datagrams is reused
    for the DMA datagrams with a few modifications:
    - the receive buffer is always the maximum size for DMA datagrams
      (IO ports would try with a shorter buffer first to reduce
      overhead of the ioread8_rep operation).
    - for DMA datagrams, datagrams are provided contiguous in the
      buffer as opposed to IO port datagrams, where they can start
      on any page boundary
    Reviewed-by: default avatarVishnu Dasa <vdasa@vmware.com>
    Signed-off-by: default avatarJorgen Hansen <jhansen@vmware.com>
    Link: https://lore.kernel.org/r/20220207102725.2742-9-jhansen@vmware.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    463713eb
vmci_guest.c 27 KB