Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1415708 > unrolled thread

Re: [PATCH] dmaengine: dmatest: Add support for scatter-gather DMA mode

Started byVinod Koul <vinod.koul@intel.com>
First post2016-06-07 07:30 +0200
Last post2016-06-07 08:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] dmaengine: dmatest: Add support for scatter-gather DMA  mode Vinod Koul <vinod.koul@intel.com> - 2016-06-07 07:30 +0200
    RE: [PATCH] dmaengine: dmatest: Add support for scatter-gather DMA  mode Appana Durga Kedareswara Rao <appana.durga.rao@xilinx.com> - 2016-06-07 08:10 +0200

#1415708 — Re: [PATCH] dmaengine: dmatest: Add support for scatter-gather DMA mode

FromVinod Koul <vinod.koul@intel.com>
Date2016-06-07 07:30 +0200
SubjectRe: [PATCH] dmaengine: dmatest: Add support for scatter-gather DMA mode
Message-ID<rHhKq-6U6-13@gated-at.bofh.it>
On Mon, Apr 25, 2016 at 02:18:05PM +0530, Kedareswara rao Appana wrote:
> This patch updates the dmatest client to support
> scatter-gather dma mode.
> 
> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> ---
>  drivers/dma/dmatest.c | 38 ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 36 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
> index b8576fd..6f259d8 100644
> --- a/drivers/dma/dmatest.c
> +++ b/drivers/dma/dmatest.c
> @@ -51,6 +51,14 @@ module_param(iterations, uint, S_IRUGO | S_IWUSR);
>  MODULE_PARM_DESC(iterations,
>  		"Iterations before stopping test (default: infinite)");
>  
> +static unsigned int sg_sources = 1;
> +module_param(sg_sources, uint, S_IRUGO | S_IWUSR);
> +MODULE_PARM_DESC(sg_sources,

sg_buffers rather?

> +		"Number of scatter gather buffers (default: 1)");

blank line please

> +static unsigned int dmatest = 1;
> +module_param(dmatest, uint, S_IRUGO | S_IWUSR);
> +MODULE_PARM_DESC(dmatest,
> +		"dmatest 0-memcpy 1-slave_sg (default: 1)");

dmatest? What does this mean!

