2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 13:58:14 +00:00
Commit Graph

64 Commits

Author SHA1 Message Date
Ben Pfaff
0dce369bdd ofpbuf: Enable ofpbuf_push() to expand headroom.
Until now, ofpbuf_put() has been able to reallocate an ofpbuf to
expand the tailroom, but ofpbuf_push() has not been able to expand
the headroom in an analogous way.  This omission is simply because
it has never been useful to do this.  However, an upcoming change
will make the amount of headroom in an ofpbuf passed up from a
dpif to ofproto harder to predict.  It seems that we might as well
simply implement expanding headroom, so this commit does that.

Acked-by: Jesse Gross <jesse@nicira.com>
2011-01-27 09:26:05 -08:00
Ben Pfaff
31ac1e590b ofpbuf: New function ofpbuf_use_stack().
This new function is useful in a situation where a small stack-allocated
buffer is usually appropriate but occasionally it must be expanded.

Acked-by: Jesse Gross <jesse@nicira.com>
2011-01-27 09:26:05 -08:00
Ben Pfaff
78090f6300 ofpbuf: New function ofpbuf_put_hex().
This commit converts nx_match_from_string() to use this new function.  The
new function will also have another user in an upcoming commit.
2010-12-09 14:51:31 -08:00
Ben Pfaff
0bc9407dbb ofpbuf: New function ofpbuf_use_const().
This is a code cleanup.

Suggested-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-07 13:44:17 -08:00
Ben Pfaff
b3907fbc6c queue: Get rid of ovs_queue data structure.
ovs_queue doesn't seem very useful; it's just a singly-linked list.  It's
more generally useful to use a general-purpose "struct list" for lists of
packets, so this commit adds such a member to "struct ofpbuf" and shifts
the existing users to use it.
2010-12-06 10:03:31 -08:00
Ben Pfaff
68efcbec41 ofpbuf: Add ofpbuf_new_with_headroom(), ofpbuf_clone_with_headroom().
These new functions simplify an increasingly common usage pattern.

Suggested-by: Jesse Gross <jesse@nicira.com>
2010-09-01 12:55:50 -07:00
Joe Perches
d295e8e97a treewide: Remove trailing whitespace
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-08-30 13:23:08 -07:00
Ben Pfaff
1f5cbaa3ba ofpbuf: Implement unsupported feature in ofpbuf_trim().
Until now, ofpbuf_trim() has not handled the case where the ofpbuf has
nonzero headroom.  This causes an assertion failure when pinsched_send()
queues a packet to be sent later, because such packets have been
guaranteed to have nonzero headroom since commit 43253595 "ofproto: Avoid
buffer copy in OFPT_PACKET_IN path."  This commit fixes the problem by
implementing the until-now unsupported case.

This commit factors code out of ofpbuf_prealloc_tailroom() into two new
functions, ofpbuf_rebase__() and ofpbuf_resize_tailroom__(), and uses the
latter to implement both ofpbuf_prealloc_tailroom() and ofpbuf_trim().
ofpbuf_rebase__() isn't used on its own at all, but it seems potentially
useful so I made it an independent function.

Reported-by: Tom Everman <teverman@google.com>
2010-07-14 15:00:08 -07:00
Ben Pfaff
30f07f1a5e ofpbuf: New function ofpbuf_push_zeros(). 2010-04-26 14:57:49 -07:00
Ben Pfaff
0ab8e15fd7 ofpbuf: New function ofpbuf_to_string().
Useful for debugging.

From Jean Tourrilhes <jt@hpl.hp.com>.
2010-02-12 13:55:46 -08:00
Ben Pfaff
5019f688d4 ofpbuf: Mark ofpbuf_headroom(), ofpbuf_tailroom() parameters const. 2010-02-12 13:55:46 -08:00
Ben Pfaff
d45e9c65c6 ofpbuf: Rename ofpbuf "private" member for C++ header compatibility.
From partner.
2010-02-01 09:46:31 -08:00
Ben Pfaff
a14bc59fb8 Update primary code license to Apache 2.0. 2009-06-15 15:11:30 -07:00
Ben Pfaff
064af42167 Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45. 2009-07-08 13:19:16 -07:00