* Strange dma map/unmap/memcpy dance in ipoib_cm_handle_rx_wc
@ 2016-04-27 7:48 Nikolay Borisov
[not found] ` <57206ECD.8060007-6AxghH7DbtA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Borisov @ 2016-04-27 7:48 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Hello,
I need a bit of help in understanding the logic behind the following
code sequence in ipoib_cm_handle_rx_wc:
newskb = ipoib_cm_alloc_rx_skb(dev, rx_ring, wr_id, frags,
mapping, GFP_ATOMIC);
so Here a new skb is being allocated and pages constituting its
fragments are being dma mapped.
ipoib_cm_dma_unmap_rx(priv, frags, rx_ring[wr_id].mapping);
immediately after that the very same mappings are being unmapped. And
finally the resulting dma addresses from ipoib_cm_alloc_rx_skb are being
copied via this call to memcpy:
memcpy(rx_ring[wr_id].mapping, mapping, (frags + 1) * sizeof *mapping);
Can someone explain what's the logic of doing the memcpy after the
mappings have been destroyed, doesn't that mean the dma addresses stored
in rx_ring[wr_id].mapping are invalid?
Regards,
Nikolay
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Strange dma map/unmap/memcpy dance in ipoib_cm_handle_rx_wc
[not found] ` <57206ECD.8060007-6AxghH7DbtA@public.gmane.org>
@ 2016-04-28 14:22 ` Doug Ledford
0 siblings, 0 replies; 2+ messages in thread
From: Doug Ledford @ 2016-04-28 14:22 UTC (permalink / raw)
To: Nikolay Borisov, linux-rdma-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1533 bytes --]
On 04/27/2016 03:48 AM, Nikolay Borisov wrote:
> Hello,
>
> I need a bit of help in understanding the logic behind the following
> code sequence in ipoib_cm_handle_rx_wc:
>
> newskb = ipoib_cm_alloc_rx_skb(dev, rx_ring, wr_id, frags,
> mapping, GFP_ATOMIC);
>
> so Here a new skb is being allocated and pages constituting its
> fragments are being dma mapped.
Into the local variable mapping.
> ipoib_cm_dma_unmap_rx(priv, frags, rx_ring[wr_id].mapping);
>
> immediately after that the very same mappings are being unmapped.
No, these are the saved mappings of the skb that has the same ring slot
as the one we are going to take.
> And
> finally the resulting dma addresses from ipoib_cm_alloc_rx_skb are being
> copied via this call to memcpy:
>
> memcpy(rx_ring[wr_id].mapping, mapping, (frags + 1) * sizeof *mapping);
From our local variable to the saved mapping slot for this ring index.
> Can someone explain what's the logic of doing the memcpy after the
> mappings have been destroyed, doesn't that mean the dma addresses stored
> in rx_ring[wr_id].mapping are invalid?
>
> Regards,
> Nikolay
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
GPG KeyID: 0E572FDD
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-28 14:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-27 7:48 Strange dma map/unmap/memcpy dance in ipoib_cm_handle_rx_wc Nikolay Borisov
[not found] ` <57206ECD.8060007-6AxghH7DbtA@public.gmane.org>
2016-04-28 14:22 ` Doug Ledford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).