aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCiprian Barbu <ciprian.barbu@linaro.org>2014-08-18 17:49:56 +0300
committerZoltan Kiss <zoltan.kiss@linaro.org>2014-12-17 17:28:05 +0000
commitc74317f3bb092dce9d515629b4743c35feff85ca (patch)
tree3f02aa4d299dda1c0894badb4c4999585946ae12
parent94a72fd6f09cd07b3a67f4cc390436550fad00e7 (diff)
ofpbuf: Added OFPBUF_ODP type.
This will be used by ODP for zero copy IO. Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
-rw-r--r--lib/ofpbuf.c6
-rw-r--r--lib/ofpbuf.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
index 4946e6fc8..08fefbeb4 100644
--- a/lib/ofpbuf.c
+++ b/lib/ofpbuf.c
@@ -253,6 +253,8 @@ ofpbuf_resize__(struct ofpbuf *b, size_t new_headroom, size_t new_tailroom)
new_allocated = new_headroom + ofpbuf_size(b) + new_tailroom;
switch (b->source) {
+ case OFPBUF_ODP:
+ OVS_NOT_REACHED();
case OFPBUF_DPDK:
OVS_NOT_REACHED();
@@ -323,7 +325,7 @@ ofpbuf_prealloc_headroom(struct ofpbuf *b, size_t size)
void
ofpbuf_trim(struct ofpbuf *b)
{
- ovs_assert(b->source != OFPBUF_DPDK);
+ ovs_assert(b->source != OFPBUF_DPDK && b->source != OFPBUF_ODP);
if (b->source == OFPBUF_MALLOC
&& (ofpbuf_headroom(b) || ofpbuf_tailroom(b))) {
@@ -484,7 +486,7 @@ void *
ofpbuf_steal_data(struct ofpbuf *b)
{
void *p;
- ovs_assert(b->source != OFPBUF_DPDK);
+ ovs_assert(b->source != OFPBUF_DPDK && b->source != OFPBUF_ODP);
if (b->source == OFPBUF_MALLOC && ofpbuf_data(b) == ofpbuf_base(b)) {
p = ofpbuf_data(b);
diff --git a/lib/ofpbuf.h b/lib/ofpbuf.h
index 4c0f7eaa4..6ceed88f5 100644
--- a/lib/ofpbuf.h
+++ b/lib/ofpbuf.h
@@ -34,6 +34,8 @@ enum OVS_PACKED_ENUM ofpbuf_source {
OFPBUF_STUB, /* Starts on stack, may expand into heap. */
OFPBUF_DPDK, /* buffer data is from DPDK allocated memory.
ref to build_ofpbuf() in netdev-dpdk. */
+ OFPBUF_ODP, /* buffer data is from DPDK allocated memory.
+ ref to build_ofpbuf() in netdev-odp. */
};
/* Buffer for holding arbitrary data. An ofpbuf is automatically reallocated