ofproto: Avoid buffer copy in OFPT_PACKET_IN path.
authorBen Pfaff <blp@nicira.com>
Tue, 27 Apr 2010 16:40:46 +0000 (09:40 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 27 Apr 2010 16:40:46 +0000 (09:40 -0700)
commit43253595291318833572088595769b45a79c9c54
tree46201919e2253c6127dff9bfbdfc8d3da3992899
parent1f256c11cd354fe1494af6846cf31c7ee2698e6c
ofproto: Avoid buffer copy in OFPT_PACKET_IN path.

When a dpif passes an odp_msg down to ofproto, and ofproto transforms it
into an ofp_packet_in to send to the controller, until now this always
involved a full copy of the packet inside ofproto.  This commit eliminates
this copy by ensuring that there is always enough headroom in the ofpbuf
that holds the odp_msg to replace it by an ofp_packet_in in-place.

From Jean Tourrilhes <jt@hpl.hp.com>, with some revisions.
lib/dpif-linux.c
lib/dpif-netdev.c
lib/dpif-provider.h
lib/dpif.c
ofproto/ofproto.c