Re: [PATCH v2 3/3] dpaa2_eth: use new unmap and sync dma api variants

From: hch@xxxxxx
Date: Mon Oct 28 2019 - 07:38:20 EST


On Mon, Oct 28, 2019 at 10:55:05AM +0000, Laurentiu Tudor wrote:
> >> @@ -85,9 +75,10 @@ static void free_rx_fd(struct dpaa2_eth_priv *priv,
> >>      sgt = vaddr + dpaa2_fd_get_offset(fd);
> >>      for (i = 1; i < DPAA2_ETH_MAX_SG_ENTRIES; i++) {
> >>          addr = dpaa2_sg_get_addr(&sgt[i]);
> >> -        sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr);
> >> -        dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
> >> -                   DMA_BIDIRECTIONAL);
> >> +        sg_vaddr = page_to_virt
> >> +                (dma_unmap_page_desc(dev, addr,
> >> +                            DPAA2_ETH_RX_BUF_SIZE,
> >> +                            DMA_BIDIRECTIONAL));
> >
> > This is doing virt -> page -> virt.  Why not just have the new
> > function return the VA corresponding to the addr, which would
> > match the other functions?
>
> I'd really like that as it would get rid of the page_to_virt() calls but
> it will break the symmetry with the dma_map_page() API. I'll let the
> maintainers decide.

It would be symmetric with dma_map_single, though. Maybe we need
both variants?