Age | Commit message (Collapse) | Author |
|
|
|
My original intent for ofpbufs initialized with ofpbuf_use_stack() was that
the caller was providing enough space on the stack for the common case,
with dynamic allocation as a fallback. But in practice, none of the
clients actually do this. Instead, all of them actually know that the
stack-allocated buffer is big enough and, since they don't want to bother
with having to call ofpbuf_delete(), they instead assert that the buffer
wasn't reallocated.
Since this is a bit of a pain, this commit changes the semantics of
ofpbuf_use_stack() to be that the stack-allocated buffer cannot be
reallocated at all. This is more convenient for the existing clients.
|
|
This will have its first use in an upcoming commit.
|
|
This new function is a simple helper that creates a new ofpbuf with some
initial contents plus a caller-specified amount of headroom.
This will be used in upcoming commits.
Acked-by: Jesse Gross <jesse@nicira.com>
|
|
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>
|
|
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>
|
|
This commit converts nx_match_from_string() to use this new function. The
new function will also have another user in an upcoming commit.
|
|
This is a code cleanup.
Suggested-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
|
|
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.
|
|
These new functions simplify an increasingly common usage pattern.
Suggested-by: Jesse Gross <jesse@nicira.com>
|
|
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jesse Gross <jesse@nicira.com>
|
|
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>
|
|
|
|
Useful for debugging.
From Jean Tourrilhes <jt@hpl.hp.com>.
|
|
|
|
From partner.
|
|
|
|
|