mbuf: allow to clone an indirect mbuf
authorOlivier Matz <olivier.matz@6wind.com>
Wed, 22 Apr 2015 09:57:26 +0000 (11:57 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 28 Apr 2015 09:35:53 +0000 (11:35 +0200)
commit4a96e8b6521819870a71c9389f774b436c9244b4
tree0eba16d58cabf4c94c634a09d45a36eaefac366a
parent355e6735b3359223f32485c3cbd4e99583eacb7c
mbuf: allow to clone an indirect mbuf

Remove one limitation of rte_pktmbuf_attach(): "mbuf we're attaching to
must be direct".

Now, when we attach to an indirect mbuf:
- copy the all relevant fields (addr, len, offload, ...) as before
- get the pointer to the mbuf that embeds the data buffer (direct mbuf),
  and increase the reference counter of this one.

When detaching the mbuf, we can retrieve this direct mbuf as the pointer
is determined from the buffer address.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/librte_mbuf/rte_mbuf.h