On Thu, Oct 08, 2020 at 11:27:52AM +0300, Leon Romanovsky wrote: > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > The code in setup_dma_device has become rather convoluted, move all of > this to the drivers. Drives now pass in a DMA capable struct device which > will be used to setup DMA, or drivers must fully configure the ibdev for > DMA and pass in NULL. > > Other than setting the masks in rvt all drivers were doing this already > anyhow. > > mthca, mlx4 and mlx5 were already setting up maximum DMA segment size for > DMA based on their hardweare limits in: > __mthca_init_one() > dma_set_max_seg_size (1G) > > __mlx4_init_one() > dma_set_max_seg_size (1G) > > mlx5_pci_init() > set_dma_caps() > dma_set_max_seg_size (2G) > > Other non software drivers (except usnic) were extended to UINT_MAX [1, 2] > instead of 2G as was before. > > [1] https://lore.kernel.org/linux-rdma/20200924114940.GE9475@xxxxxxxxxx/ > [2] https://lore.kernel.org/linux-rdma/20200924114940.GE9475@xxxxxxxxxx/ > Suggested-by: Christoph Hellwig <hch@xxxxxxxxxxxxx> > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > Signed-off-by: Parav Pandit <parav@xxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx> > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > --- > Changelog: > v4: > * Deleted dma_virt_op assignments and masks in rvt, siw and rxe drivers > v3: https://lore.kernel.org/linux-rdma/20201007070641.3552647-1-leon@xxxxxxxxxx > * Changed hardcoded max_segment_size to use dma_set_max_seg_size for > RXE and SIW. > * Protected dma_virt_ops from linkage failure without CONFIG_DMA_OPS. > * Removed not needed mask setting in RVT. > v2: https://lore.kernel.org/linux-rdma/20201006073229.2347811-1-leon@xxxxxxxxxx > * Simplified setup_dma_device() by removing extra if()s over various > * WARN_ON(). > v1: https://lore.kernel.org/linux-rdma/20201005110050.1703618-1-leon@xxxxxxxxxx > * Moved dma_set_max_seg_size() to be part of the drivers and increased > the limit to UINT_MAX. > --- > drivers/infiniband/core/device.c | 65 +++++-------------- > drivers/infiniband/hw/bnxt_re/main.c | 3 +- > drivers/infiniband/hw/cxgb4/provider.c | 4 +- > drivers/infiniband/hw/efa/efa_main.c | 4 +- > drivers/infiniband/hw/hns/hns_roce_main.c | 3 +- > drivers/infiniband/hw/i40iw/i40iw_verbs.c | 3 +- > drivers/infiniband/hw/mlx4/main.c | 3 +- > drivers/infiniband/hw/mlx5/main.c | 2 +- > drivers/infiniband/hw/mthca/mthca_provider.c | 2 +- > drivers/infiniband/hw/ocrdma/ocrdma_main.c | 4 +- > drivers/infiniband/hw/qedr/main.c | 3 +- > drivers/infiniband/hw/usnic/usnic_ib_main.c | 3 +- > .../infiniband/hw/vmw_pvrdma/pvrdma_main.c | 4 +- > drivers/infiniband/sw/rdmavt/vt.c | 6 +- > drivers/infiniband/sw/rxe/rxe_verbs.c | 9 +-- > drivers/infiniband/sw/siw/siw_main.c | 8 +-- > include/rdma/ib_verbs.h | 3 +- > 17 files changed, 52 insertions(+), 77 deletions(-) Applied to for-next thanks Jason