> -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > Sent: Tuesday, May 17, 2016 3:19 PM > To: Ananyev, Konstantin > Cc: dev at dpdk.org; Hiroyuki Mikita; olivier.matz at 6wind.com > Subject: Re: [dpdk-dev] [PATCH v2] mbuf: decrease refcnt when detaching > > 2016-05-17 13:44, Ananyev, Konstantin: > > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > > > 2016-05-17 12:59, Ananyev, Konstantin: > > > > > > The rte_pktmbuf_detach() function should decrease refcnt on a direct > > > > > > buffer. > > > > > > > > > > As you have noticed, "whenever the indirect buffer is detached, > > > > > the reference counter on the direct buffer is decremented." > > > > > So the current behaviour of rte_pktmbuf_detach() is buggy. > > > > > Why not fix it without renaming? > > > > > If you consider this behavioral bug is part of the API, we > > > > > can fix it in a new function unattach and deprecate detach. > > > > > But Konstantin, why do you want to keep a restore function? > > > > > What is the need? > > > > > > > > I think it might be a useful functionality in some situations: > > > > some users can attach/detach to external memory buffers (no mbufs) > > > > and similar functionality is required. > > > > > > Attach to external memory buffer (raw buffer) is not currently supported. > > > > > > > Let say right now examples/vhost/main.c has its own pktmbuf_detach_zcp() > > > > > > You should look at the commit http://dpdk.org/commit/68363d85 > > > "examples/vhost: remove the non-working zero copy code" > > > > > > > which is doing pretty much the same - restore original values, after > > > > detaching > > > > mbuf from external (virtio) memory buffer. > > > > Would be good if we'll use a standard API function here. > > > > > > You are welcome to implement mbuf attach to raw buffer. > > > But it is not a requirement for this fix. > > > > Hmm, still not sure why we can't keep an existing function? > > Because it does not do what its name (and doc) suggest. > > > Obviously it wouldn't cost anything and I still think might be useful. > > It costs to overcomplicate API for only a half support.
I still think it is better to have it then not, but wouldn't insist here. Konstantin > If you need the feature "attach to raw", please implement it completely.