new_allocated = new_headroom + b->size + new_tailroom;
switch (b->source) {
+ case OFPBUF_DPDK:
+ OVS_NOT_REACHED();
+
case OFPBUF_MALLOC:
if (new_headroom == ofpbuf_headroom(b)) {
new_base = xrealloc(b->base, new_allocated);
void
ofpbuf_trim(struct ofpbuf *b)
{
+ ovs_assert(b->source != OFPBUF_DPDK);
+
if (b->source == OFPBUF_MALLOC
&& (ofpbuf_headroom(b) || ofpbuf_tailroom(b))) {
ofpbuf_resize__(b, 0, 0);
ofpbuf_steal_data(struct ofpbuf *b)
{
void *p;
+ ovs_assert(b->source != OFPBUF_DPDK);
+
if (b->source == OFPBUF_MALLOC && b->data == b->base) {
p = b->data;
} else {
enum ofpbuf_source {
OFPBUF_MALLOC, /* Obtained via malloc(). */
OFPBUF_STACK, /* Un-movable stack space or static buffer. */
- OFPBUF_STUB /* Starts on stack, may expand into heap. */
+ OFPBUF_STUB, /* Starts on stack, may expand into heap. */
+ OFPBUF_DPDK, /* buffer data is from DPDK allocated memory. */
};
/* Buffer for holding arbitrary data. An ofpbuf is automatically reallocated