DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: wangyunjian <wangyunjian@huawei.com>,
	dev@dpdk.org, keith.wiles@intel.com, jerry.lilijun@huawei.com,
	xudingke@huawei.com, stable@dpdk.org
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3 3/5] net/tap: fix check for mbuf's nb_segs failure
Date: Tue, 7 Apr 2020 09:08:05 -0700	[thread overview]
Message-ID: <20200407090805.6941a61b@hermes.lan> (raw)
In-Reply-To: <f1fd0ebe-5fb8-a6a9-7f58-07fbc7887648@intel.com>

On Tue, 7 Apr 2020 16:45:59 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 4/7/2020 4:38 PM, Stephen Hemminger wrote:
> > On Tue, 7 Apr 2020 16:15:16 +0100
> > Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >   
> >>> +static void
> >>> +tap_rxq_pool_free(struct rte_mbuf *pool)
> >>> +{
> >>> +	struct rte_mbuf *mbuf = pool;
> >>> +	uint16_t nb_segs = 1;
> >>> +
> >>> +	if (mbuf == NULL)
> >>> +		return;
> >>> +
> >>> +	while (mbuf->next) {
> >>> +		mbuf = mbuf->next;
> >>> +		nb_segs++;
> >>> +	}
> >>> +	pool->nb_segs = nb_segs;
> >>> +	rte_pktmbuf_free(pool);
> >>> +}    
> > 
> > Since mbuf is going to be free, why bother with nb_segs.
> > Since rte_pktmbuf_free takes NULL as an argument, and frees the m->next chain
> > I don't see why not just
> > 	rte_pktmbuf_free(pool)
> >   
> 
> Chain is not constructed properly, 'nb_segs' is wrong, only 'rte_pktmbuf_free()'
> call won't free all the chain but first mbuf.
> 
> This implementation is fixing 'nb_segs' sot that 'rte_pktmbuf_free()' can work
> as you suggested.
> 
> Or I suggest iterate the list and fix all mbufs, instead of fixing 'nb_segs',
> this may be one iteration less.

If you look at implementation of rte_pktmbuf_free() in current DPDK version
it does not care what nb_segs is set to.

  parent reply	other threads:[~2020-04-07 16:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07  4:23 [dpdk-dev] " wangyunjian
2020-04-07 15:15 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2020-04-07 15:38   ` Stephen Hemminger
2020-04-07 15:45     ` Ferruh Yigit
2020-04-07 15:49       ` Ferruh Yigit
2020-04-07 16:08       ` Stephen Hemminger [this message]
2020-04-08  1:10         ` wangyunjian
2020-04-07 15:58   ` Ferruh Yigit

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=20200407090805.6941a61b@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerry.lilijun@huawei.com \
    --cc=keith.wiles@intel.com \
    --cc=stable@dpdk.org \
    --cc=wangyunjian@huawei.com \
    --cc=xudingke@huawei.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).