From: Sergio Gonzalez Monroy Date: Wed, 18 Feb 2015 11:03:02 +0000 (+0000) Subject: mbuf: introduce indirect attached flag X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e8b9ef877e4fd4bf723bb4d987e4bece5d276a88;hp=e8b9ef877e4fd4bf723bb4d987e4bece5d276a88;p=dpdk.git mbuf: introduce indirect attached flag Currently for mbufs with refcnt, we cannot free mbufs with external memory buffers (ie. vhost zero copy), as they are recognized as indirect attached mbufs and therefore we free the direct mbuf it points to, resulting in an error in the case of external memory buffers. We solve the issue by introducing the IND_ATTACHED_MBUF flag, which indicates that the mbuf is an indirect attached mbuf pointing to another mbuf. When we free an mbuf, we only free the direct mbuf if the flag is set. Freeing an mbuf with external buffer is the same as freeing a non attached mbuf. The flag is set during attach and clear on detach. So in the case of vhost zero copy where we have mbufs with external buffers, by default we just free the mbuf and it is up to the user to deal with the external buffer. This patch would allow the removal of the RTE_MBUF_REFCNT config option, setting refcnt for all mbufs permanently. The patch also modifies the vhost example as it was using the RTE_MBUF_INDIRECT macro to detect if it was an mbuf with external buffer. Signed-off-by: Sergio Gonzalez Monroy Acked-by: Olivier Matz Acked-by: Konstantin Ananyev ---