>  static unsigned int xor_sources = 3;
>  module_param(xor_sources, uint, S_IRUGO | S_IWUSR);
>  MODULE_PARM_DESC(xor_sources,
> @@ -431,6 +439,8 @@ static int dmatest_func(void *data)
>  	dev = chan->device;
>  	if (thread->type == DMA_MEMCPY)
>  		src_cnt = dst_cnt = 1;
> +	else if (thread->type == DMA_SG)
> +		src_cnt = dst_cnt = sg_sources;
>  	else if (thread->type == DMA_XOR) {
>  		/* force odd to ensure dst = src */
>  		src_cnt = min_odd(params->xor_sources | 1, dev->max_xor);
> @@ -485,6 +495,8 @@ static int dmatest_func(void *data)
>  		dma_addr_t *dsts;
>  		unsigned int src_off, dst_off, len;
>  		u8 align = 0;
> +		struct scatterlist tx_sg[src_cnt];
> +		struct scatterlist rx_sg[src_cnt];
>  
>  		total_tests++;
>  
> @@ -577,10 +589,21 @@ static int dmatest_func(void *data)
>  			um->bidi_cnt++;
>  		}
>  
> +		sg_init_table(tx_sg, src_cnt);
> +		sg_init_table(rx_sg, dst_cnt);

why dst_cnt  here wheras you used src_cnt to create the list!

> +		for (i = 0; i < src_cnt; i++) {
> +			sg_dma_address(&rx_sg[i]) = srcs[i];
> +			sg_dma_address(&tx_sg[i]) = dsts[i] + dst_off;
> +			sg_dma_len(&tx_sg[i]) = len;
> +			sg_dma_len(&rx_sg[i]) = len;
> +		}
>  		if (thread->type == DMA_MEMCPY)
>  			tx = dev->device_prep_dma_memcpy(chan,
>  							 dsts[0] + dst_off,
>  							 srcs[0], len, flags);
> +		else if (thread->type == DMA_SG)
> +			tx = dev->device_prep_dma_sg(chan, tx_sg,
> +					dst_cnt, rx_sg, src_cnt, flags);

again dst_cnt

>  		else if (thread->type == DMA_XOR)
>  			tx = dev->device_prep_dma_xor(chan,
>  						      dsts[0] + dst_off,
> @@ -748,6 +771,8 @@ static int dmatest_add_threads(struct dmatest_info *info,
>  
>  	if (type == DMA_MEMCPY)
>  		op = "copy";
> +	else if (type == DMA_SG)
> +		op = "sg";
>  	else if (type == DMA_XOR)
>  		op = "xor";
>  	else if (type == DMA_PQ)
> @@ -802,8 +827,16 @@ static int dmatest_add_channel(struct dmatest_info *info,
>  	INIT_LIST_HEAD(&dtc->threads);
>  
>  	if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) {
> -		cnt = dmatest_add_threads(info, dtc, DMA_MEMCPY);
> -		thread_count += cnt > 0 ? cnt : 0;
> +		if (dmatest == 0) {
> +			cnt = dmatest_add_threads(info, dtc, DMA_MEMCPY);
> +			thread_count += cnt > 0 ? cnt : 0;
> +		}
> +	}

blank line

-- 
~Vinod

[toc] | [next] | [standalone]


#1415725

FromAppana Durga Kedareswara Rao <appana.durga.rao@xilinx.com>
Date2016-06-07 08:10 +0200
Message-ID<rHin7-7mM-7@gated-at.bofh.it>
In reply to#1415708
Hi Vinod,

> >
> > +static unsigned int sg_sources = 1;
> > +module_param(sg_sources, uint, S_IRUGO | S_IWUSR);
> > +MODULE_PARM_DESC(sg_sources,
> 
> sg_buffers rather?

Ok sure will fix...

> 
> > +		"Number of scatter gather buffers (default: 1)");
> 
> blank line please

Ok

> 
> > +static unsigned int dmatest = 1;
> > +module_param(dmatest, uint, S_IRUGO | S_IWUSR);
> > +MODULE_PARM_DESC(dmatest,
> > +		"dmatest 0-memcpy 1-slave_sg (default: 1)");
> 
> dmatest? What does this mean!

To differentiate b/w the memcpy and slave_sg transfers using this dmatest 
Sysfs entry.

> 
> >  static unsigned int xor_sources = 3;
> >  module_param(xor_sources, uint, S_IRUGO | S_IWUSR);
> > MODULE_PARM_DESC(xor_sources, @@ -431,6 +439,8 @@ static int
> > dmatest_func(void *data)
> >  	dev = chan->device;
> >  	if (thread->type == DMA_MEMCPY)
> >  		src_cnt = dst_cnt = 1;
> > +	else if (thread->type == DMA_SG)
> > +		src_cnt = dst_cnt = sg_sources;
> >  	else if (thread->type == DMA_XOR) {
> >  		/* force odd to ensure dst = src */
> >  		src_cnt = min_odd(params->xor_sources | 1, dev->max_xor);
> @@ -485,6
> > +495,8 @@ static int dmatest_func(void *data)
> >  		dma_addr_t *dsts;
> >  		unsigned int src_off, dst_off, len;
> >  		u8 align = 0;
> > +		struct scatterlist tx_sg[src_cnt];
> > +		struct scatterlist rx_sg[src_cnt];
> >
> >  		total_tests++;
> >
> > @@ -577,10 +589,21 @@ static int dmatest_func(void *data)
> >  			um->bidi_cnt++;
> >  		}
> >
> > +		sg_init_table(tx_sg, src_cnt);
> > +		sg_init_table(rx_sg, dst_cnt);
> 
> why dst_cnt  here wheras you used src_cnt to create the list!

dst_cnt is used in prep_dma_sg will use dst_cnt to created list for rx buffers
Will fix this in v2.

> 
> > +		for (i = 0; i < src_cnt; i++) {
> > +			sg_dma_address(&rx_sg[i]) = srcs[i];
> > +			sg_dma_address(&tx_sg[i]) = dsts[i] + dst_off;
> > +			sg_dma_len(&tx_sg[i]) = len;
> > +			sg_dma_len(&rx_sg[i]) = len;
> > +		}
> >  		if (thread->type == DMA_MEMCPY)
> >  			tx = dev->device_prep_dma_memcpy(chan,
> >  							 dsts[0] + dst_off,
> >  							 srcs[0], len, flags);
> > +		else if (thread->type == DMA_SG)
> > +			tx = dev->device_prep_dma_sg(chan, tx_sg,
> > +					dst_cnt, rx_sg, src_cnt, flags);
> 
> again dst_cnt

Will fix in v2.

> 
> >  		else if (thread->type == DMA_XOR)
> >  			tx = dev->device_prep_dma_xor(chan,
> >  						      dsts[0] + dst_off,
> > @@ -748,6 +771,8 @@ static int dmatest_add_threads(struct dmatest_info
> > *info,
> >
> >  	if (type == DMA_MEMCPY)
> >  		op = "copy";
> > +	else if (type == DMA_SG)
> > +		op = "sg";
> >  	else if (type == DMA_XOR)
> >  		op = "xor";
> >  	else if (type == DMA_PQ)
> > @@ -802,8 +827,16 @@ static int dmatest_add_channel(struct dmatest_info
> *info,
> >  	INIT_LIST_HEAD(&dtc->threads);
> >
> >  	if (dma_has_cap(DMA_MEMCPY, dma_dev->cap_mask)) {
> > -		cnt = dmatest_add_threads(info, dtc, DMA_MEMCPY);
> > -		thread_count += cnt > 0 ? cnt : 0;
> > +		if (dmatest == 0) {
> > +			cnt = dmatest_add_threads(info, dtc, DMA_MEMCPY);
> > +			thread_count += cnt > 0 ? cnt : 0;
> > +		}
> > +	}
> 
> blank line

Ok sure will fix in v2...

Thanks,
Kedar.

> 
> --
> ~Vinod

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web