mbuf: add function to reset headroom
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 4 Oct 2016 12:05:23 +0000 (14:05 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 5 Oct 2016 13:13:37 +0000 (15:13 +0200)
commitfebf2bb46d727563e0de7a6f43d5a2da9f68e17a
tree96b2fb5378293433ba4c88d0cca74d110c1ec5b6
parent4e8739e9bb5aa125dbc964ad49caaf876d616b41
mbuf: add function to reset headroom

Some application use rte_mbuf_raw_alloc() function to improve
performance by not resetting mbuf's fields to their default state.

This can be however problematic for mbuf consumers that need some
headroom, meaning that data_off field gets decremented after
allocation. When the mbuf is re-used afterwards, there might not
be enough room for the consumer to prepend anything, if the data_off
field is not reset to its default value.

This patch adds a new rte_pktmbuf_reset_headroom() function that
applications can call to reset the data_off field.
This patch also replaces current data_off affectations in the mbuf
lib with a call to this function.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
lib/librte_mbuf/rte_mbuf.h