Re: [RFC RESEND 16/16] nvme-pci: use blk_rq_dma_map() for NVMe SGL

From: Leon Romanovsky
Date: Sun May 05 2024 - 09:23:33 EST


On Fri, May 03, 2024 at 04:41:21PM +0200, Zhu Yanjun wrote:
> On 05.03.24 12:18, Leon Romanovsky wrote:
> > From: Chaitanya Kulkarni <kch@xxxxxxxxxx>

<...>

> > This is an RFC to demonstrate the newly added DMA APIs can be used to
> > map/unmap bvecs without the use of sg list, hence I've modified the pci
> > code to only handle SGLs for now. Once we have some agreement on the
> > structure of new DMA API I'll add support for PRPs along with all the
> > optimization that I've removed from the code for this RFC for NVMe SGLs
> > and PRPs.
> >

<...>

> > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> > index e6267a6aa380..140939228409 100644
> > --- a/drivers/nvme/host/pci.c
> > +++ b/drivers/nvme/host/pci.c
> > @@ -236,7 +236,9 @@ struct nvme_iod {
> > unsigned int dma_len; /* length of single DMA segment mapping */
> > dma_addr_t first_dma;
> > dma_addr_t meta_dma;
> > - struct sg_table sgt;
> > + struct dma_iova_attrs iova;
> > + dma_addr_t dma_link_address[128];
>
> Why the length of this array is 128? Can we increase this length of the
> array?

It is combination of two things:
* Good enough value for this nvme RFC to pass simple test, which Chaitanya did.
* Output of various NVME_CTRL_* defines

Thanks