diff mbox

[APPS,1/4] ofpbuf: Added OFPBUF_ODP type.

Message ID 1408554678-55317-2-git-send-email-ciprian.barbu@linaro.org
State New
Headers show

Commit Message

Ciprian Barbu Aug. 20, 2014, 5:11 p.m. UTC
This will be used by ODP for zero copy IO.

Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
---
 lib/ofpbuf.c | 6 ++++--
 lib/ofpbuf.h | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Maxim Uvarov Aug. 20, 2014, 7:34 p.m. UTC | #1
On 08/20/2014 09:11 PM, Ciprian Barbu wrote:
> +    OFPBUF_ODP,                 /* buffer data is from DPDK allocated memory.
> +                                   ref to build_ofpbuf() in netdev-odp. */
is from ODP allocated memory.
diff mbox

Patch

diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
index 198bbf6..28013d5 100644
--- a/lib/ofpbuf.c
+++ b/lib/ofpbuf.c
@@ -251,6 +251,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();
 
@@ -321,7 +323,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))) {
@@ -481,7 +483,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 adaf526..6af9c64 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