On 03/21/2014 07:03 PM, Pravin wrote:
This will be used by DPDK for zero copy IO.
Signed-off-by: Pravin B Shelar <pshe...@nicira.com>
---
v1-v2:
Added comment.
---
lib/ofpbuf.c | 7 ++++++-
lib/ofpbuf.h | 3 ++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
index 0eed428..249fbaa 100644
--- a/lib/ofpbuf.c
+++ b/lib/ofpbuf.c
@@ -265,6 +265,9 @@ ofpbuf_resize__(struct ofpbuf *b, size_t new_headroom,
size_t new_tailroom)
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);
@@ -343,7 +346,7 @@ ofpbuf_prealloc_headroom(struct ofpbuf *b, size_t size)
void
ofpbuf_trim(struct ofpbuf *b)
{
- if (b->source == OFPBUF_MALLOC
+ if ((b->source == OFPBUF_MALLOC || b->source == OFPBUF_DPDK)
&& (ofpbuf_headroom(b) || ofpbuf_tailroom(b))) {
ofpbuf_resize__(b, 0, 0);
}
I guess the intention is to assert on trim for a DPDK buf. The code
is kind of misleading though. Maybe assert directly in trim itself?
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev