[openib-general] [PATCH] ib_mad: PCI mapping/unmapping and some buffering fixes

Roland Dreier roland at topspin.com
Wed Sep 15 08:59:25 PDT 2004


    Hal> I don't recall but in any case...

Here's the thread: http://thread.gmane.org/gmane.linux.drivers.openib/4428

    Hal> Is that the best choice ? Is there an advantage to the client
    Hal> doing this over the MAD layer ?

I see a few reasons.  First, principle of least surprise: consumers
need to do the mapping for ib_post_send, so it makes sense for them to
do it for ib_mad_post_send (especially since we're reusing the same
work request structure).  Second, avoiding bugs: if we hide the PCI
mapping from consumers, then they may not realize it's happening at
all and pass non-DMA-able memory (eg from vmalloc) into
ib_mad_post_send.  Finally, flexibility: a consumer may want to use
other DMA mapping functions and we may as well allow it.

Also I didn't notice before but the current code in ib_mad.c is wrong.
It does pci_map_single on the first gather entry but potentially the
consumer can pass in a gather list with more than one entry.

 - R.




More information about the general mailing list