2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

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.
This commit is contained in:
Ben Pfaff
2010-04-27 09:40:46 -07:00
parent 1f256c11cd
commit 4325359529
5 changed files with 123 additions and 43 deletions

View File

@@ -1280,7 +1280,8 @@ dp_netdev_output_control(struct dp_netdev *dp, const struct ofpbuf *packet,
}
msg_size = sizeof *header + packet->size;
msg = ofpbuf_new(msg_size);
msg = ofpbuf_new(msg_size + DPIF_RECV_MSG_PADDING);
ofpbuf_reserve(msg, DPIF_RECV_MSG_PADDING);
header = ofpbuf_put_uninit(msg, sizeof *header);
header->type = queue_no;
header->length = msg_size;