#include <stdlib.h>
#include <string.h>
#include "dynamic-string.h"
+#include "netdev-dpdk.h"
#include "util.h"
static void
void
ofpbuf_uninit(struct ofpbuf *b)
{
- if (b && b->source == OFPBUF_MALLOC) {
- free(b->base);
+ if (b) {
+ if (b->source == OFPBUF_MALLOC) {
+ free(b->base);
+ }
+ if (b->source == OFPBUF_DPDK) {
+ free_dpdk_buf(b);
+ }
}
}
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 {