DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hiroyuki MIKITA <h.mikita89@gmail.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	 "olivier.matz@6wind.com" <olivier.matz@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] mbuf: decrease refcnt when detaching
Date: Mon, 16 May 2016 11:46:07 +0900	[thread overview]
Message-ID: <CAO_n4D11aSBKpkV8v0S4g84K=QDyUjnqAYhXoZiR+u8BnUrfzQ@mail.gmail.com> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB97725836B50F15@irsmsx105.ger.corp.intel.com>

Hi Konstantin,

Now, the attach operation increases refcnt, but the detach does not decrease it.
I think both operations should affect refcnt or not.
Which design is intended?

In "6.7. Direct and Indirect Buffers" of Programmer's Guide,
it is mentioned that "...whenever an indirect buffer is attached to
the direct buffer,
the reference counter on the direct buffer is incremented.
Similarly, whenever the indirect buffer is detached,
the reference counter on the direct buffer is decremented."

Regards,
Hiroyuki

2016-05-16 9:05 GMT+09:00 Ananyev, Konstantin <konstantin.ananyev@intel.com>:
>
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hiroyuki Mikita
>> Sent: Sunday, May 15, 2016 4:51 PM
>> To: olivier.matz@6wind.com
>> Cc: dev@dpdk.org
>> Subject: [dpdk-dev] [PATCH] mbuf: decrease refcnt when detaching
>>
>> The rte_pktmbuf_detach() function should decrease refcnt on a direct
>> buffer.
>
> Hmm, why is that?
> What's wrong with the current approach?
> Konstantin
>
>>
>> Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
>> ---
>>  lib/librte_mbuf/rte_mbuf.h | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
>> index 529debb..3b117ca 100644
>> --- a/lib/librte_mbuf/rte_mbuf.h
>> +++ b/lib/librte_mbuf/rte_mbuf.h
>> @@ -1468,9 +1468,11 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *m)
>>   */
>>  static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
>>  {
>> +     struct rte_mbuf *md = rte_mbuf_from_indirect(m);
>>       struct rte_mempool *mp = m->pool;
>>       uint32_t mbuf_size, buf_len, priv_size;
>>
>> +     rte_mbuf_refcnt_update(md, -1);
>>       priv_size = rte_pktmbuf_priv_size(mp);
>>       mbuf_size = sizeof(struct rte_mbuf) + priv_size;
>>       buf_len = rte_pktmbuf_data_room_size(mp);
>> @@ -1498,7 +1500,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
>>               if (RTE_MBUF_INDIRECT(m)) {
>>                       struct rte_mbuf *md = rte_mbuf_from_indirect(m);
>>                       rte_pktmbuf_detach(m);
>> -                     if (rte_mbuf_refcnt_update(md, -1) == 0)
>> +                     if (rte_mbuf_refcnt_read(md) == 0)
>>                               __rte_mbuf_raw_free(md);
>>               }
>>               return m;
>> --
>> 1.9.1
>

  reply	other threads:[~2016-05-16  2:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-15 15:50 Hiroyuki Mikita
2016-05-16  0:05 ` Ananyev, Konstantin
2016-05-16  2:46   ` Hiroyuki MIKITA [this message]
2016-05-16  8:49     ` Ananyev, Konstantin
2016-05-16  9:13     ` Thomas Monjalon
2016-05-16 16:24       ` Hiroyuki MIKITA
2016-05-16  8:52 ` Olivier Matz
2016-05-16 16:53 ` [dpdk-dev] [PATCH v2] " Hiroyuki Mikita
2016-05-17 10:58   ` Bruce Richardson
2016-05-17 11:06   ` Ananyev, Konstantin
2016-05-17 12:43   ` Thomas Monjalon
2016-05-17 12:59     ` Ananyev, Konstantin
2016-05-17 13:39       ` Thomas Monjalon
2016-05-17 13:44         ` Ananyev, Konstantin
2016-05-17 14:19           ` Thomas Monjalon
2016-05-17 15:45             ` Ananyev, Konstantin
2016-05-17 16:12               ` Hiroyuki MIKITA
2016-05-17 16:35   ` [dpdk-dev] [PATCH v3] " Hiroyuki Mikita
2016-05-18 11:58     ` Olivier Matz
2016-05-18 14:29       ` Hiroyuki Mikita
2016-05-18 14:41     ` [dpdk-dev] [PATCH v4] " Hiroyuki Mikita
2016-05-18 15:51       ` Olivier Matz
2016-05-19 12:38         ` 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='CAO_n4D11aSBKpkV8v0S4g84K=QDyUjnqAYhXoZiR+u8BnUrfzQ@mail.gmail.com' \
    --to=h.mikita89@gmail.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=olivier.matz@6wind.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).