DPDK patches and discussions
 help / color / mirror / Atom feed
From: Amit Prakash Shukla <amitprakashs@marvell.com>
To: fengchengwen <fengchengwen@huawei.com>,
	Kevin Laatz <kevin.laatz@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	"conor.walsh@intel.com" <conor.walsh@intel.com>,
	Vamsi Krishna Attunuru <vattunuru@marvell.com>,
	"g.singh@nxp.com" <g.singh@nxp.com>,
	"sachin.saxena@oss.nxp.com" <sachin.saxena@oss.nxp.com>,
	"hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
	"cheng1.jiang@intel.com" <cheng1.jiang@intel.com>,
	Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	"mb@smartsharesystems.com" <mb@smartsharesystems.com>
Subject: RE: [EXT] Re: [PATCH] test/dma: fix for buffer auto free
Date: Thu, 2 Nov 2023 09:40:25 +0000	[thread overview]
Message-ID: <PH0PR18MB51670058B48B476E958177EFC8A6A@PH0PR18MB5167.namprd18.prod.outlook.com> (raw)
In-Reply-To: <b2bbd6a7-a83b-cca8-e832-aae783fd3f34@huawei.com>

Hi Chengwen,

Thanks for the review and feedback. I will send v2 with suggested changes.

Thanks,
Amit Shukla

> -----Original Message-----
> From: fengchengwen <fengchengwen@huawei.com>
> Sent: Thursday, November 2, 2023 7:37 AM
> To: Amit Prakash Shukla <amitprakashs@marvell.com>; Kevin Laatz
> <kevin.laatz@intel.com>; Bruce Richardson <bruce.richardson@intel.com>
> Cc: dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>;
> conor.walsh@intel.com; Vamsi Krishna Attunuru <vattunuru@marvell.com>;
> g.singh@nxp.com; sachin.saxena@oss.nxp.com; hemant.agrawal@nxp.com;
> cheng1.jiang@intel.com; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; Anoob Joseph <anoobj@marvell.com>;
> mb@smartsharesystems.com
> Subject: [EXT] Re: [PATCH] test/dma: fix for buffer auto free
> 
> External Email
> 
> ----------------------------------------------------------------------
> Hi Amit,
> 
>   I prefer not use static variable to control it because it introduce many
> coupling.
> 
>   Suggest add one function which prepare the test_m2d_auto_free, like
> prepare_m2d_auto_free
> 
> 	if ((info.dev_capa & RTE_DMA_CAPA_M2D_AUTO_FREE) &&
> 	    dma_add_test[TEST_M2D_AUTO_FREE].enabled == true) {
>                 if (prepare_m2d_auto_free(dev_id) != 0)
>                     goto err;
> 		if (runtest("m2d_auto_free", test_m2d_auto_free, 128,
> dev_id, vchan,
> 			    CHECK_ERRS) < 0)
> 			goto err;
> 	}
> 
> In the new function, could do reinit vchan just like the beginging
> test_m2d_auto_free.
> static int prepare_m2d_auto_free(int dev_id) {
> 	const struct rte_dma_vchan_conf qconf = {
> 		.direction = RTE_DMA_DIR_MEM_TO_DEV,
> 		.nb_desc = TEST_RINGSIZE,
> 		.auto_free.m2d.pool = pool,
> 		.dst_port.port_type = RTE_DMA_PORT_PCIE,
> 		.dst_port.pcie.coreid = 0,
> 	};
> 	/* Stop the device to reconfigure vchan because should use Mem-to-
> Dev mode. */
> 	if (rte_dma_stop(dev_id) < 0)
> 		ERR_RETURN("Error stopping device %u\n", dev_id);
> 	if (rte_dma_vchan_setup(dev_id, vchan, &qconf) < 0)
> 		ERR_RETURN("Error with queue configuration\n");
> 	if (rte_dma_start(dev_id) != 0)
> 		ERR_RETURN("Error with rte_dma_start()\n");
> 	return 0;
> }
> 
> 
> 
> Also I found a bug in test_m2d_auto_free function, if above path taken:
> 	if (rte_pktmbuf_alloc_bulk(pool, src, NR_MBUF) != 0) {
> 		printf("alloc src mbufs failed.\n");
> 		ret = -1;
> 		goto done;
> 	}
> 
> done:
> 	rte_pktmbuf_free_bulk(dst, NR_MBUF);
> 	/* If the test passes source buffer will be freed in hardware. */
> 	if (ret < 0)
> 		rte_pktmbuf_free_bulk(&src[nb_done], (NR_MBUF -
> nb_done));
> 		----- then it will free invalid mbuf to pool because src was not
> success init
> 
> 

<snip>

  reply	other threads:[~2023-11-02  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 10:18 Amit Prakash Shukla
2023-11-01 14:08 ` Hemant Agrawal
2023-11-02  2:06 ` fengchengwen
2023-11-02  9:40   ` Amit Prakash Shukla [this message]
2023-11-03 18:30 ` [PATCH v2] " Amit Prakash Shukla
2023-11-06  1:08   ` fengchengwen
2023-11-14 14:58     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR18MB51670058B48B476E958177EFC8A6A@PH0PR18MB5167.namprd18.prod.outlook.com \
    --to=amitprakashs@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=bruce.richardson@intel.com \
    --cc=cheng1.jiang@intel.com \
    --cc=conor.walsh@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=g.singh@nxp.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerinj@marvell.com \
    --cc=kevin.laatz@intel.com \
    --cc=mb@smartsharesystems.com \
    --cc=ndabilpuram@marvell.com \
    --cc=sachin.saxena@oss.nxp.com \
    --cc=vattunuru@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).