DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
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 16:49:43 +0100	[thread overview]
Message-ID: <cf5afe7a-9669-822c-74eb-6952eeea8d88@intel.com> (raw)
In-Reply-To: <f1fd0ebe-5fb8-a6a9-7f58-07fbc7887648@intel.com>

On 4/7/2020 4:45 PM, Ferruh Yigit 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.

No, my bad. It will free all and will work as expected. But this is to fix the
mbuf sanity checks when they are enabled.

> 
> 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.
> 


  reply	other threads:[~2020-04-07 15:49 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 [this message]
2020-04-07 16:08       ` Stephen Hemminger
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=cf5afe7a-9669-822c-74eb-6952eeea8d88@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerry.lilijun@huawei.com \
    --cc=keith.wiles@intel.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.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).