public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leonro@mellanox.com>,
	Doug Ledford <dledford@redhat.com>,
	linux-rdma@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/4] RDMA/core: Fix ib_dma_max_seg_size()
Date: Mon, 21 Oct 2019 08:56:02 -0700	[thread overview]
Message-ID: <f594b855-7dc3-7346-eb6e-349c8cd0500e@acm.org> (raw)
In-Reply-To: <20191021152721.GE25178@ziepe.ca>

On 10/21/19 8:27 AM, Jason Gunthorpe wrote:
> On Mon, Oct 21, 2019 at 08:03:32AM -0700, Bart Van Assche wrote:
>> On 10/21/19 7:09 AM, Jason Gunthorpe wrote:
>>> On Sun, Oct 20, 2019 at 07:10:27PM -0700, Bart Van Assche wrote:
>>>> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
>>>> index 6a47ba85c54c..e6c167d03aae 100644
>>>> +++ b/include/rdma/ib_verbs.h
>>>> @@ -4043,9 +4043,7 @@ static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev,
>>>>     */
>>>>    static inline unsigned int ib_dma_max_seg_size(struct ib_device *dev)
>>>>    {
>>>> -	struct device_dma_parameters *p = dev->dma_device->dma_parms;
>>>> -
>>>> -	return p ? p->max_segment_size : UINT_MAX;
>>>> +	return dma_get_max_seg_size(dev->dma_device);
>>>>    }
>>>
>>> Should we get rid of this wrapper?
>>
>> Hi Jason,
>>
>> In general I agree that getting rid of single line inline functions is good.
>> In this case however I'd like to keep the wrapper such that RDMA ULP code
>> does not have to deal with the choice between dev->dma_device and &dev->dev.
>>  From struct ib_device:
>>   /* Do not access @dma_device directly from ULP nor from HW drivers. */
>> struct device                *dma_device;
> 
> Do you think it is a mistake we have dma_device at all?
> 
> Can the modern dma framework let us make the 'struct ib_device' into a
> full dma_device that is still connected to some PCI device?

Hi Jason,

My understanding is that dma_device is passed as the first argument to 
DMA mapping functions. Before PCIe P2P support was introduced in the 
RDMA code, the only struct device members used by DMA mapping functions 
were dma_ops, dma_mask, coherent_dma_mask, bus_dma_mask and dma_parms. I 
think it would have been sufficient to copy all these members from the 
PCI device into struct ib_device before PCIe P2P support was introduced. 
The dma_device pointer however is also passed to the pci_p2pdma_map_sg() 
and pci_p2pdma_unmap_sg() functions. These functions use several 
additional members of struct pci_dev. Although it may be possible to 
eliminate the dma_device member, this may make maintaining the RDMA core 
harder because setup_dma_device() will have to be modified every time a 
DMA mapping function uses an additional member from struct device.

Bart.

  reply	other threads:[~2019-10-21 15:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21  2:10 [PATCH 0/4] Fixes related to the DMA max_segment_size parameter Bart Van Assche
2019-10-21  2:10 ` [PATCH 1/4] RDMA/core: Fix ib_dma_max_seg_size() Bart Van Assche
2019-10-21 14:09   ` Jason Gunthorpe
2019-10-21 15:03     ` Bart Van Assche
2019-10-21 15:27       ` Jason Gunthorpe
2019-10-21 15:56         ` Bart Van Assche [this message]
2019-10-21  2:10 ` [PATCH 2/4] RDMA/core: Set DMA parameters correctly Bart Van Assche
2019-10-21 14:10   ` Jason Gunthorpe
2019-10-21 16:26     ` Bart Van Assche
2019-10-21 17:44       ` Saleem, Shiraz
2019-10-21 18:10         ` Bart Van Assche
2019-10-21 20:32           ` Saleem, Shiraz
2019-10-22 14:40           ` Jason Gunthorpe
2019-10-22 22:11             ` Bart Van Assche
2019-10-21  2:10 ` [PATCH 3/4] rdma_rxe: Increase DMA max_segment_size parameter Bart Van Assche
2019-10-21  2:10 ` [PATCH 4/4] siw: " Bart Van Assche
2019-10-21  9:36   ` Bernard Metzler
2019-10-21 13:53     ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f594b855-7dc3-7346-eb6e-349c8cd0500e@acm.org \
    --to=bvanassche@acm.org \
    --cc=dledford@redhat.com \
    --cc=hch@lst.de \
    --cc=jgg@ziepe.ca \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox