b->allocated = allocated;
b->source = source;
b->frame = NULL;
+ b->l2_pad_size = 0;
b->l2_5_ofs = b->l3_ofs = b->l4_ofs = UINT16_MAX;
list_poison(&b->list_node);
}
if (b) {
if (b->source == OFPBUF_MALLOC) {
free(ofpbuf_base(b));
+ } else if (b->source == OFPBUF_DPDK) {
+#ifdef DPDK_NETDEV
+ /* If this ofpbuf was allocated by DPDK it must have been
+ * created as a dpif_packet */
+ free_dpdk_buf((struct dpif_packet*) b);
+#else
+ ovs_assert(b->source != OFPBUF_DPDK);
+#endif
}
- ovs_assert(b->source != OFPBUF_DPDK);
}
}
new_buffer->frame = (char *) buffer->frame + data_delta;
}
+ new_buffer->l2_pad_size = buffer->l2_pad_size;
new_buffer->l2_5_ofs = buffer->l2_5_ofs;
new_buffer->l3_ofs = buffer->l3_ofs;
new_buffer->l4_ofs = buffer->l4_ofs;
}
}
-/* Trims the size of 'b' to fit its actual content, reducing its tailroom to
- * 0. Its headroom, if any, is preserved.
+/* Trims the size of 'b' to fit its actual content, reducing its headroom and
+ * tailroom to 0, if any.
*
* Buffers not obtained from malloc() are not resized, since that wouldn't save
* any memory. */
ofpbuf_set_data(b, (char*)ofpbuf_data(b) + size);
}
-/* Reserves 'size' bytes of headroom so that they can be later allocated with
- * ofpbuf_push_uninit() without reallocating the ofpbuf. */
+/* Reserves 'headroom' bytes at the head and 'tailroom' at the end so that
+ * they can be later allocated with ofpbuf_push_uninit() or
+ * ofpbuf_put_uninit() without reallocating the ofpbuf. */
void
ofpbuf_reserve_with_tailroom(struct ofpbuf *b, size_t headroom,
size_t tailroom)
/* Removes each of the "struct ofpbuf"s on 'list' from the list and frees
* them. */
void
-ofpbuf_list_delete(struct list *list)
+ofpbuf_list_delete(struct ovs_list *list)
{
struct ofpbuf *b, *next;